[ros-diffs] [dreimer] 41671: Sync wordpad and winhlp32 with wine 1.1.24.

dreimer at svn.reactos.org dreimer at svn.reactos.org
Sun Jun 28 19:27:57 CEST 2009


Author: dreimer
Date: Sun Jun 28 21:27:56 2009
New Revision: 41671

URL: http://svn.reactos.org/svn/reactos?rev=41671&view=rev
Log:
Sync wordpad and winhlp32 with wine 1.1.24.

Modified:
    trunk/reactos/base/applications/winhlp32/lang/it-IT.rc
    trunk/reactos/base/applications/winhlp32/lex.yy.c
    trunk/reactos/base/applications/winhlp32/macro.c
    trunk/reactos/base/applications/winhlp32/macro.h
    trunk/reactos/base/applications/winhlp32/macro.lex.l
    trunk/reactos/base/applications/winhlp32/winhelp.c
    trunk/reactos/base/applications/winhlp32/winhelp.h
    trunk/reactos/base/applications/wordpad/De.rc
    trunk/reactos/base/applications/wordpad/Fr.rc
    trunk/reactos/base/applications/wordpad/Si.rc

Modified: trunk/reactos/base/applications/winhlp32/lang/it-IT.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/winhlp32/lang/it-IT.rc?rev=41671&r1=41670&r2=41671&view=diff
==============================================================================
--- trunk/reactos/base/applications/winhlp32/lang/it-IT.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/winhlp32/lang/it-IT.rc [iso-8859-1] Sun Jun 28 21:27:56 2009
@@ -39,21 +39,21 @@
  POPUP "&Segnalibro" {
    MENUITEM "&Definisci...", MNID_BKMK_DEFINE
  }
- POPUP "&Options" {
-   POPUP	"Help always visible"
+ POPUP "&Opzioni" {
+   POPUP	"Aiuto sempre visibile"
    BEGIN
-     MENUITEM "Default",	MNID_OPTS_HELP_DEFAULT
-     MENUITEM "Visible",	MNID_OPTS_HELP_VISIBLE
-     MENUITEM "Non visible",	MNID_OPTS_HELP_NONVISIBLE
+     MENUITEM "Predefinito",	MNID_OPTS_HELP_DEFAULT
+     MENUITEM "Visibile",	MNID_OPTS_HELP_VISIBLE
+     MENUITEM "Non visibile",	MNID_OPTS_HELP_NONVISIBLE
   END
-  MENUITEM "History",		MNID_OPTS_HISTORY
-  POPUP    "Fonts"
+  MENUITEM "Cronologia",		MNID_OPTS_HISTORY
+  POPUP    "Caratteri"
   BEGIN
-    MENUITEM "Small",		MNID_OPTS_FONTS_SMALL
-    MENUITEM "Normal",    	MNID_OPTS_FONTS_NORMAL
-    MENUITEM "Large",     	MNID_OPTS_FONTS_LARGE
+    MENUITEM "Piccolo",		MNID_OPTS_FONTS_SMALL
+    MENUITEM "Normale",    	MNID_OPTS_FONTS_NORMAL
+    MENUITEM "Grande",     	MNID_OPTS_FONTS_LARGE
   END
-  MENUITEM "Use system colors",	MNID_OPTS_SYSTEM_COLORS
+  MENUITEM "Usa colori di sistema",	MNID_OPTS_SYSTEM_COLORS
  }
  POPUP "&?" {
    MENUITEM "&Aiuto sulla guida", MNID_HELP_HELPON
@@ -61,7 +61,7 @@
    MENUITEM SEPARATOR
    MENUITEM "&Informazioni su...", MNID_HELP_ABOUT
 #ifdef WINELIB
-   MENUITEM "&Informazion su WINE", MNID_HELP_WINE
+   MENUITEM "&Informazioni su WINE", MNID_HELP_WINE
 #endif
  }
 }
@@ -76,12 +76,12 @@
 STID_INFO,  		"Informazione"
 STID_NOT_IMPLEMENTED, 	"Non ancora implementato"
 STID_HLPFILE_ERROR_s, 	"Errore di lettura del file della Guida `%s'"
-STID_INDEX, 		"Index"
+STID_INDEX, 		"Indice"
 STID_CONTENTS,		"&Sommario"
 STID_BACK, 		"&Precedente"
 STID_ALL_FILES, 	"Tutti i file (*.*)"
 STID_HELP_FILES_HLP, 	"File della Guida (*.hlp)"
-STID_FILE_NOT_FOUND_s	"Cannot find '%s'. Do you want to find this file yourself?"
-STID_NO_RICHEDIT	"Cannot find a richedit implementation... Aborting"
-STID_PSH_INDEX,		"Help topics: "
+STID_FILE_NOT_FOUND_s	"Non è stato possibile trovare '%s'. Vuoi cercare questo file?"
+STID_NO_RICHEDIT	"Non è stato possibile trovare un'implementazione richedit... Annullando"
+STID_PSH_INDEX,		"Argomenti di aiuto: "
 }

Modified: trunk/reactos/base/applications/winhlp32/lex.yy.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/winhlp32/lex.yy.c?rev=41671&r1=41670&r2=41671&view=diff
==============================================================================
--- trunk/reactos/base/applications/winhlp32/lex.yy.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/winhlp32/lex.yy.c [iso-8859-1] Sun Jun 28 21:27:56 2009
@@ -380,9 +380,9 @@
 #define YY_MORE_ADJ 0
 #define YY_RESTORE_YY_MORE_OFFSET
 char *yytext;
-#line 1 "macro.lex.l"
+#line 1 ".\\macro.lex.l"
 #define INITIAL 0
-#line 2 "macro.lex.l"
+#line 2 ".\\macro.lex.l"
 /*
  * Help Viewer
  *
@@ -407,15 +407,20 @@
 #define YY_NO_UNPUT 1
 #define quote 1
 
-#line 26 "macro.lex.l"
+#line 26 ".\\macro.lex.l"
 #include "config.h"
 #include <assert.h>
+#include <stdarg.h>
 
 #ifndef HAVE_UNISTD_H
 #define YY_NO_UNISTD_H
 #endif
 
-#include "macro.h"
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "winhelp.h"
 
 #include "wine/debug.h"
 
@@ -428,6 +433,7 @@
     unsigned quote_stk_idx;
     LPSTR    cache_string[32];
     int      cache_used;
+    WINHELP_WINDOW* window;
 };
 static struct lex_data* lex_data = NULL;
 
@@ -436,7 +442,7 @@
 #define YY_INPUT(buf,result,max_size)\
   if ((result = *lex_data->macroptr ? 1 : 0)) buf[0] = *lex_data->macroptr++;
 
-#line 440 "lex.yy.c"
+#line 446 "lex.yy.c"
 
 /* Macros after this point can all be overridden by user definitions in
  * section 1.
@@ -587,10 +593,10 @@
 	register char *yy_cp, *yy_bp;
 	register int yy_act;
 
-#line 55 "macro.lex.l"
-
-
-#line 594 "lex.yy.c"
+#line 61 ".\\macro.lex.l"
+
+
+#line 600 "lex.yy.c"
 
 	if ( yy_init )
 		{
@@ -675,32 +681,32 @@
 
 case 1:
 YY_RULE_SETUP
-#line 57 "macro.lex.l"
+#line 63 ".\\macro.lex.l"
 yylval.integer = strtol(yytext, NULL, 10);	return INTEGER;
 	YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 58 "macro.lex.l"
+#line 64 ".\\macro.lex.l"
 yylval.integer = strtol(yytext, NULL, 16);	return INTEGER;
 	YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 60 "macro.lex.l"
+#line 66 ".\\macro.lex.l"
 return MACRO_Lookup(yytext, &yylval);
 	YY_BREAK
 case 4:
-#line 63 "macro.lex.l"
+#line 69 ".\\macro.lex.l"
 case 5:
-#line 64 "macro.lex.l"
+#line 70 ".\\macro.lex.l"
 case 6:
-#line 65 "macro.lex.l"
+#line 71 ".\\macro.lex.l"
 case 7:
-#line 66 "macro.lex.l"
+#line 72 ".\\macro.lex.l"
 case 8:
-#line 67 "macro.lex.l"
+#line 73 ".\\macro.lex.l"
 case 9:
 YY_RULE_SETUP
-#line 67 "macro.lex.l"
+#line 73 ".\\macro.lex.l"
 {
     if (lex_data->quote_stk_idx == 0 ||
         (yytext[0] == '\"' && lex_data->quote_stack[lex_data->quote_stk_idx - 1] != '\"') ||
@@ -735,34 +741,34 @@
 	YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 99 "macro.lex.l"
+#line 105 ".\\macro.lex.l"
 *lex_data->strptr++ = yytext[0];
 	YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 100 "macro.lex.l"
+#line 106 ".\\macro.lex.l"
 *lex_data->strptr++ = yytext[1];
 	YY_BREAK
 case YY_STATE_EOF(quote):
-#line 101 "macro.lex.l"
+#line 107 ".\\macro.lex.l"
 return 0;
 	YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 103 "macro.lex.l"
+#line 109 ".\\macro.lex.l"
 
 	YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 104 "macro.lex.l"
+#line 110 ".\\macro.lex.l"
 return yytext[0];
 	YY_BREAK
 case 14:
 YY_RULE_SETUP
-#line 105 "macro.lex.l"
+#line 111 ".\\macro.lex.l"
 ECHO;
 	YY_BREAK
-#line 766 "lex.yy.c"
+#line 772 "lex.yy.c"
 case YY_STATE_EOF(INITIAL):
 	yyterminate();
 
@@ -1648,7 +1654,7 @@
 	return 0;
 	}
 #endif
-#line 105 "macro.lex.l"
+#line 111 ".\\macro.lex.l"
 
 
 #if 0
@@ -1813,7 +1819,7 @@
     return 1;
 }
 
-BOOL MACRO_ExecuteMacro(LPCSTR macro)
+BOOL MACRO_ExecuteMacro(WINHELP_WINDOW* window, LPCSTR macro)
 {
     struct lex_data     curr_lex_data, *prev_lex_data;
     BOOL ret = TRUE;
@@ -1826,6 +1832,7 @@
 
     memset(lex_data, 0, sizeof(*lex_data));
     lex_data->macroptr = macro;
+    lex_data->window = WINHELP_GrabWindow(window);
 
     while ((t = yylex()) != EMPTY)
     {
@@ -1840,13 +1847,15 @@
             break;
         default:
             WINE_WARN("got unexpected type %s\n", ts(t));
-            return 0;
+            YY_FLUSH_BUFFER;
+            ret = FALSE;
+            goto done;
         }
         switch (t = yylex())
         {
         case EMPTY:     goto done;
         case ';':       break;
-        default:        ret = FALSE; goto done;
+        default:        ret = FALSE; YY_FLUSH_BUFFER; goto done;
         }
     }
 
@@ -1854,10 +1863,16 @@
     for (t = 0; t < lex_data->cache_used; t++)
         HeapFree(GetProcessHeap(), 0, lex_data->cache_string[t]);
     lex_data = prev_lex_data;
+    WINHELP_ReleaseWindow(window);
 
     return ret;
 }
 
+WINHELP_WINDOW* MACRO_CurrentWindow(void)
+{
+    return lex_data ? lex_data->window : Globals.active_win;
+}
+
 #ifndef yywrap
 int yywrap(void) { return 1; }
 #endif

Modified: trunk/reactos/base/applications/winhlp32/macro.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/winhlp32/macro.c?rev=41671&r1=41670&r2=41671&view=diff
==============================================================================
--- trunk/reactos/base/applications/winhlp32/macro.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/winhlp32/macro.c [iso-8859-1] Sun Jun 28 21:27:56 2009
@@ -68,7 +68,7 @@
 
 void CALLBACK MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
 {
-    WINHELP_WINDOW *win = Globals.active_win;
+    WINHELP_WINDOW *win = MACRO_CurrentWindow();
     WINHELP_BUTTON *button, **b;
     LONG            size;
     LPSTR           ptr;
@@ -115,7 +115,7 @@
 
     WINE_TRACE("(\"%s\")\n", id);
 
-    b = MACRO_LookupButton(Globals.active_win, id);
+    b = MACRO_LookupButton(MACRO_CurrentWindow(), id);
     if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
 
     EnableWindow((*b)->hWnd, FALSE);
@@ -127,7 +127,7 @@
 
     WINE_TRACE("(\"%s\")\n", id);
 
-    b = MACRO_LookupButton(Globals.active_win, id);
+    b = MACRO_LookupButton(MACRO_CurrentWindow(), id);
     if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
 
     EnableWindow((*b)->hWnd, TRUE);
@@ -172,7 +172,7 @@
 
 static void CALLBACK MACRO_Back(void)
 {
-    WINHELP_WINDOW* win = Globals.active_win;
+    WINHELP_WINDOW* win = MACRO_CurrentWindow();
 
     WINE_TRACE("()\n");
 
@@ -182,7 +182,7 @@
 
 static void CALLBACK MACRO_BackFlush(void)
 {
-    WINHELP_WINDOW* win = Globals.active_win;
+    WINHELP_WINDOW* win = MACRO_CurrentWindow();
 
     WINE_TRACE("()\n");
 
@@ -201,7 +201,7 @@
 
 static void CALLBACK MACRO_BrowseButtons(void)
 {
-    HLPFILE_PAGE*       page = Globals.active_win->page;
+    HLPFILE_PAGE*       page = MACRO_CurrentWindow()->page;
     ULONG               relative;
 
     WINE_TRACE("()\n");
@@ -217,7 +217,7 @@
 
 static void CALLBACK MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
 {
-    WINHELP_WINDOW*     win = Globals.active_win;
+    WINHELP_WINDOW*     win = MACRO_CurrentWindow();
     WINHELP_BUTTON*     button;
     WINHELP_BUTTON**    b;
     LONG                size;
@@ -280,8 +280,8 @@
 
     WINE_TRACE("()\n");
     for (win = Globals.win_list; win; win = win->next)
-        if (win->lpszName && lstrcmpi(win->lpszName, "main"))
-            DestroyWindow(win->hMainWnd);
+        if (lstrcmpi(win->info->name, "main"))
+            WINHELP_ReleaseWindow(win);
 }
 
 static void CALLBACK MACRO_CloseWindow(LPCSTR lpszWindow)
@@ -293,8 +293,8 @@
     if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
 
     for (win = Globals.win_list; win; win = win->next)
-        if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
-            DestroyWindow(win->hMainWnd);
+        if (!lstrcmpi(win->info->name, lpszWindow))
+            WINHELP_ReleaseWindow(win);
 }
 
 static void CALLBACK MACRO_Compare(LPCSTR str)
@@ -304,10 +304,12 @@
 
 static void CALLBACK MACRO_Contents(void)
 {
-    WINE_TRACE("()\n");
-
-    if (Globals.active_win->page)
-        MACRO_JumpContents(Globals.active_win->page->file->lpszPath, NULL);
+    HLPFILE_PAGE*       page = MACRO_CurrentWindow()->page;
+
+    WINE_TRACE("()\n");
+
+    if (page)
+        MACRO_JumpContents(page->file->lpszPath, NULL);
 }
 
 static void CALLBACK MACRO_ControlPanel(LPCSTR str1, LPCSTR str2, LONG u)
@@ -365,7 +367,7 @@
     WINE_TRACE("()\n");
 
     while (Globals.win_list)
-        DestroyWindow(Globals.win_list->hMainWnd);
+        WINHELP_ReleaseWindow(Globals.win_list);
 }
 
 static void CALLBACK MACRO_ExtAbleItem(LPCSTR str, LONG u)
@@ -428,7 +430,7 @@
     if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
 
     for (win = Globals.win_list; win; win = win->next)
-        if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
+        if (!lstrcmpi(win->info->name, lpszWindow))
             SetFocus(win->hMainWnd);
 }
 
@@ -447,7 +449,7 @@
     LPCSTR      file;
 
     WINE_TRACE("()\n");
-    file = Globals.active_win->page->file->help_on_file;
+    file = MACRO_CurrentWindow()->page->file->help_on_file;
     if (!file)
         file = (Globals.wVersion > 4) ? "winhlp32.hlp" : "winhelp.hlp";
 
@@ -473,12 +475,13 @@
 
 static void CALLBACK MACRO_IfThen(BOOL b, LPCSTR t)
 {
-    if (b) MACRO_ExecuteMacro(t);
+    if (b) MACRO_ExecuteMacro(MACRO_CurrentWindow(), t);
 }
 
 static void CALLBACK MACRO_IfThenElse(BOOL b, LPCSTR t, LPCSTR f)
 {
-    if (b) MACRO_ExecuteMacro(t); else MACRO_ExecuteMacro(f);
+    if (b) MACRO_ExecuteMacro(MACRO_CurrentWindow(), t);
+    else MACRO_ExecuteMacro(MACRO_CurrentWindow(), f);
 }
 
 static BOOL CALLBACK MACRO_InitMPrint(void)
@@ -532,7 +535,10 @@
     HLPFILE*    hlpfile;
 
     WINE_TRACE("(\"%s\", \"%s\", %u)\n", lpszPath, lpszWindow, lHash);
-    hlpfile = WINHELP_LookupHelpFile(lpszPath);
+    if (!lpszPath || !lpszPath[0])
+        hlpfile = MACRO_CurrentWindow()->page->file;
+    else
+        hlpfile = WINHELP_LookupHelpFile(lpszPath);
     WINHELP_OpenHelpWindow(HLPFILE_PageByHash, hlpfile, lHash,
                            WINHELP_GetWindowInfo(hlpfile, lpszWindow),
                            SW_NORMAL);
@@ -599,12 +605,12 @@
     WINHELP_WNDPAGE     wp;
 
     WINE_TRACE("()\n");
-    wp.page = Globals.active_win->page;
+    wp.page = MACRO_CurrentWindow()->page;
     wp.page = HLPFILE_PageByOffset(wp.page->file, wp.page->browse_fwd, &wp.relative);
     if (wp.page)
     {
         wp.page->file->wRefCount++;
-        wp.wininfo = Globals.active_win->info;
+        wp.wininfo = MACRO_CurrentWindow()->info;
         WINHELP_CreateHelpWindow(&wp, SW_NORMAL, TRUE);
     }
 }
@@ -639,12 +645,12 @@
     WINHELP_WNDPAGE     wp;
 
     WINE_TRACE("()\n");
-    wp.page = Globals.active_win->page;
+    wp.page = MACRO_CurrentWindow()->page;
     wp.page = HLPFILE_PageByOffset(wp.page->file, wp.page->browse_bwd, &wp.relative);
     if (wp.page)
     {
         wp.page->file->wRefCount++;
-        wp.wininfo = Globals.active_win->info;
+        wp.wininfo = MACRO_CurrentWindow()->info;
         WINHELP_CreateHelpWindow(&wp, SW_NORMAL, TRUE);
     }
 }
@@ -656,7 +662,7 @@
     WINE_TRACE("()\n");
 
     printer.lStructSize         = sizeof(printer);
-    printer.hwndOwner           = Globals.active_win->hMainWnd;
+    printer.hwndOwner           = MACRO_CurrentWindow()->hMainWnd;
     printer.hInstance           = Globals.hInstance;
     printer.hDevMode            = 0;
     printer.hDevNames           = 0;
@@ -774,19 +780,23 @@
 
 static void CALLBACK MACRO_SetHelpOnFile(LPCSTR str)
 {
+    HLPFILE_PAGE*       page = MACRO_CurrentWindow()->page;
+
     WINE_TRACE("(\"%s\")\n", str);
 
-    HeapFree(GetProcessHeap(), 0, Globals.active_win->page->file->help_on_file);
-    Globals.active_win->page->file->help_on_file = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1);
-    if (Globals.active_win->page->file->help_on_file)
-        strcpy(Globals.active_win->page->file->help_on_file, str);
+    HeapFree(GetProcessHeap(), 0, page->file->help_on_file);
+    page->file->help_on_file = HeapAlloc(GetProcessHeap(), 0, strlen(str) + 1);
+    if (page->file->help_on_file)
+        strcpy(page->file->help_on_file, str);
 }
 
 static void CALLBACK MACRO_SetPopupColor(LONG r, LONG g, LONG b)
 {
+    HLPFILE_PAGE*       page = MACRO_CurrentWindow()->page;
+
     WINE_TRACE("(%x, %x, %x)\n", r, g, b);
-    Globals.active_win->page->file->has_popup_color = TRUE;
-    Globals.active_win->page->file->popup_color = RGB(r, g, b);
+    page->file->has_popup_color = TRUE;
+    page->file->popup_color = RGB(r, g, b);
 }
 
 static void CALLBACK MACRO_ShellExecute(LPCSTR str1, LPCSTR str2, LONG u1, LONG u2, LPCSTR str3, LPCSTR str4)
@@ -911,7 +921,7 @@
     {"MPrintHash",          NULL, 0, "U",      (FARPROC)MACRO_MPrintHash},
     {"MPrintID",            NULL, 0, "S",      (FARPROC)MACRO_MPrintID},
     {"Next",                NULL, 0, "",       (FARPROC)MACRO_Next},
-    {"NoShow",              NULL, 0, "",       (FARPROC)MACRO_NoShow},
+    {"NoShow",              "NS", 0, "",       (FARPROC)MACRO_NoShow},
     {"PopupContext",        "PC", 0, "SU",     (FARPROC)MACRO_PopupContext},
     {"PopupHash",           NULL, 0, "SU",     (FARPROC)MACRO_PopupHash},
     {"PopupId",             "PI", 0, "SS",     (FARPROC)MACRO_PopupId},

Modified: trunk/reactos/base/applications/winhlp32/macro.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/winhlp32/macro.h?rev=41671&r1=41670&r2=41671&view=diff
==============================================================================
--- trunk/reactos/base/applications/winhlp32/macro.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/winhlp32/macro.h [iso-8859-1] Sun Jun 28 21:27:56 2009
@@ -33,9 +33,11 @@
 };
 
 extern struct lexret yylval;
+struct tagWinHelp;
 
-BOOL MACRO_ExecuteMacro(LPCSTR);
-int  MACRO_Lookup(const char* name, struct lexret* lr);
+BOOL            MACRO_ExecuteMacro(struct tagWinHelp*, LPCSTR);
+int             MACRO_Lookup(const char* name, struct lexret* lr);
+struct tagWinHelp* MACRO_CurrentWindow(void);
 
 enum token_types {EMPTY, VOID_FUNCTION, BOOL_FUNCTION, INTEGER, STRING, IDENTIFIER};
 void CALLBACK MACRO_About(void);

Modified: trunk/reactos/base/applications/winhlp32/macro.lex.l
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/winhlp32/macro.lex.l?rev=41671&r1=41670&r2=41671&view=diff
==============================================================================
--- trunk/reactos/base/applications/winhlp32/macro.lex.l [iso-8859-1] (original)
+++ trunk/reactos/base/applications/winhlp32/macro.lex.l [iso-8859-1] Sun Jun 28 21:27:56 2009
@@ -25,12 +25,17 @@
 %{
 #include "config.h"
 #include <assert.h>
+#include <stdarg.h>
 
 #ifndef HAVE_UNISTD_H
 #define YY_NO_UNISTD_H
 #endif
 
-#include "macro.h"
+#include "windef.h"
+#include "winbase.h"
+#include "wingdi.h"
+#include "winuser.h"
+#include "winhelp.h"
 
 #include "wine/debug.h"
 
@@ -43,6 +48,7 @@
     unsigned quote_stk_idx;
     LPSTR    cache_string[32];
     int      cache_used;
+    WINHELP_WINDOW* window;
 };
 static struct lex_data* lex_data = NULL;
 
@@ -266,7 +272,7 @@
     return 1;
 }
 
-BOOL MACRO_ExecuteMacro(LPCSTR macro)
+BOOL MACRO_ExecuteMacro(WINHELP_WINDOW* window, LPCSTR macro)
 {
     struct lex_data     curr_lex_data, *prev_lex_data;
     BOOL ret = TRUE;
@@ -279,6 +285,7 @@
 
     memset(lex_data, 0, sizeof(*lex_data));
     lex_data->macroptr = macro;
+    lex_data->window = WINHELP_GrabWindow(window);
 
     while ((t = yylex()) != EMPTY)
     {
@@ -293,13 +300,15 @@
             break;
         default:
             WINE_WARN("got unexpected type %s\n", ts(t));
-            return 0;
+            YY_FLUSH_BUFFER;
+            ret = FALSE;
+            goto done;
         }
         switch (t = yylex())
         {
         case EMPTY:     goto done;
         case ';':       break;
-        default:        ret = FALSE; goto done;
+        default:        ret = FALSE; YY_FLUSH_BUFFER; goto done;
         }
     }
 
@@ -307,8 +316,14 @@
     for (t = 0; t < lex_data->cache_used; t++)
         HeapFree(GetProcessHeap(), 0, lex_data->cache_string[t]);
     lex_data = prev_lex_data;
+    WINHELP_ReleaseWindow(window);
 
     return ret;
+}
+
+WINHELP_WINDOW* MACRO_CurrentWindow(void)
+{
+    return lex_data ? lex_data->window : Globals.active_win;
 }
 
 #ifndef yywrap

Modified: trunk/reactos/base/applications/winhlp32/winhelp.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/winhlp32/winhelp.c?rev=41671&r1=41670&r2=41671&view=diff
==============================================================================
--- trunk/reactos/base/applications/winhlp32/winhelp.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/winhlp32/winhelp.c [iso-8859-1] Sun Jun 28 21:27:56 2009
@@ -257,11 +257,11 @@
     unsigned int     i;
 
     if (!name || !name[0])
-        name = Globals.active_win->lpszName;
+        name = Globals.active_win->info->name;
 
     if (hlpfile)
         for (i = 0; i < hlpfile->numWindows; i++)
-            if (!strcmp(hlpfile->windows[i].name, name))
+            if (!lstrcmpi(hlpfile->windows[i].name, name))
                 return &hlpfile->windows[i];
 
     if (strcmp(name, "main") != 0)
@@ -274,11 +274,19 @@
     {
         strcpy(mwi.type, "primary");
         strcpy(mwi.name, "main");
-        LoadString(Globals.hInstance, STID_WINE_HELP, mwi.caption, sizeof(mwi.caption));
+        if (hlpfile && hlpfile->lpszTitle[0])
+        {
+            char        tmp[128];
+            LoadString(Globals.hInstance, STID_WINE_HELP, tmp, sizeof(tmp));
+            snprintf(mwi.caption, sizeof(mwi.caption), "%s %s - %s",
+                     hlpfile->lpszTitle, tmp, hlpfile->lpszPath);
+        }
+        else
+            LoadString(Globals.hInstance, STID_WINE_HELP, mwi.caption, sizeof(mwi.caption));
         mwi.origin.x = mwi.origin.y = mwi.size.cx = mwi.size.cy = CW_USEDEFAULT;
         mwi.style = SW_SHOW;
         mwi.win_style = WS_OVERLAPPEDWINDOW;
-        mwi.sr_color = mwi.sr_color = 0xFFFFFF;
+        mwi.sr_color = mwi.nsr_color = 0xFFFFFF;
     }
     return &mwi;
 }
@@ -500,11 +508,39 @@
 
 /***********************************************************************
  *
+ *           WINHELP_GrabWindow
+ */
+WINHELP_WINDOW* WINHELP_GrabWindow(WINHELP_WINDOW* win)
+{
+    WINE_TRACE("Grab %p#%d++\n", win, win->ref_count);
+    win->ref_count++;
+    return win;
+}
+
+/***********************************************************************
+ *
+ *           WINHELP_RelaseWindow
+ */
+BOOL WINHELP_ReleaseWindow(WINHELP_WINDOW* win)
+{
+    WINE_TRACE("Release %p#%d--\n", win, win->ref_count);
+
+    if (!--win->ref_count)
+    {
+        DestroyWindow(win->hMainWnd);
+        return FALSE;
+    }
+    return TRUE;
+}
+
+/***********************************************************************
+ *
  *           WINHELP_DeleteWindow
  */
 static void WINHELP_DeleteWindow(WINHELP_WINDOW* win)
 {
     WINHELP_WINDOW**    w;
+    BOOL bExit;
 
     for (w = &Globals.win_list; *w; w = &(*w)->next)
     {
@@ -514,6 +550,7 @@
             break;
         }
     }
+    bExit = (Globals.wVersion >= 4 && !lstrcmpi(win->info->name, "main"));
 
     if (Globals.active_win == win)
     {
@@ -537,6 +574,10 @@
 
     if (win->page) HLPFILE_FreeHlpFile(win->page->file);
     HeapFree(GetProcessHeap(), 0, win);
+
+    if (bExit) MACRO_Exit();
+    if (!Globals.win_list)
+        PostQuitMessage(0);
 }
 
 static char* WINHELP_GetCaption(WINHELP_WNDPAGE* wpage)
@@ -645,7 +686,6 @@
 {
     WINHELP_WINDOW*     win = NULL;
     BOOL                bPrimary, bPopup, bReUsed = FALSE;
-    LPSTR               name;
     HICON               hIcon;
     HWND                hTextWnd = NULL;
 
@@ -656,7 +696,7 @@
     {
         for (win = Globals.win_list; win; win = win->next)
         {
-            if (!lstrcmpi(win->lpszName, wpage->wininfo->name))
+            if (!lstrcmpi(win->info->name, wpage->wininfo->name))
             {
                 POINT   pt = {0, 0};
                 SIZE    sz = {0, 0};
@@ -699,21 +739,19 @@
     if (!win)
     {
         /* Initialize WINHELP_WINDOW struct */
-        win = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
-                        sizeof(WINHELP_WINDOW) + strlen(wpage->wininfo->name) + 1);
+        win = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINHELP_WINDOW));
         if (!win) return FALSE;
         win->next = Globals.win_list;
         Globals.win_list = win;
 
-        name = (char*)win + sizeof(WINHELP_WINDOW);
-        lstrcpy(name, wpage->wininfo->name);
-        win->lpszName = name;
         win->hHandCur = LoadCursorW(0, (LPWSTR)IDC_HAND);
         win->back.index = 0;
         win->font_scale = 1;
+        WINHELP_GrabWindow(win);
     }
     win->page = wpage->page;
     win->info = wpage->wininfo;
+    WINHELP_GrabWindow(win);
 
     if (!bPopup && wpage->page && remember)
     {
@@ -772,11 +810,19 @@
     {
         HLPFILE_MACRO  *macro;
         for (macro = wpage->page->file->first_macro; macro; macro = macro->next)
-            MACRO_ExecuteMacro(macro->lpszMacro);
+            MACRO_ExecuteMacro(win, macro->lpszMacro);
 
         for (macro = wpage->page->first_macro; macro; macro = macro->next)
-            MACRO_ExecuteMacro(macro->lpszMacro);
-    }
+            MACRO_ExecuteMacro(win, macro->lpszMacro);
+    }
+    /* See #17681, in some cases, the newly created window is closed by the macros it contains
+     * (braindead), so deal with this case
+     */
+    for (win = Globals.win_list; win; win = win->next)
+    {
+        if (!lstrcmpi(win->info->name, wpage->wininfo->name)) break;
+    }
+    if (!win || !WINHELP_ReleaseWindow(win)) return TRUE;
 
     if (bPopup)
     {
@@ -870,7 +916,7 @@
                                            SW_NORMAL);
                 break;
             case hlp_link_macro:
-                MACRO_ExecuteMacro(link->string);
+                MACRO_ExecuteMacro(win, link->string);
                 break;
             default:
                 WINE_FIXME("Unknown link cookie %d\n", link->cookie);
@@ -888,7 +934,7 @@
  */
 static BOOL WINHELP_CheckPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT* lret)
 {
-    HWND        hPopup;
+    WINHELP_WINDOW*     popup;
 
     if (!Globals.active_popup) return FALSE;
 
@@ -921,9 +967,9 @@
     case WM_NCLBUTTONDOWN:
     case WM_NCMBUTTONDOWN:
     case WM_NCRBUTTONDOWN:
-        hPopup = Globals.active_popup->hMainWnd;
+        popup = Globals.active_popup;
         Globals.active_popup = NULL;
-        DestroyWindow(hPopup);
+        WINHELP_ReleaseWindow(popup);
         return TRUE;
     }
     return FALSE;
@@ -1368,7 +1414,7 @@
             for (button = win->first_button; button; button = button->next)
                 if (wParam == button->wParam) break;
             if (button)
-                MACRO_ExecuteMacro(button->lpszMacro);
+                MACRO_ExecuteMacro(win, button->lpszMacro);
             else if (!HIWORD(wParam))
                 MessageBox(0, MAKEINTRESOURCE(STID_NOT_IMPLEMENTED),
                            MAKEINTRESOURCE(STID_WHERROR), MB_OK);
@@ -1427,7 +1473,8 @@
                     switch (msgf->msg)
                     {
                     case WM_KEYUP:
-                        if (msgf->wParam == VK_ESCAPE) DestroyWindow(hWnd);
+                        if (msgf->wParam == VK_ESCAPE)
+                            WINHELP_ReleaseWindow((WINHELP_WINDOW*)GetWindowLongPtr(hWnd, 0));
                         break;
                     case WM_RBUTTONDOWN:
                     {
@@ -1491,18 +1538,9 @@
         CheckMenuItem((HMENU)wParam, MNID_OPTS_FONTS_LARGE,
                       MF_BYCOMMAND | (win->font_scale == 2) ? MF_CHECKED : 0);
         break;
-
-    case WM_NCDESTROY:
-        {
-            BOOL bExit;
-            win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0);
-            bExit = (Globals.wVersion >= 4 && !lstrcmpi(win->lpszName, "main"));
-            WINHELP_DeleteWindow(win);
-
-            if (bExit) MACRO_Exit();
-            if (!Globals.win_list)
-                PostQuitMessage(0);
-        }
+    case WM_DESTROY:
+        win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0);
+        WINHELP_DeleteWindow(win);
         break;
     }
     return DefWindowProc(hWnd, msg, wParam, lParam);

Modified: trunk/reactos/base/applications/winhlp32/winhelp.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/winhlp32/winhelp.h?rev=41671&r1=41670&r2=41671&view=diff
==============================================================================
--- trunk/reactos/base/applications/winhlp32/winhelp.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/winhlp32/winhelp.h [iso-8859-1] Sun Jun 28 21:27:56 2009
@@ -71,8 +71,7 @@
 
 typedef struct tagWinHelp
 {
-    LPCSTR              lpszName;
-
+    unsigned            ref_count;
     WINHELP_BUTTON*     first_button;
     HLPFILE_PAGE*       page;
 
@@ -153,6 +152,8 @@
 HLPFILE* WINHELP_LookupHelpFile(LPCSTR lpszFile);
 HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name);
 void WINHELP_LayoutMainWindow(WINHELP_WINDOW* win);
+WINHELP_WINDOW* WINHELP_GrabWindow(WINHELP_WINDOW*);
+BOOL WINHELP_ReleaseWindow(WINHELP_WINDOW*);
 
 extern const char MAIN_WIN_CLASS_NAME[];
 extern const char BUTTON_BOX_WIN_CLASS_NAME[];

Modified: trunk/reactos/base/applications/wordpad/De.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/wordpad/De.rc?rev=41671&r1=41670&r2=41671&view=diff
==============================================================================
--- trunk/reactos/base/applications/wordpad/De.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/wordpad/De.rc [iso-8859-1] Sun Jun 28 21:27:56 2009
@@ -242,6 +242,7 @@
     STRING_OPEN_FAILED,          "Die Datei konnte nicht geöffnet werden."
     STRING_OPEN_ACCESS_DENIED,   "Sie haben keine ausreichende Zugriffsberechtigung um die Datei zu öffnen."
     STRING_PRINTING_NOT_IMPLEMENTED, "Drucken ist nicht implementiert"
+    STRING_MAX_TAB_STOPS,            "Es können nur maximal 32 Tabstopps definiert werden."
 END
 
 #pragma code_page(default)

Modified: trunk/reactos/base/applications/wordpad/Fr.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/wordpad/Fr.rc?rev=41671&r1=41670&r2=41671&view=diff
==============================================================================
--- trunk/reactos/base/applications/wordpad/Fr.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/wordpad/Fr.rc [iso-8859-1] Sun Jun 28 21:27:56 2009
@@ -1,5 +1,5 @@
 /*
- * Copyright 2006-2007 by Jonathan Ernst
+ * Copyright 2006-2009 by Jonathan Ernst
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -240,4 +240,5 @@
     STRING_OPEN_FAILED,               "Impossible d'ouvrir le fichier."
     STRING_OPEN_ACCESS_DENIED,        "Vous ne disposez pas des accès nécessaires à l'ouverture du fichier."
     STRING_PRINTING_NOT_IMPLEMENTED, "L'impression n'est pas implémentée"
-END
+    STRING_MAX_TAB_STOPS,             "Impossible d'ajouter plus de 32 taquets de tabulation."
+END

Modified: trunk/reactos/base/applications/wordpad/Si.rc
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/wordpad/Si.rc?rev=41671&r1=41670&r2=41671&view=diff
==============================================================================
--- trunk/reactos/base/applications/wordpad/Si.rc [iso-8859-1] (original)
+++ trunk/reactos/base/applications/wordpad/Si.rc [iso-8859-1] Sun Jun 28 21:27:56 2009
@@ -242,7 +242,8 @@
     STRING_WRITE_ACCESS_DENIED,       "Nimate pravic za shranjevanje te datoteke."
     STRING_OPEN_FAILED,               "Napaka pri odpiranju datoteke."
     STRING_OPEN_ACCESS_DENIED,        "Nimate pravic za odpiranje te datoteke."
-    STRING_PRINTING_NOT_IMPLEMENTED, "Tiskanje (Å¡e) ni na voljo"
+    STRING_PRINTING_NOT_IMPLEMENTED,  "Tiskanje (Å¡e) ni na voljo"
+    STRING_MAX_TAB_STOPS,             "Ne morem vstaviti več kot 32 položajev tabulatorja."
 END
 
 #pragma code_page(default)



More information about the Ros-diffs mailing list