1 // actionmodifyscale.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 "actionmodifyscale.h"
17 #include "rs_dialogfactory.h"
19 ActionModifyScale::ActionModifyScale(RS_EntityContainer & container, GraphicView & graphicView):
20 ActionInterface("Scale Entities", container, graphicView)
24 ActionModifyScale::~ActionModifyScale()
28 void ActionModifyScale::init(int status)
30 ActionInterface::init(status);
33 void ActionModifyScale::trigger()
35 RS_DEBUG->print("ActionModifyScale::trigger()");
37 RS_Modification m(*container, graphicView);
40 RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
43 void ActionModifyScale::mouseMoveEvent(QMouseEvent * e)
45 RS_DEBUG->print("ActionModifyScale::mouseMoveEvent begin");
47 if (getStatus() == SetReferencePoint)
49 Vector mouse = snapPoint(e);
53 case SetReferencePoint:
54 referencePoint = mouse;
62 RS_DEBUG->print("ActionModifyScale::mouseMoveEvent end");
65 void ActionModifyScale::mouseReleaseEvent(QMouseEvent * e)
67 if (e->button() == Qt::LeftButton)
69 Vector mouse = snapPoint(e);
73 case SetReferencePoint:
74 setStatus(ShowDialog);
76 if (RS_DIALOGFACTORY->requestScaleDialog(data))
78 data.referencePoint = referencePoint;
88 else if (e->button() == Qt::RightButton)
92 init(getStatus() - 1);
96 void ActionModifyScale::updateMouseButtonHints()
100 case SetReferencePoint:
101 RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
105 RS_DIALOGFACTORY->updateMouseWidget("", "");
110 void ActionModifyScale::updateMouseCursor()
112 graphicView->setMouseCursor(RS2::CadCursor);
115 void ActionModifyScale::updateToolBar()
119 case SetReferencePoint:
120 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
124 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);