diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2017-02-12 14:59:14 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2017-02-12 14:59:14 +0000 |
| commit | a65a0a21e5452ced77123a8b846ff10cc1bc74b0 (patch) | |
| tree | 9a263d66a1fafaaf5243a57c420197274a626e35 /src/extension/param/description.cpp | |
| parent | Fix and improve window sizing and positioning behavior when opening new docum... (diff) | |
| download | inkscape-a65a0a21e5452ced77123a8b846ff10cc1bc74b0.tar.gz inkscape-a65a0a21e5452ced77123a8b846ff10cc1bc74b0.zip | |
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)
Diffstat (limited to 'src/extension/param/description.cpp')
| -rw-r--r-- | src/extension/param/description.cpp | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 07aaa07cc..7f7d2d976 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -26,17 +26,19 @@ 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, - AppearanceMode mode) : - Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, ext), - _value(NULL), _mode(mode), _indent(0) +ParamDescription::ParamDescription(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, + AppearanceMode mode) + : Parameter(name, guitext, desc, scope, gui_hidden, gui_tip, indent, ext) + , _value(NULL) + , _mode(mode) { // printf("Building Description\n"); const char * defaultval = NULL; @@ -50,11 +52,6 @@ ParamDescription::ParamDescription (const gchar * name, _context = xml->attribute("msgctxt"); - const char * indent = xml->attribute("indent"); - if (indent != NULL) { - _indent = atoi(indent) * 12; - } - return; } @@ -76,15 +73,13 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node } else { newguitext = _(_value); } - + Gtk::Label * label; - int padding = 12 + _indent; if (_mode == HEADER) { label = Gtk::manage(new Gtk::Label(Glib::ustring("<b>") +newguitext + Glib::ustring("</b>"), Gtk::ALIGN_START)); - label->set_margin_top(5); - label->set_margin_bottom(5); + label->set_margin_top(5); + label->set_margin_bottom(5); label->set_use_markup(true); - padding = _indent; } else { label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_START)); } @@ -92,7 +87,7 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node label->show(); Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); - hbox->pack_start(*label, true, true, padding); + hbox->pack_start(*label, true, true); hbox->show(); return hbox; |
