1 // actionmodifyrotate.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 "actionmodifyrotate.h"
17 #include "rs_dialogfactory.h"
19 ActionModifyRotate::ActionModifyRotate(RS_EntityContainer & container, GraphicView & graphicView):
20 ActionInterface("Rotate Entities",
21 container, graphicView)
25 ActionModifyRotate::~ActionModifyRotate()
29 void ActionModifyRotate::init(int status)
31 ActionInterface::init(status);
34 void ActionModifyRotate::trigger()
36 RS_DEBUG->print("ActionModifyRotate::trigger()");
38 RS_Modification m(*container, graphicView);
41 RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
44 void ActionModifyRotate::mouseMoveEvent(QMouseEvent * e)
46 RS_DEBUG->print("ActionModifyRotate::mouseMoveEvent begin");
48 if (getStatus() == SetReferencePoint)
50 Vector mouse = snapPoint(e);
54 case SetReferencePoint:
55 referencePoint = mouse;
63 RS_DEBUG->print("ActionModifyRotate::mouseMoveEvent end");
66 void ActionModifyRotate::mouseReleaseEvent(QMouseEvent * e)
68 if (e->button() == Qt::LeftButton)
70 Vector ce(snapPoint(e));
73 else if (e->button() == Qt::RightButton)
77 init(getStatus() - 1);
81 void ActionModifyRotate::coordinateEvent(Vector * e)
90 case SetReferencePoint:
92 setStatus(ShowDialog);
94 if (RS_DIALOGFACTORY->requestRotateDialog(data))
96 data.center = referencePoint;
107 void ActionModifyRotate::updateMouseButtonHints()
111 case SetReferencePoint:
112 RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"),
117 RS_DIALOGFACTORY->updateMouseWidget("", "");
122 void ActionModifyRotate::updateMouseCursor()
124 graphicView->setMouseCursor(RS2::CadCursor);
127 void ActionModifyRotate::updateToolBar()
131 case SetReferencePoint:
132 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
136 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);