1 // rs_actionlayersedit.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_actionlayersremove.h"
17 #include "rs_dialogfactory.h"
20 RS_ActionLayersRemove::RS_ActionLayersRemove(RS_EntityContainer & container, GraphicView & graphicView):
21 RS_ActionInterface("Remove Layer", container, graphicView)
25 RS_ActionLayersRemove::~RS_ActionLayersRemove()
29 void RS_ActionLayersRemove::trigger()
31 RS_DEBUG->print("RS_ActionLayersRemove::trigger");
36 RS_DIALOGFACTORY->requestLayerRemovalDialog(graphic->getLayerList());
39 if (layer!=NULL && layer->getName()!="0") {
41 graphic->startUndoCycle();
42 for (RS_Entity* e=graphic->firstEntity(RS2::ResolveNone);
44 e=graphic->nextEntity(RS2::ResolveNone)) {
46 if (e->getLayer()!=NULL &&
47 e->getLayer()->getName()==layer->getName()) {
49 e->setUndoState(true);
51 graphic->addUndoable(e);
56 graphic->endUndoCycle();
59 // Now remove the layer from the layer list:
60 graphic->removeLayer(layer);
63 RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected());
66 void RS_ActionLayersRemove::init(int status)
68 RS_ActionInterface::init(status);