summaryrefslogtreecommitdiffstats
path: root/src/live_effects
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2019-10-12 19:37:49 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2019-10-12 19:37:49 +0000
commit2b52075bb40c00807fbf42c9f7d62dada27525ac (patch)
tree59fac6f4062823f7ae62e44529c9763479f13a78 /src/live_effects
parentRevert "Remove unused "nopref" variant of effects" (diff)
downloadinkscape-2b52075bb40c00807fbf42c9f7d62dada27525ac.tar.gz
inkscape-2b52075bb40c00807fbf42c9f7d62dada27525ac.zip
Add icons to show help in set defauls LPE parameters
Diffstat (limited to 'src/live_effects')
-rw-r--r--src/live_effects/effect.cpp50
-rw-r--r--src/live_effects/effect.h15
-rw-r--r--src/live_effects/lpe-simplify.cpp4
-rw-r--r--src/live_effects/lpe-transform_2pts.cpp12
-rw-r--r--src/live_effects/parameter/path.cpp8
5 files changed, 54 insertions, 35 deletions
diff --git a/src/live_effects/effect.cpp b/src/live_effects/effect.cpp
index 647394fb4..0b65b7e1c 100644
--- a/src/live_effects/effect.cpp
+++ b/src/live_effects/effect.cpp
@@ -74,13 +74,14 @@
#include "xml/node-event-vector.h"
#include "xml/sp-css-attr.h"
-#include "message-stack.h"
-#include "ui/tools/pen-tool.h"
-#include "ui/tools/node-tool.h"
-#include "ui/tools-switch.h"
+#include "display/curve.h"
#include "knotholder.h"
+#include "message-stack.h"
#include "path-chemistry.h"
-#include "display/curve.h"
+#include "ui/icon-loader.h"
+#include "ui/tools-switch.h"
+#include "ui/tools/node-tool.h"
+#include "ui/tools/pen-tool.h"
#include "object/sp-defs.h"
#include "object/sp-shape.h"
@@ -1523,6 +1524,12 @@ Effect::newWidget()
return dynamic_cast<Gtk::Widget *>(vbox);
}
+bool sp_enter_tooltip(GdkEventCrossing *evt, Gtk::Widget *widg)
+{
+ widg->trigger_tooltip_query();
+ return true;
+}
+
/**
* This *creates* a new widget, with default values setter
*/
@@ -1561,18 +1568,27 @@ Effect::defaultParamSet()
ove = Glib::ustring(_("<b>Default value overridden:</b> None\n"));
}
Gtk::HBox * vbox_param = Gtk::manage( new Gtk::HBox(true) );
+ Gtk::HBox *namedicon = Gtk::manage(new Gtk::HBox(true));
Gtk::Label *parameter_label = Gtk::manage(new Gtk::Label(label, Gtk::ALIGN_START));
parameter_label->set_use_markup(true);
parameter_label->set_use_underline(true);
- Glib::ustring tooltip = Glib::ustring("<b>") + parameter_label->get_text () + Glib::ustring("</b>\n") + param->param_tooltip + Glib::ustring("\n\n");
parameter_label->set_ellipsize(Pango::ELLIPSIZE_END);
- parameter_label->set_tooltip_markup((tooltip + def + ove).c_str());
- vbox_param->pack_start(*parameter_label, true, true, 2);
+ Glib::ustring tooltip = Glib::ustring("<b>") + parameter_label->get_text() + Glib::ustring("</b>\n") +
+ param->param_tooltip + Glib::ustring("\n\n");
+ Gtk::Image *info = sp_get_icon_image("info", 20);
+ Gtk::EventBox *infoeventbox = Gtk::manage(new Gtk::EventBox());
+ infoeventbox->add(*info);
+ infoeventbox->set_tooltip_markup((tooltip + def + ove).c_str());
+ namedicon->pack_start(*infoeventbox, false, false, 2);
+ namedicon->pack_start(*parameter_label, true, true, 2);
+ namedicon->set_homogeneous(false);
+ vbox_param->pack_start(*namedicon, true, true, 2);
Gtk::Button *set = Gtk::manage(new Gtk::Button((Glib::ustring)set_or_upd));
Gtk::Button *unset = Gtk::manage(new Gtk::Button(Glib::ustring(_("Unset"))));
- unset->signal_clicked().connect(sigc::bind<Glib::ustring, Glib::ustring, Parameter *, Gtk::Label *, Gtk::Button *, Gtk::Button *>(sigc::mem_fun(*this, &Effect::unsetDefaultParam), pref_path, tooltip, param, parameter_label, set, unset));
-
- set->signal_clicked().connect(sigc::bind<Glib::ustring, Glib::ustring, Parameter *, Gtk::Label *, Gtk::Button *, Gtk::Button *>(sigc::mem_fun(*this, &Effect::setDefaultParam), pref_path, tooltip, param, parameter_label, set, unset));
+ unset->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &Effect::unsetDefaultParam), pref_path,
+ tooltip, param, info, set, unset));
+ set->signal_clicked().connect(sigc::bind(sigc::mem_fun(*this, &Effect::setDefaultParam), pref_path, tooltip,
+ param, info, set, unset));
if (!valid) {
unset->set_sensitive(false);
}
@@ -1605,8 +1621,8 @@ Effect::onDefaultsExpanderChanged(Gtk::Expander * expander)
defaultsopen = expander->get_expanded();
}
-void
-Effect::setDefaultParam(Glib::ustring pref_path, Glib::ustring tooltip, Parameter *param, Gtk::Label *parameter_label, Gtk::Button *set , Gtk::Button *unset)
+void Effect::setDefaultParam(Glib::ustring pref_path, Glib::ustring tooltip, Parameter *param, Gtk::Image *info,
+ Gtk::Button *set, Gtk::Button *unset)
{
Glib::ustring value = param->param_getSVGValue();
Glib::ustring defvalue = param->param_getDefaultSVGValue();
@@ -1617,11 +1633,11 @@ Effect::setDefaultParam(Glib::ustring pref_path, Glib::ustring tooltip, Paramete
unset->set_sensitive(true);
Glib::ustring def = Glib::ustring(_("<b>Default value:</b> <s>")) + defvalue + Glib::ustring("</s>\n");
Glib::ustring ove = Glib::ustring(_("<b>Default value overridden:</b> ")) + value + Glib::ustring("\n");
- parameter_label->set_tooltip_markup((tooltip + def + ove).c_str());
+ info->set_tooltip_markup((tooltip + def + ove).c_str());
}
-void
-Effect::unsetDefaultParam(Glib::ustring pref_path, Glib::ustring tooltip, Parameter *param, Gtk::Label *parameter_label, Gtk::Button *set, Gtk::Button *unset)
+void Effect::unsetDefaultParam(Glib::ustring pref_path, Glib::ustring tooltip, Parameter *param, Gtk::Image *info,
+ Gtk::Button *set, Gtk::Button *unset)
{
Glib::ustring value = param->param_getSVGValue();
Glib::ustring defvalue = param->param_getDefaultSVGValue();
@@ -1632,7 +1648,7 @@ Effect::unsetDefaultParam(Glib::ustring pref_path, Glib::ustring tooltip, Parame
unset->set_sensitive(false);
Glib::ustring def = Glib::ustring(_("<b>Default value:</b> ")) + defvalue + Glib::ustring("\n");
Glib::ustring ove = Glib::ustring(_("<b>Default value overridden:</b> None\n"));
- parameter_label->set_tooltip_markup((tooltip + def + ove).c_str());
+ info->set_tooltip_markup((tooltip + def + ove).c_str());
}
Inkscape::XML::Node *Effect::getRepr()
diff --git a/src/live_effects/effect.h b/src/live_effects/effect.h
index de237b8bb..f3b315c0f 100644
--- a/src/live_effects/effect.h
+++ b/src/live_effects/effect.h
@@ -8,12 +8,13 @@
* Released under GNU GPL v2+, read the file 'COPYING' for more information.
*/
-#include <glibmm/ustring.h>
-#include <2geom/forward.h>
+#include "effect-enum.h"
+#include "parameter/bool.h"
#include "ui/widget/registry.h"
+#include <2geom/forward.h>
+#include <glibmm/ustring.h>
+#include <gtkmm/eventbox.h>
#include <gtkmm/expander.h>
-#include "parameter/bool.h"
-#include "effect-enum.h"
#define LPE_CONVERSION_TOLERANCE 0.01 // FIXME: find good solution for this.
@@ -185,8 +186,10 @@ public:
private:
void onDefaultsExpanderChanged(Gtk::Expander * expander);
- void setDefaultParam(Glib::ustring pref_path, Glib::ustring tooltip, Parameter *param, Gtk::Label *parameter_label, Gtk::Button *set , Gtk::Button *unset);
- void unsetDefaultParam(Glib::ustring pref_path, Glib::ustring tooltip, Parameter *param, Gtk::Label *parameter_label, Gtk::Button *set , Gtk::Button *unset);
+ void setDefaultParam(Glib::ustring pref_path, Glib::ustring tooltip, Parameter *param, Gtk::Image *info,
+ Gtk::Button *set, Gtk::Button *unset);
+ void unsetDefaultParam(Glib::ustring pref_path, Glib::ustring tooltip, Parameter *param, Gtk::Image *info,
+ Gtk::Button *set, Gtk::Button *unset);
bool provides_own_flash_paths; // if true, the standard flash path is suppressed
bool is_ready;
diff --git a/src/live_effects/lpe-simplify.cpp b/src/live_effects/lpe-simplify.cpp
index f101e63f2..3b6ca85d4 100644
--- a/src/live_effects/lpe-simplify.cpp
+++ b/src/live_effects/lpe-simplify.cpp
@@ -26,9 +26,9 @@ LPESimplify::LPESimplify(LivePathEffectObject *lpeobject)
&wr, this, 0.)
, helper_size(_("Helper size:"), _("Helper size"), "helper_size", &wr, this, 5)
, simplify_individual_paths(_("Paths separately"), _("Simplifying paths (separately)"), "simplify_individual_paths",
- &wr, this, false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off"))
+ &wr, this, false, "", INKSCAPE_ICON("on-outline"), INKSCAPE_ICON("off-outline"))
, simplify_just_coalesce(_("Just coalesce"), _("Simplify just coalesce"), "simplify_just_coalesce", &wr, this,
- false, "", INKSCAPE_ICON("on"), INKSCAPE_ICON("off"))
+ false, "", INKSCAPE_ICON("on-outline"), INKSCAPE_ICON("off-outline"))
{
registerParameter(&steps);
registerParameter(&threshold);
diff --git a/src/live_effects/lpe-transform_2pts.cpp b/src/live_effects/lpe-transform_2pts.cpp
index b6548a13c..81b167ebf 100644
--- a/src/live_effects/lpe-transform_2pts.cpp
+++ b/src/live_effects/lpe-transform_2pts.cpp
@@ -29,12 +29,12 @@ namespace LivePathEffect {
LPETransform2Pts::LPETransform2Pts(LivePathEffectObject *lpeobject) :
Effect(lpeobject),
- elastic(_("Elastic"), _("Elastic transform mode"), "elastic", &wr, this, false,"", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")),
- from_original_width(_("From original width"), _("From original width"), "from_original_width", &wr, this, false,"", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")),
- lock_length(_("Lock length"), _("Lock length to current distance"), "lock_length", &wr, this, false,"", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")),
- lock_angle(_("Lock angle"), _("Lock angle"), "lock_angle", &wr, this, false,"", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")),
- flip_horizontal(_("Flip horizontal"), _("Flip horizontal"), "flip_horizontal", &wr, this, false,"", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")),
- flip_vertical(_("Flip vertical"), _("Flip vertical"), "flip_vertical", &wr, this, false,"", INKSCAPE_ICON("on"), INKSCAPE_ICON("off")),
+ elastic(_("Elastic"), _("Elastic transform mode"), "elastic", &wr, this, false,"", INKSCAPE_ICON("on-outline"), INKSCAPE_ICON("off-outline")),
+ from_original_width(_("From original width"), _("From original width"), "from_original_width", &wr, this, false,"", INKSCAPE_ICON("on-outline"), INKSCAPE_ICON("off-outline")),
+ lock_length(_("Lock length"), _("Lock length to current distance"), "lock_length", &wr, this, false,"", INKSCAPE_ICON("on-outline"), INKSCAPE_ICON("off-outline")),
+ lock_angle(_("Lock angle"), _("Lock angle"), "lock_angle", &wr, this, false,"", INKSCAPE_ICON("on-outline"), INKSCAPE_ICON("off-outline")),
+ flip_horizontal(_("Flip horizontal"), _("Flip horizontal"), "flip_horizontal", &wr, this, false,"", INKSCAPE_ICON("on-outline"), INKSCAPE_ICON("off-outline")),
+ flip_vertical(_("Flip vertical"), _("Flip vertical"), "flip_vertical", &wr, this, false,"", INKSCAPE_ICON("on-outline"), INKSCAPE_ICON("off-outline")),
start(_("Start"), _("Start point"), "start", &wr, this, "Start point"),
end(_("End"), _("End point"), "end", &wr, this, "End point"),
stretch(_("Stretch"), _("Stretch the result"), "stretch", &wr, this, 1),
diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp
index b8d73a122..15471ae44 100644
--- a/src/live_effects/parameter/path.cpp
+++ b/src/live_effects/parameter/path.cpp
@@ -210,7 +210,7 @@ PathParam::param_newWidget()
Gtk::Image * pIcon = nullptr;
Gtk::Button * pButton = nullptr;
if (_edit_button) {
- pIcon = Gtk::manage(sp_get_icon_image(INKSCAPE_ICON("tool-node-editor"), Gtk::ICON_SIZE_BUTTON));
+ pIcon = Gtk::manage(sp_get_icon_image("tool-node-editor", Gtk::ICON_SIZE_BUTTON));
pButton = Gtk::manage(new Gtk::Button());
pButton->set_relief(Gtk::RELIEF_NONE);
pIcon->show();
@@ -222,7 +222,7 @@ PathParam::param_newWidget()
}
if (_copy_button) {
- pIcon = Gtk::manage(sp_get_icon_image(INKSCAPE_ICON("edit-copy"), Gtk::ICON_SIZE_BUTTON));
+ pIcon = Gtk::manage(sp_get_icon_image("edit-copy", Gtk::ICON_SIZE_BUTTON));
pButton = Gtk::manage(new Gtk::Button());
pButton->set_relief(Gtk::RELIEF_NONE);
pIcon->show();
@@ -234,7 +234,7 @@ PathParam::param_newWidget()
}
if (_paste_button) {
- pIcon = Gtk::manage(sp_get_icon_image(INKSCAPE_ICON("edit-paste"), Gtk::ICON_SIZE_BUTTON));
+ pIcon = Gtk::manage(sp_get_icon_image("edit-paste", Gtk::ICON_SIZE_BUTTON));
pButton = Gtk::manage(new Gtk::Button());
pButton->set_relief(Gtk::RELIEF_NONE);
pIcon->show();
@@ -245,7 +245,7 @@ PathParam::param_newWidget()
pButton->set_tooltip_text(_("Paste path"));
}
if (_link_button) {
- pIcon = Gtk::manage(sp_get_icon_image(INKSCAPE_ICON("edit-clone"), Gtk::ICON_SIZE_BUTTON));
+ pIcon = Gtk::manage(sp_get_icon_image("edit-clone", Gtk::ICON_SIZE_BUTTON));
pButton = Gtk::manage(new Gtk::Button());
pButton->set_relief(Gtk::RELIEF_NONE);
pIcon->show();