Fix drawing of buttonText (enforce same left/right spacing)

The computation of the width of the button was wrong. If <--> stands
for TEXT_TO_INSET_OFFSET/2 spacing, and if `[]' marks the button's
limits, then the intent is
  <-->[<-->button text<-->]<-->

Therefore the physical grey rectangle width is
   width - Inset::TEXT_TO_INSET_OFFSET

With this change, the spacing on the right of the button is not larger
than the left one.

Fixes bug #10147.
(cherry picked from commit 516d5d29dc)
This commit is contained in:
Jean-Marc Lasgouttes 2016-05-23 15:24:13 +02:00 committed by Richard Heck
parent cba0b073aa
commit aa522e7071
2 changed files with 3 additions and 1 deletions

View File

@ -590,7 +590,7 @@ void GuiPainter::buttonText(int x, int y, docstring const & str,
static int const d = Inset::TEXT_TO_INSET_OFFSET / 2; static int const d = Inset::TEXT_TO_INSET_OFFSET / 2;
button(x + d, y - ascent, width - d, descent + ascent, mouseHover); button(x + d, y - ascent, width - Inset::TEXT_TO_INSET_OFFSET, descent + ascent, mouseHover);
text(x + Inset::TEXT_TO_INSET_OFFSET, y, str, font); text(x + Inset::TEXT_TO_INSET_OFFSET, y, str, font);
} }

View File

@ -121,6 +121,8 @@ What's new
- Remove extra spacing around button insets (bug 10149). - Remove extra spacing around button insets (bug 10149).
- Fix drawing of buttons by enforcing equal left/right spacing (bug 10147).
* INTERNALS * INTERNALS