PROPSHEET: Wizard resizing
Filip Navara
xnavara at volny.cz
Fri Sep 10 23:03:12 CDT 2004
I know this patch isn't really correct, but the old code isn't correct
either. Without it about 80% of the wizards were resized incorrectly (or
not at all) and the header line wasn't hidden sometimes. Even though I
would like to code the resizing correctly it will require major code
shuffling that I can't do now due to time constraints. So I believe for
now this patch is less evil than letting the code as is.
(I can provide more details about how it should be implemented correctly
on request)
- Filip
Changelog:
First attempt at correcting wizard resizing.
-------------- next part --------------
Changelog:
First attempt at correcting wizard resizing.
--- dlls/comctl32/propsheet.c Sat Sep 11 04:15:40 2004
+++ dlls/comctl32/propsheet.c Sat Sep 11 05:41:14 2004
@@ -474,6 +474,16 @@
width = (WORD)*p; p++;
height = (WORD)*p; p++;
+ /* Add size of the header if it's present so the property sheet is later
+ * calculated correctly. FIXME: This isn't exactly correct, but the best
+ * we can do so far. */
+ if ((psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW)) &&
+ (psInfo->ppshheader.dwFlags & PSH_HEADER) &&
+ !(dwFlags & PSP_HIDEHEADER))
+ {
+ height += 35; /* Default size of header in dialog units. */
+ }
+
/* remember the largest width and height */
if (width > psInfo->width)
psInfo->width = width;
@@ -699,49 +709,6 @@
}
/******************************************************************************
- * PROPSHEET_IsTooSmallWizard
- *
- * Verify that the default property sheet is big enough.
- */
-static BOOL PROPSHEET_IsTooSmallWizard(HWND hwndDlg, PropSheetInfo* psInfo)
-{
- RECT rcSheetRect, rcPage, rcLine, rcSheetClient;
- HWND hwndLine = GetDlgItem(hwndDlg, IDC_SUNKEN_LINE);
- PADDING_INFO padding = PROPSHEET_GetPaddingInfoWizard(hwndDlg, psInfo);
-
- GetClientRect(hwndDlg, &rcSheetClient);
- GetWindowRect(hwndDlg, &rcSheetRect);
- GetWindowRect(hwndLine, &rcLine);
-
- /* Remove the space below the sunken line */
- rcSheetClient.bottom -= (rcSheetRect.bottom - rcLine.top);
-
- /* Remove the buffer zone all around the edge */
- rcSheetClient.bottom -= (padding.y * 2);
- rcSheetClient.right -= (padding.x * 2);
-
- /*
- * Biggest page size.
- */
- rcPage.left = psInfo->x;
- rcPage.top = psInfo->y;
- rcPage.right = psInfo->width;
- rcPage.bottom = psInfo->height;
-
- MapDialogRect(hwndDlg, &rcPage);
- TRACE("biggest page %ld %ld %ld %ld\n", rcPage.left, rcPage.top,
- rcPage.right, rcPage.bottom);
-
- if (rcPage.right > rcSheetClient.right)
- return TRUE;
-
- if (rcPage.bottom > rcSheetClient.bottom)
- return TRUE;
-
- return FALSE;
-}
-
-/******************************************************************************
* PROPSHEET_AdjustSize
*
* Resizes the property sheet and the tab control to fit the largest page.
@@ -880,11 +848,7 @@
/* Make room */
rc.right += (padding.x * 2);
- rc.bottom += (buttonHeight + lineHeight);
- if (psInfo->ppshheader.dwFlags & (PSH_WIZARD97_OLD | PSH_WIZARD97_NEW))
- rc.bottom += (4 * padding.y);
- else
- rc.bottom += (5 * padding.y);
+ rc.bottom += buttonHeight + lineHeight + (5 * padding.y);
/*
* Resize the property sheet.
@@ -2114,7 +2078,7 @@
SetWindowPos(psInfo->proppage[index].hwndPage, HWND_TOP,
rc.left + padding.x/2,
rc.top + padding.y/2 + offsety,
- rc.right - rc.left, rc.bottom - rc.top, 0);
+ rc.right - rc.left, rc.bottom - rc.top - offsety, 0);
} else {
/*
* Ask the Tab control to reduce the client rectangle to that
@@ -3356,11 +3320,8 @@
if (psInfo->ppshheader.dwFlags & INTRNL_ANY_WIZARD)
{
ShowWindow(hwndTabCtrl, SW_HIDE);
- if (PROPSHEET_IsTooSmallWizard(hwnd, psInfo))
- {
- PROPSHEET_AdjustSizeWizard(hwnd, psInfo);
- PROPSHEET_AdjustButtonsWizard(hwnd, psInfo);
- }
+ PROPSHEET_AdjustSizeWizard(hwnd, psInfo);
+ PROPSHEET_AdjustButtonsWizard(hwnd, psInfo);
}
else
{
More information about the wine-patches
mailing list