From d60fb000cfc3717ef51b716d9ccb9b63ecb38aa8 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Sat, 30 Jul 2016 01:44:17 +0200 Subject: Remove font-Dialog and useGtk::FontSelector instead (bzr r15017.1.13) --- src/live_effects/parameter/fontbutton.cpp | 92 +++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100644 src/live_effects/parameter/fontbutton.cpp (limited to 'src/live_effects/parameter/fontbutton.cpp') diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp new file mode 100644 index 000000000..ff8ab76a0 --- /dev/null +++ b/src/live_effects/parameter/fontbutton.cpp @@ -0,0 +1,92 @@ +/* + * Authors: + * + * Released under GNU GPL, read the file 'COPYING' for more information + */ + + +#include "ui/widget/registered-widget.h" +#include "live_effects/parameter/fontbutton.h" +#include "live_effects/effect.h" +#include "ui/widget/font-button.h" +#include "svg/svg.h" +#include "svg/stringstream.h" +#include "verbs.h" + +#include + +namespace Inkscape { + +namespace LivePathEffect { + +FontButtonParam::FontButtonParam( const Glib::ustring& label, const Glib::ustring& tip, + const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr, + Effect* effect, const Glib::ustring default_value ) + : Parameter(label, tip, key, wr, effect), + value(default_value), + defvalue(default_value) +{ +} + +void +FontButtonParam::param_set_default() +{ + param_setValue(defvalue); +} +void +FontButtonParam::param_update_default(const Glib::ustring default_value){ + defvalue = default_value; +} + +bool +FontButtonParam::param_readSVGValue(const gchar * strvalue) +{ + Inkscape::SVGOStringStream os; + os << strvalue; + param_setValue((Glib::ustring)os.str()); + return true; +} + +gchar * +FontButtonParam::param_getSVGValue() const +{ + return g_strdup(value.c_str()); +} + +Gtk::Widget * +FontButtonParam::param_newWidget() +{ + Inkscape::UI::Widget::RegisteredFontButton * fontbuttonwdg = Gtk::manage( + new Inkscape::UI::Widget::RegisteredFontButton( param_label, + param_tooltip, + param_key, + *param_wr, + param_effect->getRepr(), + param_effect->getSPDoc() ) ); + 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 (fontbuttonwdg); +} + +void +FontButtonParam::param_setValue(const Glib::ustring newvalue) +{ + value = newvalue; +} + +} /* namespace LivePathEffect */ + +} /* namespace Inkscape */ + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 : -- cgit v1.2.3 From e973e1fc03c1b10c52a21af5f354f63b0f6624bd Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Sat, 10 Dec 2016 17:15:17 +0100 Subject: Fix headers on LPE's (bzr r15318) --- src/live_effects/parameter/fontbutton.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/live_effects/parameter/fontbutton.cpp') diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp index ff8ab76a0..64c203093 100644 --- a/src/live_effects/parameter/fontbutton.cpp +++ b/src/live_effects/parameter/fontbutton.cpp @@ -4,7 +4,7 @@ * Released under GNU GPL, read the file 'COPYING' for more information */ - +#include #include "ui/widget/registered-widget.h" #include "live_effects/parameter/fontbutton.h" #include "live_effects/effect.h" -- 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/fontbutton.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'src/live_effects/parameter/fontbutton.cpp') diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp index 64c203093..53b8c0612 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 @@ -63,7 +65,7 @@ FontButtonParam::param_newWidget() *param_wr, param_effect->getRepr(), param_effect->getSPDoc() ) ); - Glib::ustring fontspec = param_getSVGValue(); + Glib::ustring fontspec = (Glib::ustring)param_getSVGValue(); fontbuttonwdg->setValue( fontspec); fontbuttonwdg->set_undo_parameters(SP_VERB_DIALOG_LIVE_PATH_EFFECT, _("Change font button parameter")); param_effect->upd_params = false; @@ -71,11 +73,12 @@ FontButtonParam::param_newWidget() } void -FontButtonParam::param_setValue(const Glib::ustring newvalue) +FontButtonParam::param_setValue(Glib::ustring newvalue) { value = newvalue; } + } /* namespace LivePathEffect */ } /* namespace Inkscape */ -- cgit v1.2.3 From af42d5456d7f523d6cb259d0e2921234aa887146 Mon Sep 17 00:00:00 2001 From: Jabiertxof Date: Thu, 27 Apr 2017 01:06:31 +0200 Subject: Add LPE prefs dialog (bzr r15620.1.4) --- src/live_effects/parameter/fontbutton.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/live_effects/parameter/fontbutton.cpp') diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp index 53b8c0612..ee76c4ab9 100644 --- a/src/live_effects/parameter/fontbutton.cpp +++ b/src/live_effects/parameter/fontbutton.cpp @@ -58,8 +58,18 @@ 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( param_label, + new Inkscape::UI::Widget::RegisteredFontButton( label, param_tooltip, param_key, *param_wr, -- 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/fontbutton.cpp | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) (limited to 'src/live_effects/parameter/fontbutton.cpp') 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 */ -- 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/fontbutton.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/live_effects/parameter/fontbutton.cpp') diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp index 64c203093..5ec98df8c 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 @@ -76,6 +78,7 @@ FontButtonParam::param_setValue(const Glib::ustring newvalue) value = newvalue; } + } /* namespace LivePathEffect */ } /* namespace Inkscape */ -- 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/fontbutton.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/live_effects/parameter/fontbutton.cpp') diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp index 64c203093..baf24d77c 100644 --- a/src/live_effects/parameter/fontbutton.cpp +++ b/src/live_effects/parameter/fontbutton.cpp @@ -66,7 +66,6 @@ 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 (fontbuttonwdg); } -- cgit v1.2.3 From 561ec7df77bc2e499dc525d987a8be4552e9ea41 Mon Sep 17 00:00:00 2001 From: Jabier Arraiza Cenoz Date: Fri, 5 May 2017 16:41:34 +0200 Subject: Improve responsive from LPE Fixed bugs: - https://launchpad.net/bugs/1688168 (bzr r15662) --- src/live_effects/parameter/fontbutton.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/live_effects/parameter/fontbutton.cpp') diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp index baf24d77c..31534fba0 100644 --- a/src/live_effects/parameter/fontbutton.cpp +++ b/src/live_effects/parameter/fontbutton.cpp @@ -72,6 +72,7 @@ FontButtonParam::param_newWidget() void FontButtonParam::param_setValue(const Glib::ustring newvalue) { + param_effect->upd_params = true; value = newvalue; } -- 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/fontbutton.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/live_effects/parameter/fontbutton.cpp') diff --git a/src/live_effects/parameter/fontbutton.cpp b/src/live_effects/parameter/fontbutton.cpp index 5add69c1d..ca8908f0e 100644 --- a/src/live_effects/parameter/fontbutton.cpp +++ b/src/live_effects/parameter/fontbutton.cpp @@ -74,7 +74,9 @@ FontButtonParam::param_newWidget() void FontButtonParam::param_setValue(const Glib::ustring newvalue) { - param_effect->upd_params = true; + if (value != newvalue) { + param_effect->upd_params = true; + } value = newvalue; } -- cgit v1.2.3