diff options
author | Caolán McNamara <caolanm@redhat.com> | 2013-07-25 12:08:37 +0100 |
---|---|---|
committer | Fridrich Strba <fridrich@documentfoundation.org> | 2013-07-25 13:24:47 +0000 |
commit | 74a3450b6d681b9ca0fa3e4d01522bfd4269ab5e (patch) | |
tree | 031bccdbb928965c18ce349f0d3f671f2cb7eaa5 | |
parent | a45098d295eeb1848dbe53f79047ffbb75f5f38e (diff) |
Resolves: fdo#63618 don't include border size twice in edit optimal size
CalcSize calls CalcWindowSize, but we will call that also in GetOptimalSize, so
undo the first one with CalcOutputSize. This makes the editboxes especially
less tall under MacOSX
(cherry picked from commit 0fcf74d203d97b7e829e72b7e55782d86a048802)
Change-Id: Ibbbf5a30e0c640744b1a979937301f87d250873a
Reviewed-on: https://gerrit.libreoffice.org/5098
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
-rw-r--r-- | vcl/source/control/edit.cxx | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index e8798a295380..bb94ee3c8bc8 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -2894,7 +2894,9 @@ Size Edit::CalcMinimumSizeForText(const OUString &rString) const Size aSize; if (mnWidthInChars != -1) { - aSize = CalcSize(mnWidthInChars); + //CalcSize calls CalcWindowSize, but we will call that also in this + //function, so undo the first one with CalcOutputSize + aSize = CalcOutputSize(CalcSize(mnWidthInChars)); } else { @@ -2907,9 +2909,13 @@ Size Edit::CalcMinimumSizeForText(const OUString &rString) const aSize.Height() = GetTextHeight(); aSize.Width() = GetTextWidth(aString); aSize.Width() += ImplGetExtraOffset() * 2; + // do not create edit fields in which one cannot enter anything // a default minimum width should exist for at least 3 characters - Size aMinSize(CalcSize(3)); + + //CalcSize calls CalcWindowSize, but we will call that also in this + //function, so undo the first one with CalcOutputSize + Size aMinSize(CalcOutputSize(CalcSize(3))); if (aSize.Width() < aMinSize.Width()) aSize.Width() = aMinSize.Width(); } |