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"
19 #include "rs_dialogfactory.h"
21 ActionModifyScale::ActionModifyScale(RS_EntityContainer & container, GraphicView & graphicView):
22 ActionInterface("Scale Entities", container, graphicView)
26 ActionModifyScale::~ActionModifyScale()
30 void ActionModifyScale::init(int status)
32 ActionInterface::init(status);
35 void ActionModifyScale::trigger()
37 RS_DEBUG->print("ActionModifyScale::trigger()");
39 RS_Modification m(*container, graphicView);
42 RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
45 void ActionModifyScale::mouseMoveEvent(QMouseEvent * e)
47 RS_DEBUG->print("ActionModifyScale::mouseMoveEvent begin");
49 if (getStatus() == SetReferencePoint)
51 Vector mouse = snapPoint(e);
55 case SetReferencePoint:
56 referencePoint = mouse;
64 RS_DEBUG->print("ActionModifyScale::mouseMoveEvent end");
67 void ActionModifyScale::mouseReleaseEvent(QMouseEvent * e)
69 if (e->button() == Qt::LeftButton)
71 Vector mouse = snapPoint(e);
75 case SetReferencePoint:
76 setStatus(ShowDialog);
78 if (RS_DIALOGFACTORY->requestScaleDialog(data))
80 data.referencePoint = referencePoint;
90 else if (e->button() == Qt::RightButton)
94 init(getStatus() - 1);
98 void ActionModifyScale::updateMouseButtonHints()
102 case SetReferencePoint:
103 RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"), tr("Cancel"));
107 RS_DIALOGFACTORY->updateMouseWidget("", "");
112 void ActionModifyScale::updateMouseCursor()
114 graphicView->setMouseCursor(RS2::CadCursor);
117 void ActionModifyScale::updateToolBar()
121 case SetReferencePoint:
122 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
126 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);