summaryrefslogtreecommitdiffstats
path: root/src/live_effects/parameter/message.cpp
diff options
context:
space:
mode:
authorJabier Arraiza <jabier.arraiza@marker.es>2017-09-25 19:33:14 +0000
committerJabier Arraiza <jabier.arraiza@marker.es>2017-09-25 19:33:14 +0000
commit943cb6ba767b1f3fd35fb3bb74161f224a53cdc7 (patch)
treede6d67aef60b36625f0575e5f34c35f7c3e966f9 /src/live_effects/parameter/message.cpp
parentMinor code cleanup and better handling of non-spacing marks in upright vertic... (diff)
downloadinkscape-943cb6ba767b1f3fd35fb3bb74161f224a53cdc7.tar.gz
inkscape-943cb6ba767b1f3fd35fb3bb74161f224a53cdc7.zip
Add improvements to meassure segments LPE pointed by CR
Diffstat (limited to 'src/live_effects/parameter/message.cpp')
-rw-r--r--src/live_effects/parameter/message.cpp101
1 files changed, 101 insertions, 0 deletions
diff --git a/src/live_effects/parameter/message.cpp b/src/live_effects/parameter/message.cpp
new file mode 100644
index 000000000..39d8f12c7
--- /dev/null
+++ b/src/live_effects/parameter/message.cpp
@@ -0,0 +1,101 @@
+/*
+ * Authors:
+ *
+ * Released under GNU GPL, read the file 'COPYING' for more information
+ */
+
+#include <gtkmm.h>
+#include "live_effects/parameter/message.h"
+#include "live_effects/effect.h"
+#include <glibmm/i18n.h>
+
+namespace Inkscape {
+
+namespace LivePathEffect {
+
+MessageParam::MessageParam( const Glib::ustring& label, const Glib::ustring& tip,
+ const Glib::ustring& key, Inkscape::UI::Widget::Registry* wr,
+ Effect* effect, const gchar * default_message )
+ : Parameter(label, tip, key, wr, effect),
+ message(g_strdup(default_message)),
+ defmessage(g_strdup(default_message))
+{
+
+}
+
+void
+MessageParam::param_set_default()
+{
+ param_setValue(defmessage);
+}
+
+void
+MessageParam::param_update_default(const gchar * default_message)
+{
+ defmessage = g_strdup(default_message);
+}
+
+bool
+MessageParam::param_readSVGValue(const gchar * strvalue)
+{
+ param_setValue(strvalue);
+ return true;
+}
+
+gchar *
+MessageParam::param_getSVGValue() const
+{
+ return message;
+}
+
+gchar *
+MessageParam::param_getDefaultSVGValue() const
+{
+ return defmessage;
+}
+
+Gtk::Widget *
+MessageParam::param_newWidget()
+{
+ Gtk::Frame * frame = new Gtk::Frame (param_label);
+ Gtk::Widget * widg_frame = frame->get_label_widget();
+ widg_frame->set_margin_right(5);
+ widg_frame->set_margin_left(5);
+ Gtk::Label * label = new Gtk::Label (message, Gtk::ALIGN_END);
+ label->set_use_underline (true);
+ label->set_use_markup();
+ label->set_line_wrap(true);
+ Gtk::Widget * widg_label = dynamic_cast<Gtk::Widget *> (label);
+ widg_label->set_margin_top(8);
+ widg_label->set_margin_bottom(10);
+ widg_label->set_margin_right(6);
+ widg_label->set_margin_left(6);
+
+ frame->add(*widg_label);
+ return dynamic_cast<Gtk::Widget *> (frame);
+}
+
+void
+MessageParam::param_setValue(const gchar * strvalue)
+{
+ if (strcmp(strvalue, message) != 0) {
+ param_effect->upd_params = true;
+ }
+ message = g_strdup(strvalue);
+}
+
+
+} /* 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 :