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 // 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 "actionmodifyrotate.h"
20 #include "dialogfactory.h"
22 ActionModifyRotate::ActionModifyRotate(EntityContainer & container, GraphicView & graphicView):
23 ActionInterface("Rotate Entities",
24 container, graphicView)
28 ActionModifyRotate::~ActionModifyRotate()
32 void ActionModifyRotate::init(int status)
34 ActionInterface::init(status);
37 void ActionModifyRotate::trigger()
39 DEBUG->print("ActionModifyRotate::trigger()");
41 Modification m(*container, graphicView);
44 DIALOGFACTORY->updateSelectionWidget(container->countSelected());
47 void ActionModifyRotate::mouseMoveEvent(QMouseEvent * e)
49 DEBUG->print("ActionModifyRotate::mouseMoveEvent begin");
51 if (getStatus() == SetReferencePoint)
53 Vector mouse = snapPoint(e);
57 case SetReferencePoint:
58 referencePoint = mouse;
66 DEBUG->print("ActionModifyRotate::mouseMoveEvent end");
69 void ActionModifyRotate::mouseReleaseEvent(QMouseEvent * e)
71 if (e->button() == Qt::LeftButton)
73 Vector ce(snapPoint(e));
76 else if (e->button() == Qt::RightButton)
80 init(getStatus() - 1);
84 void ActionModifyRotate::coordinateEvent(Vector * e)
93 case SetReferencePoint:
95 setStatus(ShowDialog);
97 if (DIALOGFACTORY->requestRotateDialog(data))
99 data.center = referencePoint;
110 void ActionModifyRotate::updateMouseButtonHints()
114 case SetReferencePoint:
115 DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"),
120 DIALOGFACTORY->updateMouseWidget("", "");
125 void ActionModifyRotate::updateMouseCursor()
127 graphicView->setMouseCursor(RS2::CadCursor);
130 void ActionModifyRotate::updateToolBar()
134 case SetReferencePoint:
135 DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
139 DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);