diff options
| author | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-09-22 16:00:59 +0000 |
|---|---|---|
| committer | Jabier Arraiza <jabier.arraiza@marker.es> | 2017-09-22 16:00:59 +0000 |
| commit | 1711a79b8604d9e6d936e25eaf966154ff122483 (patch) | |
| tree | f03084c6e81d58583f1ff705b9392a8d215643aa /src/live_effects/parameter | |
| parent | Add some sugesstions and fixes from CR to measure segments (diff) | |
| download | inkscape-1711a79b8604d9e6d936e25eaf966154ff122483.tar.gz inkscape-1711a79b8604d9e6d936e25eaf966154ff122483.zip | |
Add tooltip to set default LPE widget
Diffstat (limited to 'src/live_effects/parameter')
32 files changed, 139 insertions, 1 deletions
diff --git a/src/live_effects/parameter/array.h b/src/live_effects/parameter/array.h index e65d3b55c..c66d53266 100644 --- a/src/live_effects/parameter/array.h +++ b/src/live_effects/parameter/array.h @@ -67,6 +67,10 @@ public: gchar * str = g_strdup(os.str().c_str()); return str; } + + virtual gchar * param_getDefaultSVGValue() const { + return g_strdup(""); + } void param_setValue(std::vector<StorageType> const &new_vector) { _vector = new_vector; diff --git a/src/live_effects/parameter/bool.cpp b/src/live_effects/parameter/bool.cpp index f291a8104..1a01f269b 100644 --- a/src/live_effects/parameter/bool.cpp +++ b/src/live_effects/parameter/bool.cpp @@ -61,6 +61,13 @@ BoolParam::param_getSVGValue() const return str; } +gchar * +BoolParam::param_getDefaultSVGValue() const +{ + gchar * str = g_strdup(defvalue ? "true" : "false"); + return str; +} + Gtk::Widget * BoolParam::param_newWidget() { diff --git a/src/live_effects/parameter/bool.h b/src/live_effects/parameter/bool.h index 417752050..1aa0e3c4a 100644 --- a/src/live_effects/parameter/bool.h +++ b/src/live_effects/parameter/bool.h @@ -32,6 +32,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() const; void param_setValue(bool newvalue); virtual void param_set_default(); diff --git a/src/live_effects/parameter/enum.h b/src/live_effects/parameter/enum.h index 78fa87a4f..ca237c0f7 100644 --- a/src/live_effects/parameter/enum.h +++ b/src/live_effects/parameter/enum.h @@ -64,7 +64,12 @@ public: gchar * str = g_strdup( enumdataconv->get_key(value).c_str() ); return str; }; - + + gchar * param_getDefaultSVGValue() const { + gchar * str = g_strdup( enumdataconv->get_key(defvalue).c_str() ); + return str; + }; + E get_value() const { return value; } diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp index ca8908f0e..49edb850a 100644 --- a/src/live_effects/parameter/fontbutton.cpp +++ b/src/live_effects/parameter/fontbutton.cpp @@ -55,6 +55,14 @@ FontButtonParam::param_getSVGValue() const return g_strdup(value.c_str()); } +gchar * +FontButtonParam::param_getDefaultSVGValue() const +{ + return g_strdup(defvalue.c_str()); +} + + + Gtk::Widget * FontButtonParam::param_newWidget() { diff --git a/src/live_effects/parameter/fontbutton.h b/src/live_effects/parameter/fontbutton.h index 60e1aa46e..e2d0e1bb2 100644 --- a/src/live_effects/parameter/fontbutton.h +++ b/src/live_effects/parameter/fontbutton.h @@ -28,6 +28,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); void param_update_default(const gchar * default_value); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() const; void param_setValue(Glib::ustring newvalue); diff --git a/src/live_effects/parameter/hidden.cpp b/src/live_effects/parameter/hidden.cpp index e8c55ebd3..e08881f6d 100644 --- a/src/live_effects/parameter/hidden.cpp +++ b/src/live_effects/parameter/hidden.cpp @@ -59,6 +59,15 @@ HiddenParam::param_getSVGValue() const return str; } +gchar * +HiddenParam::param_getDefaultSVGValue() const +{ + Inkscape::SVGOStringStream os; + os << defvalue; + gchar * str = g_strdup(os.str().c_str()); + return str; +} + Gtk::Widget * HiddenParam::param_newWidget() { diff --git a/src/live_effects/parameter/hidden.h b/src/live_effects/parameter/hidden.h index c3fba5575..b41c6c93c 100644 --- a/src/live_effects/parameter/hidden.h +++ b/src/live_effects/parameter/hidden.h @@ -37,6 +37,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() const; void param_setValue(Glib::ustring newvalue, bool write = false); virtual void param_set_default(); diff --git a/src/live_effects/parameter/item.cpp b/src/live_effects/parameter/item.cpp index 71134b118..149fd6627 100644 --- a/src/live_effects/parameter/item.cpp +++ b/src/live_effects/parameter/item.cpp @@ -104,6 +104,12 @@ ItemParam::param_getSVGValue() const return g_strdup(href); } +gchar * +ItemParam::param_getDefaultSVGValue() const +{ + return g_strdup(defvalue); +} + Gtk::Widget * ItemParam::param_newWidget() { diff --git a/src/live_effects/parameter/item.h b/src/live_effects/parameter/item.h index 89c32f9bd..b98294258 100644 --- a/src/live_effects/parameter/item.h +++ b/src/live_effects/parameter/item.h @@ -34,6 +34,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() const; virtual void param_set_default(); virtual void param_update_default(const gchar * default_value); diff --git a/src/live_effects/parameter/originalitemarray.cpp b/src/live_effects/parameter/originalitemarray.cpp index 24b002e18..83c237f2e 100644 --- a/src/live_effects/parameter/originalitemarray.cpp +++ b/src/live_effects/parameter/originalitemarray.cpp @@ -442,6 +442,11 @@ gchar * OriginalItemArrayParam::param_getSVGValue() const return str; } +gchar * OriginalItemArrayParam::param_getDefaultSVGValue() const +{ + return ""; +} + void OriginalItemArrayParam::update() { for (std::vector<ItemAndActive*>::iterator iter = _vector.begin(); iter != _vector.end(); ++iter) { diff --git a/src/live_effects/parameter/originalitemarray.h b/src/live_effects/parameter/originalitemarray.h index f600aba34..f93d865ec 100644 --- a/src/live_effects/parameter/originalitemarray.h +++ b/src/live_effects/parameter/originalitemarray.h @@ -62,6 +62,7 @@ public: virtual Gtk::Widget * param_newWidget(); virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() 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 */ diff --git a/src/live_effects/parameter/originalpatharray.cpp b/src/live_effects/parameter/originalpatharray.cpp index d67f08e5b..4535b6aa5 100644 --- a/src/live_effects/parameter/originalpatharray.cpp +++ b/src/live_effects/parameter/originalpatharray.cpp @@ -527,6 +527,11 @@ gchar * OriginalPathArrayParam::param_getSVGValue() const return str; } +gchar * OriginalPathArrayParam::param_getDefaultSVGValue() const +{ + return ""; +} + void OriginalPathArrayParam::update() { for (std::vector<PathAndDirectionAndVisible*>::iterator iter = _vector.begin(); iter != _vector.end(); ++iter) { diff --git a/src/live_effects/parameter/originalpatharray.h b/src/live_effects/parameter/originalpatharray.h index 0ba6984c2..c80d5daf3 100644 --- a/src/live_effects/parameter/originalpatharray.h +++ b/src/live_effects/parameter/originalpatharray.h @@ -66,6 +66,7 @@ public: virtual Gtk::Widget * param_newWidget(); virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() 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 */ diff --git a/src/live_effects/parameter/parameter.cpp b/src/live_effects/parameter/parameter.cpp index 2f73488aa..319ab3fe8 100644 --- a/src/live_effects/parameter/parameter.cpp +++ b/src/live_effects/parameter/parameter.cpp @@ -95,6 +95,15 @@ ScalarParam::param_getSVGValue() const return str; } +gchar * +ScalarParam::param_getDefaultSVGValue() const +{ + Inkscape::SVGOStringStream os; + os << defvalue; + gchar * str = g_strdup(os.str().c_str()); + return str; +} + void ScalarParam::param_set_default() { diff --git a/src/live_effects/parameter/parameter.h b/src/live_effects/parameter/parameter.h index 7ab7e30dd..1586ef346 100644 --- a/src/live_effects/parameter/parameter.h +++ b/src/live_effects/parameter/parameter.h @@ -57,6 +57,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue) = 0; // returns true if new value is valid / accepted. virtual gchar * param_getSVGValue() const = 0; + virtual gchar * param_getDefaultSVGValue() const = 0; virtual void param_widget_is_visible(bool is_visible) {widget_is_visible = is_visible;} void write_to_SVG(); @@ -109,6 +110,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() const; virtual void param_set_default(); void param_update_default(gdouble default_value); diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index a91e50db8..bd6608737 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -173,6 +173,12 @@ PathParam::param_getSVGValue() const } } +gchar * +PathParam::param_getDefaultSVGValue() const +{ + return g_strdup(defvalue); +} + void PathParam::set_buttons(bool edit_button, bool copy_button, bool paste_button, bool link_button) { diff --git a/src/live_effects/parameter/path.h b/src/live_effects/parameter/path.h index c8efb11e0..635056772 100644 --- a/src/live_effects/parameter/path.h +++ b/src/live_effects/parameter/path.h @@ -38,6 +38,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() const; virtual void param_set_default(); virtual void param_update_default(const gchar * default_value); diff --git a/src/live_effects/parameter/point.cpp b/src/live_effects/parameter/point.cpp index 331a86f81..da6edf812 100644 --- a/src/live_effects/parameter/point.cpp +++ b/src/live_effects/parameter/point.cpp @@ -115,6 +115,15 @@ PointParam::param_getSVGValue() const return str; } +gchar * +PointParam::param_getDefaultSVGValue() const +{ + Inkscape::SVGOStringStream os; + os << defvalue; + gchar * str = g_strdup(os.str().c_str()); + return str; +} + void PointParam::param_transform_multiply(Geom::Affine const& postmul, bool /*set*/) { diff --git a/src/live_effects/parameter/point.h b/src/live_effects/parameter/point.h index a5153ad80..03256f6d0 100644 --- a/src/live_effects/parameter/point.h +++ b/src/live_effects/parameter/point.h @@ -38,6 +38,7 @@ public: bool param_readSVGValue(const gchar * strvalue); gchar * param_getSVGValue() const; + gchar * param_getDefaultSVGValue() const; inline const gchar *handleTip() const { return handle_tip ? handle_tip : param_tooltip.c_str(); } void param_setValue(Geom::Point newpoint, bool write = false); void param_set_default(); diff --git a/src/live_effects/parameter/random.cpp b/src/live_effects/parameter/random.cpp index b1375adda..c2c1b5440 100644 --- a/src/live_effects/parameter/random.cpp +++ b/src/live_effects/parameter/random.cpp @@ -71,6 +71,15 @@ RandomParam::param_getSVGValue() const return str; } +gchar * +RandomParam::param_getDefaultSVGValue() const +{ + Inkscape::SVGOStringStream os; + os << defvalue << ';' << defseed; + gchar * str = g_strdup(os.str().c_str()); + return str; +} + void RandomParam::param_set_default() { diff --git a/src/live_effects/parameter/random.h b/src/live_effects/parameter/random.h index 5fb6027ac..c10473e85 100644 --- a/src/live_effects/parameter/random.h +++ b/src/live_effects/parameter/random.h @@ -31,6 +31,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() const; virtual void param_set_default(); virtual Gtk::Widget * param_newWidget(); diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index f40708917..3f41bfeed 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -115,6 +115,15 @@ TextParam::param_getSVGValue() const return str; } +gchar * +TextParam::param_getDefaultSVGValue() const +{ + Inkscape::SVGOStringStream os; + os << defvalue; + gchar * str = g_strdup(os.str().c_str()); + return str; +} + Gtk::Widget * TextParam::param_newWidget() { diff --git a/src/live_effects/parameter/text.h b/src/live_effects/parameter/text.h index 137f3ee02..460ef8629 100644 --- a/src/live_effects/parameter/text.h +++ b/src/live_effects/parameter/text.h @@ -38,6 +38,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() const; void param_setValue(Glib::ustring newvalue); void param_hide_canvas_text(); diff --git a/src/live_effects/parameter/togglebutton.cpp b/src/live_effects/parameter/togglebutton.cpp index 6aad8b3a6..16b8f9067 100644 --- a/src/live_effects/parameter/togglebutton.cpp +++ b/src/live_effects/parameter/togglebutton.cpp @@ -59,6 +59,13 @@ ToggleButtonParam::param_getSVGValue() const return str; } +gchar * +ToggleButtonParam::param_getDefaultSVGValue() const +{ + gchar * str = g_strdup(defvalue ? "true" : "false"); + return str; +} + void ToggleButtonParam::param_update_default(bool default_value) { diff --git a/src/live_effects/parameter/togglebutton.h b/src/live_effects/parameter/togglebutton.h index 02b9d5127..4d043b340 100644 --- a/src/live_effects/parameter/togglebutton.h +++ b/src/live_effects/parameter/togglebutton.h @@ -41,6 +41,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() const; void param_setValue(bool newvalue); virtual void param_set_default(); diff --git a/src/live_effects/parameter/transformedpoint.cpp b/src/live_effects/parameter/transformedpoint.cpp index 22d5ba3a4..6ec2d0943 100644 --- a/src/live_effects/parameter/transformedpoint.cpp +++ b/src/live_effects/parameter/transformedpoint.cpp @@ -82,6 +82,15 @@ TransformedPointParam::param_getSVGValue() const return str; } +gchar * +TransformedPointParam::param_getDefaultSVGValue() const +{ + Inkscape::SVGOStringStream os; + os << defvalue; + gchar * str = g_strdup(os.str().c_str()); + return str; +} + void TransformedPointParam::param_update_default(Geom::Point default_point) { diff --git a/src/live_effects/parameter/transformedpoint.h b/src/live_effects/parameter/transformedpoint.h index 269cc508e..8b92d81ba 100644 --- a/src/live_effects/parameter/transformedpoint.h +++ b/src/live_effects/parameter/transformedpoint.h @@ -37,6 +37,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() const; Geom::Point getVector() const { return vector; }; Geom::Point getOrigin() const { return origin; }; diff --git a/src/live_effects/parameter/unit.cpp b/src/live_effects/parameter/unit.cpp index b9b91c1e6..9199e592d 100644 --- a/src/live_effects/parameter/unit.cpp +++ b/src/live_effects/parameter/unit.cpp @@ -48,6 +48,12 @@ UnitParam::param_getSVGValue() const return g_strdup(unit->abbr.c_str()); } +gchar * +UnitParam::param_getDefaultSVGValue() const +{ + return g_strdup(defunit->abbr.c_str()); +} + void UnitParam::param_set_default() { diff --git a/src/live_effects/parameter/unit.h b/src/live_effects/parameter/unit.h index c662b6edc..86e1a24b3 100644 --- a/src/live_effects/parameter/unit.h +++ b/src/live_effects/parameter/unit.h @@ -31,6 +31,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() const; virtual void param_set_default(); void param_set_value(Inkscape::Util::Unit const &val); virtual void param_update_default(const gchar * default_unit); diff --git a/src/live_effects/parameter/vector.cpp b/src/live_effects/parameter/vector.cpp index 470fa9c2d..6b565536e 100644 --- a/src/live_effects/parameter/vector.cpp +++ b/src/live_effects/parameter/vector.cpp @@ -101,6 +101,15 @@ VectorParam::param_getSVGValue() const return str; } +gchar * +VectorParam::param_getDefaultSVGValue() const +{ + Inkscape::SVGOStringStream os; + os << defvalue; + gchar * str = g_strdup(os.str().c_str()); + return str; +} + Gtk::Widget * VectorParam::param_newWidget() { diff --git a/src/live_effects/parameter/vector.h b/src/live_effects/parameter/vector.h index d270e9f43..8c842e805 100644 --- a/src/live_effects/parameter/vector.h +++ b/src/live_effects/parameter/vector.h @@ -36,6 +36,7 @@ public: virtual bool param_readSVGValue(const gchar * strvalue); virtual gchar * param_getSVGValue() const; + virtual gchar * param_getDefaultSVGValue() const; Geom::Point getVector() const { return vector; }; Geom::Point getOrigin() const { return origin; }; |
