1 // rs_actionmodifyentity.cpp
3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // (C) 2010 Underground Software
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 06/04/2010 Added this text. :-)
15 #include "rs_actionmodifyentity.h"
17 #include "rs_dialogfactory.h"
18 #include "graphicview.h"
20 RS_ActionModifyEntity::RS_ActionModifyEntity(RS_EntityContainer & container,
21 GraphicView & graphicView):
22 RS_ActionInterface("Modify Entity", container, graphicView)
27 RS_ActionModifyEntity::~RS_ActionModifyEntity()
31 void RS_ActionModifyEntity::trigger()
35 RS_Entity * clone = en->clone();
37 if (RS_DIALOGFACTORY->requestModifyEntityDialog(clone))
39 container->addEntity(clone);
41 graphicView->deleteEntity(en);
42 en->setSelected(false);
44 clone->setSelected(false);
45 graphicView->drawEntity(clone);
49 document->startUndoCycle();
51 document->addUndoable(clone);
52 en->setUndoState(true);
53 document->addUndoable(en);
55 document->endUndoCycle();
57 RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
64 RS_DEBUG->print("RS_ActionModifyEntity::trigger: Entity is NULL\n");
67 void RS_ActionModifyEntity::mouseReleaseEvent(QMouseEvent * e)
69 if (e->button() == Qt::RightButton)
70 init(getStatus() - 1);
78 void RS_ActionModifyEntity::updateMouseCursor()
80 graphicView->setMouseCursor(RS2::SelectCursor);