]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actionsetsnaprestriction.cpp
d4805d019c03014ba4d9ad79900c59963abef54e
[architektonas] / src / actions / rs_actionsetsnaprestriction.cpp
1 // rs_actionsetsnaprestriction.cpp
2 //
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
7 //
8 // JLH = James L. Hammons <jlhamm@acm.org>
9 //
10 // Who  When        What
11 // ---  ----------  -----------------------------------------------------------
12 // JLH  06/05/2010  Added this text. :-)
13 //
14
15 #include "rs_actionsetsnaprestriction.h"
16
17 #include "graphicview.h"
18
19 /**
20  * Constructor.
21  *
22  * @param snapRes The new snap mode used from now on.
23  * @param set true: set additional snap mode / false: unset
24  */
25 RS_ActionSetSnapRestriction::RS_ActionSetSnapRestriction(
26         RS_EntityContainer & container, GraphicView & graphicView, RS2::SnapRestriction snapRes):
27         RS_ActionInterface("Set Additional Snap Mode", container, graphicView)
28 {
29         this->snapRes = snapRes;
30 }
31
32 RS_ActionSetSnapRestriction::~RS_ActionSetSnapRestriction()
33 {
34 }
35
36 void RS_ActionSetSnapRestriction::trigger()
37 {
38         graphicView->setSnapRestriction(snapRes);
39         finish();
40 }
41
42 void RS_ActionSetSnapRestriction::init(int status)
43 {
44         RS_ActionInterface::init(status);
45         trigger();
46 }