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

Alexandre Julliard julliard at winehq.org
Wed Apr 23 07:59:31 CDT 2008


Module: wine
Branch: master
Commit: 4a89d2910496304d9365ade2a30f684eb4b3e50f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=4a89d2910496304d9365ade2a30f684eb4b3e50f

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Tue Apr 22 22:00:20 2008 +0200

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

---

 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 ee7925f..13507d9 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;
@@ -590,9 +588,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)
@@ -609,6 +607,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));
@@ -669,7 +668,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);
 }
 
 /***********************************************************************
@@ -684,7 +683,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);
 }
 
 /***********************************************************************
@@ -699,7 +698,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);
 }
 
 /***********************************************************************
@@ -1293,7 +1292,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-cvs mailing list