[PATCH 12/21] [WinHelp]: Enable/Disable prev/next buttons if there's a prev/next page

Eric Pouech eric.pouech at orange.fr
Mon Apr 21 14:07:58 CDT 2008


- also move page/file macro execution (when opening a new page) after the
  windows creation so that the buttons' windows exist

A+
---

 programs/winhelp/macro.c   |    7 +++++++
 programs/winhelp/winhelp.c |   22 +++++++++++-----------
 2 files changed, 18 insertions(+), 11 deletions(-)


diff --git a/programs/winhelp/macro.c b/programs/winhelp/macro.c
index 2ff1ad2..2c38b01 100644
--- a/programs/winhelp/macro.c
+++ b/programs/winhelp/macro.c
@@ -245,10 +245,17 @@ void CALLBACK MACRO_BookmarkMore(void)
 
 void CALLBACK MACRO_BrowseButtons(void)
 {
+    HLPFILE_PAGE*       page = Globals.active_win->page;
+
     WINE_TRACE("()\n");
 
     MACRO_CreateButton("BTN_PREV", "&<<", "Prev()");
     MACRO_CreateButton("BTN_NEXT", "&>>", "Next()");
+
+    if (!HLPFILE_PageByOffset(page->file, page->browse_bwd))
+        MACRO_DisableButton("BTN_PREV");
+    if (!HLPFILE_PageByOffset(page->file, page->browse_fwd))
+        MACRO_DisableButton("BTN_NEXT");
 }
 
 void CALLBACK MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c
index 878262a..b3f6a51 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -612,17 +612,6 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
         MACRO_CreateButton("BTN_TOPICS", buffer, "Finder()");
     }
 
-    /* Initialize file specific pushbuttons */
-    if (!(wpage->wininfo->win_style & WS_POPUP) && wpage->page)
-    {
-        HLPFILE_MACRO  *macro;
-        for (macro = wpage->page->file->first_macro; macro; macro = macro->next)
-            MACRO_ExecuteMacro(macro->lpszMacro);
-
-        for (macro = wpage->page->first_macro; macro; macro = macro->next)
-            MACRO_ExecuteMacro(macro->lpszMacro);
-    }
-
     if (!bReUsed)
     {
         win->hMainWnd = CreateWindowEx((bPopup) ? WS_EX_TOOLWINDOW : 0, MAIN_WIN_CLASS_NAME,
@@ -642,6 +631,17 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
                      0, 0, 0, 0, win->hMainWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, win);
     }
 
+    /* Initialize file specific pushbuttons */
+    if (!(wpage->wininfo->win_style & WS_POPUP) && wpage->page)
+    {
+        HLPFILE_MACRO  *macro;
+        for (macro = wpage->page->file->first_macro; macro; macro = macro->next)
+            MACRO_ExecuteMacro(macro->lpszMacro);
+
+        for (macro = wpage->page->first_macro; macro; macro = macro->next)
+            MACRO_ExecuteMacro(macro->lpszMacro);
+    }
+
     WINHELP_LayoutMainWindow(win);
     if (bPopup) Globals.hPopupWnd = win->hMainWnd;
 





More information about the wine-patches mailing list