diff options
| author | Eduard Braun <eduard.braun2@gmx.de> | 2017-02-13 01:46:19 +0000 |
|---|---|---|
| committer | Eduard Braun <eduard.braun2@gmx.de> | 2017-02-13 01:46:19 +0000 |
| commit | a2e57d792590665163dd07eb5e926017e40ccb90 (patch) | |
| tree | dba1e536d7fef490aaf6a7c1d0588e6fb9a5a74e /src | |
| parent | Extensions: Make "int" and "float" parameters specifying 'appearance="full"'e... (diff) | |
| download | inkscape-a2e57d792590665163dd07eb5e926017e40ccb90.tar.gz inkscape-a2e57d792590665163dd07eb5e926017e40ccb90.zip | |
Extensions: Work around gtk3 width/height calculation bug for long labels
Also use constants for most dimensions so they can easily be chaned in future.
(bzr r15511)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/param/bool.cpp | 2 | ||||
| -rw-r--r-- | src/extension/param/color.cpp | 4 | ||||
| -rw-r--r-- | src/extension/param/description.cpp | 15 | ||||
| -rw-r--r-- | src/extension/param/enum.cpp | 2 | ||||
| -rw-r--r-- | src/extension/param/float.cpp | 2 | ||||
| -rw-r--r-- | src/extension/param/int.cpp | 2 | ||||
| -rw-r--r-- | src/extension/param/parameter.h | 10 | ||||
| -rw-r--r-- | src/extension/param/radiobutton.cpp | 2 | ||||
| -rw-r--r-- | src/extension/param/string.cpp | 2 | ||||
| -rw-r--r-- | src/extension/prefdialog.cpp | 2 |
10 files changed, 31 insertions, 12 deletions
diff --git a/src/extension/param/bool.cpp b/src/extension/param/bool.cpp index 833215546..9f8d3dcc0 100644 --- a/src/extension/param/bool.cpp +++ b/src/extension/param/bool.cpp @@ -133,7 +133,7 @@ Gtk::Widget *ParamBool::get_widget(SPDocument * doc, Inkscape::XML::Node * node, return NULL; } - auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); + auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING)); hbox->set_homogeneous(false); Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); diff --git a/src/extension/param/color.cpp b/src/extension/param/color.cpp index 041cd5509..fd88e9adb 100644 --- a/src/extension/param/color.cpp +++ b/src/extension/param/color.cpp @@ -106,9 +106,9 @@ Gtk::Widget *ParamColor::get_widget( SPDocument * /*doc*/, Inkscape::XML::Node * _color_changed.block(false); } - Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, 4)); + Gtk::HBox *hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); Gtk::Widget *selector = Gtk::manage(new ColorNotebook(_color)); - hbox->pack_start (*selector, true, true, 0); + hbox->pack_start(*selector, true, true, 0); selector->show(); hbox->show(); return hbox; diff --git a/src/extension/param/description.cpp b/src/extension/param/description.cpp index 7f7d2d976..898544e94 100644 --- a/src/extension/param/description.cpp +++ b/src/extension/param/description.cpp @@ -84,9 +84,22 @@ ParamDescription::get_widget (SPDocument * /*doc*/, Inkscape::XML::Node * /*node label = Gtk::manage(new Gtk::Label(newguitext, Gtk::ALIGN_START)); } label->set_line_wrap(); + label->set_xalign(0); + + // TODO: Ugly "fix" for gtk3 width/height calculation of labels. + // - If not applying any limits long labels will make the window grow horizontally until it uses up + // most of the available space (i.e. most of the screen area) which is ridicously wide + // - By using "set_default_size(0,0)" in prefidalog.cpp we tell the window to shrink as much as possible, + // however this can result in a much to narrow dialog instead and much unnecessary wrapping + // - Here we set a lower limit of GUI_MAX_LINE_LENGTH characters per line that long texts will always use + // This means texts can not shrink anymore (they can still grow, though) and it's also necessary + // to prevent https://bugzilla.gnome.org/show_bug.cgi?id=773572 + int len = newguitext.length(); + label->set_width_chars(len > Parameter::GUI_MAX_LINE_LENGTH ? Parameter::GUI_MAX_LINE_LENGTH : len); + label->show(); - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox()); hbox->pack_start(*label, true, true); hbox->show(); diff --git a/src/extension/param/enum.cpp b/src/extension/param/enum.cpp index 9f254041a..a26458c35 100644 --- a/src/extension/param/enum.cpp +++ b/src/extension/param/enum.cpp @@ -250,7 +250,7 @@ Gtk::Widget *ParamComboBox::get_widget(SPDocument * doc, Inkscape::XML::Node * n return NULL; } - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false); diff --git a/src/extension/param/float.cpp b/src/extension/param/float.cpp index dd7087968..e3fdba826 100644 --- a/src/extension/param/float.cpp +++ b/src/extension/param/float.cpp @@ -174,7 +174,7 @@ Gtk::Widget * ParamFloat::get_widget(SPDocument * doc, Inkscape::XML::Node * nod return NULL; } - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); auto pfa = new ParamFloatAdjustment(this, doc, node, changeSignal); Glib::RefPtr<Gtk::Adjustment> fadjust(pfa); diff --git a/src/extension/param/int.cpp b/src/extension/param/int.cpp index ba51df2a3..538ddc08d 100644 --- a/src/extension/param/int.cpp +++ b/src/extension/param/int.cpp @@ -155,7 +155,7 @@ ParamInt::get_widget (SPDocument * doc, Inkscape::XML::Node * node, sigc::signal return NULL; } - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); auto pia = new ParamIntAdjustment(this, doc, node, changeSignal); Glib::RefPtr<Gtk::Adjustment> fadjust(pia); diff --git a/src/extension/param/parameter.h b/src/extension/param/parameter.h index edbd9ce08..c107f24f9 100644 --- a/src/extension/param/parameter.h +++ b/src/extension/param/parameter.h @@ -160,12 +160,16 @@ public: virtual Parameter *get_param(gchar const *name); - /** Recommended margin of boxes containing parameters */ + /** Recommended margin of boxes containing multiple Parameters (in px) */ const static int GUI_BOX_MARGIN = 10; - /** Recommended spacing between individual parameters when packing into boxes */ + /** Recommended spacing between multiple Parameters packed into a box (in px) */ const static int GUI_BOX_SPACING = 4; - /** Recommended indentation width of parameters */ + /** Recommended spacing between the widgets making up a signle Parameter (e.g. label and input) (in px) */ + const static int GUI_PARAM_WIDGETS_SPACING = 4; + /** Recommended indentation width of parameters (in px) */ const static int GUI_INDENTATION = 12; + /** Recommended maximum line lenght for wrapping textual parameters (in chars) */ + const static int GUI_MAX_LINE_LENGTH = 60; protected: diff --git a/src/extension/param/radiobutton.cpp b/src/extension/param/radiobutton.cpp index fd1b6e04e..178dc20e8 100644 --- a/src/extension/param/radiobutton.cpp +++ b/src/extension/param/radiobutton.cpp @@ -301,7 +301,7 @@ Gtk::Widget * ParamRadioButton::get_widget(SPDocument * doc, Inkscape::XML::Node return NULL; } - auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 4)); + auto hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, Parameter::GUI_PARAM_WIDGETS_SPACING)); hbox->set_homogeneous(false); auto vbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_VERTICAL, 0)); vbox->set_homogeneous(false); diff --git a/src/extension/param/string.cpp b/src/extension/param/string.cpp index f7d3c9662..0c5238f99 100644 --- a/src/extension/param/string.cpp +++ b/src/extension/param/string.cpp @@ -168,7 +168,7 @@ Gtk::Widget * ParamString::get_widget(SPDocument * doc, Inkscape::XML::Node * no return NULL; } - Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, 4)); + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox(false, Parameter::GUI_PARAM_WIDGETS_SPACING)); Gtk::Label * label = Gtk::manage(new Gtk::Label(_(_text), Gtk::ALIGN_START)); label->show(); hbox->pack_start(*label, false, false); diff --git a/src/extension/prefdialog.cpp b/src/extension/prefdialog.cpp index e98d88b2d..2bdbb081e 100644 --- a/src/extension/prefdialog.cpp +++ b/src/extension/prefdialog.cpp @@ -50,6 +50,8 @@ PrefDialog::PrefDialog (Glib::ustring name, gchar const * help, Gtk::Widget * co _effect(effect), _exEnv(NULL) { + this->set_default_size(0,0); // we want the window to be as small as possible instead of clobbering up space + Gtk::HBox * hbox = Gtk::manage(new Gtk::HBox()); if (controls == NULL) { if (_effect == NULL) { |
