Code

send verb ids into history and remove casting errors
authoracspike <acspike@users.sourceforge.net>
Mon, 12 Mar 2007 04:17:17 +0000 (04:17 +0000)
committeracspike <acspike@users.sourceforge.net>
Mon, 12 Mar 2007 04:17:17 +0000 (04:17 +0000)
src/selection-chemistry.cpp
src/selection-chemistry.h
src/verbs.cpp

index 7d22695fc45d1042f8a984d2630f1ba06ebf42f6..ead15446645ec8cef6b754a18bf7a9f88a38f9ae 100644 (file)
@@ -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"));
 }
 
 /*
index 0ad465ec472439ef7ab1e425a9357e212102700f..5a4ad194b971252de648d5d8a8b9c727a62aafaf 100644 (file)
@@ -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 */
index 91adfc7d08a6ccc65a0543bbb643742a858ceb35..88b5f4e3381a90b72ea75028ae31ac7e9f0ff97c 100644 (file)
@@ -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;