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"
20 #include "dialogfactory.h"
22 ActionModifyRotate2::ActionModifyRotate2(
23 EntityContainer & container, GraphicView & graphicView):
24 ActionInterface("Rotate Entities around two centers", container, graphicView)
28 ActionModifyRotate2::~ActionModifyRotate2()
32 void ActionModifyRotate2::init(int status)
34 ActionInterface::init(status);
37 void ActionModifyRotate2::trigger()
39 DEBUG->print("ActionModifyRotate2::trigger()");
41 Modification m(*container, graphicView);
46 DIALOGFACTORY->updateSelectionWidget(container->countSelected());
49 void ActionModifyRotate2::mouseMoveEvent(QMouseEvent * e)
51 DEBUG->print("ActionModifyRotate2::mouseMoveEvent begin");
53 if (getStatus() == SetReferencePoint1 || getStatus() == SetReferencePoint2)
55 Vector mouse = snapPoint(e);
59 case SetReferencePoint1:
63 case SetReferencePoint2:
65 if (data.center1.valid)
75 DEBUG->print("ActionModifyRotate2::mouseMoveEvent end");
78 void ActionModifyRotate2::mouseReleaseEvent(QMouseEvent * e)
80 if (e->button() == Qt::LeftButton)
82 Vector ce(snapPoint(e));
85 else if (e->button() == Qt::RightButton)
89 init(getStatus() - 1);
93 void ActionModifyRotate2::coordinateEvent(Vector * e)
102 case SetReferencePoint1:
104 setStatus(SetReferencePoint2);
107 case SetReferencePoint2:
109 setStatus(ShowDialog);
111 if (DIALOGFACTORY->requestRotate2Dialog(data))
121 void ActionModifyRotate2::commandEvent(CommandEvent * /*e*/)
125 QStringList ActionModifyRotate2::getAvailableCommands()
131 void ActionModifyRotate2::updateMouseButtonHints()
135 case SetReferencePoint1:
136 DIALOGFACTORY->updateMouseWidget(tr("Specify absolute reference point"),
140 case SetReferencePoint2:
141 DIALOGFACTORY->updateMouseWidget(tr("Specify relative reference point"),
146 DIALOGFACTORY->updateMouseWidget("", "");
151 void ActionModifyRotate2::updateMouseCursor()
153 graphicView->setMouseCursor(RS2::CadCursor);
156 void ActionModifyRotate2::updateToolBar()
160 case SetReferencePoint1:
161 case SetReferencePoint2:
162 DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
166 DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);