From 939f84facd2f8beb4f5a1601c09bf7b71f1274a0 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 25 Mar 2011 16:09:55 +0100 Subject: Extensions. Replacing the groupheader element with an appearance mode in the description element. (bzr r10129) --- src/extension/param/description.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src/extension/param/description.cpp') diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index f17b45b4b..049b7d5a3 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -30,8 +30,16 @@ namespace Extension { /** \brief Initialize the object, to do that, copy the data. */ -ParamDescription::ParamDescription (const gchar * name, const gchar * guitext, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(NULL) +ParamDescription::ParamDescription (const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml, + AppearanceMode mode) : + Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(NULL), _mode(mode) { // printf("Building Description\n"); const char * defaultval = NULL; @@ -60,13 +68,21 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node newguitext = _(_value); } - Gtk::Label * label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_LEFT)); - + Gtk::Label * label; + int padding = 12; + if (_mode == HEADER) { + label = Gtk::manage(new Gtk::Label(Glib::ustring("") +newguitext + Glib::ustring(""), Gtk::ALIGN_LEFT)); + label->set_padding(0,5); + label->set_use_markup(true); + padding = 0; + } else { + label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_LEFT)); + } label->set_line_wrap(); label->show(); Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - hbox->pack_start(*label, true, true, 12); + hbox->pack_start(*label, true, true, padding); hbox->show(); return hbox; -- cgit v1.2.3 From ec8d0b742153e4715efd13fb19607c3167cc2092 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Sat, 6 Aug 2011 20:48:21 +0200 Subject: Extensions. New "indent" attribute to add an indent level to extension elements. Filters. Adding the new "indent" attribute to parameters groups. (bzr r10529) --- src/extension/param/description.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src/extension/param/description.cpp') diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 049b7d5a3..7a68aff62 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -39,18 +39,26 @@ ParamDescription::ParamDescription (const gchar * name, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml, AppearanceMode mode) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), _value(NULL), _mode(mode) + Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), + _value(NULL), _mode(mode), _indent(0) { // printf("Building Description\n"); const char * defaultval = NULL; - if (sp_repr_children(xml) != NULL) + if (sp_repr_children(xml) != NULL) { defaultval = sp_repr_children(xml)->content(); + } - if (defaultval != NULL) + if (defaultval != NULL) { _value = g_strdup(defaultval); - + } + _context = xml->attribute("msgctxt"); - + + const char * indent = xml->attribute("indent"); + if (indent != NULL) { + _indent = atoi(indent) * 12; + } + return; } @@ -58,7 +66,9 @@ ParamDescription::ParamDescription (const gchar * name, Gtk::Widget * ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node*/, sigc::signal * /*changeSignal*/) { - if (_gui_hidden) return NULL; + if (_gui_hidden) { + return NULL; + } Glib::ustring newguitext; @@ -69,12 +79,12 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node } Gtk::Label * label; - int padding = 12; + int padding = 12 + _indent; if (_mode == HEADER) { label = Gtk::manage(new Gtk::Label(Glib::ustring("") +newguitext + Glib::ustring(""), Gtk::ALIGN_LEFT)); label->set_padding(0,5); label->set_use_markup(true); - padding = 0; + padding = _indent; } else { label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_LEFT)); } -- cgit v1.2.3