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"
19 #include "rs_dialogfactory.h"
21 ActionModifyRotate::ActionModifyRotate(RS_EntityContainer & container, GraphicView & graphicView):
22 ActionInterface("Rotate Entities",
23 container, graphicView)
27 ActionModifyRotate::~ActionModifyRotate()
31 void ActionModifyRotate::init(int status)
33 ActionInterface::init(status);
36 void ActionModifyRotate::trigger()
38 RS_DEBUG->print("ActionModifyRotate::trigger()");
40 RS_Modification m(*container, graphicView);
43 RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
46 void ActionModifyRotate::mouseMoveEvent(QMouseEvent * e)
48 RS_DEBUG->print("ActionModifyRotate::mouseMoveEvent begin");
50 if (getStatus() == SetReferencePoint)
52 Vector mouse = snapPoint(e);
56 case SetReferencePoint:
57 referencePoint = mouse;
65 RS_DEBUG->print("ActionModifyRotate::mouseMoveEvent end");
68 void ActionModifyRotate::mouseReleaseEvent(QMouseEvent * e)
70 if (e->button() == Qt::LeftButton)
72 Vector ce(snapPoint(e));
75 else if (e->button() == Qt::RightButton)
79 init(getStatus() - 1);
83 void ActionModifyRotate::coordinateEvent(Vector * e)
92 case SetReferencePoint:
94 setStatus(ShowDialog);
96 if (RS_DIALOGFACTORY->requestRotateDialog(data))
98 data.center = referencePoint;
109 void ActionModifyRotate::updateMouseButtonHints()
113 case SetReferencePoint:
114 RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"),
119 RS_DIALOGFACTORY->updateMouseWidget("", "");
124 void ActionModifyRotate::updateMouseCursor()
126 graphicView->setMouseCursor(RS2::CadCursor);
129 void ActionModifyRotate::updateToolBar()
133 case SetReferencePoint:
134 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
138 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);