diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-03-12 08:19:08 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-03-12 08:19:08 +0000 |
| commit | c9a989288ac802c9f7ca65f387827a3c2e991741 (patch) | |
| tree | 603d9ca781e5379f27c45c96da46bb7a1415e240 /src/live_effects/parameter | |
| parent | Allow changing document scale (via changing viewBox). Start of GUI. (diff) | |
| download | inkscape-c9a989288ac802c9f7ca65f387827a3c2e991741.tar.gz inkscape-c9a989288ac802c9f7ca65f387827a3c2e991741.zip | |
Point parameter refactor, Fixes a bug in Lattice2 whith lines.
(bzr r13995)
Diffstat (limited to 'src/live_effects/parameter')
| -rw-r--r-- | src/live_effects/parameter/point.cpp | 61 | ||||
| -rw-r--r-- | src/live_effects/parameter/point.h | 7 |
2 files changed, 29 insertions, 39 deletions
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 319d441b8..30e59a2bd 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -26,8 +26,7 @@ namespace LivePathEffect { PointParam::PointParam( const Glib::ustring& label, const Glib::ustring& tip, const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, Effect* effect, const gchar *htip, Geom::Point default_value) - : Geom::Point(default_value), - Parameter(label, tip, key, wr, effect), + : Parameter(label, tip, key, wr, effect), defvalue(default_value) { knot_shape = SP_KNOT_SHAPE_DIAMOND; @@ -45,19 +44,26 @@ PointParam::~PointParam() void PointParam::param_set_default() { - param_setValue(defvalue); + param_setValue(defvalue,true); } void -PointParam::param_set_and_write_default() +PointParam::param_update_default(Geom::Point newpoint) { - param_set_and_write_new_value(defvalue); + defvalue = newpoint; } void -PointParam::param_update_default(Geom::Point newpoint) +PointParam::param_setValue(Geom::Point newpoint, bool write) { - this->defvalue = newpoint; + *dynamic_cast<Geom::Point *>( this ) = newpoint; + if(write){ + Inkscape::SVGOStringStream os; + os << newpoint; + gchar * str = g_strdup(os.str().c_str()); + param_write_to_repr(str); + g_free(str); + } } bool @@ -84,6 +90,12 @@ PointParam::param_getSVGValue() const return str; } +void +PointParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/) +{ + param_setValue( (*this) * postmul, true); +} + Gtk::Widget * PointParam::param_newWidget() { @@ -110,29 +122,6 @@ PointParam::param_newWidget() } void -PointParam::param_setValue(Geom::Point newpoint) -{ - *dynamic_cast<Geom::Point *>( this ) = newpoint; -} - -void -PointParam::param_set_and_write_new_value(Geom::Point newpoint) -{ - Inkscape::SVGOStringStream os; - os << newpoint; - gchar * str = g_strdup(os.str().c_str()); - param_write_to_repr(str); - g_free(str); -} - -void -PointParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/) -{ - param_set_and_write_new_value( (*this) * postmul ); -} - - -void PointParam::set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color) { knot_shape = shape; @@ -168,8 +157,11 @@ PointParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &or s = A; } } - pparam->param_setValue(s); - sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false); + pparam->param_setValue(s, true); + SPLPEItem * splpeitem = dynamic_cast<SPLPEItem *>(item); + if(splpeitem){ + sp_lpe_item_update_patheffect(splpeitem, false, false); + } } Geom::Point @@ -184,7 +176,10 @@ PointParamKnotHolderEntity::knot_click(guint state) if (state & GDK_CONTROL_MASK) { if (state & GDK_MOD1_MASK) { this->pparam->param_set_default(); - sp_lpe_item_update_patheffect(SP_LPE_ITEM(item), false, false); + SPLPEItem * splpeitem = dynamic_cast<SPLPEItem *>(item); + if(splpeitem){ + sp_lpe_item_update_patheffect(splpeitem, false, false); + } } } } diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h index c4dc096d8..346e79bdd 100644 --- a/src/live_effects/parameter/point.h +++ b/src/live_effects/parameter/point.h @@ -39,13 +39,9 @@ public: gchar * param_getSVGValue() const; inline const gchar *handleTip() const { return handle_tip ? handle_tip : param_tooltip.c_str(); } - void param_setValue(Geom::Point newpoint); + void param_setValue(Geom::Point newpoint, bool write = false); void param_set_default(); - void param_set_and_write_default(); void param_update_default(Geom::Point newpoint); - - void param_set_and_write_new_value(Geom::Point newpoint); - virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/); void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color); @@ -57,7 +53,6 @@ public: private: PointParam(const PointParam&); PointParam& operator=(const PointParam&); - Geom::Point defvalue; SPKnotShapeType knot_shape; SPKnotModeType knot_mode; |
