1 // rs_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 "rs_actionlayerstogglelock.h"
17 #include "graphicview.h"
20 RS_ActionLayersToggleLock::RS_ActionLayersToggleLock(RS_EntityContainer & container, GraphicView & graphicView): RS_ActionInterface("Toggle Layer Visibility",
21 container, graphicView)
25 RS_ActionLayersToggleLock::~RS_ActionLayersToggleLock()
29 void RS_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 RS_ActionLayersToggleLock::init(int status)
63 RS_ActionInterface::init(status);