Code

move shape_editor from node context to the parent class, event context
[inkscape.git] / src / live_effects / parameter / path.cpp
index 68cb5cd633bcc98b6f02c75aaf0d29988895b61f..1214a1766db3281d66926d12c91bcd9475159468 100644 (file)
@@ -49,6 +49,7 @@ PathParam::PathParam( const Glib::ustring& label, const Glib::ustring& tip,
                       const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr,
                       Effect* effect, const gchar * default_value)
     : Parameter(label, tip, key, wr, effect),
+      changed(true),
       _pathvector(),
       _pwd2(),
       must_recalculate_pwd2(false),
@@ -119,7 +120,7 @@ PathParam::param_readSVGValue(const gchar * strvalue)
             _pathvector = sp_svg_read_pathv(strvalue);
         }
 
-        signal_path_changed.emit();
+        emit_changed();
         return true;
     }
 
@@ -196,10 +197,10 @@ PathParam::param_editOncanvas(SPItem * item, SPDesktop * dt)
 {
     // If not already in nodecontext, goto it!
     if (!tools_isactive(dt, TOOLS_NODES)) {
-        tools_switch_current(TOOLS_NODES);
+        tools_switch(dt, TOOLS_NODES);
     }
 
-    ShapeEditor * shape_editor = SP_NODE_CONTEXT( dt->event_context )->shape_editor;
+    ShapeEditor * shape_editor = dt->event_context->shape_editor;
     if (!href) {
         shape_editor->set_item_lpe_path_parameter(item, SP_OBJECT(param_effect->getLPEObj()), param_key.c_str());
     } else {
@@ -254,7 +255,7 @@ PathParam::set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const & newpa
     } else {
         _pwd2 = newpath;
         must_recalculate_pwd2 = false;
-        signal_path_changed.emit();
+        emit_changed();
     }
 }
 
@@ -282,7 +283,7 @@ PathParam::set_new_value (std::vector<Geom::Path> const &newpath, bool write_to_
         param_write_to_repr(svgd);
         g_free(svgd);
     } else {
-        signal_path_changed.emit();
+        emit_changed();
     }
 }
 
@@ -299,6 +300,13 @@ PathParam::ensure_pwd2()
     }
 }
 
+void
+PathParam::emit_changed()
+{
+    changed = true;
+    signal_path_changed.emit();
+}
+
 void
 PathParam::start_listening(SPObject * to)
 {
@@ -364,7 +372,7 @@ PathParam::linked_modified(SPObject *linked_obj, guint /*flags*/)
     }
 
     must_recalculate_pwd2 = true;
-    signal_path_changed.emit();
+    emit_changed();
     SP_OBJECT(param_effect->getLPEObj())->requestModified(SP_OBJECT_MODIFIED_FLAG);
 }