Commit 042bbf9a authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winhlp32: Force the handling of a current help window while processing a macro.

parent ae20d470
...@@ -473,12 +473,13 @@ void CALLBACK MACRO_History(void) ...@@ -473,12 +473,13 @@ void CALLBACK MACRO_History(void)
static void CALLBACK MACRO_IfThen(BOOL b, LPCSTR t) 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) 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) static BOOL CALLBACK MACRO_InitMPrint(void)
......
...@@ -33,9 +33,11 @@ struct lexret { ...@@ -33,9 +33,11 @@ struct lexret {
}; };
extern struct lexret yylval; extern struct lexret yylval;
struct tagWinHelp;
BOOL MACRO_ExecuteMacro(LPCSTR); BOOL MACRO_ExecuteMacro(struct tagWinHelp*, LPCSTR);
int MACRO_Lookup(const char* name, struct lexret* lr); 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}; enum token_types {EMPTY, VOID_FUNCTION, BOOL_FUNCTION, INTEGER, STRING, IDENTIFIER};
void CALLBACK MACRO_About(void); void CALLBACK MACRO_About(void);
......
...@@ -25,12 +25,17 @@ ...@@ -25,12 +25,17 @@
%{ %{
#include "config.h" #include "config.h"
#include <assert.h> #include <assert.h>
#include <stdarg.h>
#ifndef HAVE_UNISTD_H #ifndef HAVE_UNISTD_H
#define YY_NO_UNISTD_H #define YY_NO_UNISTD_H
#endif #endif
#include "macro.h" #include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winhelp.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -43,6 +48,7 @@ struct lex_data { ...@@ -43,6 +48,7 @@ struct lex_data {
unsigned quote_stk_idx; unsigned quote_stk_idx;
LPSTR cache_string[32]; LPSTR cache_string[32];
int cache_used; int cache_used;
WINHELP_WINDOW* window;
}; };
static struct lex_data* lex_data = NULL; static struct lex_data* lex_data = NULL;
...@@ -266,7 +272,7 @@ static int MACRO_CallVoidFunc(FARPROC fn, const char* args) ...@@ -266,7 +272,7 @@ static int MACRO_CallVoidFunc(FARPROC fn, const char* args)
return 1; return 1;
} }
BOOL MACRO_ExecuteMacro(LPCSTR macro) BOOL MACRO_ExecuteMacro(WINHELP_WINDOW* window, LPCSTR macro)
{ {
struct lex_data curr_lex_data, *prev_lex_data; struct lex_data curr_lex_data, *prev_lex_data;
BOOL ret = TRUE; BOOL ret = TRUE;
...@@ -279,6 +285,7 @@ BOOL MACRO_ExecuteMacro(LPCSTR macro) ...@@ -279,6 +285,7 @@ BOOL MACRO_ExecuteMacro(LPCSTR macro)
memset(lex_data, 0, sizeof(*lex_data)); memset(lex_data, 0, sizeof(*lex_data));
lex_data->macroptr = macro; lex_data->macroptr = macro;
lex_data->window = window;
while ((t = yylex()) != EMPTY) while ((t = yylex()) != EMPTY)
{ {
...@@ -313,6 +320,11 @@ done: ...@@ -313,6 +320,11 @@ done:
return ret; return ret;
} }
WINHELP_WINDOW* MACRO_CurrentWindow(void)
{
return lex_data ? lex_data->window : Globals.active_win;
}
#ifndef yywrap #ifndef yywrap
int yywrap(void) { return 1; } int yywrap(void) { return 1; }
#endif #endif
...@@ -772,10 +772,10 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe ...@@ -772,10 +772,10 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
{ {
HLPFILE_MACRO *macro; HLPFILE_MACRO *macro;
for (macro = wpage->page->file->first_macro; macro; macro = macro->next) 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) for (macro = wpage->page->first_macro; macro; macro = macro->next)
MACRO_ExecuteMacro(macro->lpszMacro); MACRO_ExecuteMacro(win, macro->lpszMacro);
} }
if (bPopup) if (bPopup)
...@@ -870,7 +870,7 @@ static BOOL WINHELP_HandleTextMouse(WINHELP_WINDOW* win, UINT msg, LPARAM lParam ...@@ -870,7 +870,7 @@ static BOOL WINHELP_HandleTextMouse(WINHELP_WINDOW* win, UINT msg, LPARAM lParam
SW_NORMAL); SW_NORMAL);
break; break;
case hlp_link_macro: case hlp_link_macro:
MACRO_ExecuteMacro(link->string); MACRO_ExecuteMacro(win, link->string);
break; break;
default: default:
WINE_FIXME("Unknown link cookie %d\n", link->cookie); WINE_FIXME("Unknown link cookie %d\n", link->cookie);
...@@ -1368,7 +1368,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam, ...@@ -1368,7 +1368,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
for (button = win->first_button; button; button = button->next) for (button = win->first_button; button; button = button->next)
if (wParam == button->wParam) break; if (wParam == button->wParam) break;
if (button) if (button)
MACRO_ExecuteMacro(button->lpszMacro); MACRO_ExecuteMacro(win, button->lpszMacro);
else if (!HIWORD(wParam)) else if (!HIWORD(wParam))
MessageBox(0, MAKEINTRESOURCE(STID_NOT_IMPLEMENTED), MessageBox(0, MAKEINTRESOURCE(STID_NOT_IMPLEMENTED),
MAKEINTRESOURCE(STID_WHERROR), MB_OK); MAKEINTRESOURCE(STID_WHERROR), MB_OK);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment