diff options
| author | Aaron Spike <aaron@ekips.org> | 2007-03-12 03:26:13 +0000 |
|---|---|---|
| committer | acspike <acspike@users.sourceforge.net> | 2007-03-12 03:26:13 +0000 |
| commit | 6fec0ce5665d697b171152dfaf963361b7f1be43 (patch) | |
| tree | d37178dac98aff1e4b00dde44d61318f68d7780b /src/selection-chemistry.cpp | |
| parent | sodipodi:docbase finally goes packing, along with a lauris comment (diff) | |
| download | inkscape-6fec0ce5665d697b171152dfaf963361b7f1be43.tar.gz inkscape-6fec0ce5665d697b171152dfaf963361b7f1be43.zip | |
add verbs for unlocking and unhiding all objects globaly or within the current layer
(bzr r2613)
Diffstat (limited to 'src/selection-chemistry.cpp')
| -rw-r--r-- | src/selection-chemistry.cpp | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index bc9ebe7a5..7d22695fc 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -2870,6 +2870,62 @@ void fit_canvas_to_selection_or_drawing(SPDesktop *desktop) { _("Fit page to selection")); }; +static void itemtree_map(void (*f)(SPItem *, SPDesktop *), SPObject *root, SPDesktop *desktop) { + // don't operate on layers + if (SP_IS_ITEM(root) && !desktop->isLayer(SP_ITEM(root))) { + f(SP_ITEM(root), desktop); + } + for ( SPObject::SiblingIterator iter = root->firstChild() ; iter ; ++iter ) { + //don't recurse into locked layers + if (!(desktop->isLayer(SP_ITEM(&*iter)) && SP_ITEM(&*iter)->isLocked())) { + itemtree_map(f, iter, desktop); + } + } +} + +static void unlock(SPItem *item, SPDesktop *desktop) { + if (item->isLocked()) { + item->setLocked(FALSE); + } +} + +static void unhide(SPItem *item, SPDesktop *desktop) { + if (desktop->itemIsHidden(item)) { + item->setExplicitlyHidden(FALSE); + } +} + +static void process_all(void (*f)(SPItem *, SPDesktop *), SPDesktop *dt, bool layer_only, char *label) { + if (!dt) return; + + SPObject *root; + if (layer_only) { + root = dt->currentLayer(); + } else { + root = dt->currentRoot(); + } + + itemtree_map(f, root, dt); + + sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, label); +} + +void unlock_all(SPDesktop *dt) { + process_all(&unlock, dt, true, _("Unlock all objects in the current layer")); +} + +void unlock_all_in_all_layers(SPDesktop *dt) { + process_all(&unlock, dt, false, _("Unlock all objects in all layers")); +} + +void unhide_all(SPDesktop *dt) { + process_all(&unhide, dt, true, _("Unhide all objects in the current layer")); +} + +void unhide_all_in_all_layers(SPDesktop *dt) { + process_all(&unhide, dt, false, _("Unhide all objects in all layers")); +} + /* Local Variables: mode:c++ |
