From cebbe5b970cba85a5e21f8347f0a20e78351d394 Mon Sep 17 00:00:00 2001 From: Alex Valavanis Date: Thu, 28 Jul 2016 11:22:07 +0100 Subject: extensions: Drop GTKMM2 fallbacks (bzr r15023.2.5) --- src/extension/param/notebook.cpp | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src/extension/param/notebook.cpp') diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 20c8e8481..957d12d06 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -353,11 +353,7 @@ public: // hook function this->signal_switch_page().connect(sigc::mem_fun(this, &ParamNotebookWdg::changed_page)); }; -#if WITH_GTKMM_3_0 void changed_page(Gtk::Widget *page, guint pagenum); -#else - void changed_page(GtkNotebookPage *page, guint pagenum); -#endif bool activated; }; @@ -368,11 +364,7 @@ public: * is actually visible. This to exclude 'fake' changes when the * notebookpages are added or removed. */ -#if WITH_GTKMM_3_0 void ParamNotebookWdg::changed_page(Gtk::Widget * /*page*/, guint pagenum) -#else -void ParamNotebookWdg::changed_page(GtkNotebookPage * /*page*/, guint pagenum) -#endif { if (get_visible()) { _pref->set((int)pagenum, _doc, _node); -- cgit v1.2.3 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/param/notebook.cpp | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'src/extension/param/notebook.cpp') diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 957d12d06..bfdff885a 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -54,8 +54,16 @@ private: public: static ParamNotebookPage * makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext); - ParamNotebookPage(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); + ParamNotebookPage(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); ~ParamNotebookPage(void); + Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void paramString (std::list &list); gchar * get_guitext (void) {return _text;}; @@ -63,8 +71,15 @@ public: }; /* class ParamNotebookPage */ -ParamNotebookPage::ParamNotebookPage (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) +ParamNotebookPage::ParamNotebookPage(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, /*indent*/ 0, ext) { parameters = NULL; @@ -206,9 +221,11 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod Parameter * param = reinterpret_cast(list->data); Gtk::Widget * widg = param->get_widget(doc, node, changeSignal); if (widg) { - gchar const * tip = param->get_tooltip(); - // printf("Tip: '%s'\n", tip); + int indent = param->get_indent(); + widg->set_margin_left(indent*12); vbox->pack_start(*widg, false, false, 2); + + gchar const * tip = param->get_tooltip(); if (tip) { widg->set_tooltip_text(_(tip)); } else { @@ -224,8 +241,16 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod } -ParamNotebook::ParamNotebook (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) +ParamNotebook::ParamNotebook(const gchar * name, + const gchar * guitext, + const gchar * desc, + const Parameter::_scope_t scope, + bool gui_hidden, + const gchar * gui_tip, + int indent, + Inkscape::Extension::Extension * ext, + Inkscape::XML::Node * xml) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) { pages = NULL; -- 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/param/notebook.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/extension/param/notebook.cpp') diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index bfdff885a..8ef48926e 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -214,7 +214,8 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod } Gtk::VBox * vbox = Gtk::manage(new Gtk::VBox); - vbox->set_border_width(5); + vbox->set_border_width(Parameter::GUI_BOX_MARGIN); + vbox->set_spacing(Parameter::GUI_BOX_SPACING); // add parameters onto page (if any) for (GSList * list = parameters; list != NULL; list = g_slist_next(list)) { @@ -222,8 +223,8 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod Gtk::Widget * widg = param->get_widget(doc, node, changeSignal); if (widg) { int indent = param->get_indent(); - widg->set_margin_left(indent*12); - vbox->pack_start(*widg, false, false, 2); + widg->set_margin_left(indent * Parameter::GUI_INDENTATION); + vbox->pack_start(*widg, false, false, 0); gchar const * tip = param->get_tooltip(); if (tip) { -- 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/param/notebook.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/extension/param/notebook.cpp') diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 8ef48926e..de86d1005 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -223,7 +223,11 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod Gtk::Widget * widg = param->get_widget(doc, node, changeSignal); if (widg) { int indent = param->get_indent(); +#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 vbox->pack_start(*widg, false, false, 0); gchar const * tip = param->get_tooltip(); -- cgit v1.2.3 From 34a1f9ad048c2aec2149e0bdaca5e66fca8de442 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 9 Apr 2017 15:20:24 +0200 Subject: Remove unused field "gui_tip" ("gui_description" does now what "gui_tip" was supposed to do) (bzr r15633.1.1) --- src/extension/param/notebook.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) (limited to 'src/extension/param/notebook.cpp') diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index de86d1005..2e216e967 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -59,7 +59,6 @@ public: const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); ~ParamNotebookPage(void); @@ -76,10 +75,9 @@ ParamNotebookPage::ParamNotebookPage(const gchar * name, 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, /*indent*/ 0, ext) + : Parameter(name, guitext, desc, scope, gui_hidden, /*indent*/ 0, ext) { parameters = NULL; @@ -157,15 +155,11 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: Parameter::_scope_t scope = Parameter::SCOPE_USER; bool gui_hidden = false; const char * gui_hide; - const char * gui_tip; name = in_repr->attribute("name"); guitext = in_repr->attribute("gui-text"); if (guitext == NULL) guitext = in_repr->attribute("_gui-text"); - gui_tip = in_repr->attribute("gui-tip"); - if (gui_tip == NULL) - gui_tip = in_repr->attribute("_gui-tip"); desc = in_repr->attribute("gui-description"); if (desc == NULL) desc = in_repr->attribute("_gui-description"); @@ -194,7 +188,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: } } - ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, scope, gui_hidden, gui_tip, in_ext, in_repr); + ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, scope, gui_hidden, in_ext, in_repr); /* Note: page could equal NULL */ return page; @@ -251,11 +245,10 @@ ParamNotebook::ParamNotebook(const gchar * name, const gchar * desc, const Parameter::_scope_t scope, bool gui_hidden, - const gchar * gui_tip, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) { pages = NULL; -- cgit v1.2.3 From f0ad38f6fd0d18f48d92df4b55ff8352747e6b2c Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 9 Apr 2017 15:39:40 +0200 Subject: Remove unused field "scope" (bzr r15633.1.2) --- src/extension/param/notebook.cpp | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'src/extension/param/notebook.cpp') diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index 2e216e967..c61733d26 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -57,7 +57,6 @@ public: ParamNotebookPage(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); @@ -73,11 +72,10 @@ public: ParamNotebookPage::ParamNotebookPage(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, /*indent*/ 0, ext) + : Parameter(name, guitext, desc, gui_hidden, /*indent*/ 0, ext) { parameters = NULL; @@ -151,8 +149,6 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: const char * name; const char * guitext; const char * desc; - const char * scope_str; - Parameter::_scope_t scope = Parameter::SCOPE_USER; bool gui_hidden = false; const char * gui_hide; @@ -163,7 +159,6 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: desc = in_repr->attribute("gui-description"); if (desc == NULL) desc = in_repr->attribute("_gui-description"); - scope_str = in_repr->attribute("scope"); gui_hide = in_repr->attribute("gui-hidden"); if (gui_hide != NULL) { if (strcmp(gui_hide, "1") == 0 || @@ -178,17 +173,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: return NULL; } - if (scope_str != NULL) { - if (!strcmp(scope_str, "user")) { - scope = Parameter::SCOPE_USER; - } else if (!strcmp(scope_str, "document")) { - scope = Parameter::SCOPE_DOCUMENT; - } else if (!strcmp(scope_str, "node")) { - scope = Parameter::SCOPE_NODE; - } - } - - ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, scope, gui_hidden, in_ext, in_repr); + ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, gui_hidden, in_ext, in_repr); /* Note: page could equal NULL */ return page; @@ -243,12 +228,11 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod ParamNotebook::ParamNotebook(const gchar * name, const gchar * guitext, const gchar * desc, - const Parameter::_scope_t scope, bool gui_hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, scope, gui_hidden, indent, ext) + : Parameter(name, guitext, desc, gui_hidden, indent, ext) { pages = NULL; -- cgit v1.2.3 From bc1ecf9dd11d0b3bb6939114ce6aec229fc86548 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Sun, 9 Apr 2017 16:46:33 +0200 Subject: Some code refactoring for consistency (notably "gui_hidden" -> hidden", "guitext" -> "text", "desc" -> "description") (bzr r15633.1.3) --- src/extension/param/notebook.cpp | 62 ++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 31 deletions(-) (limited to 'src/extension/param/notebook.cpp') diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index c61733d26..a31dda421 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -55,27 +55,27 @@ public: static ParamNotebookPage * makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext); ParamNotebookPage(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml); ~ParamNotebookPage(void); Gtk::Widget * get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal); void paramString (std::list &list); - gchar * get_guitext (void) {return _text;}; + gchar * get_text (void) {return _text;}; Parameter * get_param (const gchar * name); }; /* class ParamNotebookPage */ ParamNotebookPage::ParamNotebookPage(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, gui_hidden, /*indent*/ 0, ext) + : Parameter(name, text, description, hidden, /*indent*/ 0, ext) { parameters = NULL; @@ -147,23 +147,23 @@ ParamNotebookPage * ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension::Extension * in_ext) { const char * name; - const char * guitext; - const char * desc; - bool gui_hidden = false; - const char * gui_hide; + const char * text; + const char * description; + bool hidden = false; + const char * hide; name = in_repr->attribute("name"); - guitext = in_repr->attribute("gui-text"); - if (guitext == NULL) - guitext = in_repr->attribute("_gui-text"); - desc = in_repr->attribute("gui-description"); - if (desc == NULL) - desc = in_repr->attribute("_gui-description"); - gui_hide = in_repr->attribute("gui-hidden"); - if (gui_hide != NULL) { - if (strcmp(gui_hide, "1") == 0 || - strcmp(gui_hide, "true") == 0) { - gui_hidden = true; + text = in_repr->attribute("gui-text"); + if (text == NULL) + text = in_repr->attribute("_gui-text"); + description = in_repr->attribute("gui-description"); + if (description == NULL) + description = in_repr->attribute("_gui-description"); + hide = in_repr->attribute("gui-hidden"); + if (hide != NULL) { + if (strcmp(hide, "1") == 0 || + strcmp(hide, "true") == 0) { + hidden = true; } /* else stays false */ } @@ -173,7 +173,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: return NULL; } - ParamNotebookPage * page = new ParamNotebookPage(name, guitext, desc, gui_hidden, in_ext, in_repr); + ParamNotebookPage * page = new ParamNotebookPage(name, text, description, hidden, in_ext, in_repr); /* Note: page could equal NULL */ return page; @@ -188,7 +188,7 @@ ParamNotebookPage::makepage (Inkscape::XML::Node * in_repr, Inkscape::Extension: */ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { - if (_gui_hidden) { + if (_hidden) { return NULL; } @@ -226,13 +226,13 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod ParamNotebook::ParamNotebook(const gchar * name, - const gchar * guitext, - const gchar * desc, - bool gui_hidden, + const gchar * text, + const gchar * description, + bool hidden, int indent, Inkscape::Extension::Extension * ext, Inkscape::XML::Node * xml) - : Parameter(name, guitext, desc, gui_hidden, indent, ext) + : Parameter(name, text, description, hidden, indent, ext) { pages = NULL; @@ -423,7 +423,7 @@ Parameter *ParamNotebookPage::get_param(const gchar * name) */ Gtk::Widget * ParamNotebook::get_widget(SPDocument * doc, Inkscape::XML::Node * node, sigc::signal * changeSignal) { - if (_gui_hidden) { + if (_hidden) { return NULL; } @@ -436,7 +436,7 @@ Gtk::Widget * ParamNotebook::get_widget(SPDocument * doc, Inkscape::XML::Node * i++; ParamNotebookPage * page = reinterpret_cast(list->data); Gtk::Widget * widg = page->get_widget(doc, node, changeSignal); - nb->append_page(*widg, _(page->get_guitext())); + nb->append_page(*widg, _(page->get_text())); if (!strcmp(_value, page->name())) { pagenr = i; // this is the page to be displayed? } -- cgit v1.2.3 From bcd53f13e2f8547266a915dac0fc4c0012bfcf87 Mon Sep 17 00:00:00 2001 From: Eduard Braun Date: Mon, 24 Apr 2017 21:43:24 +0200 Subject: Extensions: Fixes and improvements for "gui-description" parameter attribute along the lines of r14955 - "gui-description" was always translated (as opposed to only "_gui-description") - Added possibility to specify "msgctxt" for "_gui-description" (bzr r15635) --- src/extension/param/notebook.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension/param/notebook.cpp') diff --git a/src/extension/param/notebook.cpp b/src/extension/param/notebook.cpp index a31dda421..4e94b5216 100644 --- a/src/extension/param/notebook.cpp +++ b/src/extension/param/notebook.cpp @@ -211,7 +211,7 @@ Gtk::Widget * ParamNotebookPage::get_widget(SPDocument * doc, Inkscape::XML::Nod gchar const * tip = param->get_tooltip(); if (tip) { - widg->set_tooltip_text(_(tip)); + widg->set_tooltip_text(tip); } else { widg->set_tooltip_text(""); widg->set_has_tooltip(false); -- cgit v1.2.3