summaryrefslogtreecommitdiffstats
path: root/src/live_effects/parameter/point.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2015-03-12 08:19:08 +0000
committerJabiertxof <jtx@jtx.marker.es>2015-03-12 08:19:08 +0000
commitc9a989288ac802c9f7ca65f387827a3c2e991741 (patch)
tree603d9ca781e5379f27c45c96da46bb7a1415e240 /src/live_effects/parameter/point.cpp
parentAllow changing document scale (via changing viewBox). Start of GUI. (diff)
downloadinkscape-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/point.cpp')
-rw-r--r--src/live_effects/parameter/point.cpp61
1 files changed, 28 insertions, 33 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);
+ }
}
}
}