]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actionblocksfreezeall.cpp
01cdea62fe873c626c8debcd6b5594fccceac461
[architektonas] / src / actions / rs_actionblocksfreezeall.cpp
1 // rs_actionblocksfreezeall.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_actionblocksfreezeall.h"
16
17 #include "rs_graphic.h"
18
19 RS_ActionBlocksFreezeAll::RS_ActionBlocksFreezeAll(bool freeze, RS_EntityContainer & container,
20         RS_GraphicView& graphicView): RS_ActionInterface("Freeze all Blocks",
21         container, graphicView)
22 {
23         this->freeze = freeze;
24 }
25
26 QAction * RS_ActionBlocksFreezeAll::createGUIAction(RS2::ActionType type, QObject* /*parent*/)
27 {
28     QAction * action = NULL;
29
30         if (type == RS2::ActionBlocksFreezeAll)
31         {
32                 action = new QAction(tr("&Freeze all"), 0);
33 //              action= new QAction(tr("Freeze all"), tr("&Freeze all"),
34 //                                  QKeySequence(), NULL);
35         action->setStatusTip(tr("Freeze all blocks"));
36         }
37         else if (type == RS2::ActionBlocksDefreezeAll)
38         {
39         action = new QAction(tr("&Defreeze all"), 0);
40 //        action = new QAction(tr("Defreeze all"), tr("&Defreeze all"),
41 //                             QKeySequence(), NULL);
42         action->setStatusTip(tr("Defreeze all blocks"));
43         }
44
45     return action;
46 }
47
48 void RS_ActionBlocksFreezeAll::trigger()
49 {
50         RS_DEBUG->print("RS_ActionBlocksFreezeAll::trigger");
51
52         if (graphic!=NULL)
53                 graphic->freezeAllBlocks(freeze);
54
55         graphicView->redraw();
56         finish();
57 }
58
59 void RS_ActionBlocksFreezeAll::init(int status)
60 {
61         RS_ActionInterface::init(status);
62         trigger();
63 }