summaryrefslogtreecommitdiffstats
path: root/src/live_effects/parameter/point.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/live_effects/parameter/point.cpp')
-rw-r--r--src/live_effects/parameter/point.cpp36
1 files changed, 22 insertions, 14 deletions
diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp
index c87b1e299..4ca88a6b8 100644
--- a/src/live_effects/parameter/point.cpp
+++ b/src/live_effects/parameter/point.cpp
@@ -26,8 +26,7 @@ PointParam::PointParam( const Glib::ustring& label, const Glib::ustring& tip,
: Parameter(label, tip, key, wr, effect),
defvalue(default_value),
liveupdate(live_update),
- knoth(NULL),
- _pointwdg(NULL)
+ knoth(NULL)
{
knot_shape = SP_KNOT_SHAPE_DIAMOND;
knot_mode = SP_KNOT_MODE_XOR;
@@ -59,12 +58,25 @@ PointParam::param_get_default() const{
}
void
-PointParam::param_update_default(const Geom::Point default_point)
+PointParam::param_update_default(Geom::Point default_point)
{
defvalue = default_point;
}
void
+PointParam::param_update_default(const gchar * default_point)
+{
+ gchar ** strarray = g_strsplit(default_point, ",", 2);
+ double newx, newy;
+ unsigned int success = sp_svg_number_read_d(strarray[0], &newx);
+ success += sp_svg_number_read_d(strarray[1], &newy);
+ g_strfreev (strarray);
+ if (success == 2) {
+ param_update_default( Geom::Point(newx, newy) );
+ }
+}
+
+void
PointParam::param_setValue(Geom::Point newpoint, bool write)
{
*dynamic_cast<Geom::Point *>( this ) = newpoint;
@@ -78,9 +90,6 @@ PointParam::param_setValue(Geom::Point newpoint, bool write)
if(knoth && liveupdate){
knoth->update_knots();
}
- if (_pointwdg) {
- _pointwdg->setValue( newpoint );
- }
}
bool
@@ -116,7 +125,7 @@ PointParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/)
Gtk::Widget *
PointParam::param_newWidget()
{
- _pointwdg = Gtk::manage(
+ Inkscape::UI::Widget::RegisteredTransformedPoint * pointwdg = Gtk::manage(
new Inkscape::UI::Widget::RegisteredTransformedPoint( param_label,
param_tooltip,
param_key,
@@ -125,15 +134,14 @@ PointParam::param_newWidget()
param_effect->getSPDoc() ) );
Geom::Affine transf = Geom::Scale(1, -1);
transf[5] = SP_ACTIVE_DOCUMENT->getHeight().value("px");
- _pointwdg->setTransform(transf);
- _pointwdg->setValue( *this );
- _pointwdg->clearProgrammatically();
- _pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter"));
+ pointwdg->setTransform(transf);
+ pointwdg->setValue( *this );
+ pointwdg->clearProgrammatically();
+ pointwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change point parameter"));
Gtk::HBox * hbox = Gtk::manage( new Gtk::HBox() );
- static_cast<Gtk::HBox*>(hbox)->pack_start(*_pointwdg, true, true);
+ static_cast<Gtk::HBox*>(hbox)->pack_start(*pointwdg, true, true);
static_cast<Gtk::HBox*>(hbox)->show_all_children();
- param_effect->upd_params = false;
return dynamic_cast<Gtk::Widget *> (hbox);
}
@@ -173,7 +181,7 @@ PointParamKnotHolderEntity::knot_set(Geom::Point const &p, Geom::Point const &or
s = A;
}
}
- pparam->param_setValue(s, this->pparam->liveupdate);
+ pparam->param_setValue(s);
SPLPEItem * splpeitem = dynamic_cast<SPLPEItem *>(item);
if(splpeitem && this->pparam->liveupdate){
sp_lpe_item_update_patheffect(splpeitem, false, false);