[PATCH 09/21] [WinHelp]: don't add a page to the history when using the back button
Eric Pouech
eric.pouech at orange.fr
Mon Apr 21 14:07:40 CDT 2008
A+
---
programs/winhelp/macro.c | 6 +++---
programs/winhelp/winhelp.c | 19 +++++++++----------
programs/winhelp/winhelp.h | 2 +-
3 files changed, 13 insertions(+), 14 deletions(-)
diff --git a/programs/winhelp/macro.c b/programs/winhelp/macro.c
index 877d33f..d43ec9f 100644
--- a/programs/winhelp/macro.c
+++ b/programs/winhelp/macro.c
@@ -221,7 +221,7 @@ void CALLBACK MACRO_Back(void)
WINE_TRACE("()\n");
if (win && win->back.index >= 2)
- WINHELP_CreateHelpWindow(&win->back.set[--win->back.index - 1], SW_SHOW);
+ WINHELP_CreateHelpWindow(&win->back.set[--win->back.index - 1], SW_SHOW, FALSE);
}
void CALLBACK MACRO_BackFlush(void)
@@ -699,7 +699,7 @@ void CALLBACK MACRO_Next(void)
{
wp.page->file->wRefCount++;
wp.wininfo = Globals.active_win->info;
- WINHELP_CreateHelpWindow(&wp, SW_NORMAL);
+ WINHELP_CreateHelpWindow(&wp, SW_NORMAL, TRUE);
}
}
@@ -739,7 +739,7 @@ void CALLBACK MACRO_Prev(void)
{
wp.page->file->wRefCount++;
wp.wininfo = Globals.active_win->info;
- WINHELP_CreateHelpWindow(&wp, SW_NORMAL);
+ WINHELP_CreateHelpWindow(&wp, SW_NORMAL, TRUE);
}
}
diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c
index efd6865..878262a 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -485,12 +485,10 @@ void WINHELP_LayoutMainWindow(WINHELP_WINDOW* win)
}
-static void WINHELP_AddHistory(WINHELP_WINDOW* win, HLPFILE_PAGE* page)
+static void WINHELP_RememberPage(WINHELP_WINDOW* win, HLPFILE_PAGE* page)
{
unsigned num;
- /* FIXME: when using back, we shouldn't update the history... */
- /* add to history only if different from top of history */
if (!Globals.history.index || Globals.history.set[0].page != page)
{
num = sizeof(Globals.history.set) / sizeof(Globals.history.set[0]);
@@ -527,7 +525,7 @@ static void WINHELP_AddHistory(WINHELP_WINDOW* win, HLPFILE_PAGE* page)
*
* WINHELP_CreateHelpWindow
*/
-BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow)
+BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remember)
{
WINHELP_WINDOW* win = NULL;
BOOL bPrimary, bPopup, bReUsed = FALSE;
@@ -588,9 +586,9 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow)
win->hArrowCur = LoadCursorA(0, (LPSTR)IDC_ARROW);
win->hHandCur = LoadCursorA(0, (LPSTR)IDC_HAND);
- if (!bPopup && wpage->page)
+ if (!bPopup && wpage->page && remember)
{
- WINHELP_AddHistory(win, wpage->page);
+ WINHELP_RememberPage(win, wpage->page);
}
if (!bPopup)
@@ -607,6 +605,7 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow)
MACRO_CreateButton("BTN_SEARCH", buffer, "Search()");
LoadString(Globals.hInstance, STID_BACK, buffer, sizeof(buffer));
MACRO_CreateButton("BTN_BACK", buffer, "Back()");
+ if (win->back.index <= 1) MACRO_DisableButton("BTN_BACK");
LoadString(Globals.hInstance, STID_HISTORY, buffer, sizeof(buffer));
MACRO_CreateButton("BTN_HISTORY", buffer, "History()");
LoadString(Globals.hInstance, STID_TOPICS, buffer, sizeof(buffer));
@@ -667,7 +666,7 @@ BOOL WINHELP_CreateHelpWindowByHash(HLPFILE* hlpfile, LONG lHash,
HLPFILE_Contents(hlpfile);
if (wpage.page) wpage.page->file->wRefCount++;
wpage.wininfo = wi;
- return WINHELP_CreateHelpWindow(&wpage, nCmdShow);
+ return WINHELP_CreateHelpWindow(&wpage, nCmdShow, TRUE);
}
/***********************************************************************
@@ -682,7 +681,7 @@ BOOL WINHELP_CreateHelpWindowByMap(HLPFILE* hlpfile, LONG lMap,
wpage.page = HLPFILE_PageByMap(hlpfile, lMap);
if (wpage.page) wpage.page->file->wRefCount++;
wpage.wininfo = wi;
- return WINHELP_CreateHelpWindow(&wpage, nCmdShow);
+ return WINHELP_CreateHelpWindow(&wpage, nCmdShow, TRUE);
}
/***********************************************************************
@@ -697,7 +696,7 @@ BOOL WINHELP_CreateHelpWindowByOffset(HLPFILE* hlpfile, LONG lOffset,
wpage.page = HLPFILE_PageByOffset(hlpfile, lOffset);
if (wpage.page) wpage.page->file->wRefCount++;
wpage.wininfo = wi;
- return WINHELP_CreateHelpWindow(&wpage, nCmdShow);
+ return WINHELP_CreateHelpWindow(&wpage, nCmdShow, TRUE);
}
/***********************************************************************
@@ -1291,7 +1290,7 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
GetTextMetrics(hDc, &tm);
i = HIWORD(lParam) / tm.tmHeight;
if (i < Globals.history.index)
- WINHELP_CreateHelpWindow(&Globals.history.set[i], SW_SHOW);
+ WINHELP_CreateHelpWindow(&Globals.history.set[i], SW_SHOW, TRUE);
ReleaseDC(hWnd, hDc);
break;
case WM_PAINT:
diff --git a/programs/winhelp/winhelp.h b/programs/winhelp/winhelp.h
index f1f67d2..81ce74e 100644
--- a/programs/winhelp/winhelp.h
+++ b/programs/winhelp/winhelp.h
@@ -180,7 +180,7 @@ extern FARPROC Callbacks[];
BOOL WINHELP_CreateHelpWindowByHash(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
BOOL WINHELP_CreateHelpWindowByMap(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
BOOL WINHELP_CreateHelpWindowByOffset(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
-BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE*, int);
+BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE*, int, BOOL);
BOOL WINHELP_GetOpenFileName(LPSTR, int);
BOOL WINHELP_CreateIndexWindow(void);
void WINHELP_DeleteBackSet(WINHELP_WINDOW*);
More information about the wine-patches
mailing list