]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actionlayersadd.cpp
Major refactoring of actions: Moved implementation from header files
[architektonas] / src / actions / rs_actionlayersadd.cpp
1 // rs_actionlayersadd.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/04/2010  Added this text. :-)
13 //
14
15 #include "rs_actionlayersadd.h"
16
17 #include "rs_dialogfactory.h"
18 #include "drawing.h"
19
20 RS_ActionLayersAdd::RS_ActionLayersAdd(RS_EntityContainer & container, RS_GraphicView & graphicView):
21         RS_ActionInterface("Add Layer", container, graphicView)
22 {
23 }
24
25 RS_ActionLayersAdd::~RS_ActionLayersAdd()
26 {
27 }
28
29 void RS_ActionLayersAdd::trigger()
30 {
31         RS_DEBUG->print("add layer");
32
33         if (RS_DIALOGFACTORY != NULL && graphic)
34         {
35                 RS_Layer * layer = RS_DIALOGFACTORY->requestNewLayerDialog(graphic->getLayerList());
36
37                 if (layer != NULL)
38                         graphic->addLayer(layer);
39         }
40
41         finish();
42 }
43
44 void RS_ActionLayersAdd::init(int status)
45 {
46         RS_ActionInterface::init(status);
47         trigger();
48 }
49