Code

correctly transform LPE path and point parameters with the SPItem's transform
authorjohanengelen <johanengelen@users.sourceforge.net>
Tue, 8 Jan 2008 19:52:22 +0000 (19:52 +0000)
committerjohanengelen <johanengelen@users.sourceforge.net>
Tue, 8 Jan 2008 19:52:22 +0000 (19:52 +0000)
src/live_effects/parameter/parameter.cpp
src/live_effects/parameter/parameter.h
src/live_effects/parameter/path.cpp
src/live_effects/parameter/path.h
src/live_effects/parameter/point.cpp
src/live_effects/parameter/point.h

index 500578db464a75fd1cdfed451b29cb7b7abae47e..893f0d7f1c88478e4833ad85f311f52c7a9d5200 100644 (file)
@@ -38,6 +38,11 @@ Parameter::Parameter( const Glib::ustring& label, const Glib::ustring& tip,
 }
 
 
+void
+Parameter::param_write_to_repr(const char * svgd)
+{
+    param_effect->getRepr()->setAttribute(param_key.c_str(), svgd);
+}
 
 /*###########################################
  *   REAL PARAM
index 08af7f928b6c2f4f99c38123d55a824f58e8d75b..e3d372706560af5e967239bf665145707c22d6c0 100644 (file)
@@ -68,6 +68,8 @@ protected:
 
     Effect* param_effect;
 
+    void param_write_to_repr(const char * svgd);
+
 private:
     Parameter(const Parameter&);
     Parameter& operator=(const Parameter&);
index 9bc81d52111a586524d77e397cbc3c69cce68c9d..1f0e6f3be181c658c9404ee42bc717bd52e1af8a 100644 (file)
@@ -150,12 +150,11 @@ PathParam::param_setup_nodepath(Inkscape::NodePath::Path *np)
 }
 
 void
-PathParam::param_write_to_repr(const char * svgd)
+PathParam::param_transform_multiply(Geom::Matrix const& postmul, bool /*set*/)
 {
-    param_effect->getRepr()->setAttribute(param_key.c_str(), svgd);
+    param_set_and_write_new_value( (*this) * postmul );
 }
 
-
 void
 PathParam::param_set_and_write_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > newpath)
 {
index a269f3e4f26bf2a034c6034dba01b65e7c819d1d..82e240310d7bf82dc4e70956cc6af53f13ba21d3 100644 (file)
@@ -49,7 +49,7 @@ public:
     void param_editOncanvas(SPItem * item, SPDesktop * dt);
     void param_setup_nodepath(Inkscape::NodePath::Path *np);
 
-    virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/) {};
+    virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/);
 
     sigc::signal <void> signal_path_pasted;
     sigc::signal <void> signal_path_changed;
@@ -61,8 +61,6 @@ private:
     Gtk::Widget * _widget;
     Gtk::Tooltips * _tooltips;
 
-    void param_write_to_repr(const char * svgd);
-
     void on_edit_button_click();
     void on_paste_button_click();
 
index 3d13ed12dfc93b639bdbbb6840192a3b6247c0e7..eea337c8599a46e6eb2a9f476776ab1b5b0713df 100644 (file)
@@ -118,6 +118,22 @@ PointParam::param_setValue(Geom::Point newpoint)
         pointwdg->setValue(newpoint[0], newpoint[1]);
 }
 
+void
+PointParam::param_set_and_write_new_value (Geom::Point newpoint)
+{
+    Inkscape::SVGOStringStream os;
+    os << newpoint[0] << "," << newpoint[1];
+    gchar * str = g_strdup(os.str().c_str());
+    param_write_to_repr(str);
+    g_free(str);
+}
+
+void
+PointParam::param_transform_multiply(Geom::Matrix const& postmul, bool /*set*/)
+{
+    param_set_and_write_new_value( (*this) * postmul );
+}
+
 
 // CALLBACKS:
 
index 72b3991e15efe98e5429458434a4e20b7aa9354b..688a50d4abe9d53d5e835498dae5f72328f1e3e0 100644 (file)
@@ -43,7 +43,9 @@ public:
     void param_setValue(Geom::Point newpoint);
     void param_set_default();
 
-    virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/) {};
+    void param_set_and_write_new_value(Geom::Point newpoint);
+
+    virtual void param_transform_multiply(Geom::Matrix const& /*postmul*/, bool /*set*/);
 
 private:
     PointParam(const PointParam&);