[Expander]: Fix for Zoom

* When the zip file was really large, it was possible the Height passed to SetZoomLimit exceeded the maximum allowed size. Now, we clip at 32767.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35193 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Saint-Pierre
2010-01-20 03:56:36 +00:00
parent e9b3ccb129
commit 94a20a5e74
+10 -10
View File
@@ -570,14 +570,16 @@ ExpanderWindow::_ExpandListingText()
if (minWidth < Frame().Width() + delta) { if (minWidth < Frame().Width() + delta) {
// set the Zoom limit as the minimal required size // set the Zoom limit as the minimal required size
SetZoomLimits(Frame().Width() + delta, SetZoomLimits(Frame().Width() + delta,
fSizeLimit + fListingText->TextRect().Height() min_c(fSizeLimit + fListingText->TextRect().Height()
+ fLineHeight + B_H_SCROLL_BAR_HEIGHT + 1.0f); + fLineHeight + B_H_SCROLL_BAR_HEIGHT + 1.0f,
maxHeight));
} else { } else {
// set the zoom limit based on minimal window size allowed // set the zoom limit based on minimal window size allowed
SetZoomLimits(minWidth, SetZoomLimits(minWidth,
fSizeLimit + fListingText->TextRect().Height() min_c(fSizeLimit + fListingText->TextRect().Height()
+ fLineHeight + B_H_SCROLL_BAR_HEIGHT + 1.0f); + fLineHeight + B_H_SCROLL_BAR_HEIGHT + 1.0f,
maxHeight));
} }
} }
@@ -591,6 +593,8 @@ ExpanderWindow::_UpdateWindowSize(bool showContents)
float bottom = fSizeLimit; float bottom = fSizeLimit;
if (showContents) { if (showContents) {
minHeight = bottom + 5.0 * fLineHeight;
maxHeight = 32767.0;
if (fPreviousHeight < 0.0) { if (fPreviousHeight < 0.0) {
BFont font; BFont font;
font_height fontHeight; font_height fontHeight;
@@ -599,13 +603,9 @@ ExpanderWindow::_UpdateWindowSize(bool showContents)
fLineHeight = ceilf(fontHeight.ascent + fontHeight.descent fLineHeight = ceilf(fontHeight.ascent + fontHeight.descent
+ fontHeight.leading); + fontHeight.leading);
minHeight = bottom + 5.0 * fLineHeight;
maxHeight = 32767.0;
fPreviousHeight = minHeight + 10.0 * fLineHeight; fPreviousHeight = minHeight + 10.0 * fLineHeight;
} }
minHeight = bottom + 5.0 * fLineHeight; bottom = fPreviousHeight;
maxHeight = 32767.0;
bottom = fPreviousHeight;
} else { } else {
minHeight = fSizeLimit; minHeight = fSizeLimit;
maxHeight = fSizeLimit; maxHeight = fSizeLimit;