]> Shamusworld >> Repos - architektonas/blob - src/actions/actionblocksadd.cpp
In the middle of major refactoring...
[architektonas] / src / actions / actionblocksadd.cpp
1 // actionblocksadd.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  07/12/2010  Added this text. :-)
13 //
14
15 #include "actionblocksadd.h"
16
17 #include "drawing.h"
18 #include "rs_dialogfactory.h"
19
20 ActionBlocksAdd::ActionBlocksAdd(RS_EntityContainer & container, GraphicView & graphicView):
21         ActionInterface("Add Block", container, graphicView)
22 {
23 }
24
25 ActionBlocksAdd::~ActionBlocksAdd()
26 {
27 }
28
29 void ActionBlocksAdd::trigger()
30 {
31         RS_DEBUG->print("adding block");
32
33         if (graphic)
34         {
35                 RS_BlockList * blockList = graphic->getBlockList();
36
37                 if (blockList)
38                 {
39                         RS_BlockData d = RS_DIALOGFACTORY->requestNewBlockDialog(blockList);
40
41                         if (d.isValid())
42                                 graphic->addBlock(new RS_Block(container, d));
43                 }
44         }
45
46         finish();
47 }
48
49 void ActionBlocksAdd::init(int status)
50 {
51         ActionInterface::init(status);
52         trigger();
53 }