[PATCH 07/45] [WinHelp]: removed a couple of internal fields to WINHELP_WINDOW and use control ID:s instead

Eric Pouech eric.pouech at orange.fr
Sun Mar 23 04:17:48 CDT 2008




A+
---

 programs/winhelp/winhelp.c |   25 +++++++++++++------------
 programs/winhelp/winhelp.h |    2 --
 2 files changed, 13 insertions(+), 14 deletions(-)


diff --git a/programs/winhelp/winhelp.c b/programs/winhelp/winhelp.c
index a4cf342..b3174df 100644
--- a/programs/winhelp/winhelp.c
+++ b/programs/winhelp/winhelp.c
@@ -418,23 +418,24 @@ void            WINHELP_LayoutMainWindow(WINHELP_WINDOW* win)
 {
     RECT        rect, button_box_rect;
     INT         text_top;
+    HWND        hButtonBoxWnd = GetDlgItem(win->hMainWnd, CTL_ID_BUTTON);
+    HWND        hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
 
     GetClientRect(win->hMainWnd, &rect);
 
     /* Update button box and text Window */
-    SetWindowPos(win->hButtonBoxWnd, HWND_TOP,
+    SetWindowPos(hButtonBoxWnd, HWND_TOP,
                  rect.left, rect.top,
                  rect.right - rect.left,
                  rect.bottom - rect.top, 0);
 
-    GetWindowRect(win->hButtonBoxWnd, &button_box_rect);
+    GetWindowRect(hButtonBoxWnd, &button_box_rect);
     text_top = rect.top + button_box_rect.bottom - button_box_rect.top;
 
-    SetWindowPos(win->hTextWnd, HWND_TOP,
+    SetWindowPos(hTextWnd, HWND_TOP,
                  rect.left, text_top,
                  rect.right - rect.left,
                  rect.bottom - text_top, 0);
-
 }
 
 /******************************************************************
@@ -446,12 +447,11 @@ static BOOL     WINHELP_ReuseWindow(WINHELP_WINDOW* win, WINHELP_WINDOW* oldwin,
                                     HLPFILE_PAGE* page, int nCmdShow)
 {
     unsigned int i;
+    HWND                hTextWnd;
 
     win->hMainWnd      = oldwin->hMainWnd;
-    win->hButtonBoxWnd = oldwin->hButtonBoxWnd;
-    win->hTextWnd      = oldwin->hTextWnd;
     win->hHistoryWnd   = oldwin->hHistoryWnd;
-    oldwin->hMainWnd   = oldwin->hButtonBoxWnd = oldwin->hTextWnd = oldwin->hHistoryWnd = 0;
+    oldwin->hMainWnd   = oldwin->hHistoryWnd = 0;
 
     SetWindowLong(win->hMainWnd,      0, (LONG)win);
     SetWindowLong(win->hHistoryWnd,   0, (LONG)win);
@@ -461,10 +461,11 @@ static BOOL     WINHELP_ReuseWindow(WINHELP_WINDOW* win, WINHELP_WINDOW* oldwin,
     if (page)
         SetWindowText(win->hMainWnd, page->file->lpszTitle);
 
-    InvalidateRect(win->hTextWnd, NULL, TRUE);
+    hTextWnd = GetDlgItem(win->hMainWnd, CTL_ID_TEXT);
+    InvalidateRect(hTextWnd, NULL, TRUE);
     WINHELP_LayoutMainWindow(win);
     ShowWindow(win->hMainWnd, nCmdShow);
-    UpdateWindow(win->hTextWnd);
+    UpdateWindow(hTextWnd);
 
     if (!(win->info->win_style & WS_POPUP))
     {
@@ -622,9 +623,9 @@ BOOL WINHELP_CreateHelpWindow(HLPFILE_PAGE* page, HLPFILE_WINDOWINFO* wi,
         CreateWindow(BUTTON_BOX_WIN_CLASS_NAME, "", WS_CHILD | WS_VISIBLE,
                      0, 0, 0, 0, hWnd, (HMENU)CTL_ID_BUTTON, Globals.hInstance, NULL);
 
-    win->hTextWnd = CreateWindow(RICHEDIT_CLASS, NULL,
-                                 ES_MULTILINE | ES_READONLY | WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,
-                                 0, 0, 0, 0, hWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, NULL);
+    CreateWindow(RICHEDIT_CLASS, NULL,
+                 ES_MULTILINE | ES_READONLY | WS_CHILD | WS_HSCROLL | WS_VSCROLL | WS_VISIBLE,
+                 0, 0, 0, 0, hWnd, (HMENU)CTL_ID_TEXT, Globals.hInstance, NULL);
 
     WINHELP_LayoutMainWindow(win);
     if (bPopup) Globals.hPopupWnd = hWnd;
diff --git a/programs/winhelp/winhelp.h b/programs/winhelp/winhelp.h
index 30ee277..8366d6d 100644
--- a/programs/winhelp/winhelp.h
+++ b/programs/winhelp/winhelp.h
@@ -63,8 +63,6 @@ typedef struct tagWinHelp
     HLPFILE_PAGE*       page;
 
     HWND                hMainWnd;
-    HWND                hButtonBoxWnd;
-    HWND                hTextWnd;
     HWND                hShadowWnd;
     HWND                hHistoryWnd;
 





More information about the wine-patches mailing list