summaryrefslogtreecommitdiffstats
path: root/src/extension/param/description.cpp
diff options
context:
space:
mode:
authorEduard Braun <eduard.braun2@gmx.de>2017-02-13 01:46:19 +0000
committerEduard Braun <eduard.braun2@gmx.de>2017-02-13 01:46:19 +0000
commita2e57d792590665163dd07eb5e926017e40ccb90 (patch)
treedba1e536d7fef490aaf6a7c1d0588e6fb9a5a74e /src/extension/param/description.cpp
parentExtensions: Make "int" and "float" parameters specifying 'appearance="full"'e... (diff)
downloadinkscape-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/extension/param/description.cpp')
-rw-r--r--src/extension/param/description.cpp15
1 files changed, 14 insertions, 1 deletions
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();