diff options
| author | Jabiertxof <jtx@jtx> | 2017-04-28 19:42:36 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx> | 2017-04-28 19:42:36 +0000 |
| commit | 52054e24f8b98c07753588c726a1e777bad7245b (patch) | |
| tree | 69b39b96cef271d0bb9acbf2d75f7329bee6c2d9 /src/live_effects/parameter | |
| parent | Update to trunk (diff) | |
| download | inkscape-52054e24f8b98c07753588c726a1e777bad7245b.tar.gz inkscape-52054e24f8b98c07753588c726a1e777bad7245b.zip | |
Reset
(bzr r15620.1.9)
Diffstat (limited to 'src/live_effects/parameter')
32 files changed, 48 insertions, 307 deletions
diff --git a/src/live_effects/parameter/array.h b/src/live_effects/parameter/array.h index fa08e1f91..a600f0257 100644 --- a/src/live_effects/parameter/array.h +++ b/src/live_effects/parameter/array.h @@ -59,7 +59,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 a031b5ced..813c06b4e 100644 --- a/src/live_effects/parameter/bool.cpp +++ b/src/live_effects/parameter/bool.cpp @@ -37,17 +37,11 @@ BoolParam::param_set_default() } void -BoolParam::param_update_default(bool default_value) +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) { @@ -66,18 +60,8 @@ Gtk::Widget * BoolParam::param_newWidget() { if(!hide_widget){ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Inkscape::UI::Widget::RegisteredCheckButton * checkwdg = Gtk::manage( - new Inkscape::UI::Widget::RegisteredCheckButton( label, + new Inkscape::UI::Widget::RegisteredCheckButton( param_label, param_tooltip, param_key, *param_wr, diff --git a/src/live_effects/parameter/bool.h b/src/live_effects/parameter/bool.h index a96966c46..7ad8a9368 100644 --- a/src/live_effects/parameter/bool.h +++ b/src/live_effects/parameter/bool.h @@ -36,9 +36,9 @@ public: void param_setValue(bool newvalue); virtual void param_set_default(); - void param_update_default(bool default_value); - virtual void param_update_default(const gchar * default_value); + void param_update_default(bool const 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 0bb2d89b2..dbfc68623 100644 --- a/src/live_effects/parameter/enum.h +++ b/src/live_effects/parameter/enum.h @@ -76,15 +76,7 @@ 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) { value = val; } diff --git a/src/live_effects/parameter/filletchamferpointarray.h b/src/live_effects/parameter/filletchamferpointarray.h index 4e4268703..b81339a69 100644 --- a/src/live_effects/parameter/filletchamferpointarray.h +++ b/src/live_effects/parameter/filletchamferpointarray.h @@ -55,7 +55,6 @@ public: virtual void set_chamfer_steps(int value_chamfer_steps); virtual void addCanvasIndicators(SPLPEItem const *lpeitem, std::vector<Geom::PathVector> &hp_vec); - virtual void param_update_default(const gchar * default_value){}; virtual bool providesKnotHolderEntities() const { return true; } diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp index ee76c4ab9..64c203093 100644 --- a/src/live_effects/parameter/fontbutton.cpp +++ b/src/live_effects/parameter/fontbutton.cpp @@ -33,11 +33,9 @@ FontButtonParam::param_set_default() { param_setValue(defvalue); } - void -FontButtonParam::param_update_default(const gchar * default_value) -{ - defvalue = (Glib::ustring)strdup(default_value); +FontButtonParam::param_update_default(const Glib::ustring default_value){ + defvalue = default_value; } bool @@ -58,24 +56,14 @@ FontButtonParam::param_getSVGValue() const Gtk::Widget * FontButtonParam::param_newWidget() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Inkscape::UI::Widget::RegisteredFontButton * fontbuttonwdg = Gtk::manage( - new Inkscape::UI::Widget::RegisteredFontButton( label, + new Inkscape::UI::Widget::RegisteredFontButton( param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) ); - Glib::ustring fontspec = (Glib::ustring)param_getSVGValue(); + 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; @@ -83,12 +71,11 @@ FontButtonParam::param_newWidget() } void -FontButtonParam::param_setValue(Glib::ustring newvalue) +FontButtonParam::param_setValue(const Glib::ustring newvalue) { value = newvalue; } - } /* namespace LivePathEffect */ } /* namespace Inkscape */ diff --git a/src/live_effects/parameter/fontbutton.h b/src/live_effects/parameter/fontbutton.h index 60e1aa46e..df47251a2 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 = "Sans 10"); + const Glib::ustring default_value = ""); virtual ~FontButtonParam() {} virtual Gtk::Widget * param_newWidget(); virtual bool param_readSVGValue(const gchar * strvalue); - void param_update_default(const gchar * default_value); + void param_update_default(const Glib::ustring defvalue); virtual gchar * param_getSVGValue() const; - void param_setValue(Glib::ustring newvalue); + void param_setValue(const 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 aba61b96a..93cf2b15f 100644 --- a/src/live_effects/parameter/item.cpp +++ b/src/live_effects/parameter/item.cpp @@ -60,10 +60,6 @@ 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() @@ -108,20 +104,10 @@ ItemParam::param_getSVGValue() const Gtk::Widget * ItemParam::param_newWidget() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Gtk::HBox * _widget = Gtk::manage(new Gtk::HBox()); Gtk::Widget* pIcon = Gtk::manage( sp_icon_get_icon( INKSCAPE_ICON("edit-clone"), Inkscape::ICON_SIZE_BUTTON) ); Gtk::Button * pButton = Gtk::manage(new Gtk::Button()); - Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(label)); + Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true); pLabel->set_tooltip_text(param_tooltip); pButton->set_relief(Gtk::RELIEF_NONE); diff --git a/src/live_effects/parameter/item.h b/src/live_effects/parameter/item.h index 89c32f9bd..6c719d451 100644 --- a/src/live_effects/parameter/item.h +++ b/src/live_effects/parameter/item.h @@ -36,7 +36,6 @@ 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/originalitem.cpp b/src/live_effects/parameter/originalitem.cpp index 8db8851bf..053062128 100644 --- a/src/live_effects/parameter/originalitem.cpp +++ b/src/live_effects/parameter/originalitem.cpp @@ -46,20 +46,10 @@ OriginalItemParam::~OriginalItemParam() Gtk::Widget * OriginalItemParam::param_newWidget() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Gtk::HBox *_widget = Gtk::manage(new Gtk::HBox()); { // Label - Gtk::Label *pLabel = Gtk::manage(new Gtk::Label(label)); + Gtk::Label *pLabel = Gtk::manage(new Gtk::Label(param_label)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true); pLabel->set_tooltip_text(param_tooltip); } diff --git a/src/live_effects/parameter/originalitem.h b/src/live_effects/parameter/originalitem.h index de1a6ac25..58d04e05a 100644 --- a/src/live_effects/parameter/originalitem.h +++ b/src/live_effects/parameter/originalitem.h @@ -26,6 +26,7 @@ public: void setInverse(bool inversed) { inverse = inversed; } bool linksToItem() const { return (href != NULL); } SPItem * getObject() const { return ref.getObject(); } + virtual Gtk::Widget * param_newWidget(); protected: diff --git a/src/live_effects/parameter/originalpath.cpp b/src/live_effects/parameter/originalpath.cpp index 388a3b5e6..1e78f7fe1 100644 --- a/src/live_effects/parameter/originalpath.cpp +++ b/src/live_effects/parameter/originalpath.cpp @@ -47,20 +47,10 @@ OriginalPathParam::~OriginalPathParam() Gtk::Widget * OriginalPathParam::param_newWidget() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Gtk::HBox *_widget = Gtk::manage(new Gtk::HBox()); { // Label - Gtk::Label *pLabel = Gtk::manage(new Gtk::Label(label)); + Gtk::Label *pLabel = Gtk::manage(new Gtk::Label(param_label)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true); pLabel->set_tooltip_text(param_tooltip); } diff --git a/src/live_effects/parameter/originalpatharray.h b/src/live_effects/parameter/originalpatharray.h index fe9371644..296c0f7f7 100644 --- a/src/live_effects/parameter/originalpatharray.h +++ b/src/live_effects/parameter/originalpatharray.h @@ -65,11 +65,12 @@ 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 359a51913..befac4df1 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -107,16 +107,6 @@ 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) { @@ -172,18 +162,8 @@ Gtk::Widget * ScalarParam::param_newWidget() { if(!hide_widget){ - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Inkscape::UI::Widget::RegisteredScalar *rsu = Gtk::manage( new Inkscape::UI::Widget::RegisteredScalar( - label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) ); + param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) ); rsu->setValue(value); rsu->setDigits(digits); diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h index ee1d2d547..6cf10710c 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,7 +77,6 @@ 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; @@ -85,6 +84,7 @@ public: bool widget_is_visible; protected: + Glib::ustring param_tooltip; Effect* param_effect; @@ -112,7 +112,6 @@ 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); @@ -121,6 +120,7 @@ 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 9bdebaf47..dafc6d406 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -170,19 +170,9 @@ PathParam::param_getSVGValue() const Gtk::Widget * PathParam::param_newWidget() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Gtk::HBox * _widget = Gtk::manage(new Gtk::HBox()); - Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(label)); + Gtk::Label* pLabel = Gtk::manage(new Gtk::Label(param_label)); static_cast<Gtk::HBox*>(_widget)->pack_start(*pLabel, true, true); pLabel->set_tooltip_text(param_tooltip); @@ -449,10 +439,6 @@ 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 5381a6b36..d2dddbe97 100644 --- a/src/live_effects/parameter/path.h +++ b/src/live_effects/parameter/path.h @@ -40,7 +40,6 @@ 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 2fbe4b3b4..db768090a 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -64,19 +64,6 @@ PointParam::param_update_default(Geom::Point 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; @@ -126,18 +113,8 @@ PointParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/) Gtk::Widget * PointParam::param_newWidget() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Inkscape::UI::Widget::RegisteredTransformedPoint * pointwdg = Gtk::manage( - new Inkscape::UI::Widget::RegisteredTransformedPoint( label, + new Inkscape::UI::Widget::RegisteredTransformedPoint( param_label, param_tooltip, param_key, *param_wr, diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h index a5153ad80..5d145a81a 100644 --- a/src/live_effects/parameter/point.h +++ b/src/live_effects/parameter/point.h @@ -44,8 +44,6 @@ public: Geom::Point param_get_default() const; void param_set_liveupdate(bool live_update); 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); diff --git a/src/live_effects/parameter/powerstrokepointarray.h b/src/live_effects/parameter/powerstrokepointarray.h index a34163ca1..56a609fa8 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 bcba05399..075e85ee1 100644 --- a/src/live_effects/parameter/random.cpp +++ b/src/live_effects/parameter/random.cpp @@ -78,20 +78,6 @@ 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; @@ -129,18 +115,8 @@ RandomParam::resetRandomizer() Gtk::Widget * RandomParam::param_newWidget() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Inkscape::UI::Widget::RegisteredRandom* regrandom = Gtk::manage( - new Inkscape::UI::Widget::RegisteredRandom( label, + new Inkscape::UI::Widget::RegisteredRandom( param_label, param_tooltip, param_key, *param_wr, diff --git a/src/live_effects/parameter/random.h b/src/live_effects/parameter/random.h index 5fb6027ac..ca4440336 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 5c56e8447..5c4cdf4c6 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(const gchar * default_value) +TextParam::param_update_default(Glib::ustring default_value) { - defvalue = (Glib::ustring)default_value; + defvalue = default_value; } void @@ -119,18 +119,8 @@ TextParam::param_getSVGValue() const Gtk::Widget * TextParam::param_newWidget() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Inkscape::UI::Widget::RegisteredText *rsu = Gtk::manage(new Inkscape::UI::Widget::RegisteredText( - label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc())); + param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc())); rsu->setText(value); rsu->setProgrammatically = false; @@ -140,7 +130,7 @@ TextParam::param_newWidget() } void -TextParam::param_setValue(Glib::ustring newvalue) +TextParam::param_setValue(const Glib::ustring newvalue) { param_effect->upd_params = true; value = newvalue; diff --git a/src/live_effects/parameter/text.h b/src/live_effects/parameter/text.h index 137f3ee02..553c84c0a 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(Glib::ustring newvalue); + void param_setValue(const Glib::ustring newvalue); void param_hide_canvas_text(); virtual void param_set_default(); - virtual void param_update_default(const gchar * default_value); + void param_update_default(Glib::ustring 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 value; }; + const Glib::ustring get_value() const { return defvalue; }; private: TextParam(const TextParam&); diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp index 1d1bc82a6..b3f6442bb 100644 --- a/src/live_effects/parameter/togglebutton.cpp +++ b/src/live_effects/parameter/togglebutton.cpp @@ -60,37 +60,15 @@ 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() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } if (_toggled_connection.connected()) { _toggled_connection.disconnect(); } checkwdg = Gtk::manage( - new Inkscape::UI::Widget::RegisteredToggleButton( label, + new Inkscape::UI::Widget::RegisteredToggleButton( param_label, param_tooltip, param_key, *param_wr, diff --git a/src/live_effects/parameter/togglebutton.h b/src/live_effects/parameter/togglebutton.h index d6ca15e75..8390fec86 100644 --- a/src/live_effects/parameter/togglebutton.h +++ b/src/live_effects/parameter/togglebutton.h @@ -51,8 +51,6 @@ 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 2081a8c0c..0d03432c3 100644 --- a/src/live_effects/parameter/transformedpoint.cpp +++ b/src/live_effects/parameter/transformedpoint.cpp @@ -82,40 +82,11 @@ 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() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Inkscape::UI::Widget::RegisteredVector * pointwdg = Gtk::manage( - new Inkscape::UI::Widget::RegisteredVector( label, + new Inkscape::UI::Widget::RegisteredVector( param_label, param_tooltip, param_key, *param_wr, diff --git a/src/live_effects/parameter/transformedpoint.h b/src/live_effects/parameter/transformedpoint.h index 269cc508e..c96bedb53 100644 --- a/src/live_effects/parameter/transformedpoint.h +++ b/src/live_effects/parameter/transformedpoint.h @@ -51,9 +51,7 @@ 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 684f29555..b6ea99bfe 100644 --- a/src/live_effects/parameter/unit.cpp +++ b/src/live_effects/parameter/unit.cpp @@ -55,9 +55,9 @@ UnitParam::param_set_default() } void -UnitParam::param_update_default(const gchar * default_unit) +UnitParam::param_update_default(const Glib::ustring default_unit) { - defunit = unit_table.getUnit((Glib::ustring)default_unit); + defunit = unit_table.getUnit(default_unit); } void @@ -75,18 +75,8 @@ UnitParam::get_abbreviation() const Gtk::Widget * UnitParam::param_newWidget() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Inkscape::UI::Widget::RegisteredUnitMenu* unit_menu = Gtk::manage( - new Inkscape::UI::Widget::RegisteredUnitMenu(label, + new Inkscape::UI::Widget::RegisteredUnitMenu(param_label, param_key, *param_wr, param_effect->getRepr(), diff --git a/src/live_effects/parameter/unit.h b/src/live_effects/parameter/unit.h index c662b6edc..ae58cf956 100644 --- a/src/live_effects/parameter/unit.h +++ b/src/live_effects/parameter/unit.h @@ -33,10 +33,11 @@ public: virtual gchar * param_getSVGValue() const; virtual void param_set_default(); void param_set_value(Inkscape::Util::Unit const &val); - virtual void param_update_default(const gchar * default_unit); + void param_update_default(const Glib::ustring 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 d6593871d..55b4d4b32 100644 --- a/src/live_effects/parameter/vector.cpp +++ b/src/live_effects/parameter/vector.cpp @@ -48,25 +48,6 @@ 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) { @@ -104,18 +85,8 @@ VectorParam::param_getSVGValue() const Gtk::Widget * VectorParam::param_newWidget() { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - Glib::ustring effectkey = (Glib::ustring)Inkscape::LivePathEffect::LPETypeConverter.get_key(param_effect->effectType()); - Glib::ustring pref_path = (Glib::ustring)"/live_effects/" + - effectkey + - (Glib::ustring)"/" + - (Glib::ustring)param_key; - Glib::ustring label = param_label; - if(prefs->getEntry(pref_path).isValid()){ - label = (Glib::ustring)"* " + param_label; - } Inkscape::UI::Widget::RegisteredVector * pointwdg = Gtk::manage( - new Inkscape::UI::Widget::RegisteredVector( label, + new Inkscape::UI::Widget::RegisteredVector( param_label, param_tooltip, param_key, *param_wr, diff --git a/src/live_effects/parameter/vector.h b/src/live_effects/parameter/vector.h index d270e9f43..edee4ff4d 100644 --- a/src/live_effects/parameter/vector.h +++ b/src/live_effects/parameter/vector.h @@ -51,8 +51,7 @@ 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); |
