<commit_before>#include "StagePanel.h"
#include "StageCanvas.h"
#include "ArrangeSpriteOP.h"

namespace libsketch
{

StagePanel::StagePanel(wxWindow* parent, wxTopLevelWindow* frame, 
					   d2d::LibraryPanel* library)
	: d2d::EditPanel(parent, frame)
	, d2d::MultiSpritesImpl(parent)
{
	m_canvas = new StageCanvas(this, this, library);
	library->setCanvas(m_canvas);

	m_editOP = new ArrangeSpriteOP(this);

	SetDropTarget(new d2d::StageDropTarget(static_cast<d2d::Frame*>(frame), this, this, library));
}

StagePanel::~StagePanel()
{
}

void StagePanel::clear()
{
	d2d::EditPanel::clear();
}

void StagePanel::traverseSprites(d2d::IVisitor& visitor, d2d::TraverseType type, 
								 bool order) const
{
	for (int i = 0, n = m_sprites.size(); i < n; ++i) {
		bool fetch_next;
		visitor.visit(m_sprites[i], fetch_next);
		if (!fetch_next) {
			break;
		}
	}
}

void StagePanel::removeSprite(d2d::ISprite* sprite)
{
	for (int i = 0, n = m_sprites.size(); i < n; ++i) {
		if (m_sprites[i] == sprite) {
			sprite->Release();
			m_sprites.erase(m_sprites.begin() + i);
		}
	}
}

void StagePanel::insertSprite(d2d::ISprite* sprite)
{
	sprite->Retain();
	m_sprites.push_back(sprite);

	m_canvas->Refresh();
}

void StagePanel::clearSprites()
{
	for (int i = 0, n = m_sprites.size(); i < n; ++i) {
		m_sprites[i]->Release();
	}
	m_sprites.clear();
}

void StagePanel::resetSpriteOrder(d2d::ISprite* sprite, bool up)
{

}

ivec2 StagePanel::TransPos3ProjectToScreen(const vec3& proj) const
{
	StageCanvas* canvas = static_cast<StageCanvas*>(m_canvas);
	return canvas->TransPos3ProjectToScreen(proj);
}

vec3 StagePanel::TransPos3ScreenToProject(const ivec2& scr, float proj_z) const
{
	StageCanvas* canvas = static_cast<StageCanvas*>(m_canvas);
	return canvas->TransPos3ScreenToProject(scr, proj_z);	
}

}<commit_msg>[FIXED] libsketch<commit_after>#include "StagePanel.h"
#include "StageCanvas.h"
#include "ArrangeSpriteOP.h"

namespace libsketch
{

StagePanel::StagePanel(wxWindow* parent, wxTopLevelWindow* frame, 
					   d2d::LibraryPanel* library)
	: d2d::EditPanel(parent, frame)
	, d2d::MultiSpritesImpl(parent)
{
	m_canvas = new StageCanvas(this, this, library);
	library->setCanvas(m_canvas);

	m_editOP = new ArrangeSpriteOP(this);

	SetDropTarget(new d2d::StageDropTarget(this, this, library));
}

StagePanel::~StagePanel()
{
}

void StagePanel::clear()
{
	d2d::EditPanel::clear();
}

void StagePanel::traverseSprites(d2d::IVisitor& visitor, d2d::TraverseType type, 
								 bool order) const
{
	for (int i = 0, n = m_sprites.size(); i < n; ++i) {
		bool fetch_next;
		visitor.visit(m_sprites[i], fetch_next);
		if (!fetch_next) {
			break;
		}
	}
}

void StagePanel::removeSprite(d2d::ISprite* sprite)
{
	for (int i = 0, n = m_sprites.size(); i < n; ++i) {
		if (m_sprites[i] == sprite) {
			sprite->Release();
			m_sprites.erase(m_sprites.begin() + i);
		}
	}
}

void StagePanel::insertSprite(d2d::ISprite* sprite)
{
	sprite->Retain();
	m_sprites.push_back(sprite);

	m_canvas->Refresh();
}

void StagePanel::clearSprites()
{
	for (int i = 0, n = m_sprites.size(); i < n; ++i) {
		m_sprites[i]->Release();
	}
	m_sprites.clear();
}

void StagePanel::resetSpriteOrder(d2d::ISprite* sprite, bool up)
{

}

ivec2 StagePanel::TransPos3ProjectToScreen(const vec3& proj) const
{
	StageCanvas* canvas = static_cast<StageCanvas*>(m_canvas);
	return canvas->TransPos3ProjectToScreen(proj);
}

vec3 StagePanel::TransPos3ScreenToProject(const ivec2& scr, float proj_z) const
{
	StageCanvas* canvas = static_cast<StageCanvas*>(m_canvas);
	return canvas->TransPos3ScreenToProject(scr, proj_z);	
}

}
{'fraction_non_alphanumeric': 0.15808516559977734, 'fraction_numerical': 0.011967715001391595, 'mean_word_length': 5.643253234750462, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 22, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4027652', 'n_tokens_mistral': 1469, 'n_tokens_neox': 1408, 'n_words': 248}