1 // rs_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 "rs_actionmodifyscale.h"
17 #include "rs_dialogfactory.h"
19 RS_ActionModifyScale::RS_ActionModifyScale(RS_EntityContainer & container, GraphicView & graphicView):
20 RS_PreviewActionInterface("Scale Entities",
21 container, graphicView)
25 RS_ActionModifyScale::~RS_ActionModifyScale()
29 void RS_ActionModifyScale::init(int status)
31 RS_ActionInterface::init(status);
34 void RS_ActionModifyScale::trigger()
36 RS_DEBUG->print("RS_ActionModifyScale::trigger()");
38 RS_Modification m(*container, graphicView);
41 RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
44 void RS_ActionModifyScale::mouseMoveEvent(QMouseEvent * e)
46 RS_DEBUG->print("RS_ActionModifyScale::mouseMoveEvent begin");
48 if (getStatus() == SetReferencePoint)
50 Vector mouse = snapPoint(e);
54 case SetReferencePoint:
55 referencePoint = mouse;
63 RS_DEBUG->print("RS_ActionModifyScale::mouseMoveEvent end");
66 void RS_ActionModifyScale::mouseReleaseEvent(QMouseEvent * e)
68 if (e->button() == Qt::LeftButton)
70 Vector mouse = snapPoint(e);
74 case SetReferencePoint:
75 setStatus(ShowDialog);
77 if (RS_DIALOGFACTORY->requestScaleDialog(data))
79 data.referencePoint = referencePoint;
89 else if (e->button() == Qt::RightButton)
93 init(getStatus() - 1);
97 void RS_ActionModifyScale::updateMouseButtonHints()
102 RS_DIALOGFACTORY->updateMouseWidget(tr("Pick entities to scale"),
105 case SetReferencePoint:
106 RS_DIALOGFACTORY->updateMouseWidget(tr("Specify reference point"),
111 RS_DIALOGFACTORY->updateMouseWidget("", "");
116 void RS_ActionModifyScale::updateMouseCursor()
118 graphicView->setMouseCursor(RS2::CadCursor);
121 void RS_ActionModifyScale::updateToolBar()
126 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSelect);
128 case SetReferencePoint:
129 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
133 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify);