void ArrangeSpriteOP<TBase>::TranslateVisitor:: visit(ICloneable* object, bool& bFetchNext) { ISprite* sprite = static_cast<ISprite*>(object); sprite->translate(m_delta); bFetchNext = true; }
bool PasteSymbolOP::onMouseLeftDown(int x, int y) { if (ZoomViewOP::onMouseLeftDown(x, y)) return true; ISymbol* symbol = m_libraryPanel->getSymbol(); if (symbol) { m_pos = m_editPanel->transPosScreenToProject(x, y); ISprite* sprite = SpriteFactory::Instance()->create(symbol); sprite->translate(m_pos); if (m_pScale) sprite->setScale(*m_pScale); m_panelImpl->insertSprite(sprite); sprite->release(); } return false; }
bool SpritesPanelImpl::DragSymbolTarget:: OnDropText(wxCoord x, wxCoord y, const wxString& data) { wxString sType = data.substr(0, data.find(",")); wxString sIndex = data.substr(data.find(",") + 1); long index; sIndex.ToLong(&index); ISymbol* symbol = m_panelImpl->m_libraryPanel->getSymbol(index); if (symbol) { Vector pos = m_panelImpl->m_editPanel->transPosScreenToProject(x, y); ISprite* sprite = SpriteFactory::create(symbol); sprite->translate(pos); m_panelImpl->insertSprite(sprite); sprite->release(); } return true; }
bool PasteSymbolRandomOP::onMouseLeftDown(int x, int y) { if (ZoomViewOP::onMouseLeftDown(x, y)) return true; ISymbol* symbol = m_randomValue.symbol; if (!symbol) symbol = m_libraryPanel->getSymbol(); if (symbol) { m_pos = m_editPanel->transPosScreenToProject(x, y); ISprite* sprite = SpriteFactory::Instance()->create(symbol); sprite->translate(m_pos); if (m_randomValue.scale != 1.0f) sprite->setScale(m_randomValue.scale); if (m_randomValue.angle != 0.0f) sprite->setTransform(m_pos, m_randomValue.angle); m_panelImpl->insertSprite(sprite); sprite->release(); } changeRandomValue(); return false; }