PATCH: property sheet next/back skipping
Marcus Meissner
marcus at jet.franken.de
Mon Jun 4 04:58:15 CDT 2001
Hi,
The IE5 Setup wizard uses the PSN_SETACTIVE return value to skip pages
when pressing next.
To make that work I merged skipping into SetCurSel and replaced the
rest of the ShowPage calls with SetCurSel.
It works better now.
Ciao, Marcus
Changelog:
Implemented page skipping on PSN_SETACTIVE -1 return.
Index: propsheet.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/propsheet.c,v
retrieving revision 1.50
diff -u -r1.50 propsheet.c
--- propsheet.c 2001/02/12 18:08:31 1.50
+++ propsheet.c 2001/06/04 10:53:32
@@ -113,6 +113,7 @@
static BOOL PROPSHEET_CanSetCurSel(HWND hwndDlg);
static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
int index,
+ int skipdir,
HPROPSHEETPAGE hpage);
static LRESULT PROPSHEET_QuerySiblings(HWND hwndDlg,
WPARAM wParam, LPARAM lParam);
@@ -1092,32 +1093,18 @@
static BOOL PROPSHEET_ShowPage(HWND hwndDlg, int index, PropSheetInfo * psInfo)
{
if (index == psInfo->active_page)
- {
+ {
if (GetTopWindow(hwndDlg) != psInfo->proppage[index].hwndPage)
SetWindowPos(psInfo->proppage[index].hwndPage, HWND_TOP, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
- return TRUE;
- }
+ return TRUE;
+ }
if (psInfo->proppage[index].hwndPage == 0)
{
LPCPROPSHEETPAGEA ppshpage;
- PSHNOTIFY psn;
ppshpage = (LPCPROPSHEETPAGEA)psInfo->proppage[index].hpage;
PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppshpage);
-
- psn.hdr.hwndFrom = hwndDlg;
- psn.hdr.code = PSN_SETACTIVE;
- psn.hdr.idFrom = 0;
- psn.lParam = 0;
-
- /* Send the notification before showing the page. */
- SendMessageA(psInfo->proppage[index].hwndPage,
- WM_NOTIFY, 0, (LPARAM) &psn);
-
- /*
- * TODO: check return value.
- */
}
if (psInfo->active_page != -1)
@@ -1150,6 +1137,7 @@
HWND hwndPage;
PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
PropSheetInfoStr);
+ LRESULT result;
if (psInfo->active_page < 0)
return FALSE;
@@ -1161,7 +1149,8 @@
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
- if (SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn) == -1)
+ result = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
+ if (result == -1)
return FALSE;
if (psInfo->active_page > 0)
@@ -1169,7 +1158,7 @@
res = PROPSHEET_CanSetCurSel(hwndDlg);
if(res != FALSE)
{
- res = PROPSHEET_SetCurSel(hwndDlg, psInfo->active_page - 1, 0);
+ res = PROPSHEET_SetCurSel(hwndDlg, psInfo->active_page - 1, -1, 0);
}
}
@@ -1198,15 +1187,12 @@
hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
msgResult = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
-
- TRACE("msg result %ld\n", msgResult);
-
if (msgResult == -1)
return FALSE;
if(PROPSHEET_CanSetCurSel(hwndDlg) != FALSE)
{
- PROPSHEET_SetCurSel(hwndDlg, psInfo->active_page + 1, 0);
+ PROPSHEET_SetCurSel(hwndDlg, psInfo->active_page + 1, 1, 0);
}
return TRUE;
@@ -1512,11 +1498,11 @@
*/
static BOOL PROPSHEET_SetCurSel(HWND hwndDlg,
int index,
- HPROPSHEETPAGE hpage)
+ int skipdir,
+ HPROPSHEETPAGE hpage
+ )
{
- PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg,
- PropSheetInfoStr);
- HWND hwndPage;
+ PropSheetInfo* psInfo = (PropSheetInfo*) GetPropA(hwndDlg, PropSheetInfoStr);
HWND hwndHelp = GetDlgItem(hwndDlg, IDHELP);
/* hpage takes precedence over index */
@@ -1529,14 +1515,7 @@
return FALSE;
}
- hwndPage = psInfo->proppage[index].hwndPage;
-
- /*
- * Notify the new page if it's already created.
- * If not it will get created and notified in PROPSHEET_ShowPage.
- */
- if (hwndPage)
- {
+ while (1) {
int result;
PSHNOTIFY psn;
@@ -1545,13 +1524,28 @@
psn.hdr.idFrom = 0;
psn.lParam = 0;
- result = SendMessageA(hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
+ if (!psInfo->proppage[index].hwndPage) {
+ LPCPROPSHEETPAGEA ppshpage = (LPCPROPSHEETPAGEA)psInfo->proppage[index].hpage;
+ PROPSHEET_CreatePage(hwndDlg, index, psInfo, ppshpage);
+ }
- /*
- * TODO: check return value.
- */
+ result = SendMessageA(psInfo->proppage[index].hwndPage, WM_NOTIFY, 0, (LPARAM) &psn);
+ if (!result)
+ break;
+ if (result == -1) {
+ index+=skipdir;
+ if (index < 0) {
+ index = 0;
+ FIXME("Tried to skip before first property sheet page!\n");
+ break;
+ }
+ if (index >= psInfo->nPages) {
+ FIXME("Tried to skip after last property sheet page!\n");
+ index = psInfo->nPages-1;
+ break;
+ }
+ }
}
-
/*
* Display the new page.
*/
@@ -1691,8 +1685,7 @@
/* If it is the only page - show it */
if(psInfo->nPages == 1)
- PROPSHEET_ShowPage(hwndDlg, 0, psInfo);
-
+ PROPSHEET_SetCurSel(hwndDlg, 0, 1, 0);
return TRUE;
}
@@ -1739,12 +1732,12 @@
if (index > 0)
{
/* activate previous page */
- PROPSHEET_ShowPage(hwndDlg, index - 1, psInfo);
+ PROPSHEET_SetCurSel(hwndDlg, index - 1, -1, 0);
}
else
{
/* activate the next page */
- PROPSHEET_ShowPage(hwndDlg, index + 1, psInfo);
+ PROPSHEET_SetCurSel(hwndDlg, index + 1, 1, 0);
psInfo->active_page = index;
}
}
@@ -2059,7 +2052,7 @@
else if (new_page >= psInfo->nPages)
new_page = 0;
- PROPSHEET_SetCurSel(hwnd, new_page, 0);
+ PROPSHEET_SetCurSel(hwnd, new_page, 1, 0);
}
return TRUE;
@@ -2152,7 +2145,7 @@
ppshpage = (LPCPROPSHEETPAGEA)psInfo->proppage[idx].hpage;
psInfo->active_page = -1;
- PROPSHEET_SetCurSel(hwnd, idx, psInfo->proppage[idx].hpage);
+ PROPSHEET_SetCurSel(hwnd, idx, 1, psInfo->proppage[idx].hpage);
if (!(psInfo->ppshheader.dwFlags & PSH_WIZARD))
SendMessageA(hwndTabCtrl, TCM_SETCURSEL, psInfo->active_page, 0);
@@ -2252,7 +2245,7 @@
if (pnmh->code == TCN_SELCHANGE)
{
int index = SendMessageA(pnmh->hwndFrom, TCM_GETCURSEL, 0, 0);
- PROPSHEET_SetCurSel(hwnd, index, 0);
+ PROPSHEET_SetCurSel(hwnd, index, 1, 0);
}
if(pnmh->code == TCN_SELCHANGING)
@@ -2305,6 +2298,7 @@
{
msgResult = PROPSHEET_SetCurSel(hwnd,
(int)wParam,
+ 1,
(HPROPSHEETPAGE)lParam);
}
More information about the wine-patches
mailing list