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 // 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/05/2010 Added this text. :-)
17 #include "actionsetrelativezero.h"
19 #include "dialogfactory.h"
20 #include "graphicview.h"
22 ActionSetRelativeZero::ActionSetRelativeZero(EntityContainer & container,
23 GraphicView & graphicView): ActionInterface("Set the relative Zero",
24 container, graphicView)
28 ActionSetRelativeZero::~ActionSetRelativeZero()
32 /*virtual*/ RS2::ActionType ActionSetRelativeZero::rtti()
34 return RS2::ActionSetRelativeZero;
37 void ActionSetRelativeZero::trigger()
39 bool wasLocked = graphicView->isRelativeZeroLocked();
43 graphicView->lockRelativeZero(false);
44 graphicView->moveRelativeZero(pt);
45 graphicView->lockRelativeZero(wasLocked);
50 void ActionSetRelativeZero::mouseMoveEvent(QMouseEvent * e)
55 void ActionSetRelativeZero::mouseReleaseEvent(QMouseEvent * e)
57 if (e->button() == Qt::RightButton)
60 init(getStatus() - 1);
64 Vector ce(snapPoint(e));
69 void ActionSetRelativeZero::coordinateEvent(Vector * e)
78 void ActionSetRelativeZero::updateMouseButtonHints()
83 DIALOGFACTORY->updateMouseWidget(tr("Set relative Zero"), tr("Cancel"));
87 DIALOGFACTORY->updateMouseWidget("", "");
92 void ActionSetRelativeZero::updateMouseCursor()
94 graphicView->setMouseCursor(RS2::CadCursor);
97 void ActionSetRelativeZero::updateToolBar()
100 DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
102 DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);