Code

move sp_document_done() out into verbs.cpp
authoracspike <acspike@users.sourceforge.net>
Mon, 12 Mar 2007 04:31:44 +0000 (04:31 +0000)
committeracspike <acspike@users.sourceforge.net>
Mon, 12 Mar 2007 04:31:44 +0000 (04:31 +0000)
src/selection-chemistry.cpp
src/selection-chemistry.h
src/verbs.cpp

index ead15446645ec8cef6b754a18bf7a9f88a38f9ae..00ef487669ce097fcb0644042184a10ae50f7699 100644 (file)
@@ -2895,10 +2895,8 @@ static void unhide(SPItem *item, SPDesktop *desktop) {
     }
 }
 
-static void process_all(void (*f)(SPItem *, SPDesktop *), SPDesktop *dt, unsigned int id, bool layer_only, char *label) {
+static void process_all(void (*f)(SPItem *, SPDesktop *), SPDesktop *dt, bool layer_only) {
     if (!dt) return;
-    SPDocument *doc = sp_desktop_document(dt);
-    if (!doc) return;
         
     SPObject *root;
     if (layer_only) {
@@ -2908,24 +2906,22 @@ static void process_all(void (*f)(SPItem *, SPDesktop *), SPDesktop *dt, unsigne
     }
     
     itemtree_map(f, root, dt);
-    
-    sp_document_done(doc, id, label);
 }
 
-void unlock_all(SPDesktop *dt, unsigned int id) {
-    process_all(&unlock, dt, id, true, _("Unlock all objects in the current layer"));
+void unlock_all(SPDesktop *dt) {
+    process_all(&unlock, dt, true);
 }
 
-void unlock_all_in_all_layers(SPDesktop *dt, unsigned int id) {
-    process_all(&unlock, dt, id, false, _("Unlock all objects in all layers"));
+void unlock_all_in_all_layers(SPDesktop *dt) {
+    process_all(&unlock, dt, false);
 }
 
-void unhide_all(SPDesktop *dt, unsigned int id) {
-    process_all(&unhide, dt, id, true, _("Unhide all objects in the current layer"));
+void unhide_all(SPDesktop *dt) {
+    process_all(&unhide, dt, true);
 }
 
-void unhide_all_in_all_layers(SPDesktop *dt, unsigned int id) {
-    process_all(&unhide, dt, id, false, _("Unhide all objects in all layers"));
+void unhide_all_in_all_layers(SPDesktop *dt) {
+    process_all(&unhide, dt, false);
 }
 
 /*
index 5a4ad194b971252de648d5d8a8b9c727a62aafaf..0ad465ec472439ef7ab1e425a9357e212102700f 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, 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);
+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);
 
 
 /* selection cycling */
index 88b5f4e3381a90b72ea75028ae31ac7e9f0ff97c..f884224074631bcbddd7182d4dee523edc39d343 100644 (file)
@@ -2013,19 +2013,25 @@ LockAndHideVerb::perform(SPAction *action, void *data, void *pdata)
 {
     SPDesktop *dt = static_cast<SPDesktop*>(sp_action_get_view(action));
     if (!dt) return;
+    SPDocument *doc = sp_desktop_document(dt);
+    if (!doc) return;
     
     switch ((long) data) {
         case SP_VERB_UNLOCK_ALL:
-            unlock_all(dt, SP_VERB_UNLOCK_ALL);
+            unlock_all(dt);
+            sp_document_done(doc, SP_VERB_UNLOCK_ALL, _("Unlock all objects in the current layer"));
             break;
         case SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS:
-            unlock_all_in_all_layers(dt, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS);
+            unlock_all_in_all_layers(dt);
+            sp_document_done(doc, SP_VERB_UNLOCK_ALL_IN_ALL_LAYERS, _("Unlock all objects in all layers"));
             break;
         case SP_VERB_UNHIDE_ALL:
-            unhide_all(dt, SP_VERB_UNHIDE_ALL);
+            unhide_all(dt);
+            sp_document_done(doc, SP_VERB_UNHIDE_ALL, _("Unhide all objects in the current layer"));
             break;
         case SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS:
-            unhide_all_in_all_layers(dt, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS);
+            unhide_all_in_all_layers(dt);
+            sp_document_done(doc, SP_VERB_UNHIDE_ALL_IN_ALL_LAYERS, _("Unhide all objects in all layers"));
             break;
         default:
             return;