diff options
Diffstat (limited to 'src/extension/extension.cpp')
| -rw-r--r-- | src/extension/extension.cpp | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/src/extension/extension.cpp b/src/extension/extension.cpp index 6f7539360..497f98431 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. @@ -16,18 +16,13 @@ */ #ifdef HAVE_CONFIG_H -# include "config.h" +#include <config.h> #endif #include <gtkmm/box.h> #include <gtkmm/label.h> #include <gtkmm/frame.h> - -#if WITH_GTKMM_3_0 -# include <gtkmm/grid.h> -#else -# include <gtkmm/table.h> -#endif +#include <gtkmm/grid.h> #include <glibmm/i18n.h> #include "inkscape.h" @@ -149,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<Parameter *>(list->data); delete param; } g_slist_free(parameters); - - + + for (unsigned int i = 0 ; i < _deps.size(); i++) { delete _deps[i]; } @@ -335,7 +330,7 @@ Extension::get_repr (void) } /** - \return bool + \return bool \brief Whether this extension should hide the "working, please wait" dialog */ bool @@ -449,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. @@ -697,11 +692,16 @@ 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) { - this->pack_start(*widg, false, false, 2); +#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)); + widg->set_tooltip_text(tooltip); } else { widg->set_tooltip_text(""); widg->set_has_tooltip(false); @@ -718,7 +718,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_hidden = true NULL is returned as well. */ Gtk::Widget * Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<void> * changeSignal) @@ -726,16 +726,19 @@ Extension::autogui (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal<v if (!_gui || param_visible_count() == 0) return NULL; AutoGUI * agui = Gtk::manage(new AutoGUI()); + agui->set_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)) { Parameter * param = reinterpret_cast<Parameter *>(list->data); - if (param->get_gui_hidden()) continue; //Ignore hidden parameters + if (param->get_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; }; @@ -766,11 +769,7 @@ Extension::get_info_widget(void) Gtk::Frame * info = Gtk::manage(new Gtk::Frame("General Extension Information")); retval->pack_start(*info, true, true, 5); -#if WITH_GTKMM_3_0 - Gtk::Grid * table = Gtk::manage(new Gtk::Grid()); -#else - Gtk::Table * table = Gtk::manage(new Gtk::Table()); -#endif + auto table = Gtk::manage(new Gtk::Grid()); info->add(*table); @@ -784,26 +783,17 @@ Extension::get_info_widget(void) return retval; } -#if WITH_GTKMM_3_0 void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Grid * table, int * row) -#else -void Extension::add_val(Glib::ustring labelstr, Glib::ustring valuestr, Gtk::Table * table, int * row) -#endif { Gtk::Label * label; Gtk::Label * value; - (*row)++; + (*row)++; label = Gtk::manage(new Gtk::Label(labelstr)); value = Gtk::manage(new Gtk::Label(valuestr)); -#if WITH_GTKMM_3_0 table->attach(*label, 0, (*row) - 1, 1, 1); table->attach(*value, 1, (*row) - 1, 1, 1); -#else - table->attach(*label, 0, 1, (*row) - 1, *row); - table->attach(*value, 1, 2, (*row) - 1, *row); -#endif label->show(); value->show(); @@ -842,13 +832,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<Parameter *>(list->data); - if (!param->get_gui_hidden()) _visible_count++; - } + if (!param->get_hidden()) _visible_count++; + } return _visible_count; } |
