summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJohn Smith <john.smith7545@yahoo.com>2012-10-09 06:26:18 +0000
committerJohn Smith <john.smith7545@yahoo.com>2012-10-09 06:26:18 +0000
commit1208e5f7938731244720438bff526c0b6e07c54f (patch)
tree61807e55187f16ae2bfe25c2715a01ac36645091 /src
parentpackaging/macosx: update default theme for newer Clearlooks engine (diff)
downloadinkscape-1208e5f7938731244720438bff526c0b6e07c54f.tar.gz
inkscape-1208e5f7938731244720438bff526c0b6e07c54f.zip
Fix for 191020 : Lock/Unlock all layers
(bzr r11764)
Diffstat (limited to 'src')
-rw-r--r--src/desktop.cpp13
-rw-r--r--src/desktop.h3
-rw-r--r--src/ui/dialog/layers.cpp17
-rw-r--r--src/verbs.cpp20
-rw-r--r--src/verbs.h2
5 files changed, 49 insertions, 6 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp
index ca981a458..b01bf5d64 100644
--- a/src/desktop.cpp
+++ b/src/desktop.cpp
@@ -496,13 +496,22 @@ void SPDesktop::setCurrentLayer(SPObject *object) {
_layer_hierarchy->setBottom(object);
}
-void SPDesktop::toggleAllLayers(bool hide) {
+void SPDesktop::toggleHideAllLayers(bool hide) {
- for ( SPObject* obj = currentRoot(); obj; obj = Inkscape::previous_layer(currentRoot(), obj) ) {
+ for ( SPObject* obj = Inkscape::previous_layer(currentRoot(), currentRoot()); obj; obj = Inkscape::previous_layer(currentRoot(), obj) ) {
SP_ITEM(obj)->setHidden(hide);
}
}
+void SPDesktop::toggleLockAllLayers(bool lock) {
+
+ for ( SPObject* obj = Inkscape::previous_layer(currentRoot(), currentRoot()); obj; obj = Inkscape::previous_layer(currentRoot(), obj) ) {
+ SP_ITEM(obj)->setLocked(lock);
+ }
+}
+
+
+
void SPDesktop::toggleLayerSolo(SPObject *object) {
g_return_if_fail(SP_IS_GROUP(object));
g_return_if_fail( currentRoot() == object || (currentRoot() && currentRoot()->isAncestorOf(object)) );
diff --git a/src/desktop.h b/src/desktop.h
index 919cd905e..3eb0294e7 100644
--- a/src/desktop.h
+++ b/src/desktop.h
@@ -280,7 +280,8 @@ public:
void setCurrentLayer(SPObject *object);
void toggleLayerSolo(SPObject *object);
- void toggleAllLayers(bool hidden);
+ void toggleHideAllLayers(bool hide);
+ void toggleLockAllLayers(bool lock);
SPObject *layerForObject(SPObject *object);
bool isLayer(SPObject *object) const;
bool isWithinViewport(SPItem *item) const;
diff --git a/src/ui/dialog/layers.cpp b/src/ui/dialog/layers.cpp
index 70cf7075c..44eef89bb 100644
--- a/src/ui/dialog/layers.cpp
+++ b/src/ui/dialog/layers.cpp
@@ -69,6 +69,8 @@ enum {
BUTTON_SOLO,
BUTTON_SHOW_ALL,
BUTTON_HIDE_ALL,
+ BUTTON_LOCK_ALL,
+ BUTTON_UNLOCK_ALL,
DRAGNDROP
};
@@ -263,6 +265,16 @@ bool LayersPanel::_executeAction()
_fireAction( SP_VERB_LAYER_HIDE_ALL );
}
break;
+ case BUTTON_LOCK_ALL:
+ {
+ _fireAction( SP_VERB_LAYER_LOCK_ALL );
+ }
+ break;
+ case BUTTON_UNLOCK_ALL:
+ {
+ _fireAction( SP_VERB_LAYER_UNLOCK_ALL );
+ }
+ break;
case DRAGNDROP:
{
_doTreeMove( );
@@ -876,6 +888,11 @@ LayersPanel::LayersPanel() :
_popupMenu.append(*manage(new Gtk::SeparatorMenuItem()));
+ _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOCK_ALL, 0, "Lock All", (int)BUTTON_LOCK_ALL ) );
+ _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_UNLOCK_ALL, 0, "Unlock All", (int)BUTTON_UNLOCK_ALL ) );
+
+ _popupMenu.append(*manage(new Gtk::SeparatorMenuItem()));
+
_watchingNonTop.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RAISE, GTK_STOCK_GO_UP, "Up", (int)BUTTON_UP ) );
_watchingNonBottom.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_LOWER, GTK_STOCK_GO_DOWN, "Down", (int)BUTTON_DOWN ) );
diff --git a/src/verbs.cpp b/src/verbs.cpp
index edfc45f8e..591280d47 100644
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
@@ -1342,17 +1342,27 @@ void LayerVerb::perform(SPAction *action, void *data)
break;
}
case SP_VERB_LAYER_SHOW_ALL: {
- dt->toggleAllLayers( false );
+ dt->toggleHideAllLayers( false );
DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:showall", SP_VERB_LAYER_SHOW_ALL, _("Show all layers"));
break;
}
-
case SP_VERB_LAYER_HIDE_ALL: {
- dt->toggleAllLayers( true );
+ dt->toggleHideAllLayers( true );
DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:hideall", SP_VERB_LAYER_HIDE_ALL, _("Hide all layers"));
break;
}
+ case SP_VERB_LAYER_LOCK_ALL: {
+ dt->toggleLockAllLayers( true );
+ DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:lockall", SP_VERB_LAYER_LOCK_ALL, _("Lock all layers"));
+ break;
+ }
+
+ case SP_VERB_LAYER_UNLOCK_ALL: {
+ dt->toggleLockAllLayers( false );
+ DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:unlockall", SP_VERB_LAYER_UNLOCK_ALL, _("Unlock all layers"));
+ break;
+ }
case SP_VERB_LAYER_TOGGLE_LOCK:
case SP_VERB_LAYER_TOGGLE_HIDE: {
if ( dt->currentLayer() == dt->currentRoot() ) {
@@ -2489,6 +2499,10 @@ Verb *Verb::_base_verbs[] = {
N_("Show all the layers"), NULL),
new LayerVerb(SP_VERB_LAYER_HIDE_ALL, "LayerHideAll", N_("_Hide all layers"),
N_("Hide all the layers"), NULL),
+ new LayerVerb(SP_VERB_LAYER_LOCK_ALL, "LayerLockAll", N_("_Lock all layers"),
+ N_("Lock all the layers"), NULL),
+ new LayerVerb(SP_VERB_LAYER_UNLOCK_ALL, "LayerUnlockAll", N_("_Unlock all layers"),
+ N_("Unlock all the layers"), NULL),
new LayerVerb(SP_VERB_LAYER_TOGGLE_LOCK, "LayerToggleLock", N_("_Lock/Unlock Current Layer"),
N_("Toggle lock on current layer"), NULL),
new LayerVerb(SP_VERB_LAYER_TOGGLE_HIDE, "LayerToggleHide", N_("_Show/hide Current Layer"),
diff --git a/src/verbs.h b/src/verbs.h
index aa801803c..e8b271a18 100644
--- a/src/verbs.h
+++ b/src/verbs.h
@@ -149,6 +149,8 @@ enum {
SP_VERB_LAYER_SOLO,
SP_VERB_LAYER_SHOW_ALL,
SP_VERB_LAYER_HIDE_ALL,
+ SP_VERB_LAYER_LOCK_ALL,
+ SP_VERB_LAYER_UNLOCK_ALL,
SP_VERB_LAYER_TOGGLE_LOCK,
SP_VERB_LAYER_TOGGLE_HIDE,
/* Object */