Code

Get rid of a whole bunch of further instances of SP_ACTIVE_DESKTOP (where the desktop...
authorcilix42 <cilix42@users.sourceforge.net>
Thu, 14 Aug 2008 21:33:11 +0000 (21:33 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Thu, 14 Aug 2008 21:33:11 +0000 (21:33 +0000)
src/box3d-context.cpp
src/eraser-context.cpp
src/nodepath.cpp
src/pen-context.cpp
src/pencil-context.cpp
src/rect-context.cpp
src/select-context.cpp
src/selection-chemistry.cpp
src/selection-chemistry.h
src/verbs.cpp

index 6f3b6ee510dc6913ae6184c5a59adc5855cb6bf5..393340cc4b0822a1be162af9e721683913115678 100644 (file)
@@ -40,7 +40,6 @@
 #include "xml/node-event-vector.h"
 #include "prefs-utils.h"
 #include "context-fns.h"
-#include "inkscape.h"
 #include "desktop-style.h"
 #include "transf_mat_3x4.h"
 #include "perspective-line.h"
@@ -497,7 +496,7 @@ static gint sp_box3d_context_root_handler(SPEventContext *event_context, GdkEven
         case GDK_g:
         case GDK_G:
             if (MOD__SHIFT_ONLY) {
-                sp_selection_to_guides();
+                sp_selection_to_guides(desktop);
                 ret = true;
             }
             break;
index f6df71dc29f73d5436e89ca78bd02ace6b1e62cf..9a8e07e668dc918b557f1bb81cf1c915bffed4e3 100644 (file)
@@ -51,7 +51,6 @@
 #include "xml/repr.h"
 #include "context-fns.h"
 #include "sp-item.h"
-#include "inkscape.h"
 #include "color.h"
 #include "rubberband.h"
 #include "splivarot.h"
@@ -802,7 +801,7 @@ set_to_accumulated(SPEraserContext *dc)
                 g_slist_free(toWorkOn);
 
                 if ( !eraserMode ) {
-                    //sp_selection_delete();
+                    //sp_selection_delete(desktop);
                     remainingItems.clear();
                 }
 
index 4260d03c88964ed8bde179eab95b80ee390d4b13..0f62240937ab024dc31cd114e0b3a14d86fb4fd4 100644 (file)
@@ -2454,7 +2454,7 @@ void sp_node_delete_preserve(GList *nodes_to_delete)
             //FIXME: The following line will be wrong when we have mltiple nodepaths: we only want to
             //delete this nodepath's object, not the entire selection! (though at this time, this
             //does not matter)
-            sp_selection_delete();
+            sp_selection_delete(nodepath->desktop);
             sp_document_done (document, SP_VERB_CONTEXT_NODE,
                               _("Delete nodes"));
         } else {
@@ -2490,7 +2490,7 @@ void sp_node_selected_delete(Inkscape::NodePath::Path *nodepath)
     if (nodepath->subpaths == NULL ||
         sp_nodepath_get_node_count(nodepath) < 2) {
         SPDocument *document = sp_desktop_document (nodepath->desktop);
-        sp_selection_delete();
+        sp_selection_delete(nodepath->desktop);
         sp_document_done (document, SP_VERB_CONTEXT_NODE,
                           _("Delete nodes"));
         return;
index 30b09013b09f770a37fa83d8d72d61dcd8c8895d..3cc7cc0d62a71a3e9830211f11f0000be91ca85f 100644 (file)
@@ -1097,7 +1097,7 @@ pen_handle_key_press(SPPenContext *const pc, GdkEvent *event)
         case GDK_g:
         case GDK_G:
             if (MOD__SHIFT_ONLY) {
-                sp_selection_to_guides();
+                sp_selection_to_guides(SP_EVENT_CONTEXT(pc)->desktop);
                 ret = true;
             }
             break;
index cd0f9be7f27972f4ed5be48156bac7bc37cf6139..01f3020fda34954c0552346fae86c16088308e32 100644 (file)
@@ -520,7 +520,7 @@ pencil_handle_key_press(SPPencilContext *const pc, guint const keyval, guint con
         case GDK_g:
         case GDK_G:
             if (mod_shift_only(state)) {
-                sp_selection_to_guides();
+                sp_selection_to_guides(SP_EVENT_CONTEXT(pc)->desktop);
                 ret = true;
             }
             break;
index e8d7dc7dd985cd86f85b8c3e1cbb605d2f21d644..999aa03b82d5e34a4f8b8ac17f47e5d5f7ef84a1 100644 (file)
@@ -15,7 +15,6 @@
  */
 
 #include "config.h"
-#include "inkscape.h"
 
 #include <gdk/gdkkeysyms.h>
 #include <cstring>
@@ -403,23 +402,10 @@ static gint sp_rect_context_root_handler(SPEventContext *event_context, GdkEvent
             }
             break;
 
-        case GDK_T:
-            {
-                Inkscape::Selection *selection = sp_desktop_selection (inkscape_active_desktop());
-                SPItem *item = selection->singleItem();
-                if (item && SP_IS_RECT (item)) {
-                    g_print ("Scaling transformation matrix\n");
-                    SP_RECT (item)->transform = NR::Matrix(NR::scale(1.25, 1.5));
-                    SP_OBJECT (item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
-                }
-                ret = TRUE;
-            }
-            break;
-
         case GDK_g:
         case GDK_G:
             if (MOD__SHIFT_ONLY) {
-                sp_selection_to_guides();
+                sp_selection_to_guides(desktop);
                 ret = true;
             }
             break;
index 0957b8432233000c74c91fc837e741becf0bf94f..22b358dc7ea55985bd9af6bef81946c30639db7c 100644 (file)
@@ -726,12 +726,12 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                         gint mul = 1 + gobble_key_events(
                             get_group0_keyval(&event->key), 0); // with any mask
                         if (MOD__ALT) { // alt
-                            if (MOD__SHIFT) sp_selection_move_screen(mul*-10, 0); // shift
-                            else sp_selection_move_screen(mul*-1, 0); // no shift
+                            if (MOD__SHIFT) sp_selection_move_screen(desktop, mul*-10, 0); // shift
+                            else sp_selection_move_screen(desktop, mul*-1, 0); // no shift
                         }
                         else { // no alt
-                            if (MOD__SHIFT) sp_selection_move(mul*-10*nudge, 0); // shift
-                            else sp_selection_move(mul*-nudge, 0); // no shift
+                            if (MOD__SHIFT) sp_selection_move(desktop, mul*-10*nudge, 0); // shift
+                            else sp_selection_move(desktop, mul*-nudge, 0); // no shift
                         }
                         ret = TRUE;
                     }
@@ -743,12 +743,12 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                         gint mul = 1 + gobble_key_events(
                             get_group0_keyval(&event->key), 0); // with any mask
                         if (MOD__ALT) { // alt
-                            if (MOD__SHIFT) sp_selection_move_screen(0, mul*10); // shift
-                            else sp_selection_move_screen(0, mul*1); // no shift
+                            if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*10); // shift
+                            else sp_selection_move_screen(desktop, 0, mul*1); // no shift
                         }
                         else { // no alt
-                            if (MOD__SHIFT) sp_selection_move(0, mul*10*nudge); // shift
-                            else sp_selection_move(0, mul*nudge); // no shift
+                            if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*10*nudge); // shift
+                            else sp_selection_move(desktop, 0, mul*nudge); // no shift
                         }
                         ret = TRUE;
                     }
@@ -760,12 +760,12 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                         gint mul = 1 + gobble_key_events(
                             get_group0_keyval(&event->key), 0); // with any mask
                         if (MOD__ALT) { // alt
-                            if (MOD__SHIFT) sp_selection_move_screen(mul*10, 0); // shift
-                            else sp_selection_move_screen(mul*1, 0); // no shift
+                            if (MOD__SHIFT) sp_selection_move_screen(desktop, mul*10, 0); // shift
+                            else sp_selection_move_screen(desktop, mul*1, 0); // no shift
                         }
                         else { // no alt
-                            if (MOD__SHIFT) sp_selection_move(mul*10*nudge, 0); // shift
-                            else sp_selection_move(mul*nudge, 0); // no shift
+                            if (MOD__SHIFT) sp_selection_move(desktop, mul*10*nudge, 0); // shift
+                            else sp_selection_move(desktop, mul*nudge, 0); // no shift
                         }
                         ret = TRUE;
                     }
@@ -777,12 +777,12 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                         gint mul = 1 + gobble_key_events(
                             get_group0_keyval(&event->key), 0); // with any mask
                         if (MOD__ALT) { // alt
-                            if (MOD__SHIFT) sp_selection_move_screen(0, mul*-10); // shift
-                            else sp_selection_move_screen(0, mul*-1); // no shift
+                            if (MOD__SHIFT) sp_selection_move_screen(desktop, 0, mul*-10); // shift
+                            else sp_selection_move_screen(desktop, 0, mul*-1); // no shift
                         }
                         else { // no alt
-                            if (MOD__SHIFT) sp_selection_move(0, mul*-10*nudge); // shift
-                            else sp_selection_move(0, mul*-nudge); // no shift
+                            if (MOD__SHIFT) sp_selection_move(desktop, 0, mul*-10*nudge); // shift
+                            else sp_selection_move(desktop, 0, mul*-nudge); // no shift
                         }
                         ret = TRUE;
                     }
@@ -795,7 +795,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                 case GDK_a:
                 case GDK_A:
                     if (MOD__CTRL_ONLY) {
-                        sp_edit_select_all();
+                        sp_edit_select_all(desktop);
                         ret = TRUE;
                     }
                     break;
@@ -901,7 +901,7 @@ sp_select_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                 case GDK_g:
                 case GDK_G:
                     if (MOD__SHIFT_ONLY) {
-                        sp_selection_to_guides();
+                        sp_selection_to_guides(desktop);
                         ret = true;
                     }
                     break;
index c6e2e615332d5f9a8afb6918180c32143878d552..f47d4b0b741fc040b6f4dd4ef5d4fa542c59c50e 100644 (file)
@@ -25,7 +25,6 @@
 #include <gtkmm/clipboard.h>
 
 #include "svg/svg.h"
-#include "inkscape.h"
 #include "desktop.h"
 #include "desktop-style.h"
 #include "selection.h"
@@ -183,9 +182,8 @@ void sp_selection_delete_impl(GSList const *items, bool propagate = true, bool p
 }
 
 
-void sp_selection_delete()
+void sp_selection_delete(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL) {
         return;
     }
@@ -236,9 +234,8 @@ void add_ids_recursive (std::vector<const gchar *> &ids, SPObject *obj)
     }
 }
 
-void sp_selection_duplicate(bool suppressDone)
+void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -320,9 +317,8 @@ void sp_selection_duplicate(bool suppressDone)
     g_slist_free(newsel);
 }
 
-void sp_edit_clear_all()
+void sp_edit_clear_all(SPDesktop *dt)
 {
-    SPDesktop *dt = SP_ACTIVE_DESKTOP;
     if (!dt)
         return;
 
@@ -363,9 +359,8 @@ get_all_items (GSList *list, SPObject *from, SPDesktop *desktop, bool onlyvisibl
     return list;
 }
 
-void sp_edit_select_all_full (bool force_all_layers, bool invert)
+void sp_edit_select_all_full (SPDesktop *dt, bool force_all_layers, bool invert)
 {
-    SPDesktop *dt = SP_ACTIVE_DESKTOP;
     if (!dt)
         return;
 
@@ -429,29 +424,28 @@ void sp_edit_select_all_full (bool force_all_layers, bool invert)
     }
 }
 
-void sp_edit_select_all ()
+void sp_edit_select_all (SPDesktop *desktop)
 {
-    sp_edit_select_all_full (false, false);
+    sp_edit_select_all_full (desktop, false, false);
 }
 
-void sp_edit_select_all_in_all_layers ()
+void sp_edit_select_all_in_all_layers (SPDesktop *desktop)
 {
-    sp_edit_select_all_full (true, false);
+    sp_edit_select_all_full (desktop, true, false);
 }
 
-void sp_edit_invert ()
+void sp_edit_invert (SPDesktop *desktop)
 {
-    sp_edit_select_all_full (false, true);
+    sp_edit_select_all_full (desktop, false, true);
 }
 
-void sp_edit_invert_in_all_layers ()
+void sp_edit_invert_in_all_layers (SPDesktop *desktop)
 {
-    sp_edit_select_all_full (true, true);
+    sp_edit_select_all_full (desktop, true, true);
 }
 
-void sp_selection_group()
+void sp_selection_group(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -541,9 +535,8 @@ void sp_selection_group()
     Inkscape::GC::release(group);
 }
 
-void sp_selection_ungroup()
+void sp_selection_ungroup(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -648,9 +641,8 @@ prev_sibling(SPObject *child)
 }
 
 void
-sp_selection_raise()
+sp_selection_raise(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (!desktop)
         return;
 
@@ -707,9 +699,8 @@ sp_selection_raise()
                      Q_("undo_action|Raise"));
 }
 
-void sp_selection_raise_to_top()
+void sp_selection_raise_to_top(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -744,9 +735,8 @@ void sp_selection_raise_to_top()
 }
 
 void
-sp_selection_lower()
+sp_selection_lower(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -807,9 +797,8 @@ sp_selection_lower()
                      _("Lower"));
 }
 
-void sp_selection_lower_to_bottom()
+void sp_selection_lower_to_bottom(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -869,10 +858,10 @@ sp_redo(SPDesktop *desktop, SPDocument *)
             desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to redo."));
 }
 
-void sp_selection_cut()
+void sp_selection_cut(SPDesktop *desktop)
 {
     sp_selection_copy();
-    sp_selection_delete();
+    sp_selection_delete(desktop);
 }
 
 /**
@@ -922,26 +911,26 @@ void sp_selection_copy()
     cm->copy();
 }
 
-void sp_selection_paste(bool in_place)
+void sp_selection_paste(SPDesktop *desktop, bool in_place)
 {
     Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
     if(cm->paste(in_place))
-        sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_PASTE, _("Paste"));
+        sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE, _("Paste"));
 }
 
-void sp_selection_paste_style()
+void sp_selection_paste_style(SPDesktop *desktop)
 {
     Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
     if(cm->pasteStyle())
-        sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_PASTE_STYLE, _("Paste style"));
+        sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_STYLE, _("Paste style"));
 }
 
 
-void sp_selection_paste_livepatheffect()
+void sp_selection_paste_livepatheffect(SPDesktop *desktop)
 {
     Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
     if(cm->pastePathEffect())
-        sp_document_done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_PASTE_LIVEPATHEFFECT,
+        sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_LIVEPATHEFFECT,
                      _("Paste live path effect"));
 }
 
@@ -953,9 +942,8 @@ void sp_selection_remove_livepatheffect_impl(SPItem *item)
     }
 }
 
-void sp_selection_remove_livepatheffect()
+void sp_selection_remove_livepatheffect(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL) return;
 
     Inkscape::Selection *selection = sp_desktop_selection(desktop);
@@ -977,9 +965,8 @@ void sp_selection_remove_livepatheffect()
                      _("Remove live path effect"));
 }
 
-void sp_selection_remove_filter ()
+void sp_selection_remove_filter (SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL) return;
 
     Inkscape::Selection *selection = sp_desktop_selection(desktop);
@@ -1000,26 +987,24 @@ void sp_selection_remove_filter ()
 }
 
 
-void sp_selection_paste_size (bool apply_x, bool apply_y)
+void sp_selection_paste_size (SPDesktop *desktop, bool apply_x, bool apply_y)
 {
     Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
     if(cm->pasteSize(false, apply_x, apply_y))
-        sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_EDIT_PASTE_SIZE,
+        sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE,
                      _("Paste size"));
 }
 
-void sp_selection_paste_size_separately (bool apply_x, bool apply_y)
+void sp_selection_paste_size_separately (SPDesktop *desktop, bool apply_x, bool apply_y)
 {
     Inkscape::UI::ClipboardManager *cm = Inkscape::UI::ClipboardManager::get();
     if(cm->pasteSize(true, apply_x, apply_y))
-        sp_document_done(sp_desktop_document(SP_ACTIVE_DESKTOP), SP_VERB_EDIT_PASTE_SIZE_SEPARATELY,
+        sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_PASTE_SIZE_SEPARATELY,
                      _("Paste size separately"));
 }
 
-void sp_selection_to_next_layer(bool suppressDone)
+void sp_selection_to_next_layer(SPDesktop *dt, bool suppressDone)
 {
-    SPDesktop *dt = SP_ACTIVE_DESKTOP;
-
     Inkscape::Selection *selection = sp_desktop_selection(dt);
 
     // check if something is selected
@@ -1063,10 +1048,8 @@ void sp_selection_to_next_layer(bool suppressDone)
     g_slist_free ((GSList *) items);
 }
 
-void sp_selection_to_prev_layer(bool suppressDone)
+void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone)
 {
-    SPDesktop *dt = SP_ACTIVE_DESKTOP;
-
     Inkscape::Selection *selection = sp_desktop_selection(dt);
 
     // check if something is selected
@@ -1276,9 +1259,8 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const
     }
 }
 
-void sp_selection_remove_transform()
+void sp_selection_remove_transform(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -1383,10 +1365,8 @@ void sp_selection_move_relative(Inkscape::Selection *selection, double dx, doubl
  *
  */
 
-void sp_selection_rotate_90_cw()
+void sp_selection_rotate_90_cw(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-
     Inkscape::Selection *selection = sp_desktop_selection(desktop);
 
     if (selection->isEmpty())
@@ -1407,10 +1387,8 @@ void sp_selection_rotate_90_cw()
 /**
  * @brief Rotates selected objects 90 degrees counter-clockwise.
  */
-void sp_selection_rotate_90_ccw()
+void sp_selection_rotate_90_ccw(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-
     Inkscape::Selection *selection = sp_desktop_selection(desktop);
 
     if (selection->isEmpty())
@@ -1536,9 +1514,8 @@ sp_selection_scale_times(Inkscape::Selection *selection, gdouble times)
 }
 
 void
-sp_selection_move(gdouble dx, gdouble dy)
+sp_selection_move(SPDesktop *desktop, gdouble dx, gdouble dy)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     Inkscape::Selection *selection = sp_desktop_selection(desktop);
     if (selection->isEmpty()) {
         return;
@@ -1559,10 +1536,8 @@ sp_selection_move(gdouble dx, gdouble dy)
 }
 
 void
-sp_selection_move_screen(gdouble dx, gdouble dy)
+sp_selection_move_screen(SPDesktop *desktop, gdouble dx, gdouble dy)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-
     Inkscape::Selection *selection = sp_desktop_selection(desktop);
     if (selection->isEmpty()) {
         return;
@@ -1639,9 +1614,8 @@ private:
 }
 
 void
-sp_selection_item_next(void)
+sp_selection_item_next(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     g_return_if_fail(desktop != NULL);
     Inkscape::Selection *selection = sp_desktop_selection(desktop);
 
@@ -1667,10 +1641,9 @@ sp_selection_item_next(void)
 }
 
 void
-sp_selection_item_prev(void)
+sp_selection_item_prev(SPDesktop *desktop)
 {
-    SPDocument *document = SP_ACTIVE_DOCUMENT;
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+    SPDocument *document = sp_desktop_document(desktop);
     g_return_if_fail(document != NULL);
     g_return_if_fail(desktop != NULL);
     Inkscape::Selection *selection = sp_desktop_selection(desktop);
@@ -1865,9 +1838,8 @@ void scroll_to_show_item(SPDesktop *desktop, SPItem *item)
 
 
 void
-sp_selection_clone()
+sp_selection_clone(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -1921,9 +1893,8 @@ sp_selection_clone()
 }
 
 void
-sp_selection_relink()
+sp_selection_relink(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (!desktop)
         return;
 
@@ -1970,9 +1941,8 @@ sp_selection_relink()
 
 
 void
-sp_selection_unlink()
+sp_selection_unlink(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (!desktop)
         return;
 
@@ -2036,9 +2006,8 @@ sp_selection_unlink()
 }
 
 void
-sp_select_clone_original()
+sp_select_clone_original(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -2109,9 +2078,8 @@ sp_select_clone_original()
 }
 
 
-void sp_selection_to_marker(bool apply)
+void sp_selection_to_marker(SPDesktop *desktop, bool apply)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -2205,9 +2173,8 @@ static void sp_selection_to_guides_recursive(SPItem *item, bool deleteitem, bool
     }
 }
 
-void sp_selection_to_guides()
+void sp_selection_to_guides(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -2232,9 +2199,8 @@ void sp_selection_to_guides()
 }
 
 void
-sp_selection_tile(bool apply)
+sp_selection_tile(SPDesktop *desktop, bool apply)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -2336,9 +2302,8 @@ sp_selection_tile(bool apply)
 }
 
 void
-sp_selection_untile()
+sp_selection_untile(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -2478,9 +2443,8 @@ sp_document_get_export_hints (SPDocument *doc, char const **filename, float *xdp
 }
 
 void
-sp_selection_create_bitmap_copy ()
+sp_selection_create_bitmap_copy (SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -2677,9 +2641,8 @@ sp_selection_create_bitmap_copy ()
  *
  */
 void
-sp_selection_set_mask(bool apply_clip_path, bool apply_to_layer)
+sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_layer)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     if (desktop == NULL)
         return;
 
@@ -2805,8 +2768,7 @@ sp_selection_set_mask(bool apply_clip_path, bool apply_to_layer)
         sp_document_done (doc, SP_VERB_OBJECT_SET_MASK, _("Set mask"));
 }
 
-void sp_selection_unset_mask(bool apply_clip_path) {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
+void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) {
     if (desktop == NULL)
         return;
 
index 37d8a4a0911468dd5d6a12af765e205135f29d67..f6e5858a803d88ac697e3f5be924d5cf24dd38ac 100644 (file)
@@ -28,55 +28,55 @@ namespace LivePathEffect {
 
 class SPCSSAttr;
 
-void sp_selection_delete();
-void sp_selection_duplicate(bool suppressDone = false);
-void sp_edit_clear_all();
+void sp_selection_delete(SPDesktop *desktop);
+void sp_selection_duplicate(SPDesktop *desktop, bool suppressDone = false);
+void sp_edit_clear_all(SPDesktop *desktop);
 
-void sp_edit_select_all();
-void sp_edit_select_all_in_all_layers ();
-void sp_edit_invert ();
-void sp_edit_invert_in_all_layers ();
+void sp_edit_select_all(SPDesktop *desktop);
+void sp_edit_select_all_in_all_layers (SPDesktop *desktop);
+void sp_edit_invert (SPDesktop *desktop);
+void sp_edit_invert_in_all_layers (SPDesktop *desktop);
 
-void sp_selection_clone();
-void sp_selection_unlink();
-void sp_selection_relink();
-void sp_select_clone_original ();
+void sp_selection_clone(SPDesktop *desktop);
+void sp_selection_unlink(SPDesktop *desktop);
+void sp_selection_relink(SPDesktop *desktop);
+void sp_select_clone_original(SPDesktop *desktop);
 
-void sp_selection_to_marker(bool apply = true);
-void sp_selection_to_guides();
+void sp_selection_to_marker(SPDesktop *desktop, bool apply = true);
+void sp_selection_to_guides(SPDesktop *desktop);
 
-void sp_selection_tile(bool apply = true);
-void sp_selection_untile();
+void sp_selection_tile(SPDesktop *desktop, bool apply = true);
+void sp_selection_untile(SPDesktop *desktop);
 
-void sp_selection_group();
-void sp_selection_ungroup();
+void sp_selection_group(SPDesktop *desktop);
+void sp_selection_ungroup(SPDesktop *desktop);
 
-void sp_selection_raise();
-void sp_selection_raise_to_top();
-void sp_selection_lower();
-void sp_selection_lower_to_bottom();
+void sp_selection_raise(SPDesktop *desktop);
+void sp_selection_raise_to_top(SPDesktop *desktop);
+void sp_selection_lower(SPDesktop *desktop);
+void sp_selection_lower_to_bottom(SPDesktop *desktop);
 
 SPCSSAttr *take_style_from_item (SPItem *item);
 
-void sp_selection_cut();
+void sp_selection_cut(SPDesktop *desktop);
 void sp_selection_copy();
-void sp_selection_paste(bool in_place);
-void sp_selection_paste_style();
-void sp_selection_paste_livepatheffect();
-void sp_selection_remove_livepatheffect();
+void sp_selection_paste(SPDesktop *desktop, bool in_place);
+void sp_selection_paste_style(SPDesktop *desktop);
+void sp_selection_paste_livepatheffect(SPDesktop *desktop);
+void sp_selection_remove_livepatheffect(SPDesktop *desktop);
 
-void sp_selection_remove_filter();
+void sp_selection_remove_filter(SPDesktop *desktop);
 
 void sp_set_style_clipboard (SPCSSAttr *css);
 
-void sp_selection_paste_size(bool apply_x, bool apply_y);
-void sp_selection_paste_size_separately(bool apply_x, bool apply_y);
+void sp_selection_paste_size(SPDesktop *desktop, bool apply_x, bool apply_y);
+void sp_selection_paste_size_separately(SPDesktop *desktop, bool apply_x, bool apply_y);
 
-void sp_selection_to_next_layer( bool suppressDone = false );
-void sp_selection_to_prev_layer( bool suppressDone = false );
+void sp_selection_to_next_layer( SPDesktop *desktop, bool suppressDone = false );
+void sp_selection_to_prev_layer( SPDesktop *desktop, bool suppressDone = false );
 
 void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const &affine, bool set_i2d = true);
-void sp_selection_remove_transform (void);
+void sp_selection_remove_transform (SPDesktop *desktop);
 void sp_selection_scale_absolute (Inkscape::Selection *selection, double x0, double x1, double y0, double y1);
 void sp_selection_scale_relative(Inkscape::Selection *selection, NR::Point const &align, NR::scale const &scale);
 void sp_selection_rotate_relative (Inkscape::Selection *selection, NR::Point const &center, gdouble angle);
@@ -84,8 +84,8 @@ void sp_selection_skew_relative (Inkscape::Selection *selection, NR::Point const
 void sp_selection_move_relative (Inkscape::Selection *selection, NR::Point const &move);
 void sp_selection_move_relative (Inkscape::Selection *selection, double dx, double dy);
 
-void sp_selection_rotate_90_cw (void);
-void sp_selection_rotate_90_ccw (void);
+void sp_selection_rotate_90_cw (SPDesktop *desktop);
+void sp_selection_rotate_90_ccw (SPDesktop *desktop);
 void sp_selection_rotate (Inkscape::Selection *selection, gdouble angle);
 void sp_selection_rotate_screen (Inkscape::Selection *selection, gdouble angle);
 
@@ -93,11 +93,11 @@ void sp_selection_scale (Inkscape::Selection *selection, gdouble grow);
 void sp_selection_scale_screen (Inkscape::Selection *selection, gdouble grow_pixels);
 void sp_selection_scale_times (Inkscape::Selection *selection, gdouble times);
 
-void sp_selection_move (gdouble dx, gdouble dy);
-void sp_selection_move_screen (gdouble dx, gdouble dy);
+void sp_selection_move (SPDesktop *desktop, gdouble dx, gdouble dy);
+void sp_selection_move_screen (SPDesktop *desktop, gdouble dx, gdouble dy);
 
-void sp_selection_item_next (void);
-void sp_selection_item_prev (void);
+void sp_selection_item_next (SPDesktop *desktop);
+void sp_selection_item_prev (SPDesktop *desktop);
 
 void sp_selection_next_patheffect_param(SPDesktop * dt);
 
@@ -111,10 +111,10 @@ void sp_redo (SPDesktop *desktop, SPDocument *doc);
 void sp_selection_get_export_hints (Inkscape::Selection *selection, const char **filename, float *xdpi, float *ydpi);
 void sp_document_get_export_hints (SPDocument * doc, const char **filename, float *xdpi, float *ydpi);
 
-void sp_selection_create_bitmap_copy ();
+void sp_selection_create_bitmap_copy (SPDesktop *desktop);
 
-void sp_selection_set_mask(bool apply_clip_path, bool apply_to_layer);
-void sp_selection_unset_mask(bool apply_clip_path);
+void sp_selection_set_mask(SPDesktop *desktop, bool apply_clip_path, bool apply_to_layer);
+void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path);
 
 bool fit_canvas_to_selection(SPDesktop *);
 void verb_fit_canvas_to_selection(SPDesktop *);
index c60ba6a5fe7c983f9a015feba63063587b673800..cacb0fa077d03a33651367e7333861c5af2acbbf 100644 (file)
@@ -844,106 +844,106 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
             sp_redo(dt, sp_desktop_document(dt));
             break;
         case SP_VERB_EDIT_CUT:
-            sp_selection_cut();
+            sp_selection_cut(dt);
             break;
         case SP_VERB_EDIT_COPY:
             sp_selection_copy();
             break;
         case SP_VERB_EDIT_PASTE:
-            sp_selection_paste(false);
+            sp_selection_paste(dt, false);
             break;
         case SP_VERB_EDIT_PASTE_STYLE:
-            sp_selection_paste_style();
+            sp_selection_paste_style(dt);
             break;
         case SP_VERB_EDIT_PASTE_SIZE:
-            sp_selection_paste_size(true, true);
+            sp_selection_paste_size(dt, true, true);
             break;
         case SP_VERB_EDIT_PASTE_SIZE_X:
-            sp_selection_paste_size(true, false);
+            sp_selection_paste_size(dt, true, false);
             break;
         case SP_VERB_EDIT_PASTE_SIZE_Y:
-            sp_selection_paste_size(false, true);
+            sp_selection_paste_size(dt, false, true);
             break;
         case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY:
-            sp_selection_paste_size_separately(true, true);
+            sp_selection_paste_size_separately(dt, true, true);
             break;
         case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_X:
-            sp_selection_paste_size_separately(true, false);
+            sp_selection_paste_size_separately(dt, true, false);
             break;
         case SP_VERB_EDIT_PASTE_SIZE_SEPARATELY_Y:
-            sp_selection_paste_size_separately(false, true);
+            sp_selection_paste_size_separately(dt, false, true);
             break;
         case SP_VERB_EDIT_PASTE_IN_PLACE:
-            sp_selection_paste(true);
+            sp_selection_paste(dt, true);
             break;
         case SP_VERB_EDIT_PASTE_LIVEPATHEFFECT:
-            sp_selection_paste_livepatheffect();
+            sp_selection_paste_livepatheffect(dt);
             break;
         case SP_VERB_EDIT_REMOVE_LIVEPATHEFFECT:
-            sp_selection_remove_livepatheffect();
+            sp_selection_remove_livepatheffect(dt);
             break;
         case SP_VERB_EDIT_REMOVE_FILTER:
-            sp_selection_remove_filter();
+            sp_selection_remove_filter(dt);
             break;
         case SP_VERB_EDIT_DELETE:
-            sp_selection_delete();
+            sp_selection_delete(dt);
             break;
         case SP_VERB_EDIT_DUPLICATE:
-            sp_selection_duplicate();
+            sp_selection_duplicate(dt);
             break;
         case SP_VERB_EDIT_CLONE:
-            sp_selection_clone();
+            sp_selection_clone(dt);
             break;
         case SP_VERB_EDIT_UNLINK_CLONE:
-            sp_selection_unlink();
+            sp_selection_unlink(dt);
             break;
         case SP_VERB_EDIT_RELINK_CLONE:
-            sp_selection_relink();
+            sp_selection_relink(dt);
             break;
         case SP_VERB_EDIT_CLONE_SELECT_ORIGINAL:
-            sp_select_clone_original();
+            sp_select_clone_original(dt);
             break;
         case SP_VERB_EDIT_SELECTION_2_MARKER:
-            sp_selection_to_marker();
+            sp_selection_to_marker(dt);
             break;
         case SP_VERB_EDIT_SELECTION_2_GUIDES:
-            sp_selection_to_guides();
+            sp_selection_to_guides(dt);
             break;
         case SP_VERB_EDIT_TILE:
-            sp_selection_tile();
+            sp_selection_tile(dt);
             break;
         case SP_VERB_EDIT_UNTILE:
-            sp_selection_untile();
+            sp_selection_untile(dt);
             break;
         case SP_VERB_EDIT_CLEAR_ALL:
-            sp_edit_clear_all();
+            sp_edit_clear_all(dt);
             break;
         case SP_VERB_EDIT_SELECT_ALL:
             if (tools_isactive(dt, TOOLS_NODES)) {
                 SP_NODE_CONTEXT(ec)->shape_editor->select_all_from_subpath(false);
             } else {
-                sp_edit_select_all();
+                sp_edit_select_all(dt);
             }
             break;
         case SP_VERB_EDIT_INVERT:
             if (tools_isactive(dt, TOOLS_NODES)) {
                 SP_NODE_CONTEXT(ec)->shape_editor->select_all_from_subpath(true);
             } else {
-                sp_edit_invert();
+                sp_edit_invert(dt);
             }
             break;
         case SP_VERB_EDIT_SELECT_ALL_IN_ALL_LAYERS:
             if (tools_isactive(dt, TOOLS_NODES)) {
                 SP_NODE_CONTEXT(ec)->shape_editor->select_all(false);
             } else {
-                sp_edit_select_all_in_all_layers();
+                sp_edit_select_all_in_all_layers(dt);
             }
             break;
         case SP_VERB_EDIT_INVERT_IN_ALL_LAYERS:
             if (tools_isactive(dt, TOOLS_NODES)) {
                 SP_NODE_CONTEXT(ec)->shape_editor->select_all(true);
             } else {
-                sp_edit_invert_in_all_layers();
+                sp_edit_invert_in_all_layers(dt);
             }
             break;
 
@@ -954,7 +954,7 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
                        && ec->_grdrag->isNonEmpty()) {
                 sp_gradient_context_select_next (ec);
             } else {
-                sp_selection_item_next();
+                sp_selection_item_next(dt);
             }
             break;
         case SP_VERB_EDIT_SELECT_PREV:
@@ -964,7 +964,7 @@ EditVerb::perform(SPAction *action, void *data, void */*pdata*/)
                        && ec->_grdrag->isNonEmpty()) {
                 sp_gradient_context_select_prev (ec);
             } else {
-                sp_selection_item_prev();
+                sp_selection_item_prev(dt);
             }
             break;
 
@@ -1002,22 +1002,22 @@ SelectionVerb::perform(SPAction *action, void *data, void */*pdata*/)
 
     switch (reinterpret_cast<std::size_t>(data)) {
         case SP_VERB_SELECTION_TO_FRONT:
-            sp_selection_raise_to_top();
+            sp_selection_raise_to_top(dt);
             break;
         case SP_VERB_SELECTION_TO_BACK:
-            sp_selection_lower_to_bottom();
+            sp_selection_lower_to_bottom(dt);
             break;
         case SP_VERB_SELECTION_RAISE:
-            sp_selection_raise();
+            sp_selection_raise(dt);
             break;
         case SP_VERB_SELECTION_LOWER:
-            sp_selection_lower();
+            sp_selection_lower(dt);
             break;
         case SP_VERB_SELECTION_GROUP:
-            sp_selection_group();
+            sp_selection_group(dt);
             break;
         case SP_VERB_SELECTION_UNGROUP:
-            sp_selection_ungroup();
+            sp_selection_ungroup(dt);
             break;
 
         case SP_VERB_SELECTION_TEXTTOPATH:
@@ -1091,7 +1091,7 @@ SelectionVerb::perform(SPAction *action, void *data, void */*pdata*/)
             dt->_dlg_mgr->showDialog("Trace");
             break;
         case SP_VERB_SELECTION_CREATE_BITMAP:
-            sp_selection_create_bitmap_copy();
+            sp_selection_create_bitmap_copy(dt);
             break;
 
         case SP_VERB_SELECTION_COMBINE:
@@ -1155,11 +1155,11 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
             break;
         }
         case SP_VERB_LAYER_MOVE_TO_NEXT: {
-            sp_selection_to_next_layer();
+            sp_selection_to_next_layer(dt);
             break;
         }
         case SP_VERB_LAYER_MOVE_TO_PREV: {
-            sp_selection_to_prev_layer();
+            sp_selection_to_prev_layer(dt);
             break;
         }
         case SP_VERB_LAYER_TO_TOP:
@@ -1232,11 +1232,11 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/)
                     g_free(name);
                 }
 
-                sp_edit_select_all();
-                sp_selection_duplicate(true);
-                sp_selection_to_prev_layer(true);
+                sp_edit_select_all(dt);
+                sp_selection_duplicate(dt, true);
+                sp_selection_to_prev_layer(dt, true);
                 dt->setCurrentLayer(new_layer);
-                sp_edit_select_all();
+                sp_edit_select_all(dt);
 
                 sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE,
                                  _("Duplicate layer"));
@@ -1323,13 +1323,13 @@ ObjectVerb::perform( SPAction *action, void *data, void */*pdata*/ )
 
     switch (reinterpret_cast<std::size_t>(data)) {
         case SP_VERB_OBJECT_ROTATE_90_CW:
-            sp_selection_rotate_90_cw();
+            sp_selection_rotate_90_cw(dt);
             break;
         case SP_VERB_OBJECT_ROTATE_90_CCW:
-            sp_selection_rotate_90_ccw();
+            sp_selection_rotate_90_ccw(dt);
             break;
         case SP_VERB_OBJECT_FLATTEN:
-            sp_selection_remove_transform();
+            sp_selection_remove_transform(dt);
             break;
         case SP_VERB_OBJECT_TO_CURVE:
             sp_selected_path_to_curves(dt);
@@ -1383,22 +1383,22 @@ ObjectVerb::perform( SPAction *action, void *data, void */*pdata*/ )
                              _("Flip vertically"));
             break;
         case SP_VERB_OBJECT_SET_MASK:
-            sp_selection_set_mask(false, false);
+            sp_selection_set_mask(dt, false, false);
             break;
         case SP_VERB_OBJECT_EDIT_MASK:
             sp_selection_edit_clip_or_mask(dt, false);
             break;
         case SP_VERB_OBJECT_UNSET_MASK:
-            sp_selection_unset_mask(false);
+            sp_selection_unset_mask(dt, false);
             break;
         case SP_VERB_OBJECT_SET_CLIPPATH:
-            sp_selection_set_mask(true, false);
+            sp_selection_set_mask(dt, true, false);
             break;
         case SP_VERB_OBJECT_EDIT_CLIPPATH:
             sp_selection_edit_clip_or_mask(dt, true);
             break;
         case SP_VERB_OBJECT_UNSET_CLIPPATH:
-            sp_selection_unset_mask(true);
+            sp_selection_unset_mask(dt, true);
             break;
         default:
             break;