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

This commit is contained in:
Eric Pouech 2009-05-30 14:26:33 +02:00 committed by Alexandre Julliard
parent ae20d4708b
commit 042bbf9a41
4 changed files with 25 additions and 10 deletions

View file

@ -473,12 +473,13 @@ void CALLBACK MACRO_History(void)
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)

View file

@ -33,9 +33,11 @@ struct lexret {
};
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);
struct tagWinHelp* MACRO_CurrentWindow(void);
enum token_types {EMPTY, VOID_FUNCTION, BOOL_FUNCTION, INTEGER, STRING, IDENTIFIER};
void CALLBACK MACRO_About(void);

View file

@ -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 @@ struct lex_data {
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 @@ static int MACRO_CallVoidFunc(FARPROC fn, const char* args)
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 @@ BOOL MACRO_ExecuteMacro(LPCSTR macro)
memset(lex_data, 0, sizeof(*lex_data));
lex_data->macroptr = macro;
lex_data->window = window;
while ((t = yylex()) != EMPTY)
{
@ -313,6 +320,11 @@ done:
return ret;
}
WINHELP_WINDOW* MACRO_CurrentWindow(void)
{
return lex_data ? lex_data->window : Globals.active_win;
}
#ifndef yywrap
int yywrap(void) { return 1; }
#endif

View file

@ -772,10 +772,10 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
{
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);
}
if (bPopup)
@ -870,7 +870,7 @@ static BOOL WINHELP_HandleTextMouse(WINHELP_WINDOW* win, UINT msg, LPARAM lParam
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);
@ -1368,7 +1368,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
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);