summaryrefslogtreecommitdiffstats
path: root/src/live_effects/parameter
diff options
context:
space:
mode:
Diffstat (limited to 'src/live_effects/parameter')
-rw-r--r--src/live_effects/parameter/array.h2
-rw-r--r--src/live_effects/parameter/bool.cpp7
-rw-r--r--src/live_effects/parameter/bool.h2
-rw-r--r--src/live_effects/parameter/enum.h11
-rw-r--r--src/live_effects/parameter/fontbutton.cpp9
-rw-r--r--src/live_effects/parameter/fontbutton.h6
-rw-r--r--src/live_effects/parameter/item.cpp4
-rw-r--r--src/live_effects/parameter/item.h1
-rw-r--r--src/live_effects/parameter/originalpatharray.h3
-rw-r--r--src/live_effects/parameter/parameter.cpp16
-rw-r--r--src/live_effects/parameter/parameter.h6
-rw-r--r--src/live_effects/parameter/path.cpp4
-rw-r--r--src/live_effects/parameter/path.h1
-rw-r--r--src/live_effects/parameter/point.cpp36
-rw-r--r--src/live_effects/parameter/point.h6
-rw-r--r--src/live_effects/parameter/powerstrokepointarray.h2
-rw-r--r--src/live_effects/parameter/random.cpp14
-rw-r--r--src/live_effects/parameter/random.h4
-rw-r--r--src/live_effects/parameter/text.cpp6
-rw-r--r--src/live_effects/parameter/text.h6
-rw-r--r--src/live_effects/parameter/togglebutton.cpp18
-rw-r--r--src/live_effects/parameter/togglebutton.h2
-rw-r--r--src/live_effects/parameter/transformedpoint.cpp19
-rw-r--r--src/live_effects/parameter/transformedpoint.h4
-rw-r--r--src/live_effects/parameter/unit.cpp5
-rw-r--r--src/live_effects/parameter/unit.h5
-rw-r--r--src/live_effects/parameter/vector.cpp19
-rw-r--r--src/live_effects/parameter/vector.h3
28 files changed, 163 insertions, 58 deletions
diff --git a/src/live_effects/parameter/array.h b/src/live_effects/parameter/array.h
index 9204ede1f..10a3ea018 100644
--- a/src/live_effects/parameter/array.h
+++ b/src/live_effects/parameter/array.h
@@ -60,7 +60,7 @@ public:
g_strfreev (strarray);
return true;
}
-
+ virtual void param_update_default(const gchar * default_value){};
virtual gchar * param_getSVGValue() const {
Inkscape::SVGOStringStream os;
writesvg(os, _vector);
diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp
index 813c06b4e..9cb91bdd6 100644
--- a/src/live_effects/parameter/bool.cpp
+++ b/src/live_effects/parameter/bool.cpp
@@ -42,6 +42,12 @@ BoolParam::param_update_default(bool const default_value)
defvalue = default_value;
}
+void
+BoolParam::param_update_default(const gchar * default_value)
+{
+ param_update_default(helperfns_read_bool(default_value, defvalue));
+}
+
bool
BoolParam::param_readSVGValue(const gchar * strvalue)
{
@@ -72,7 +78,6 @@ BoolParam::param_newWidget()
checkwdg->setActive(value);
checkwdg->setProgrammatically = false;
checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change bool parameter"));
- param_effect->upd_params = false;
return dynamic_cast<Gtk::Widget *> (checkwdg);
} else {
return NULL;
diff --git a/src/live_effects/parameter/bool.h b/src/live_effects/parameter/bool.h
index 7ad8a9368..39f328eaa 100644
--- a/src/live_effects/parameter/bool.h
+++ b/src/live_effects/parameter/bool.h
@@ -37,8 +37,8 @@ public:
void param_setValue(bool newvalue);
virtual void param_set_default();
void param_update_default(bool const default_value);
+ virtual void param_update_default(const gchar * default_value);
bool get_value() const { return value; };
-
inline operator bool() const { return value; };
private:
diff --git a/src/live_effects/parameter/enum.h b/src/live_effects/parameter/enum.h
index dbfc68623..6cadd6953 100644
--- a/src/live_effects/parameter/enum.h
+++ b/src/live_effects/parameter/enum.h
@@ -76,8 +76,17 @@ public:
void param_set_default() {
param_set_value(defvalue);
}
-
+
+ void param_update_default(E default_value) {
+ defvalue = default_value;
+ }
+
+ virtual void param_update_default(const gchar * default_value) {
+ param_update_default(enumdataconv->get_id_from_key(Glib::ustring(default_value)));
+ }
+
void param_set_value(E val) {
+ param_effect->upd_params = true;
value = val;
}
diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp
index 64c203093..5add69c1d 100644
--- a/src/live_effects/parameter/fontbutton.cpp
+++ b/src/live_effects/parameter/fontbutton.cpp
@@ -33,9 +33,11 @@ FontButtonParam::param_set_default()
{
param_setValue(defvalue);
}
+
void
-FontButtonParam::param_update_default(const Glib::ustring default_value){
- defvalue = default_value;
+FontButtonParam::param_update_default(const gchar * default_value)
+{
+ defvalue = (Glib::ustring)strdup(default_value);
}
bool
@@ -66,16 +68,17 @@ FontButtonParam::param_newWidget()
Glib::ustring fontspec = param_getSVGValue();
fontbuttonwdg->setValue( fontspec);
fontbuttonwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change font button parameter"));
- param_effect->upd_params = false;
return dynamic_cast<Gtk::Widget *> (fontbuttonwdg);
}
void
FontButtonParam::param_setValue(const Glib::ustring newvalue)
{
+ param_effect->upd_params = true;
value = newvalue;
}
+
} /* namespace LivePathEffect */
} /* namespace Inkscape */
diff --git a/src/live_effects/parameter/fontbutton.h b/src/live_effects/parameter/fontbutton.h
index df47251a2..60e1aa46e 100644
--- a/src/live_effects/parameter/fontbutton.h
+++ b/src/live_effects/parameter/fontbutton.h
@@ -21,15 +21,15 @@ public:
const Glib::ustring& key,
Inkscape::UI::Widget::Registry* wr,
Effect* effect,
- const Glib::ustring default_value = "");
+ const Glib::ustring default_value = "Sans 10");
virtual ~FontButtonParam() {}
virtual Gtk::Widget * param_newWidget();
virtual bool param_readSVGValue(const gchar * strvalue);
- void param_update_default(const Glib::ustring defvalue);
+ void param_update_default(const gchar * default_value);
virtual gchar * param_getSVGValue() const;
- void param_setValue(const Glib::ustring newvalue);
+ void param_setValue(Glib::ustring newvalue);
virtual void param_set_default();
diff --git a/src/live_effects/parameter/item.cpp b/src/live_effects/parameter/item.cpp
index 93cf2b15f..7b40f4540 100644
--- a/src/live_effects/parameter/item.cpp
+++ b/src/live_effects/parameter/item.cpp
@@ -60,6 +60,10 @@ ItemParam::param_set_default()
param_readSVGValue(defvalue);
}
+void
+ItemParam::param_update_default(const gchar * default_value){
+ defvalue = strdup(default_value);
+}
void
ItemParam::param_set_and_write_default()
diff --git a/src/live_effects/parameter/item.h b/src/live_effects/parameter/item.h
index 6c719d451..89c32f9bd 100644
--- a/src/live_effects/parameter/item.h
+++ b/src/live_effects/parameter/item.h
@@ -36,6 +36,7 @@ public:
virtual gchar * param_getSVGValue() const;
virtual void param_set_default();
+ virtual void param_update_default(const gchar * default_value);
void param_set_and_write_default();
virtual void addCanvasIndicators(SPLPEItem const* lpeitem, std::vector<Geom::PathVector> &hp_vec);
diff --git a/src/live_effects/parameter/originalpatharray.h b/src/live_effects/parameter/originalpatharray.h
index 296c0f7f7..fe9371644 100644
--- a/src/live_effects/parameter/originalpatharray.h
+++ b/src/live_effects/parameter/originalpatharray.h
@@ -65,12 +65,11 @@ public:
virtual bool param_readSVGValue(const gchar * strvalue);
virtual gchar * param_getSVGValue() const;
virtual void param_set_default();
-
+ virtual void param_update_default(const gchar * default_value){};
/** Disable the canvas indicators of parent class by overriding this method */
virtual void param_editOncanvas(SPItem * /*item*/, SPDesktop * /*dt*/) {};
/** Disable the canvas indicators of parent class by overriding this method */
virtual void addCanvasIndicators(SPLPEItem const* /*lpeitem*/, std::vector<Geom::PathVector> & /*hp_vec*/) {};
-
std::vector<PathAndDirection*> _vector;
protected:
diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp
index befac4df1..1c1063960 100644
--- a/src/live_effects/parameter/parameter.cpp
+++ b/src/live_effects/parameter/parameter.cpp
@@ -39,6 +39,7 @@ Parameter::Parameter( const Glib::ustring& label, const Glib::ustring& tip,
void
Parameter::param_write_to_repr(const char * svgd)
{
+ param_effect->upd_params = true;
param_effect->getRepr()->setAttribute(param_key.c_str(), svgd);
}
@@ -107,6 +108,16 @@ ScalarParam::param_update_default(gdouble default_value)
defvalue = default_value;
}
+void
+ScalarParam::param_update_default(const gchar * default_value)
+{
+ double newval;
+ unsigned int success = sp_svg_number_read_d(default_value, &newval);
+ if (success == 1) {
+ param_update_default(newval);
+ }
+}
+
void
ScalarParam::param_set_value(gdouble val)
{
@@ -128,7 +139,6 @@ ScalarParam::param_set_range(gdouble min, gdouble max)
// Once again, in gtk2, this is not a problem. But in gtk3,
// widgets get allocated the amount of size they ask for,
// leading to excessively long widgets.
- param_effect->upd_params = true;
if (min >= -SCALARPARAM_G_MAXDOUBLE) {
this->min = min;
} else {
@@ -145,7 +155,6 @@ ScalarParam::param_set_range(gdouble min, gdouble max)
void
ScalarParam::param_make_integer(bool yes)
{
- param_effect->upd_params = true;
integer = yes;
digits = 0;
inc_step = 1;
@@ -176,7 +185,6 @@ ScalarParam::param_newWidget()
if(!overwrite_widget){
rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change scalar parameter"));
}
- param_effect->upd_params = false;
return dynamic_cast<Gtk::Widget *> (rsu);
} else {
return NULL;
@@ -186,14 +194,12 @@ ScalarParam::param_newWidget()
void
ScalarParam::param_set_digits(unsigned digits)
{
- param_effect->upd_params = true;
this->digits = digits;
}
void
ScalarParam::param_set_increments(double step, double page)
{
- param_effect->upd_params = true;
inc_step = step;
inc_page = page;
}
diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h
index 6cf10710c..ee1d2d547 100644
--- a/src/live_effects/parameter/parameter.h
+++ b/src/live_effects/parameter/parameter.h
@@ -60,7 +60,7 @@ public:
void write_to_SVG();
virtual void param_set_default() = 0;
-
+ virtual void param_update_default(const gchar * default_value) = 0;
// This creates a new widget (newed with Gtk::manage(new ...);)
virtual Gtk::Widget * param_newWidget() = 0;
@@ -77,6 +77,7 @@ public:
virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/) {};
Glib::ustring param_key;
+ Glib::ustring param_tooltip;
Inkscape::UI::Widget::Registry * param_wr;
Glib::ustring param_label;
@@ -84,7 +85,6 @@ public:
bool widget_is_visible;
protected:
- Glib::ustring param_tooltip;
Effect* param_effect;
@@ -112,6 +112,7 @@ public:
virtual void param_set_default();
void param_update_default(gdouble default_value);
+ virtual void param_update_default(const gchar * default_value);
void param_set_value(gdouble val);
void param_make_integer(bool yes = true);
void param_set_range(gdouble min, gdouble max);
@@ -120,7 +121,6 @@ public:
void addSlider(bool add_slider_widget) { add_slider = add_slider_widget; };
double param_get_max() { return max; };
double param_get_min() { return min; };
-
void param_overwrite_widget(bool overwrite_widget);
virtual Gtk::Widget * param_newWidget();
diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp
index dafc6d406..aa87508ab 100644
--- a/src/live_effects/parameter/path.cpp
+++ b/src/live_effects/parameter/path.cpp
@@ -439,6 +439,10 @@ PathParam::linked_modified_callback(SPObject *linked_obj, guint /*flags*/)
SP_OBJECT(param_effect->getLPEObj())->requestModified(SP_OBJECT_MODIFIED_FLAG);
}
+void
+PathParam::param_update_default(const gchar * default_value){
+ defvalue = strdup(default_value);
+}
/* CALLBACK FUNCTIONS FOR THE BUTTONS */
void
diff --git a/src/live_effects/parameter/path.h b/src/live_effects/parameter/path.h
index d2dddbe97..5381a6b36 100644
--- a/src/live_effects/parameter/path.h
+++ b/src/live_effects/parameter/path.h
@@ -40,6 +40,7 @@ public:
virtual gchar * param_getSVGValue() const;
virtual void param_set_default();
+ virtual void param_update_default(const gchar * default_value);
void param_set_and_write_default();
void set_new_value (Geom::PathVector const &newpath, bool write_to_svg);
void set_new_value (Geom::Piecewise<Geom::D2<Geom::SBasis> > const &newpath, bool write_to_svg);
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);
diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h
index e8cb66225..a5153ad80 100644
--- a/src/live_effects/parameter/point.h
+++ b/src/live_effects/parameter/point.h
@@ -43,14 +43,15 @@ public:
void param_set_default();
Geom::Point param_get_default() const;
void param_set_liveupdate(bool live_update);
- void param_update_default(const Geom::Point default_point);
+ void param_update_default(Geom::Point default_point);
+
+ virtual void param_update_default(const gchar * default_point);
virtual void param_transform_multiply(Geom::Affine const& /*postmul*/, bool /*set*/);
void set_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
virtual bool providesKnotHolderEntities() const { return true; }
virtual void addKnotHolderEntities(KnotHolder *knotholder, SPItem *item);
-
friend class PointParamKnotHolderEntity;
private:
PointParam(const PointParam&);
@@ -62,7 +63,6 @@ private:
SPKnotModeType knot_mode;
guint32 knot_color;
gchar *handle_tip;
- Inkscape::UI::Widget::RegisteredTransformedPoint * _pointwdg;
};
diff --git a/src/live_effects/parameter/powerstrokepointarray.h b/src/live_effects/parameter/powerstrokepointarray.h
index 56a609fa8..a34163ca1 100644
--- a/src/live_effects/parameter/powerstrokepointarray.h
+++ b/src/live_effects/parameter/powerstrokepointarray.h
@@ -39,13 +39,13 @@ public:
virtual bool providesKnotHolderEntities() const { return true; }
virtual void addKnotHolderEntities(KnotHolder *knotholder, SPItem *item);
+ virtual void param_update_default(const gchar * default_value){};
void set_pwd2(Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in, Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_normal_in);
Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2() const { return last_pwd2; }
Geom::Piecewise<Geom::D2<Geom::SBasis> > const & get_pwd2_normal() const { return last_pwd2_normal; }
void recalculate_controlpoints_for_new_pwd2(Geom::Piecewise<Geom::D2<Geom::SBasis> > const & pwd2_in);
-
friend class PowerStrokePointArrayParamKnotHolderEntity;
private:
diff --git a/src/live_effects/parameter/random.cpp b/src/live_effects/parameter/random.cpp
index 075e85ee1..90e53ca0e 100644
--- a/src/live_effects/parameter/random.cpp
+++ b/src/live_effects/parameter/random.cpp
@@ -78,6 +78,20 @@ RandomParam::param_set_default()
}
void
+RandomParam::param_update_default(gdouble default_value){
+ defvalue = default_value;
+}
+
+void
+RandomParam::param_update_default(const gchar * default_value){
+ double newval;
+ unsigned int success = sp_svg_number_read_d(default_value, &newval);
+ if (success == 1) {
+ param_update_default(newval);
+ }
+}
+
+void
RandomParam::param_set_value(gdouble val, long newseed)
{
value = val;
diff --git a/src/live_effects/parameter/random.h b/src/live_effects/parameter/random.h
index ca4440336..5fb6027ac 100644
--- a/src/live_effects/parameter/random.h
+++ b/src/live_effects/parameter/random.h
@@ -38,9 +38,9 @@ public:
void param_set_value(gdouble val, long newseed);
void param_make_integer(bool yes = true);
void param_set_range(gdouble min, gdouble max);
-
+ void param_update_default(gdouble default_value);
+ virtual void param_update_default(const gchar * default_value);
void resetRandomizer();
-
operator gdouble();
inline gdouble get_value() { return value; } ;
diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp
index 5c4cdf4c6..4062a4dc7 100644
--- a/src/live_effects/parameter/text.cpp
+++ b/src/live_effects/parameter/text.cpp
@@ -50,9 +50,9 @@ TextParam::param_set_default()
}
void
-TextParam::param_update_default(Glib::ustring default_value)
+TextParam::param_update_default(const gchar * default_value)
{
- defvalue = default_value;
+ defvalue = (Glib::ustring)default_value;
}
void
@@ -125,14 +125,12 @@ TextParam::param_newWidget()
rsu->setProgrammatically = false;
rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change text parameter"));
- param_effect->upd_params = false;
return dynamic_cast<Gtk::Widget *> (rsu);
}
void
TextParam::param_setValue(const Glib::ustring newvalue)
{
- param_effect->upd_params = true;
value = newvalue;
if (!_hide_canvas_text) {
sp_canvastext_set_text (canvas_text, newvalue.c_str());
diff --git a/src/live_effects/parameter/text.h b/src/live_effects/parameter/text.h
index 553c84c0a..137f3ee02 100644
--- a/src/live_effects/parameter/text.h
+++ b/src/live_effects/parameter/text.h
@@ -39,16 +39,16 @@ public:
virtual bool param_readSVGValue(const gchar * strvalue);
virtual gchar * param_getSVGValue() const;
- void param_setValue(const Glib::ustring newvalue);
+ void param_setValue(Glib::ustring newvalue);
void param_hide_canvas_text();
virtual void param_set_default();
- void param_update_default(Glib::ustring default_value);
+ virtual void param_update_default(const gchar * default_value);
void setPos(Geom::Point pos);
void setPosAndAnchor(const Geom::Piecewise<Geom::D2<Geom::SBasis> > &pwd2,
const double t, const double length, bool use_curvature = false);
void setAnchor(double x_value, double y_value);
- const Glib::ustring get_value() const { return defvalue; };
+ const Glib::ustring get_value() const { return value; };
private:
TextParam(const TextParam&);
diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp
index b3f6442bb..9eb89fea5 100644
--- a/src/live_effects/parameter/togglebutton.cpp
+++ b/src/live_effects/parameter/togglebutton.cpp
@@ -60,6 +60,18 @@ ToggleButtonParam::param_getSVGValue() const
return str;
}
+void
+ToggleButtonParam::param_update_default(bool default_value)
+{
+ defvalue = default_value;
+}
+
+void
+ToggleButtonParam::param_update_default(const gchar * default_value)
+{
+ param_update_default(helperfns_read_bool(default_value, defvalue));
+}
+
Gtk::Widget *
ToggleButtonParam::param_newWidget()
{
@@ -68,7 +80,7 @@ ToggleButtonParam::param_newWidget()
}
checkwdg = Gtk::manage(
- new Inkscape::UI::Widget::RegisteredToggleButton( param_label,
+ new Inkscape::UI::Widget::RegisteredToggleButton(param_label,
param_tooltip,
param_key,
*param_wr,
@@ -112,7 +124,6 @@ ToggleButtonParam::param_newWidget()
checkwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change togglebutton parameter"));
_toggled_connection = checkwdg->signal_toggled().connect(sigc::mem_fun(*this, &ToggleButtonParam::toggled));
- param_effect->upd_params = false;
return checkwdg;
}
@@ -153,14 +164,13 @@ ToggleButtonParam::refresh_button()
void
ToggleButtonParam::param_setValue(bool newvalue)
{
+ param_effect->upd_params = true;
value = newvalue;
refresh_button();
}
void
ToggleButtonParam::toggled() {
- //Force redraw for update widgets
- param_effect->upd_params = true;
if (SP_ACTIVE_DESKTOP) {
Inkscape::Selection *selection = SP_ACTIVE_DESKTOP->getSelection();
selection->emitModified();
diff --git a/src/live_effects/parameter/togglebutton.h b/src/live_effects/parameter/togglebutton.h
index 8390fec86..d6ca15e75 100644
--- a/src/live_effects/parameter/togglebutton.h
+++ b/src/live_effects/parameter/togglebutton.h
@@ -51,6 +51,8 @@ public:
sigc::signal<void>& signal_toggled() { return _signal_toggled; }
virtual void toggled();
+ void param_update_default(bool default_value);
+ virtual void param_update_default(const gchar * default_value);
private:
ToggleButtonParam(const ToggleButtonParam&);
diff --git a/src/live_effects/parameter/transformedpoint.cpp b/src/live_effects/parameter/transformedpoint.cpp
index 0d03432c3..22d5ba3a4 100644
--- a/src/live_effects/parameter/transformedpoint.cpp
+++ b/src/live_effects/parameter/transformedpoint.cpp
@@ -82,6 +82,25 @@ TransformedPointParam::param_getSVGValue() const
return str;
}
+void
+TransformedPointParam::param_update_default(Geom::Point default_point)
+{
+ defvalue = default_point;
+}
+
+void
+TransformedPointParam::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) );
+ }
+}
+
Gtk::Widget *
TransformedPointParam::param_newWidget()
{
diff --git a/src/live_effects/parameter/transformedpoint.h b/src/live_effects/parameter/transformedpoint.h
index c96bedb53..269cc508e 100644
--- a/src/live_effects/parameter/transformedpoint.h
+++ b/src/live_effects/parameter/transformedpoint.h
@@ -51,7 +51,9 @@ public:
void set_vector_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
void set_oncanvas_color(guint32 color);
-
+ Geom::Point param_get_default() { return defvalue; }
+ void param_update_default(Geom::Point default_point);
+ virtual void param_update_default(const gchar * default_point);
virtual bool providesKnotHolderEntities() const { return true; }
virtual void addKnotHolderEntities(KnotHolder *knotholder, SPDesktop *desktop, SPItem *item);
diff --git a/src/live_effects/parameter/unit.cpp b/src/live_effects/parameter/unit.cpp
index b6ea99bfe..b9b91c1e6 100644
--- a/src/live_effects/parameter/unit.cpp
+++ b/src/live_effects/parameter/unit.cpp
@@ -55,14 +55,15 @@ UnitParam::param_set_default()
}
void
-UnitParam::param_update_default(const Glib::ustring default_unit)
+UnitParam::param_update_default(const gchar * default_unit)
{
- defunit = unit_table.getUnit(default_unit);
+ defunit = unit_table.getUnit((Glib::ustring)default_unit);
}
void
UnitParam::param_set_value(Inkscape::Util::Unit const &val)
{
+ param_effect->upd_params = true;
unit = new Inkscape::Util::Unit(val);
}
diff --git a/src/live_effects/parameter/unit.h b/src/live_effects/parameter/unit.h
index ae58cf956..c662b6edc 100644
--- a/src/live_effects/parameter/unit.h
+++ b/src/live_effects/parameter/unit.h
@@ -33,11 +33,10 @@ public:
virtual gchar * param_getSVGValue() const;
virtual void param_set_default();
void param_set_value(Inkscape::Util::Unit const &val);
- void param_update_default(const Glib::ustring default_unit);
+ virtual void param_update_default(const gchar * default_unit);
const gchar *get_abbreviation() const;
-
virtual Gtk::Widget * param_newWidget();
-
+
operator Inkscape::Util::Unit const *() const { return unit; }
private:
diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp
index 55b4d4b32..470fa9c2d 100644
--- a/src/live_effects/parameter/vector.cpp
+++ b/src/live_effects/parameter/vector.cpp
@@ -48,6 +48,25 @@ VectorParam::param_set_default()
setVector(defvalue);
}
+void
+VectorParam::param_update_default(Geom::Point default_point)
+{
+ defvalue = default_point;
+}
+
+void
+VectorParam::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) );
+ }
+}
+
bool
VectorParam::param_readSVGValue(const gchar * strvalue)
{
diff --git a/src/live_effects/parameter/vector.h b/src/live_effects/parameter/vector.h
index edee4ff4d..d270e9f43 100644
--- a/src/live_effects/parameter/vector.h
+++ b/src/live_effects/parameter/vector.h
@@ -51,7 +51,8 @@ public:
void set_vector_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
void set_origin_oncanvas_looks(SPKnotShapeType shape, SPKnotModeType mode, guint32 color);
void set_oncanvas_color(guint32 color);
-
+ void param_update_default(Geom::Point default_point);
+ virtual void param_update_default(const gchar * default_point);
virtual bool providesKnotHolderEntities() const { return true; }
virtual void addKnotHolderEntities(KnotHolder *knotholder, SPItem *item);