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 // 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 "actionmodifyrotate2.h"
19 #include "rs_dialogfactory.h"
21 ActionModifyRotate2::ActionModifyRotate2(
22 RS_EntityContainer & container, GraphicView & graphicView):
23 ActionInterface("Rotate Entities around two centers", container, graphicView)
27 ActionModifyRotate2::~ActionModifyRotate2()
31 void ActionModifyRotate2::init(int status)
33 ActionInterface::init(status);
36 void ActionModifyRotate2::trigger()
38 RS_DEBUG->print("ActionModifyRotate2::trigger()");
40 RS_Modification m(*container, graphicView);
45 RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
48 void ActionModifyRotate2::mouseMoveEvent(QMouseEvent * e)
50 RS_DEBUG->print("ActionModifyRotate2::mouseMoveEvent begin");
52 if (getStatus() == SetReferencePoint1 || getStatus() == SetReferencePoint2)
54 Vector mouse = snapPoint(e);
58 case SetReferencePoint1:
62 case SetReferencePoint2:
64 if (data.center1.valid)
74 RS_DEBUG->print("ActionModifyRotate2::mouseMoveEvent end");
77 void ActionModifyRotate2::mouseReleaseEvent(QMouseEvent * e)
79 if (e->button() == Qt::LeftButton)
81 Vector ce(snapPoint(e));
84 else if (e->button() == Qt::RightButton)
88 init(getStatus() - 1);
92 void ActionModifyRotate2::coordinateEvent(Vector * e)
101 case SetReferencePoint1:
103 setStatus(SetReferencePoint2);
106 case SetReferencePoint2:
108 setStatus(ShowDialog);
110 if (RS_DIALOGFACTORY->requestRotate2Dialog(data))
120 void ActionModifyRotate2::commandEvent(RS_CommandEvent * /*e*/)
124 QStringList ActionModifyRotate2::getAvailableCommands()
130 void ActionModifyRotate2::updateMouseButtonHints()
134 case SetReferencePoint1:
135 RS_DIALOGFACTORY->updateMouseWidget(tr("Specify absolute reference point"),
139 case SetReferencePoint2:
140 RS_DIALOGFACTORY->updateMouseWidget(tr("Specify relative reference point"),
145 RS_DIALOGFACTORY->updateMouseWidget("", "");
150 void ActionModifyRotate2::updateMouseCursor()
152 graphicView->setMouseCursor(RS2::CadCursor);
155 void ActionModifyRotate2::updateToolBar()
159 case SetReferencePoint1:
160 case SetReferencePoint2:
161 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
165 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);