1 // 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 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 06/04/2010 Added this text. :-)
17 #include "actionmodifyentity.h"
20 #include "rs_dialogfactory.h"
21 #include "graphicview.h"
23 ActionModifyEntity::ActionModifyEntity(RS_EntityContainer & container,
24 GraphicView & graphicView):
25 ActionInterface("Modify Entity", container, graphicView)
30 ActionModifyEntity::~ActionModifyEntity()
34 void ActionModifyEntity::trigger()
38 RS_Entity * clone = en->clone();
40 if (RS_DIALOGFACTORY->requestModifyEntityDialog(clone))
42 container->addEntity(clone);
44 graphicView->deleteEntity(en);
45 en->setSelected(false);
47 clone->setSelected(false);
48 graphicView->drawEntity(clone);
52 document->startUndoCycle();
54 document->addUndoable(clone);
55 en->setUndoState(true);
56 document->addUndoable(en);
58 document->endUndoCycle();
60 RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
67 RS_DEBUG->print("ActionModifyEntity::trigger: Entity is NULL\n");
70 void ActionModifyEntity::mouseReleaseEvent(QMouseEvent * e)
72 if (e->button() == Qt::RightButton)
73 init(getStatus() - 1);
81 void ActionModifyEntity::updateMouseCursor()
83 graphicView->setMouseCursor(RS2::SelectCursor);