From 6ac79a669ea08356806bd130d1426871473b0b71 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sun, 31 Jul 2016 16:02:08 +0200 Subject: Add options to fit on DIN (bzr r15017.1.16) --- src/live_effects/parameter/text.cpp | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) (limited to 'src/live_effects/parameter/text.cpp') diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 234a6174d..e51cf93ab 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -31,7 +31,8 @@ TextParam::TextParam( const Glib::ustring& label, const Glib::ustring& tip, Effect* effect, const Glib::ustring default_value ) : Parameter(label, tip, key, wr, effect), value(default_value), - defvalue(default_value) + defvalue(default_value), + _hide_canvas_text(false) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; // FIXME: we shouldn't use this! canvas_text = (SPCanvasText *) sp_canvastext_new(desktop->getTempGroup(), desktop, Geom::Point(0,0), ""); @@ -45,10 +46,25 @@ TextParam::param_set_default() param_setValue(defvalue); } +void +TextParam::param_update_default(Glib::ustring default_value) +{ + defvalue = default_value; +} + +void +TextParam::param_hide_canvas_text() +{ + _hide_canvas_text = true; + sp_canvastext_set_text (canvas_text,""); +} + void TextParam::setPos(Geom::Point pos) { - sp_canvastext_set_coords (canvas_text, pos); + if (!_hide_canvas_text) { + sp_canvastext_set_coords (canvas_text, pos); + } } void @@ -63,9 +79,10 @@ TextParam::setPosAndAnchor(const Geom::Piecewise > &pwd2, Point dir = unit_vector(derivative(pwd2_reparam).valueAt(t_reparam)); Point n = -rot90(dir); double angle = Geom::angle_between(dir, Point(1,0)); - - sp_canvastext_set_coords(canvas_text, pos + n * length); - sp_canvastext_set_anchor_manually(canvas_text, std::sin(angle), -std::cos(angle)); + if (!_hide_canvas_text) { + sp_canvastext_set_coords(canvas_text, pos + n * length); + sp_canvastext_set_anchor_manually(canvas_text, std::sin(angle), -std::cos(angle)); + } } void @@ -73,7 +90,9 @@ TextParam::setAnchor(double x_value, double y_value) { anchor_x = x_value; anchor_y = y_value; - sp_canvastext_set_anchor_manually (canvas_text, anchor_x, anchor_y); + if (!_hide_canvas_text) { + sp_canvastext_set_anchor_manually (canvas_text, anchor_x, anchor_y); + } } bool @@ -107,8 +126,9 @@ void TextParam::param_setValue(const Glib::ustring newvalue) { value = newvalue; - - sp_canvastext_set_text (canvas_text, newvalue.c_str()); + if (!_hide_canvas_text) { + sp_canvastext_set_text (canvas_text, newvalue.c_str()); + } } } /* namespace LivePathEffect */ -- cgit v1.2.3 From 28d25258de5d2274382dbb592f62e21ca8f91729 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Mon, 1 Aug 2016 00:47:38 +0200 Subject: Fix text param and alow run from commandline (bzr r15017.1.21) --- src/live_effects/parameter/text.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/live_effects/parameter/text.cpp') diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index e51cf93ab..0650b7e66 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -34,10 +34,13 @@ TextParam::TextParam( const Glib::ustring& label, const Glib::ustring& tip, defvalue(default_value), _hide_canvas_text(false) { - SPDesktop *desktop = SP_ACTIVE_DESKTOP; // FIXME: we shouldn't use this! - canvas_text = (SPCanvasText *) sp_canvastext_new(desktop->getTempGroup(), desktop, Geom::Point(0,0), ""); - sp_canvastext_set_text (canvas_text, default_value.c_str()); - sp_canvastext_set_coords (canvas_text, 0, 0); + if (SPDesktop *desktop = SP_ACTIVE_DESKTOP) { // FIXME: we shouldn't use this! + canvas_text = (SPCanvasText *) sp_canvastext_new(desktop->getTempGroup(), desktop, Geom::Point(0,0), ""); + sp_canvastext_set_text (canvas_text, default_value.c_str()); + sp_canvastext_set_coords (canvas_text, 0, 0); + } else { + _hide_canvas_text = true; + } } void @@ -55,8 +58,10 @@ TextParam::param_update_default(Glib::ustring default_value) void TextParam::param_hide_canvas_text() { - _hide_canvas_text = true; - sp_canvastext_set_text (canvas_text,""); + if (!_hide_canvas_text) { + sp_canvastext_set_text(canvas_text, " "); + _hide_canvas_text = true; + } } void @@ -113,8 +118,7 @@ TextParam::param_newWidget() { Inkscape::UI::Widget::RegisteredText *rsu = Gtk::manage(new Inkscape::UI::Widget::RegisteredText( param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc())); - - rsu->setText(value.c_str()); + rsu->setText(value); rsu->setProgrammatically = false; rsu->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change text parameter")); -- cgit v1.2.3 From f799b5d6e8278c76326a6fec8da0e017eac342ec Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Tue, 6 Dec 2016 21:41:55 +0100 Subject: Fixes for measure LPE and speed path based LPE operations (bzr r15302) --- src/live_effects/parameter/text.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/live_effects/parameter/text.cpp') diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 0650b7e66..8cab68ad0 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -110,7 +110,10 @@ TextParam::param_readSVGValue(const gchar * strvalue) gchar * TextParam::param_getSVGValue() const { - return g_strdup(value.c_str()); + Inkscape::SVGOStringStream os; + os << value; + gchar * str = g_strdup(os.str().c_str()); + return str; } Gtk::Widget * -- cgit v1.2.3 From 7bedd224ace433cf4c1a829ba38f6a3c388227e6 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Thu, 5 Jan 2017 20:03:50 +0100 Subject: Adding base (bzr r15392.1.1) --- src/live_effects/parameter/text.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/live_effects/parameter/text.cpp') diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 8cab68ad0..5c4cdf4c6 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -125,13 +125,14 @@ 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 (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()); -- cgit v1.2.3 From 3103b99b4cf6c1048c89f75e280761d8cd0ca1c2 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sat, 15 Apr 2017 00:20:13 +0200 Subject: Allow set and reset default values of LPE parameters (bzr r15620.1.1) --- src/live_effects/parameter/text.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/live_effects/parameter/text.cpp') diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 5c4cdf4c6..8d526e4cc 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 @@ -130,7 +130,7 @@ TextParam::param_newWidget() } void -TextParam::param_setValue(const Glib::ustring newvalue) +TextParam::param_setValue(Glib::ustring newvalue) { param_effect->upd_params = true; value = newvalue; -- cgit v1.2.3 From 18e032118bbb1718778c6f2e5e55cdb1723dc1ce Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Thu, 27 Apr 2017 12:05:03 +0200 Subject: Add end of preferences GUI (bzr r15620.1.6) --- src/live_effects/parameter/text.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/live_effects/parameter/text.cpp') diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 8d526e4cc..5c56e8447 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -119,8 +119,18 @@ 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( - param_label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc())); + label, param_tooltip, param_key, *param_wr, param_effect->getRepr(), param_effect->getSPDoc())); rsu->setText(value); rsu->setProgrammatically = false; -- cgit v1.2.3 From 52054e24f8b98c07753588c726a1e777bad7245b Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Fri, 28 Apr 2017 21:42:36 +0200 Subject: Reset (bzr r15620.1.9) --- src/live_effects/parameter/text.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'src/live_effects/parameter/text.cpp') 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; -- cgit v1.2.3 From e5601e5e84df30c40d93271fd69cecd31391e309 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sat, 29 Apr 2017 02:01:22 +0200 Subject: Rewrite UX (bzr r15620.1.12) --- src/live_effects/parameter/text.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/live_effects/parameter/text.cpp') diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 5c4cdf4c6..84603149e 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 -- cgit v1.2.3 From a3d1689c18ebf132acb7ae0501ec419a71e48a85 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Mon, 1 May 2017 03:15:26 +0200 Subject: Fix erase lpe in multi LPE mode Improve rendering widgets, simplify the code, redraw widgets each time not only on odd iterations (bzr r15655) --- src/live_effects/parameter/text.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/live_effects/parameter/text.cpp') diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 5c4cdf4c6..47fbd39af 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -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 (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()); -- cgit v1.2.3 From 79778c1b0a01926c1f43065525ef55a55e11587c Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sat, 6 May 2017 01:11:06 +0200 Subject: LPE widget refactor. Improvement to not update on same value (bzr r15665) --- src/live_effects/parameter/text.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/live_effects/parameter/text.cpp') diff --git a/src/live_effects/parameter/text.cpp b/src/live_effects/parameter/text.cpp index 4062a4dc7..d633666aa 100644 --- a/src/live_effects/parameter/text.cpp +++ b/src/live_effects/parameter/text.cpp @@ -131,6 +131,9 @@ TextParam::param_newWidget() void TextParam::param_setValue(const Glib::ustring newvalue) { + if (value != newvalue) { + param_effect->upd_params = true; + } value = newvalue; if (!_hide_canvas_text) { sp_canvastext_set_text (canvas_text, newvalue.c_str()); -- cgit v1.2.3