From 94a20a5e74b502a3b3f2c1662026eee58ad3b576 Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Wed, 20 Jan 2010 03:56:36 +0000 Subject: [PATCH] [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 --- src/apps/expander/ExpanderWindow.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/apps/expander/ExpanderWindow.cpp b/src/apps/expander/ExpanderWindow.cpp index 7018cbcc0d..8523b3c315 100644 --- a/src/apps/expander/ExpanderWindow.cpp +++ b/src/apps/expander/ExpanderWindow.cpp @@ -570,14 +570,16 @@ ExpanderWindow::_ExpandListingText() if (minWidth < Frame().Width() + delta) { // set the Zoom limit as the minimal required size - SetZoomLimits(Frame().Width() + delta, - fSizeLimit + fListingText->TextRect().Height() - + fLineHeight + B_H_SCROLL_BAR_HEIGHT + 1.0f); + SetZoomLimits(Frame().Width() + delta, + min_c(fSizeLimit + fListingText->TextRect().Height() + + fLineHeight + B_H_SCROLL_BAR_HEIGHT + 1.0f, + maxHeight)); } else { // set the zoom limit based on minimal window size allowed SetZoomLimits(minWidth, - fSizeLimit + fListingText->TextRect().Height() - + fLineHeight + B_H_SCROLL_BAR_HEIGHT + 1.0f); + min_c(fSizeLimit + fListingText->TextRect().Height() + + fLineHeight + B_H_SCROLL_BAR_HEIGHT + 1.0f, + maxHeight)); } } @@ -591,6 +593,8 @@ 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; @@ -599,13 +603,9 @@ ExpanderWindow::_UpdateWindowSize(bool showContents) fLineHeight = ceilf(fontHeight.ascent + fontHeight.descent + fontHeight.leading); - minHeight = bottom + 5.0 * fLineHeight; - maxHeight = 32767.0; fPreviousHeight = minHeight + 10.0 * fLineHeight; } - minHeight = bottom + 5.0 * fLineHeight; - maxHeight = 32767.0; - bottom = fPreviousHeight; + bottom = fPreviousHeight; } else { minHeight = fSizeLimit; maxHeight = fSizeLimit;