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 // 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 "actionmodifyscale.h"
20 #include "dialogfactory.h"
22 ActionModifyScale::ActionModifyScale(EntityContainer & container, GraphicView & graphicView):
23 ActionInterface("Scale Entities", container, graphicView)
27 ActionModifyScale::~ActionModifyScale()
31 void ActionModifyScale::init(int status)
33 ActionInterface::init(status);
36 void ActionModifyScale::trigger()
38 DEBUG->print("ActionModifyScale::trigger()");
40 Modification m(*container, graphicView);
43 DIALOGFACTORY->updateSelectionWidget(container->countSelected());
46 void ActionModifyScale::mouseMoveEvent(QMouseEvent * e)
48 DEBUG->print("ActionModifyScale::mouseMoveEvent begin");
50 if (getStatus() == SetReferencePoint)
52 Vector mouse = snapPoint(e);
56 case SetReferencePoint:
57 referencePoint = mouse;
65 DEBUG->print("ActionModifyScale::mouseMoveEvent end");
68 void ActionModifyScale::mouseReleaseEvent(QMouseEvent * e)
70 if (e->button() == Qt::LeftButton)
72 Vector mouse = snapPoint(e);
76 case SetReferencePoint:
77 setStatus(ShowDialog);
79 if (DIALOGFACTORY->requestScaleDialog(data))
81 data.referencePoint = referencePoint;
91 else if (e->button() == Qt::RightButton)
95 init(getStatus() - 1);
99 void ActionModifyScale::updateMouseButtonHints()
103 case SetReferencePoint:
104 DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
108 DIALOGFACTORY->updateMouseWidget("", "");
113 void ActionModifyScale::updateMouseCursor()
115 graphicView->setMouseCursor(RS2::CadCursor);
118 void ActionModifyScale::updateToolBar()
122 case SetReferencePoint:
123 DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
127 DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);