From a65a0a21e5452ced77123a8b846ff10cc1bc74b0 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 12 Feb 2017 15:59:14 +0100 Subject: Extensions: Make "indent" attribute a common attribute for all parameters that behaves more consistent and predictable than before. - Every "Parameter" now has an "_indent" member variable (specifying the indentation level; set in "Parameter::make()", see parameter.cpp) - Indentation is achieved by using "set_margin_left()" on the parameter's widget. This fixes bug #1662035 (comment #4 contains some more details about this patch). - Specifying "indent" on a parameter will now work consistently for all parameters. Previously the "indent" attribute often had no effect at all, e.g. for notebooks but also for parameters with 'appearance="full"' which was reasonable in most cases but made the outcome of using this attribute often unpredictable and is unnecessarily restrictive. - Most visible change: "description"s always used an indentation level of at least one (even if no indentation was specified). For the sake of consistency this discrepancy was dropped. Previous appearance can easily be restored by setting 'indent="1"'. Fixed bugs: - https://launchpad.net/bugs/1662035 (bzr r15508) --- src/extension/extension.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) (limited to 'src/extension/extension.cpp') diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index c6dee1b70..2d020aa0e 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -1,6 +1,6 @@ /** \file * - * Inkscape::Extension::Extension: + * Inkscape::Extension::Extension: * the ability to have features that are more modular so that they * can be added and removed easily. This is the basis for defining * those actions. @@ -144,15 +144,15 @@ Extension::~Extension (void) delete timer; timer = NULL; /** \todo Need to do parameters here */ - - // delete parameters: + + // delete parameters: for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { Parameter * param = reinterpret_cast(list->data); delete param; } g_slist_free(parameters); - - + + for (unsigned int i = 0 ; i < _deps.size(); i++) { delete _deps[i]; } @@ -330,7 +330,7 @@ Extension::get_repr (void) } /** - \return bool + \return bool \brief Whether this extension should hide the "working, please wait" dialog */ bool @@ -444,7 +444,7 @@ Extension::get_param_enum (const gchar * name, const SPDocument * doc, const Ink /** * This is useful to find out, if a given string \c value is selectable in a ComboBox named \cname. - * + * * @param name The name of the enum parameter to get. * @param doc The document to look in for document specific parameters. * @param node The node to look in for a specific parameter. @@ -692,8 +692,9 @@ public: * @param widg Widget to add. * @param tooltip Tooltip for the widget. */ - void addWidget(Gtk::Widget *widg, gchar const *tooltip) { + void addWidget(Gtk::Widget *widg, gchar const *tooltip, int indent) { if (widg) { + widg->set_margin_left(indent*12); this->pack_start(*widg, false, false, 2); if (tooltip) { widg->set_tooltip_text(_(tooltip)); @@ -713,7 +714,7 @@ public: a Gtk::VBox, which is then returned to the calling function. If there are no visible parameters, this function just returns NULL. - If all parameters are gui_visible = false NULL is returned as well. + If all parameters are gui_visible = false NULL is returned as well. */ Gtk::Widget * Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) @@ -728,9 +729,10 @@ Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signalget_gui_hidden()) continue; //Ignore hidden parameters Gtk::Widget * widg = param->get_widget(doc, node, changeSignal); gchar const * tip = param->get_tooltip(); - agui->addWidget(widg, tip); - } - + int indent = param->get_indent(); + agui->addWidget(widg, tip, indent); + } + agui->show(); return agui; }; @@ -780,7 +782,7 @@ void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Gri Gtk::Label * label; Gtk::Label * value; - (*row)++; + (*row)++; label = Gtk::manage(new Gtk::Label(labelstr)); value = Gtk::manage(new Gtk::Label(valuestr)); @@ -824,13 +826,13 @@ Extension::get_params_widget(void) return retval; } -unsigned int Extension::param_visible_count ( ) +unsigned int Extension::param_visible_count ( ) { unsigned int _visible_count = 0; for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { Parameter * param = reinterpret_cast(list->data); if (!param->get_gui_hidden()) _visible_count++; - } + } return _visible_count; } -- cgit v1.2.3 From 2295a47ec000543b6316213e54f715dc4d1e64c9 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 12 Feb 2017 19:51:27 +0100 Subject: Extensions: Harmonize appearance and try to simplify layouting a bit (bzr r15509) --- src/extension/extension.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/extension/extension.cpp') diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 2d020aa0e..8b5a687ef 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -694,8 +694,8 @@ public: */ void addWidget(Gtk::Widget *widg, gchar const *tooltip, int indent) { if (widg) { - widg->set_margin_left(indent*12); - this->pack_start(*widg, false, false, 2); + widg->set_margin_left(indent * Parameter::GUI_INDENTATION); + this->pack_start(*widg, false, false, 0); if (tooltip) { widg->set_tooltip_text(_(tooltip)); } else { @@ -722,6 +722,8 @@ Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signalset_border_width(Parameter::GUI_BOX_MARGIN); + agui->set_spacing(Parameter::GUI_BOX_SPACING); //go through the list of parameters to see if there are any non-hidden ones for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { -- cgit v1.2.3 From 80cdddd1120a4922257039847978f50d660f31f2 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Sun, 26 Feb 2017 17:31:58 +0000 Subject: Gtk+ 3 deprecation fixes (bzr r15547) --- src/extension/extension.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/extension/extension.cpp') diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 8b5a687ef..6c6e2d71e 100644 --- a/src/extension/extension.cpp +++ b/src/extension/extension.cpp @@ -694,7 +694,11 @@ public: */ void addWidget(Gtk::Widget *widg, gchar const *tooltip, int indent) { if (widg) { +#if GTK_CHECK_VERSION(3,12,0) + widg->set_margin_start(indent * Parameter::GUI_INDENTATION); +#else widg->set_margin_left(indent * Parameter::GUI_INDENTATION); +#endif this->pack_start(*widg, false, false, 0); if (tooltip) { widg->set_tooltip_text(_(tooltip)); -- cgit v1.2.3