1 // actionsetrelativezero.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/05/2010 Added this text. :-)
15 #include "actionsetrelativezero.h"
17 #include "rs_dialogfactory.h"
18 #include "graphicview.h"
20 ActionSetRelativeZero::ActionSetRelativeZero(RS_EntityContainer & container,
21 GraphicView & graphicView): ActionInterface("Set the relative Zero",
22 container, graphicView)
26 ActionSetRelativeZero::~ActionSetRelativeZero()
30 /*virtual*/ RS2::ActionType ActionSetRelativeZero::rtti()
32 return RS2::ActionSetRelativeZero;
35 void ActionSetRelativeZero::trigger()
37 bool wasLocked = graphicView->isRelativeZeroLocked();
41 graphicView->lockRelativeZero(false);
42 graphicView->moveRelativeZero(pt);
43 graphicView->lockRelativeZero(wasLocked);
48 void ActionSetRelativeZero::mouseMoveEvent(QMouseEvent * e)
53 void ActionSetRelativeZero::mouseReleaseEvent(QMouseEvent * e)
55 if (e->button() == Qt::RightButton)
58 init(getStatus() - 1);
62 Vector ce(snapPoint(e));
67 void ActionSetRelativeZero::coordinateEvent(Vector * e)
76 void ActionSetRelativeZero::updateMouseButtonHints()
81 RS_DIALOGFACTORY->updateMouseWidget(tr("Set relative Zero"), tr("Cancel"));
85 RS_DIALOGFACTORY->updateMouseWidget("", "");
90 void ActionSetRelativeZero::updateMouseCursor()
92 graphicView->setMouseCursor(RS2::CadCursor);
95 void ActionSetRelativeZero::updateToolBar()
98 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
100 RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);