Expander: don't use fLineHeight before its value is calculated. And don't resize the window to a size smaller than the calculated minHeight.

* This fixes a bug where checking "show contents" before a source archive is chosen makes the window go tiny.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35350 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Saint-Pierre
2010-01-30 20:33:48 +00:00
parent 3c08c615dc
commit d6a142a912
+5 -5
View File
@@ -593,8 +593,6 @@ ExpanderWindow::_UpdateWindowSize(bool showContents)
float bottom = fSizeLimit;
if (showContents) {
minHeight = bottom + 5.0 * fLineHeight;
maxHeight = 32767.0;
if (fPreviousHeight < 0.0) {
BFont font;
font_height fontHeight;
@@ -602,10 +600,12 @@ ExpanderWindow::_UpdateWindowSize(bool showContents)
font.GetHeight(&fontHeight);
fLineHeight = ceilf(fontHeight.ascent + fontHeight.descent
+ fontHeight.leading);
fPreviousHeight = minHeight + 10.0 * fLineHeight;
fPreviousHeight = bottom + 10.0 * fLineHeight;
}
bottom = fPreviousHeight;
minHeight = bottom + 5.0 * fLineHeight;
maxHeight = 32767.0;
bottom = max_c(fPreviousHeight, minHeight);
} else {
minHeight = fSizeLimit;
maxHeight = fSizeLimit;