Truncate long Advanced Preferences entries with ellipses

This truncates long Advanced Preferences list entry labels and values
with ellipses using hardcoded character count limits in order to avoid
stretching out the listbox too much over the dialog's width.

Currently, this is notably necessary for the German translation.

The character count limits chosen for this commit (46 for the label, 8
for the value) only really work with the basic ASCII character set. Some
Unicode characters may be rendered wider. Furthermore, the Preferences
page selection list may container longer entries that push this listbox
further to the right, closer to the dialog's right edge.

Also, I really hope most languages have words for 'yes' or 'no' that are
at most 8 characters in length or can at least be read without ambiguity
when truncated to that limit. At least none of the translations we
support which have translated those words hit the limit.
This commit is contained in:
Ignacio R. Morelle 2014-01-12 20:21:22 -03:00
parent 714bae2460
commit b0417bc573
3 changed files with 17 additions and 1 deletions

View file

@ -9,6 +9,9 @@ Version 1.11.8+dev:
help browser when they shouldn't.
* Gray-out GUI1 scrollbar upwards scrolling button by default when starting
with the view scrolled to the top.
* Truncate long Advanced Preferences entries with ellipses to avoid
situations where the listbox is wider than the Preferences dialog frame
(bug #19482).
* Miscellaneous and bug fixes:
* Added -Wno-documentation-deprecated-sync to the CMake pedantic flags.
* Fixed several Doxygen issues found by Clang 3.4.

View file

@ -13,6 +13,8 @@ Version 1.11.8+dev:
* User interface:
* Fixed hidden variations of unit types (hide_help=yes) being listed in the
help browser when they shouldn't.
* Truncate long Advanced Preferences entries with ellipses to avoid
situations where the listbox is wider than the Preferences dialog frame.
* Miscellaneous and bug fixes:
* Fixed possible invalid memory access issue in the MP sides configuration

View file

@ -1204,7 +1204,18 @@ void preferences_dialog::set_advanced_menu()
field = _("no");
}
str << adv["name"] << COLUMN_SEPARATOR << field;
std::string label = adv["name"];
// NOTE:
// The character count limits below only really work with the basic
// ASCII character set. Some Unicode characters may be rendered wider.
// Furthermore, the Preferences page selection list may container
// longer entries that push this listbox further to the right, closer
// to the dialog's right edge.
utils::ellipsis_truncate(label, 46);
utils::ellipsis_truncate(field, 8);
str << label << COLUMN_SEPARATOR << field;
advanced_items.push_back(str.str());
}