]> Shamusworld >> Repos - architektonas/blob - src/actions/actionlayersedit.cpp
187fb7592416ec11a35a377993b1fba6d33cf98a
[architektonas] / src / actions / actionlayersedit.cpp
1 // 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 "actionlayersedit.h"
16
17 #include "rs_dialogfactory.h"
18 #include "graphicview.h"
19 #include "drawing.h"
20
21 ActionLayersEdit::ActionLayersEdit(RS_EntityContainer & container, GraphicView & graphicView):
22         ActionInterface("Edit Layer", container, graphicView)
23 {
24 }
25
26 ActionLayersEdit::~ActionLayersEdit()
27 {
28 }
29
30 void ActionLayersEdit::trigger()
31 {
32         RS_DEBUG->print("ActionLayersEdit::trigger");
33         RS_Layer * layer = NULL;
34
35         if (graphic)
36         {
37                 layer = RS_DIALOGFACTORY->requestEditLayerDialog(graphic->getLayerList());
38
39                 if (layer)
40                 {
41                         graphic->editLayer(graphic->getActiveLayer(), *layer);
42
43                         // update updateable entities on the layer that has changed
44                         for(RS_Entity * e=graphic->firstEntity(RS2::ResolveNone);
45                                 e!=NULL; e=graphic->nextEntity(RS2::ResolveNone))
46                         {
47                                 RS_Layer * l = e->getLayer();
48
49                                 if (l && l->getName() == layer->getName())
50                                         e->update();
51                         }
52                 }
53         }
54
55         finish();
56         graphicView->redraw();
57 }
58
59 void ActionLayersEdit::init(int status)
60 {
61         ActionInterface::init(status);
62         trigger();
63 }