]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actionlayersfreezeall.cpp
7e7dc9088dcea233fd62ea6340bd851c753a4480
[architektonas] / src / actions / rs_actionlayersfreezeall.cpp
1 // rs_actionlayersfreezeall.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  05/22/2010  Added this text. :-)
13 //
14
15 #include "rs_actionlayersfreezeall.h"
16
17 #include "drawing.h"
18
19 RS_ActionLayersFreezeAll::RS_ActionLayersFreezeAll(bool freeze,
20         RS_EntityContainer& container,
21         RS_GraphicView& graphicView)
22         :RS_ActionInterface("Freeze all Layers",
23                     container, graphicView) {
24
25     this->freeze = freeze;
26 }
27
28 QAction * RS_ActionLayersFreezeAll::createGUIAction(RS2::ActionType type, QObject * /*parent*/)
29 {
30         QAction * action = NULL;
31
32         if (type == RS2::ActionLayersFreezeAll)
33         {
34                 action = new QAction(tr("&Freeze all"), 0);
35 //              action = new QAction(tr("Freeze all"), tr("&Freeze all"),
36 //                                                                      QKeySequence(), NULL);
37                 action->setStatusTip(tr("Freeze all layers"));
38         }
39         else if (type == RS2::ActionLayersDefreezeAll)
40         {
41                 action = new QAction(tr("&Defreeze all"), 0);
42 //              action = new QAction(tr("Defreeze all"), tr("&Defreeze all"),
43 //                                                              QKeySequence(), NULL);
44                 action->setStatusTip(tr("Defreeze all layers"));
45         }
46
47         return action;
48 }
49
50
51 void RS_ActionLayersFreezeAll::trigger()
52 {
53     RS_DEBUG->print("RS_ActionLayersFreezeAll::trigger");
54     if (graphic!=NULL)
55         {
56         //RS_Layer* layer = graphic->getActiveLayer();
57         graphic->freezeAllLayers(freeze);
58     }
59     finish();
60 }
61
62
63
64 void RS_ActionLayersFreezeAll::init(int status) {
65     RS_ActionInterface::init(status);
66     trigger();
67 }
68
69 // EOF