Commit 4a89d291 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winhelp: Don't add a page to the history when using the back button.

parent 07cf778b
...@@ -221,7 +221,7 @@ void CALLBACK MACRO_Back(void) ...@@ -221,7 +221,7 @@ void CALLBACK MACRO_Back(void)
WINE_TRACE("()\n"); WINE_TRACE("()\n");
if (win && win->back.index >= 2) 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) void CALLBACK MACRO_BackFlush(void)
...@@ -699,7 +699,7 @@ void CALLBACK MACRO_Next(void) ...@@ -699,7 +699,7 @@ void CALLBACK MACRO_Next(void)
{ {
wp.page->file->wRefCount++; wp.page->file->wRefCount++;
wp.wininfo = Globals.active_win->info; 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) ...@@ -739,7 +739,7 @@ void CALLBACK MACRO_Prev(void)
{ {
wp.page->file->wRefCount++; wp.page->file->wRefCount++;
wp.wininfo = Globals.active_win->info; wp.wininfo = Globals.active_win->info;
WINHELP_CreateHelpWindow(&wp, SW_NORMAL); WINHELP_CreateHelpWindow(&wp, SW_NORMAL, TRUE);
} }
} }
......
...@@ -485,12 +485,10 @@ void WINHELP_LayoutMainWindow(WINHELP_WINDOW* win) ...@@ -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; 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) if (!Globals.history.index || Globals.history.set[0].page != page)
{ {
num = sizeof(Globals.history.set) / sizeof(Globals.history.set[0]); num = sizeof(Globals.history.set) / sizeof(Globals.history.set[0]);
...@@ -527,7 +525,7 @@ static void WINHELP_AddHistory(WINHELP_WINDOW* win, HLPFILE_PAGE* page) ...@@ -527,7 +525,7 @@ static void WINHELP_AddHistory(WINHELP_WINDOW* win, HLPFILE_PAGE* page)
* *
* WINHELP_CreateHelpWindow * WINHELP_CreateHelpWindow
*/ */
BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow) BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remember)
{ {
WINHELP_WINDOW* win = NULL; WINHELP_WINDOW* win = NULL;
BOOL bPrimary, bPopup, bReUsed = FALSE; BOOL bPrimary, bPopup, bReUsed = FALSE;
...@@ -590,9 +588,9 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow) ...@@ -590,9 +588,9 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow)
win->hArrowCur = LoadCursorA(0, (LPSTR)IDC_ARROW); win->hArrowCur = LoadCursorA(0, (LPSTR)IDC_ARROW);
win->hHandCur = LoadCursorA(0, (LPSTR)IDC_HAND); 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) if (!bPopup)
...@@ -609,6 +607,7 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow) ...@@ -609,6 +607,7 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow)
MACRO_CreateButton("BTN_SEARCH", buffer, "Search()"); MACRO_CreateButton("BTN_SEARCH", buffer, "Search()");
LoadString(Globals.hInstance, STID_BACK, buffer, sizeof(buffer)); LoadString(Globals.hInstance, STID_BACK, buffer, sizeof(buffer));
MACRO_CreateButton("BTN_BACK", buffer, "Back()"); MACRO_CreateButton("BTN_BACK", buffer, "Back()");
if (win->back.index <= 1) MACRO_DisableButton("BTN_BACK");
LoadString(Globals.hInstance, STID_HISTORY, buffer, sizeof(buffer)); LoadString(Globals.hInstance, STID_HISTORY, buffer, sizeof(buffer));
MACRO_CreateButton("BTN_HISTORY", buffer, "History()"); MACRO_CreateButton("BTN_HISTORY", buffer, "History()");
LoadString(Globals.hInstance, STID_TOPICS, buffer, sizeof(buffer)); LoadString(Globals.hInstance, STID_TOPICS, buffer, sizeof(buffer));
...@@ -669,7 +668,7 @@ BOOL WINHELP_CreateHelpWindowByHash(HLPFILE* hlpfile, LONG lHash, ...@@ -669,7 +668,7 @@ BOOL WINHELP_CreateHelpWindowByHash(HLPFILE* hlpfile, LONG lHash,
HLPFILE_Contents(hlpfile); HLPFILE_Contents(hlpfile);
if (wpage.page) wpage.page->file->wRefCount++; if (wpage.page) wpage.page->file->wRefCount++;
wpage.wininfo = wi; wpage.wininfo = wi;
return WINHELP_CreateHelpWindow(&wpage, nCmdShow); return WINHELP_CreateHelpWindow(&wpage, nCmdShow, TRUE);
} }
/*********************************************************************** /***********************************************************************
...@@ -684,7 +683,7 @@ BOOL WINHELP_CreateHelpWindowByMap(HLPFILE* hlpfile, LONG lMap, ...@@ -684,7 +683,7 @@ BOOL WINHELP_CreateHelpWindowByMap(HLPFILE* hlpfile, LONG lMap,
wpage.page = HLPFILE_PageByMap(hlpfile, lMap); wpage.page = HLPFILE_PageByMap(hlpfile, lMap);
if (wpage.page) wpage.page->file->wRefCount++; if (wpage.page) wpage.page->file->wRefCount++;
wpage.wininfo = wi; wpage.wininfo = wi;
return WINHELP_CreateHelpWindow(&wpage, nCmdShow); return WINHELP_CreateHelpWindow(&wpage, nCmdShow, TRUE);
} }
/*********************************************************************** /***********************************************************************
...@@ -699,7 +698,7 @@ BOOL WINHELP_CreateHelpWindowByOffset(HLPFILE* hlpfile, LONG lOffset, ...@@ -699,7 +698,7 @@ BOOL WINHELP_CreateHelpWindowByOffset(HLPFILE* hlpfile, LONG lOffset,
wpage.page = HLPFILE_PageByOffset(hlpfile, lOffset); wpage.page = HLPFILE_PageByOffset(hlpfile, lOffset);
if (wpage.page) wpage.page->file->wRefCount++; if (wpage.page) wpage.page->file->wRefCount++;
wpage.wininfo = wi; wpage.wininfo = wi;
return WINHELP_CreateHelpWindow(&wpage, nCmdShow); return WINHELP_CreateHelpWindow(&wpage, nCmdShow, TRUE);
} }
/*********************************************************************** /***********************************************************************
...@@ -1293,7 +1292,7 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara ...@@ -1293,7 +1292,7 @@ static LRESULT CALLBACK WINHELP_HistoryWndProc(HWND hWnd, UINT msg, WPARAM wPara
GetTextMetrics(hDc, &tm); GetTextMetrics(hDc, &tm);
i = HIWORD(lParam) / tm.tmHeight; i = HIWORD(lParam) / tm.tmHeight;
if (i < Globals.history.index) 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); ReleaseDC(hWnd, hDc);
break; break;
case WM_PAINT: case WM_PAINT:
......
...@@ -180,7 +180,7 @@ extern FARPROC Callbacks[]; ...@@ -180,7 +180,7 @@ extern FARPROC Callbacks[];
BOOL WINHELP_CreateHelpWindowByHash(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int); BOOL WINHELP_CreateHelpWindowByHash(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
BOOL WINHELP_CreateHelpWindowByMap(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int); BOOL WINHELP_CreateHelpWindowByMap(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
BOOL WINHELP_CreateHelpWindowByOffset(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_GetOpenFileName(LPSTR, int);
BOOL WINHELP_CreateIndexWindow(void); BOOL WINHELP_CreateIndexWindow(void);
void WINHELP_DeleteBackSet(WINHELP_WINDOW*); void WINHELP_DeleteBackSet(WINHELP_WINDOW*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment