1 // actionlayerstogglelock.cpp
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
8 // JLH = James L. Hammons <jlhamm@acm.org>
11 // --- ---------- -----------------------------------------------------------
12 // JLH 06/04/2010 Added this text. :-)
15 #include "actionlayerstogglelock.h"
17 #include "graphicview.h"
20 ActionLayersToggleLock::ActionLayersToggleLock(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Toggle Layer Visibility",
21 container, graphicView)
25 ActionLayersToggleLock::~ActionLayersToggleLock()
29 void ActionLayersToggleLock::trigger()
31 RS_DEBUG->print("toggle layer");
35 RS_Layer * layer = graphic->getActiveLayer();
39 graphic->toggleLayerLock(layer);
41 // deselect entities on locked layer:
42 if (layer->isLocked())
43 for (RS_Entity * e = container->firstEntity(); e != NULL;
44 e = container->nextEntity())
45 if (e != NULL && e->isVisible() && e->getLayer() == layer)
47 if (graphicView != NULL)
48 graphicView->deleteEntity(e);
50 e->setSelected(false);
52 if (graphicView != NULL)
53 graphicView->drawEntity(e);
61 void ActionLayersToggleLock::init(int status)
63 ActionInterface::init(status);