Sync wordpad and winhlp32 with wine 1.1.24.

svn path=/trunk/; revision=41671
This commit is contained in:
Daniel Reimer 2009-06-28 17:27:56 +00:00
parent 1daa242cc5
commit 4a92fcca6f
10 changed files with 199 additions and 115 deletions

View file

@ -39,21 +39,21 @@ MAIN_MENU MENU LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL
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 @@ MAIN_MENU MENU LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL
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_WARNING, "ATTENZIONE"
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: "
}

View file

@ -380,9 +380,9 @@ static char *yy_last_accepting_cpos;
#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 @@ char *yytext;
#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 @@ struct lex_data {
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 @@ struct lexret yylval;
#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 @@ YY_DECL
register char *yy_cp, *yy_bp;
register int yy_act;
#line 55 "macro.lex.l"
#line 61 ".\\macro.lex.l"
#line 594 "lex.yy.c"
#line 600 "lex.yy.c"
if ( yy_init )
{
@ -675,32 +681,32 @@ do_action: /* This label is used only to access EOF actions. */
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_RULE_SETUP
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 @@ int main()
return 0;
}
#endif
#line 105 "macro.lex.l"
#line 111 ".\\macro.lex.l"
#if 0
@ -1813,7 +1819,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;
@ -1826,6 +1832,7 @@ BOOL MACRO_ExecuteMacro(LPCSTR macro)
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 @@ BOOL MACRO_ExecuteMacro(LPCSTR macro)
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 @@ done:
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

View file

@ -68,7 +68,7 @@ static WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR na
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 @@ void CALLBACK MACRO_DisableButton(LPCSTR id)
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 @@ static void CALLBACK MACRO_EnableButton(LPCSTR id)
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_AppendItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPC
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_Back(void)
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_BookmarkMore(void)
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_BrowseButtons(void)
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 @@ static void CALLBACK MACRO_CloseSecondarys(void)
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 @@ static void CALLBACK MACRO_CloseWindow(LPCSTR lpszWindow)
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_Compare(LPCSTR str)
static void CALLBACK MACRO_Contents(void)
{
HLPFILE_PAGE* page = MACRO_CurrentWindow()->page;
WINE_TRACE("()\n");
if (Globals.active_win->page)
MACRO_JumpContents(Globals.active_win->page->file->lpszPath, NULL);
if (page)
MACRO_JumpContents(page->file->lpszPath, NULL);
}
static void CALLBACK MACRO_ControlPanel(LPCSTR str1, LPCSTR str2, LONG u)
@ -365,7 +367,7 @@ void CALLBACK MACRO_Exit(void)
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 @@ static void CALLBACK MACRO_FocusWindow(LPCSTR lpszWindow)
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 @@ void CALLBACK MACRO_HelpOn(void)
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 @@ 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)
@ -532,7 +535,10 @@ void CALLBACK MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
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 @@ static void CALLBACK MACRO_Next(void)
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 @@ static void CALLBACK MACRO_Prev(void)
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 @@ void CALLBACK MACRO_Print(void)
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 @@ void CALLBACK MACRO_SetContents(LPCSTR str, LONG u)
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 @@ static struct MacroDesc MACRO_Builtins[] = {
{"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},

View file

@ -33,9 +33,11 @@ struct lexret {
};
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);

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 = WINHELP_GrabWindow(window);
while ((t = yylex()) != EMPTY)
{
@ -293,13 +300,15 @@ BOOL MACRO_ExecuteMacro(LPCSTR macro)
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,10 +316,16 @@ done:
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

View file

@ -257,11 +257,11 @@ HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name)
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 @@ HLPFILE_WINDOWINFO* WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name)
{
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;
}
@ -498,6 +506,33 @@ static void WINHELP_DeletePageLinks(HLPFILE_PAGE* page)
}
}
/***********************************************************************
*
* 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
@ -505,6 +540,7 @@ static void WINHELP_DeletePageLinks(HLPFILE_PAGE* page)
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 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW* win)
break;
}
}
bExit = (Globals.wVersion >= 4 && !lstrcmpi(win->info->name, "main"));
if (Globals.active_win == win)
{
@ -537,6 +574,10 @@ static void WINHELP_DeleteWindow(WINHELP_WINDOW* win)
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 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
{
WINHELP_WINDOW* win = NULL;
BOOL bPrimary, bPopup, bReUsed = FALSE;
LPSTR name;
HICON hIcon;
HWND hTextWnd = NULL;
@ -656,7 +696,7 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
{
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 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
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 @@ 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);
}
/* 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 @@ 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);
@ -888,7 +934,7 @@ static BOOL WINHELP_HandleTextMouse(WINHELP_WINDOW* win, UINT msg, LPARAM lParam
*/
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 @@ static BOOL WINHELP_CheckPopup(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam
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 @@ 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);
@ -1427,7 +1473,8 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
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 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
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);

View file

@ -71,8 +71,7 @@ typedef struct tagPageSet
typedef struct tagWinHelp
{
LPCSTR lpszName;
unsigned ref_count;
WINHELP_BUTTON* first_button;
HLPFILE_PAGE* page;
@ -153,6 +152,8 @@ void WINHELP_DeleteBackSet(WINHELP_WINDOW*);
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[];

View file

@ -242,6 +242,7 @@ BEGIN
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)

View file

@ -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 @@ BEGIN
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"
STRING_MAX_TAB_STOPS, "Impossible d'ajouter plus de 32 taquets de tabulation."
END

View file

@ -242,7 +242,8 @@ BEGIN
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)