Code

Filters. New custom predefined filters (all ABCs, Neon draw, Color shilf, Silhouette...
[inkscape.git] / src / extension / internal / bluredge.cpp
index cf133407a33b024a97b3850ba4e2ae56a0dc8315..ba6b8383c3d0e133803a93f84b36ba2c359684e0 100644 (file)
@@ -16,7 +16,7 @@
 #include "desktop.h"
 #include "selection.h"
 #include "helper/action.h"
-#include "prefs-utils.h"
+#include "preferences.h"
 #include "path-chemistry.h"
 #include "sp-item.h"
 
@@ -58,7 +58,8 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View
     float width = module->get_param_float("blur-width");
     int   steps = module->get_param_int("num-steps");
 
-    double old_offset = prefs_get_double_attribute("options.defaultoffsetwidth", "value", 1.0);
+    Inkscape::Preferences *prefs = Inkscape::Preferences::get();
+    double old_offset = prefs->getDouble("/options/defaultoffsetwidth/value", 1.0);
 
     using Inkscape::Util::GSListConstIterator;
     // TODO need to properly refcount the items, at least
@@ -71,7 +72,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(desktop->doc());
+        Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc();
         Inkscape::XML::Node * new_group = xml_doc->createElement("svg:g");
         (SP_OBJECT_REPR(spitem)->parent())->appendChild(new_group);
 
@@ -96,19 +97,20 @@ BlurEdge::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View
             if (offset < 0.0) {
                 /* Doing an inset here folks */
                 offset *= -1.0;
-                prefs_set_double_attribute("options.defaultoffsetwidth", "value", offset);
+                prefs->setDouble("/options/defaultoffsetwidth/value", offset);
                 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);
+                prefs->setDouble("/options/defaultoffsetwidth/value", offset);
                 sp_action_perform(Inkscape::Verb::get(SP_VERB_SELECTION_OFFSET)->get_action(desktop), NULL);
             }
 
             selection->clear();
         }
 
+        Inkscape::GC::release(new_group);
     }
 
-    prefs_set_double_attribute("options.defaultoffsetwidth", "value", old_offset);
+    prefs->setDouble("/options/defaultoffsetwidth/value", old_offset);
 
     selection->clear();
     selection->add(items.begin(), items.end());
@@ -131,8 +133,8 @@ BlurEdge::init (void)
         "<inkscape-extension xmlns=\"" INKSCAPE_EXTENSION_URI "\">\n"
             "<name>" N_("Inset/Outset Halo") "</name>\n"
             "<id>org.inkscape.effect.bluredge</id>\n"
-            "<param name=\"blur-width\" gui-text=\"" N_("Width") "\" gui-description=\"" N_("Width in px of the halo") "\" scope=\"document\" type=\"float\" min=\"1.0\" max=\"50.0\">1.0</param>\n"
-            "<param name=\"num-steps\" gui-text=\"" N_("Number of steps") "\" gui-description=\"" N_("Number of inset/outset copies of the object to make") "\" scope=\"document\" type=\"int\" min=\"5\" max=\"100\">11</param>\n"
+            "<param name=\"blur-width\" gui-text=\"" N_("Width:") "\" gui-description=\"" N_("Width in px of the halo") "\" scope=\"document\" type=\"float\" min=\"1.0\" max=\"50.0\">1.0</param>\n"
+            "<param name=\"num-steps\" gui-text=\"" N_("Number of steps:") "\" gui-description=\"" N_("Number of inset/outset copies of the object to make") "\" scope=\"document\" type=\"int\" min=\"5\" max=\"100\">11</param>\n"
             "<effect>\n"
                 "<object-type>all</object-type>\n"
                 "<effects-menu>\n"