Eric Pouech : winhelp: Properly handle the back button (in multiple windows , in empty stack...).

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


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

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Tue Apr 22 21:59:57 2008 +0200

winhelp: Properly handle the back button (in multiple windows, in empty stack...).

---

 programs/winhelp/macro.c   |   12 +-----------
 programs/winhelp/winhelp.c |   22 +++++++++++++++++++---
 programs/winhelp/winhelp.h |    1 +
 3 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/programs/winhelp/macro.c b/programs/winhelp/macro.c
index ca11b5a..877d33f 100644
--- a/programs/winhelp/macro.c
+++ b/programs/winhelp/macro.c
@@ -230,17 +230,7 @@ void CALLBACK MACRO_BackFlush(void)
 
     WINE_TRACE("()\n");
 
-    if (win)
-    {
-        unsigned int i;
-
-        for (i = 0; i < win->back.index; i++)
-        {
-            HLPFILE_FreeHlpFile(win->back.set[i].page->file);
-            win->back.set[i].page = NULL;
-        }
-        win->back.index = 0;
-    }
+    if (win) WINHELP_DeleteBackSet(win);
 }
 
 void CALLBACK MACRO_BookmarkDefine(void)
diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c
index 2011d2a..a33c470 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -549,6 +549,8 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow)
                     wpage->wininfo->size.cy != CW_USEDEFAULT)
                     SetWindowPos(win->hMainWnd, HWND_TOP,
                                  0, 0, wpage->wininfo->size.cx, wpage->wininfo->size.cy, SWP_NOMOVE);
+                if (wpage->page && wpage->page->file != win->page->file)
+                    WINHELP_DeleteBackSet(win);
                 WINHELP_InitFonts(win->hMainWnd);
 
                 win->page = wpage->page;
@@ -1814,6 +1816,22 @@ static void WINHELP_DeleteButtons(WINHELP_WINDOW* win)
     win->first_button = NULL;
 }
 
+/******************************************************************
+ *		WINHELP_DeleteBackSet
+ *
+ */
+void WINHELP_DeleteBackSet(WINHELP_WINDOW* win)
+{
+    unsigned int i;
+
+    for (i = 0; i < win->back.index; i++)
+    {
+        HLPFILE_FreeHlpFile(win->back.set[i].page->file);
+        win->back.set[i].page = NULL;
+    }
+    win->back.index = 0;
+}
+
 /***********************************************************************
  *
  *           WINHELP_DeleteWindow
@@ -1821,7 +1839,6 @@ static void WINHELP_DeleteButtons(WINHELP_WINDOW* win)
 static void WINHELP_DeleteWindow(WINHELP_WINDOW* win)
 {
     WINHELP_WINDOW**    w;
-    unsigned int        i;
 
     for (w = &Globals.win_list; *w; w = &(*w)->next)
     {
@@ -1846,8 +1863,7 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW* win)
 
     DeleteObject(win->hBrush);
 
-    for (i = 0; i < win->back.index; i++)
-        HLPFILE_FreeHlpFile(win->back.set[i].page->file);
+    WINHELP_DeleteBackSet(win);
 
     if (win->page) HLPFILE_FreeHlpFile(win->page->file);
     WINHELP_DeleteLines(win);
diff --git a/programs/winhelp/winhelp.h b/programs/winhelp/winhelp.h
index 5b23994..f1f67d2 100644
--- a/programs/winhelp/winhelp.h
+++ b/programs/winhelp/winhelp.h
@@ -183,6 +183,7 @@ BOOL WINHELP_CreateHelpWindowByOffset(HLPFILE*, LONG, HLPFILE_WINDOWINFO*, int);
 BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE*, int);
 BOOL WINHELP_GetOpenFileName(LPSTR, int);
 BOOL WINHELP_CreateIndexWindow(void);
+void WINHELP_DeleteBackSet(WINHELP_WINDOW*);
 INT  WINHELP_MessageBoxIDS(UINT, UINT, WORD);
 INT  WINHELP_MessageBoxIDS_s(UINT, LPCSTR, UINT, WORD);
 HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile);




More information about the wine-cvs mailing list