Code

Remove further instances of SP_ACTIVE_DESKTOP
authorcilix42 <cilix42@users.sourceforge.net>
Thu, 14 Aug 2008 21:30:51 +0000 (21:30 +0000)
committercilix42 <cilix42@users.sourceforge.net>
Thu, 14 Aug 2008 21:30:51 +0000 (21:30 +0000)
src/extension/internal/bluredge.cpp
src/node-context.cpp
src/path-chemistry.cpp
src/path-chemistry.h
src/verbs.cpp

index f8f2f57bdbbd1f219bdef6860ffd42c7829aebed..cf133407a33b024a97b3850ba4e2ae56a0dc8315 100644 (file)
@@ -48,12 +48,12 @@ BlurEdge::load (Inkscape::Extension::Extension */*module*/)
 /**
     \brief  This actually blurs the edge.
     \param  module   The effect that was called (unused)
-    \param  document What should be edited.
+    \param  desktop What should be edited.
 */
 void
-BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/)
+BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *desktop, Inkscape::Extension::Implementation::ImplementationDocumentCache * /*docCache*/)
 {
-    Inkscape::Selection * selection     = ((SPDesktop *)document)->selection;
+    Inkscape::Selection * selection     = static_cast<SPDesktop *>(desktop)->selection;
 
     float width = module->get_param_float("blur-width");
     int   steps = module->get_param_int("num-steps");
@@ -71,7 +71,7 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View
         SPItem * spitem = *item;
 
         std::vector<Inkscape::XML::Node *> new_items(steps);
-        Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document->doc());
+        Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc());
         Inkscape::XML::Node * new_group = xml_doc->createElement("svg:g");
         (SP_OBJECT_REPR(spitem)->parent())->appendChild(new_group);
 
@@ -91,16 +91,16 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View
 
             new_group->appendChild(new_items[i]);
             selection->add(new_items[i]);
-            sp_selected_path_to_curves();
+            sp_selected_path_to_curves(static_cast<SPDesktop *>(desktop));
 
             if (offset < 0.0) {
                 /* Doing an inset here folks */
                 offset *= -1.0;
                 prefs_set_double_attribute("options.defaultoffsetwidth", "value", offset);
-                sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_INSET)->get_action(document), NULL);
+                sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_INSET)->get_action(desktop), NULL);
             } else if (offset > 0.0) {
                 prefs_set_double_attribute("options.defaultoffsetwidth", "value", offset);
-                sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_OFFSET)->get_action(document), NULL);
+                sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_OFFSET)->get_action(desktop), NULL);
             }
 
             selection->clear();
index 96b562a3fb2e46b70a001d164454b60dafa497fb..b205b86d5d8973fb1d7f8bb6e4c77cb5a5a9eb3b 100644 (file)
@@ -539,7 +539,7 @@ sp_node_context_root_handler(SPEventContext *event_context, GdkEvent *event)
                 case GDK_r:
                     if (MOD__SHIFT_ONLY) {
                         // FIXME: add top panel button
-                        sp_selected_path_reverse();
+                        sp_selected_path_reverse(desktop);
                         ret = TRUE;
                     }
                     break;
index c4855e7d38980239adafd20c7d0568c84116c20b..4c459ba64dc563b2b76ea151ed3335203cf9efda 100644 (file)
@@ -30,7 +30,6 @@
 #include "libnr/nr-path.h"
 #include "text-editing.h"
 #include "style.h"
-#include "inkscape.h"
 #include "desktop.h"
 #include "document.h"
 #include "message-stack.h"
@@ -41,7 +40,7 @@
 #include "path-chemistry.h"
 
 /* Helper functions for sp_selected_path_to_curves */
-static void sp_selected_path_to_curves0(gboolean do_document_done, guint32 text_grouping_policy);
+static void sp_selected_path_to_curves0(SPDesktop *desktop, bool do_document_done, guint32 text_grouping_policy);
 static bool sp_item_list_to_curves(const GSList *items, GSList **selected, GSList **to_select);
 
 enum {
@@ -53,9 +52,8 @@ enum {
 };
 
 void
-sp_selected_path_combine(void)
+sp_selected_path_combine(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
     Inkscape::Selection *selection = sp_desktop_selection(desktop);
     SPDocument *doc = sp_desktop_document(desktop);
     
@@ -180,10 +178,8 @@ sp_selected_path_combine(void)
 }
 
 void
-sp_selected_path_break_apart(void)
+sp_selected_path_break_apart(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-
     Inkscape::Selection *selection = sp_desktop_selection(desktop);
 
     if (selection->isEmpty()) {
@@ -285,20 +281,14 @@ sp_selected_path_break_apart(void)
 
 /* This function is an entry point from GUI */
 void
-sp_selected_path_to_curves(bool interactive)
+sp_selected_path_to_curves(SPDesktop *desktop, bool interactive)
 {
-    if (interactive) {
-        sp_selected_path_to_curves0(TRUE, SP_TOCURVE_INTERACTIVE);
-    } else {
-        sp_selected_path_to_curves0(false, 0);
-    }
+    sp_selected_path_to_curves0(desktop, interactive, interactive ? SP_TOCURVE_INTERACTIVE : 0);
 }
 
 static void
-sp_selected_path_to_curves0(gboolean interactive, guint32 /*text_grouping_policy*/)
+sp_selected_path_to_curves0(SPDesktop *desktop, bool interactive, guint32 /*text_grouping_policy*/)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-
     Inkscape::Selection *selection = sp_desktop_selection(desktop);
 
     if (selection->isEmpty()) {
@@ -476,10 +466,8 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/)
 
 // FIXME: THIS DOES NOT REVERSE THE NODETYPES ORDER!
 void
-sp_selected_path_reverse()
+sp_selected_path_reverse(SPDesktop *desktop)
 {
-    SPDesktop *desktop = SP_ACTIVE_DESKTOP;
-
     Inkscape::Selection *selection = sp_desktop_selection(desktop);
     GSList *items = (GSList *) selection->itemList();
 
index a715833d052d2085a06623454169ae95fdfeace8..27c3b868016381a21f5e76fa61da34addd4ff6ce 100644 (file)
 
 #include "forward.h"
 
-void sp_selected_path_combine (void);
-void sp_selected_path_break_apart (void);
-void sp_selected_path_to_curves (bool interactive = true);
+void sp_selected_path_combine (SPDesktop *desktop);
+void sp_selected_path_break_apart (SPDesktop *desktop);
+void sp_selected_path_to_curves (SPDesktop *desktop, bool interactive = true);
 Inkscape::XML::Node *sp_selected_item_to_curved_repr(SPItem *item, guint32 text_grouping_policy);
-void sp_selected_path_reverse ();
+void sp_selected_path_reverse (SPDesktop *desktop);
 
 #endif
 
index f96d0a4f019e856cacc2601050b5ddc9bb43deb9..c60ba6a5fe7c983f9a015feba63063587b673800 100644 (file)
@@ -1084,7 +1084,7 @@ SelectionVerb::perform(SPAction *action, void *data, void */*pdata*/)
             sp_selected_path_simplify();
             break;
         case SP_VERB_SELECTION_REVERSE:
-            sp_selected_path_reverse();
+            sp_selected_path_reverse(dt);
             break;
         case SP_VERB_SELECTION_TRACE:
             inkscape_dialogs_unhide();
@@ -1095,10 +1095,10 @@ SelectionVerb::perform(SPAction *action, void *data, void */*pdata*/)
             break;
 
         case SP_VERB_SELECTION_COMBINE:
-            sp_selected_path_combine();
+            sp_selected_path_combine(dt);
             break;
         case SP_VERB_SELECTION_BREAK_APART:
-            sp_selected_path_break_apart();
+            sp_selected_path_break_apart(dt);
             break;
         case SP_VERB_SELECTION_GRIDTILE:
             inkscape_dialogs_unhide();
@@ -1332,7 +1332,7 @@ ObjectVerb::perform( SPAction *action, void *data, void */*pdata*/ )
             sp_selection_remove_transform();
             break;
         case SP_VERB_OBJECT_TO_CURVE:
-            sp_selected_path_to_curves();
+            sp_selected_path_to_curves(dt);
             break;
         case SP_VERB_OBJECT_FLOW_TEXT:
             text_flow_into_shape();