diff options
| author | John Smith <john.smith7545@yahoo.com> | 2012-07-12 09:42:23 +0000 |
|---|---|---|
| committer | John Smith <john.smith7545@yahoo.com> | 2012-07-12 09:42:23 +0000 |
| commit | eef4e4067dbd2997e08ae87990d258f64f335df7 (patch) | |
| tree | 959b1fad257c2e343e1fb3c92e030b18693a5db1 | |
| parent | Fix for 612221 : Add metadata default configuration in the preferences (diff) | |
| download | inkscape-eef4e4067dbd2997e08ae87990d258f64f335df7.tar.gz inkscape-eef4e4067dbd2997e08ae87990d258f64f335df7.zip | |
Fix for 378413 : Show/Hide all layers
(bzr r11545)
| -rw-r--r-- | src/desktop.cpp | 7 | ||||
| -rw-r--r-- | src/desktop.h | 1 | ||||
| -rw-r--r-- | src/ui/dialog/layers.cpp | 20 | ||||
| -rw-r--r-- | src/verbs.cpp | 16 | ||||
| -rw-r--r-- | src/verbs.h | 2 |
5 files changed, 44 insertions, 2 deletions
diff --git a/src/desktop.cpp b/src/desktop.cpp index 2610d31ae..ce1f4cda4 100644 --- a/src/desktop.cpp +++ b/src/desktop.cpp @@ -496,6 +496,13 @@ void SPDesktop::setCurrentLayer(SPObject *object) { _layer_hierarchy->setBottom(object); } +void SPDesktop::toggleAllLayers(bool hide) { + + for ( SPObject* obj = currentRoot(); obj; obj = Inkscape::previous_layer(currentRoot(), obj) ) { + SP_ITEM(obj)->setHidden(hide); + } +} + 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 32457b33a..7bc4ba463 100644 --- a/src/desktop.h +++ b/src/desktop.h @@ -280,6 +280,7 @@ public: void setCurrentLayer(SPObject *object); void toggleLayerSolo(SPObject *object); + void toggleAllLayers(bool hidden); 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 c01b533a3..70cf7075c 100644 --- a/src/ui/dialog/layers.cpp +++ b/src/ui/dialog/layers.cpp @@ -67,6 +67,8 @@ enum { BUTTON_DUPLICATE, BUTTON_DELETE, BUTTON_SOLO, + BUTTON_SHOW_ALL, + BUTTON_HIDE_ALL, DRAGNDROP }; @@ -251,6 +253,16 @@ bool LayersPanel::_executeAction() _fireAction( SP_VERB_LAYER_SOLO ); } break; + case BUTTON_SHOW_ALL: + { + _fireAction( SP_VERB_LAYER_SHOW_ALL ); + } + break; + case BUTTON_HIDE_ALL: + { + _fireAction( SP_VERB_LAYER_HIDE_ALL ); + } + break; case DRAGNDROP: { _doTreeMove( ); @@ -855,10 +867,14 @@ LayersPanel::LayersPanel() : _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RENAME, 0, "Rename", (int)BUTTON_RENAME ) ); _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_DUPLICATE, 0, "Duplicate", (int)BUTTON_DUPLICATE ) ); _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_NEW, 0, "New", (int)BUTTON_NEW ) ); + + _popupMenu.append(*manage(new Gtk::SeparatorMenuItem())); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SOLO, 0, "Solo", (int)BUTTON_SOLO ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SHOW_ALL, 0, "Show All", (int)BUTTON_SHOW_ALL ) ); + _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_HIDE_ALL, 0, "Hide All", (int)BUTTON_HIDE_ALL ) ); - Gtk::MenuItem* item = Gtk::manage(new Gtk::SeparatorMenuItem()); - _popupMenu.append(*item); + _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 9de7d6dbf..399e51593 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1332,6 +1332,18 @@ void LayerVerb::perform(SPAction *action, void *data) } break; } + case SP_VERB_LAYER_SHOW_ALL: { + dt->toggleAllLayers( 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 ); + DocumentUndo::maybeDone(sp_desktop_document(dt), "layer:hideall", SP_VERB_LAYER_HIDE_ALL, _("Hide all layers")); + break; + } + case SP_VERB_LAYER_TOGGLE_LOCK: case SP_VERB_LAYER_TOGGLE_HIDE: { if ( dt->currentLayer() == dt->currentRoot() ) { @@ -2443,6 +2455,10 @@ Verb *Verb::_base_verbs[] = { N_("Delete the current layer"), INKSCAPE_ICON("layer-delete")), new LayerVerb(SP_VERB_LAYER_SOLO, "LayerSolo", N_("_Show/hide other layers"), N_("Solo the current layer"), NULL), + new LayerVerb(SP_VERB_LAYER_SHOW_ALL, "LayerShowAll", N_("_Show all layers"), + 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_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 8d65db642..87547b37c 100644 --- a/src/verbs.h +++ b/src/verbs.h @@ -145,6 +145,8 @@ enum { SP_VERB_LAYER_DUPLICATE, SP_VERB_LAYER_DELETE, SP_VERB_LAYER_SOLO, + SP_VERB_LAYER_SHOW_ALL, + SP_VERB_LAYER_HIDE_ALL, SP_VERB_LAYER_TOGGLE_LOCK, SP_VERB_LAYER_TOGGLE_HIDE, /* Object */ |
