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/float.cpp | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) (limited to 'src/extension/param/float.cpp') diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index 23a03ea8f..fd82ab312 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -27,17 +27,21 @@ namespace Extension { /** Use the superclass' allocator and set the \c _value. */ -ParamFloat::ParamFloat (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(0.0), _mode(mode), _indent(0), _min(0.0), _max(10.0) +ParamFloat::ParamFloat(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(0.0) + , _mode(mode) + , _min(0.0) + , _max(10.0) { const gchar * defaultval = NULL; if (xml->firstChild() != NULL) { @@ -69,11 +73,6 @@ ParamFloat::ParamFloat (const gchar * name, _min = 0.0; } - const char * indent = xml->attribute("indent"); - if (indent != NULL) { - _indent = atoi(indent) * 12; - } - gchar * pref_name = this->pref_name(); Inkscape::Preferences *prefs = Inkscape::Preferences::get(); _value = prefs->getDouble(extension_pref_root + pref_name, _value); @@ -179,7 +178,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod auto pfa = new ParamFloatAdjustment(this, doc, node, changeSignal); Glib::RefPtr fadjust(pfa); - + if (_mode == FULL) { UI::Widget::SpinScale *scale = new UI::Widget::SpinScale(_(_text), fadjust, _precision); @@ -192,7 +191,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); - hbox->pack_start(*label, true, true, _indent); + hbox->pack_start(*label, true, true); auto spin = Gtk::manage(new Inkscape::UI::Widget::SpinButton(fadjust, 0.1, _precision)); spin->show(); -- cgit v1.2.3