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