X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Frs_actioneditcopy.cpp;h=02f0e2cd74f8f3139cd1a8bb79688f38cb44cf34;hb=3f46c180da0806c9c263e6d87d0f1404632402da;hp=64f139a3227b8cfa2a0fe338eae3c3c395f70e08;hpb=16ce54abf01ca3032e42a5bb11a4afcf9014dcca;p=architektonas diff --git a/src/actions/rs_actioneditcopy.cpp b/src/actions/rs_actioneditcopy.cpp index 64f139a..02f0e2c 100644 --- a/src/actions/rs_actioneditcopy.cpp +++ b/src/actions/rs_actioneditcopy.cpp @@ -14,6 +14,7 @@ #include "rs_actioneditcopy.h" +#include "rs_dialogfactory.h" #include "rs_modification.h" /** @@ -21,122 +22,90 @@ * * @param undo true for undo and false for redo. */ -RS_ActionEditCopy::RS_ActionEditCopy(bool copy, - RS_EntityContainer& container, RS_GraphicView& graphicView): +RS_ActionEditCopy::RS_ActionEditCopy(bool copy, RS_EntityContainer & container, RS_GraphicView & graphicView): RS_ActionInterface("Edit Copy", container, graphicView) { - this->copy = copy; + this->copy = copy; } RS_ActionEditCopy::~RS_ActionEditCopy() { } -QAction * RS_ActionEditCopy::createGUIAction(RS2::ActionType type, QObject * parent) -{ - QAction * action; - - if (type == RS2::ActionEditCopy) - { - //QPixmap icon = QPixmap(editcopy_xpm); - action = new QAction(QIcon(":/res/editcopy2.png"), tr("&Copy"), parent); - action->setShortcut(Qt::CTRL + Qt::Key_C); -// action = new QAction(tr("Copy"), QPixmap::fromMimeSource("editcopy2.png"), tr("&Copy"), -// CTRL+Key_C, parent); - action->setStatusTip(tr("Copies entities to the clipboard")); - } - else - { - //icon = QPixmap(editcut_xpm); - action = new QAction(QIcon(":/res/editcut2.png"), tr("Cu&t"), parent); - action->setShortcut(Qt::CTRL + Qt::Key_X); -// action = new QAction(tr("Cut"), QPixmap::fromMimeSource("editcut2.png"), tr("Cu&t"), -// CTRL+Key_X, parent); - action->setStatusTip(tr("Cuts entities to the clipboard")); - } - - return action; -} - void RS_ActionEditCopy::init(int status) { - RS_ActionInterface::init(status); - //trigger(); + RS_ActionInterface::init(status); + //trigger(); } +void RS_ActionEditCopy::trigger() +{ + deleteSnapper(); + RS_Modification m(*container, graphicView); + m.copy(referencePoint, !copy); -void RS_ActionEditCopy::trigger() { - - deleteSnapper(); - - RS_Modification m(*container, graphicView); - m.copy(referencePoint, !copy); - - //graphicView->redraw(); - finish(); - graphicView->killSelectActions(); - //init(getStatus()-1); - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + //graphicView->redraw(); + finish(); + graphicView->killSelectActions(); + //init(getStatus()-1); + RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } - -void RS_ActionEditCopy::mouseMoveEvent(QMouseEvent* e) { - snapPoint(e); +void RS_ActionEditCopy::mouseMoveEvent(QMouseEvent * e) +{ + snapPoint(e); } - - -void RS_ActionEditCopy::mouseReleaseEvent(QMouseEvent* e) { - if (RS2::qtToRsButtonState(e->button())==RS2::LeftButton) { - RS_CoordinateEvent ce(snapPoint(e)); - coordinateEvent(&ce); - } else if (RS2::qtToRsButtonState(e->button())==RS2::RightButton) { - deleteSnapper(); - init(getStatus()-1); - } +void RS_ActionEditCopy::mouseReleaseEvent(QMouseEvent * e) +{ + if (e->button() == Qt::LeftButton) + { + Vector ce(snapPoint(e)); + coordinateEvent(&ce); + } + else if (e->button() == Qt::RightButton) + { + deleteSnapper(); + init(getStatus() - 1); + } } +void RS_ActionEditCopy::coordinateEvent(Vector * e) +{ + if (e == NULL) + return; - -void RS_ActionEditCopy::coordinateEvent(RS_CoordinateEvent* e) { - if (e==NULL) { - return; - } - - referencePoint = e->getCoordinate(); - trigger(); + referencePoint = *e; + trigger(); } - - -void RS_ActionEditCopy::updateMouseButtonHints() { - switch (getStatus()) { - case SetReferencePoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), - tr("Cancel")); - break; - default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); - break; - } +void RS_ActionEditCopy::updateMouseButtonHints() +{ + switch (getStatus()) + { + case SetReferencePoint: + RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), + tr("Cancel")); + break; + + default: + RS_DIALOGFACTORY->updateMouseWidget("", ""); + break; + } } - - -void RS_ActionEditCopy::updateMouseCursor() { - graphicView->setMouseCursor(RS2::CadCursor); +void RS_ActionEditCopy::updateMouseCursor() +{ + graphicView->setMouseCursor(RS2::CadCursor); } - - -void RS_ActionEditCopy::updateToolBar() { - if (!isFinished()) { - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); - } else { - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); - } +void RS_ActionEditCopy::updateToolBar() +{ + if (!isFinished()) + RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + else + RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain); } - // EOF