From: johanengelen Date: Tue, 8 Jan 2008 19:52:22 +0000 (+0000) Subject: correctly transform LPE path and point parameters with the SPItem's transform X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=0903335a0099bd7ee779925f43a15a2216a0e863;p=inkscape.git correctly transform LPE path and point parameters with the SPItem's transform --- diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp index 500578db4..893f0d7f1 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -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 diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h index 08af7f928..e3d372706 100644 --- a/src/live_effects/parameter/parameter.h +++ b/src/live_effects/parameter/parameter.h @@ -68,6 +68,8 @@ protected: Effect* param_effect; + void param_write_to_repr(const char * svgd); + private: Parameter(const Parameter&); Parameter& operator=(const Parameter&); diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index 9bc81d521..1f0e6f3be 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -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 > newpath) { diff --git a/src/live_effects/parameter/path.h b/src/live_effects/parameter/path.h index a269f3e4f..82e240310 100644 --- a/src/live_effects/parameter/path.h +++ b/src/live_effects/parameter/path.h @@ -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 signal_path_pasted; sigc::signal 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(); diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 3d13ed12d..eea337c85 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -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: diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h index 72b3991e1..688a50d4a 100644 --- a/src/live_effects/parameter/point.h +++ b/src/live_effects/parameter/point.h @@ -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&);