| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #include "rs_actionlayerstogglelock.h" |
| |
|
| | #include "rs_debug.h" |
| | #include "rs_graphic.h" |
| | #include "rs_layer.h" |
| |
|
| | class RS_LayerList; |
| |
|
| | RS_ActionLayersToggleLock::RS_ActionLayersToggleLock(LC_ActionContext *actionContext,RS_Layer* layer) |
| | : RS_ActionInterface("Toggle Layer Visibility", actionContext, RS2::ActionLayersToggleLock) |
| | , m_layer(layer){ |
| | } |
| |
|
| | void RS_ActionLayersToggleLock::trigger() { |
| | RS_DEBUG->print("toggle layer"); |
| | if (m_graphic) { |
| | RS_LayerList* ll = m_graphic->getLayerList(); |
| | unsigned cnt = 0; |
| | |
| | for (auto layer: *ll) { |
| | if (!layer) continue; |
| | if (!layer->isVisibleInLayerList()) continue; |
| | if (!layer->isSelectedInLayerList()) continue; |
| | m_graphic->toggleLayerLock(layer); |
| | deselectEntitiesOnLockedLayer(layer); |
| | cnt++; |
| | } |
| | |
| | if (!cnt) { |
| | m_graphic->toggleLayerLock(m_layer); |
| | deselectEntitiesOnLockedLayer(m_layer); |
| | } |
| | } |
| | redrawDrawing(); |
| | finish(false); |
| | } |
| |
|
| | void RS_ActionLayersToggleLock::init(int status) { |
| | RS_ActionInterface::init(status); |
| | trigger(); |
| | } |
| |
|
| | void RS_ActionLayersToggleLock::deselectEntitiesOnLockedLayer(RS_Layer* layer) |
| | { |
| | if (!layer) return; |
| | if (!layer->isLocked()) return; |
| |
|
| | for(auto e: *m_container){ |
| | if (e && e->isVisible() && e->getLayer() == layer) { |
| | e->setSelected(false); |
| | } |
| | } |
| | } |
| |
|