]> Shamusworld >> Repos - architektonas/blob - src/actions/rs_actionlayersremove.cpp
Last checkin before major refactor...
[architektonas] / src / actions / rs_actionlayersremove.cpp
1 // rs_actionlayersedit.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_actionlayersremove.h"
16
17 #include "rs_dialogfactory.h"
18 #include "drawing.h"
19
20 RS_ActionLayersRemove::RS_ActionLayersRemove(RS_EntityContainer & container, GraphicView & graphicView):
21         RS_ActionInterface("Remove Layer", container, graphicView)
22 {
23 }
24
25 RS_ActionLayersRemove::~RS_ActionLayersRemove()
26 {
27 }
28
29 void RS_ActionLayersRemove::trigger()
30 {
31         RS_DEBUG->print("RS_ActionLayersRemove::trigger");
32
33         if (graphic != NULL)
34         {
35                 RS_Layer * layer =
36                         RS_DIALOGFACTORY->requestLayerRemovalDialog(graphic->getLayerList());
37
38                 /*
39                       if (layer!=NULL && layer->getName()!="0") {
40
41                           graphic->startUndoCycle();
42                           for (RS_Entity* e=graphic->firstEntity(RS2::ResolveNone);
43                                   e!=NULL;
44                                   e=graphic->nextEntity(RS2::ResolveNone)) {
45
46                               if (e->getLayer()!=NULL &&
47                                       e->getLayer()->getName()==layer->getName()) {
48
49                                   e->setUndoState(true);
50                                   e->setLayer("0");
51                                   graphic->addUndoable(e);
52                               }
53                           }
54
55
56                           graphic->endUndoCycle();
57                  */
58
59                 // Now remove the layer from the layer list:
60                 graphic->removeLayer(layer);
61         }
62         finish();
63         RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
64 }
65
66 void RS_ActionLayersRemove::init(int status)
67 {
68         RS_ActionInterface::init(status);
69         trigger();
70 }
71
72 // EOF