From 4a846925296e622a461268eaa3349fb082967ba2 Mon Sep 17 00:00:00 2001 From: acspike Date: Mon, 12 Mar 2007 04:17:17 +0000 Subject: [PATCH] send verb ids into history and remove casting errors --- src/selection-chemistry.cpp | 24 +++++++++++++----------- src/selection-chemistry.h | 8 ++++---- src/verbs.cpp | 8 ++++---- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 7d22695fc..ead154466 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -2877,7 +2877,7 @@ static void itemtree_map(void (*f)(SPItem *, SPDesktop *), SPObject *root, SPDes } for ( SPObject::SiblingIterator iter = root->firstChild() ; iter ; ++iter ) { //don't recurse into locked layers - if (!(desktop->isLayer(SP_ITEM(&*iter)) && SP_ITEM(&*iter)->isLocked())) { + if (!(SP_IS_ITEM(&*iter) && desktop->isLayer(SP_ITEM(&*iter)) && SP_ITEM(&*iter)->isLocked())) { itemtree_map(f, iter, desktop); } } @@ -2895,8 +2895,10 @@ static void unhide(SPItem *item, SPDesktop *desktop) { } } -static void process_all(void (*f)(SPItem *, SPDesktop *), SPDesktop *dt, bool layer_only, char *label) { +static void process_all(void (*f)(SPItem *, SPDesktop *), SPDesktop *dt, unsigned int id, bool layer_only, char *label) { if (!dt) return; + SPDocument *doc = sp_desktop_document(dt); + if (!doc) return; SPObject *root; if (layer_only) { @@ -2907,23 +2909,23 @@ static void process_all(void (*f)(SPItem *, SPDesktop *), SPDesktop *dt, bool la itemtree_map(f, root, dt); - sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_DIALOG_ITEM, label); + sp_document_done(doc, id, label); } -void unlock_all(SPDesktop *dt) { - process_all(&unlock, dt, true, _("Unlock all objects in the current layer")); +void unlock_all(SPDesktop *dt, unsigned int id) { + process_all(&unlock, dt, id, 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 unlock_all_in_all_layers(SPDesktop *dt, unsigned int id) { + process_all(&unlock, dt, id, 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(SPDesktop *dt, unsigned int id) { + process_all(&unhide, dt, id, 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")); +void unhide_all_in_all_layers(SPDesktop *dt, unsigned int id) { + process_all(&unhide, dt, id, false, _("Unhide all objects in all layers")); } /* diff --git a/src/selection-chemistry.h b/src/selection-chemistry.h index 0ad465ec4..5a4ad194b 100644 --- a/src/selection-chemistry.h +++ b/src/selection-chemistry.h @@ -100,10 +100,10 @@ void fit_canvas_to_selection(SPDesktop *desktop); void fit_canvas_to_drawing(SPDocument *doc); void fit_canvas_to_selection_or_drawing(SPDesktop *desktop); -void unlock_all(SPDesktop *dt); -void unlock_all_in_all_layers(SPDesktop *dt); -void unhide_all(SPDesktop *dt); -void unhide_all_in_all_layers(SPDesktop *dt); +void unlock_all(SPDesktop *dt, unsigned int id); +void unlock_all_in_all_layers(SPDesktop *dt, unsigned int id); +void unhide_all(SPDesktop *dt, unsigned int id); +void unhide_all_in_all_layers(SPDesktop *dt, unsigned int id); /* selection cycling */ diff --git a/src/verbs.cpp b/src/verbs.cpp index 91adfc7d0..88b5f4e33 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -2016,16 +2016,16 @@ LockAndHideVerb::perform(SPAction *action, void *data, void *pdata) switch ((long) data) { case SP_VERB_UNLOCK_ALL: - unlock_all(dt); + unlock_all(dt, SP_VERB_UNLOCK_ALL); break; case SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS: - unlock_all_in_all_layers(dt); + unlock_all_in_all_layers(dt, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS); break; case SP_VERB_UNHIDE_ALL: - unhide_all(dt); + unhide_all(dt, SP_VERB_UNHIDE_ALL); break; case SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS: - unhide_all_in_all_layers(dt); + unhide_all_in_all_layers(dt, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS); break; default: return; -- 2.30.2