1 // actionmodifyrotate2.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 "actionmodifyrotate2.h"
17 #include "rs_dialogfactory.h"
19 ActionModifyRotate2::ActionModifyRotate2(
20 RS_EntityContainer & container, GraphicView & graphicView):
21 ActionInterface("Rotate Entities around two centers", container, graphicView)
25 ActionModifyRotate2::~ActionModifyRotate2()
29 void ActionModifyRotate2::init(int status)
31 ActionInterface::init(status);
34 void ActionModifyRotate2::trigger()
36 RS_DEBUG->print("ActionModifyRotate2::trigger()");
38 RS_Modification m(*container, graphicView);
43 RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
46 void ActionModifyRotate2::mouseMoveEvent(QMouseEvent * e)
48 RS_DEBUG->print("ActionModifyRotate2::mouseMoveEvent begin");
50 if (getStatus() == SetReferencePoint1 || getStatus() == SetReferencePoint2)
52 Vector mouse = snapPoint(e);
56 case SetReferencePoint1:
60 case SetReferencePoint2:
62 if (data.center1.valid)
72 RS_DEBUG->print("ActionModifyRotate2::mouseMoveEvent end");
75 void ActionModifyRotate2::mouseReleaseEvent(QMouseEvent * e)
77 if (e->button() == Qt::LeftButton)
79 Vector ce(snapPoint(e));
82 else if (e->button() == Qt::RightButton)
86 init(getStatus() - 1);
90 void ActionModifyRotate2::coordinateEvent(Vector * e)
99 case SetReferencePoint1:
101 setStatus(SetReferencePoint2);
104 case SetReferencePoint2:
106 setStatus(ShowDialog);
108 if (RS_DIALOGFACTORY->requestRotate2Dialog(data))
118 void ActionModifyRotate2::commandEvent(RS_CommandEvent * /*e*/)
122 QStringList ActionModifyRotate2::getAvailableCommands()
128 void ActionModifyRotate2::updateMouseButtonHints()
132 case SetReferencePoint1:
133 RS_DIALOGFACTORY->updateMouseWidget(tr("Specify absolute reference point"),
137 case SetReferencePoint2:
138 RS_DIALOGFACTORY->updateMouseWidget(tr("Specify relative reference point"),
143 RS_DIALOGFACTORY->updateMouseWidget("", "");
148 void ActionModifyRotate2::updateMouseCursor()
150 graphicView->setMouseCursor(RS2::CadCursor);
153 void ActionModifyRotate2::updateToolBar()
157 case SetReferencePoint1:
158 case SetReferencePoint2:
159 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
163 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);