4 * Copyright 1996 Ulrich Schmid
5 * Copyright 2002 Eric Pouech
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #define WIN32_LEAN_AND_MEAN
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(winhelp
);
34 /**************************************************/
36 /**************************************************/
41 const char* arguments
;
46 * U: 32 bit unsigned int
47 * I: 32 bit signed int
49 * v: unknown (32 bit entity)
52 static struct MacroDesc MACRO_Builtins
[] = {
53 {"About", NULL
, 0, "", (FARPROC
)MACRO_About
},
54 {"AddAccelerator", "AA", 0, "UUS", (FARPROC
)MACRO_AddAccelerator
},
55 {"ALink", "AL", 0, "SUS", (FARPROC
)MACRO_ALink
},
56 {"Annotate", NULL
, 0, "", (FARPROC
)MACRO_Annotate
},
57 {"AppendItem", NULL
, 0, "SSSS", (FARPROC
)MACRO_AppendItem
},
58 {"Back", NULL
, 0, "", (FARPROC
)MACRO_Back
},
59 {"BackFlush", "BF", 0, "", (FARPROC
)MACRO_BackFlush
},
60 {"BookmarkDefine", NULL
, 0, "", (FARPROC
)MACRO_BookmarkDefine
},
61 {"BookmarkMore", NULL
, 0, "", (FARPROC
)MACRO_BookmarkMore
},
62 {"BrowseButtons", NULL
, 0, "", (FARPROC
)MACRO_BrowseButtons
},
63 {"ChangeButtonBinding", "CBB",0, "SS", (FARPROC
)MACRO_ChangeButtonBinding
},
64 {"ChangeEnable", "CE", 0, "SS", (FARPROC
)MACRO_ChangeEnable
},
65 {"ChangeItemBinding", "CIB",0, "SS", (FARPROC
)MACRO_ChangeItemBinding
},
66 {"CheckItem", "CI", 0, "S", (FARPROC
)MACRO_CheckItem
},
67 {"CloseSecondarys", "CS", 0, "", (FARPROC
)MACRO_CloseSecondarys
},
68 {"CloseWindow", "CW", 0, "S", (FARPROC
)MACRO_CloseWindow
},
69 {"Compare", NULL
, 0, "S", (FARPROC
)MACRO_Compare
},
70 {"Contents", NULL
, 0, "", (FARPROC
)MACRO_Contents
},
71 {"ControlPanel", NULL
, 0, "SSU", (FARPROC
)MACRO_ControlPanel
},
72 {"CopyDialog", NULL
, 0, "", (FARPROC
)MACRO_CopyDialog
},
73 {"CopyTopic", "CT", 0, "", (FARPROC
)MACRO_CopyTopic
},
74 {"CreateButton", "CB", 0, "SSS", (FARPROC
)MACRO_CreateButton
},
75 {"DeleteItem", NULL
, 0, "S", (FARPROC
)MACRO_DeleteItem
},
76 {"DeleteMark", NULL
, 0, "S", (FARPROC
)MACRO_DeleteMark
},
77 {"DestroyButton", NULL
, 0, "S", (FARPROC
)MACRO_DestroyButton
},
78 {"DisableButton", "DB", 0, "S", (FARPROC
)MACRO_DisableButton
},
79 {"DisableItem", "DI", 0, "S", (FARPROC
)MACRO_DisableItem
},
80 {"EnableButton", "EB", 0, "S", (FARPROC
)MACRO_EnableButton
},
81 {"EnableItem", "EI", 0, "S", (FARPROC
)MACRO_EnableItem
},
82 {"EndMPrint", NULL
, 0, "", (FARPROC
)MACRO_EndMPrint
},
83 {"ExecFile", "EF", 0, "SSUS", (FARPROC
)MACRO_ExecFile
},
84 {"ExecProgram", "EP", 0, "SU", (FARPROC
)MACRO_ExecProgram
},
85 {"Exit", NULL
, 0, "", (FARPROC
)MACRO_Exit
},
86 {"ExtAbleItem", NULL
, 0, "SU", (FARPROC
)MACRO_ExtAbleItem
},
87 {"ExtInsertItem", NULL
, 0, "SSSSUU", (FARPROC
)MACRO_ExtInsertItem
},
88 {"ExtInsertMenu", NULL
, 0, "SSSUU", (FARPROC
)MACRO_ExtInsertMenu
},
89 {"FileExist", "FE", 1, "S", (FARPROC
)MACRO_FileExist
},
90 {"FileOpen", "FO", 0, "", (FARPROC
)MACRO_FileOpen
},
91 {"Find", NULL
, 0, "", (FARPROC
)MACRO_Find
},
92 {"Finder", "FD", 0, "", (FARPROC
)MACRO_Finder
},
93 {"FloatingMenu", NULL
, 0, "", (FARPROC
)MACRO_FloatingMenu
},
94 {"Flush", "FH", 0, "", (FARPROC
)MACRO_Flush
},
95 {"FocusWindow", NULL
, 0, "S", (FARPROC
)MACRO_FocusWindow
},
96 {"Generate", NULL
, 0, "SUU", (FARPROC
)MACRO_Generate
},
97 {"GotoMark", NULL
, 0, "S", (FARPROC
)MACRO_GotoMark
},
98 {"HelpOn", NULL
, 0, "", (FARPROC
)MACRO_HelpOn
},
99 {"HelpOnTop", NULL
, 0, "", (FARPROC
)MACRO_HelpOnTop
},
100 {"History", NULL
, 0, "", (FARPROC
)MACRO_History
},
101 {"InitMPrint", NULL
, 1, "", (FARPROC
)MACRO_InitMPrint
},
102 {"InsertItem", NULL
, 0, "SSSSU", (FARPROC
)MACRO_InsertItem
},
103 {"InsertMenu", NULL
, 0, "SSU", (FARPROC
)MACRO_InsertMenu
},
104 {"IfThen", "IF", 0, "BS", (FARPROC
)MACRO_IfThen
},
105 {"IfThenElse", "IE", 0, "BSS", (FARPROC
)MACRO_IfThenElse
},
106 {"IsBook", NULL
, 1, "", (FARPROC
)MACRO_IsBook
},
107 {"IsMark", NULL
, 1, "S", (FARPROC
)MACRO_IsMark
},
108 {"IsNotMark", "NM", 1, "S", (FARPROC
)MACRO_IsNotMark
},
109 {"JumpContents", NULL
, 0, "SS", (FARPROC
)MACRO_JumpContents
},
110 {"JumpContext", "JC", 0, "SSU", (FARPROC
)MACRO_JumpContext
},
111 {"JumpHash", "JH", 0, "SSU", (FARPROC
)MACRO_JumpHash
},
112 {"JumpHelpOn", NULL
, 0, "", (FARPROC
)MACRO_JumpHelpOn
},
113 {"JumpID", "JI", 0, "SSS", (FARPROC
)MACRO_JumpID
},
114 {"JumpKeyword", "JK", 0, "SSS", (FARPROC
)MACRO_JumpKeyword
},
115 {"KLink", "KL", 0, "SUSS", (FARPROC
)MACRO_KLink
},
116 {"Menu", "MU", 0, "", (FARPROC
)MACRO_Menu
},
117 {"MPrintHash", NULL
, 0, "U", (FARPROC
)MACRO_MPrintHash
},
118 {"MPrintID", NULL
, 0, "S", (FARPROC
)MACRO_MPrintID
},
119 {"Next", NULL
, 0, "", (FARPROC
)MACRO_Next
},
120 {"NoShow", NULL
, 0, "", (FARPROC
)MACRO_NoShow
},
121 {"PopupContext", "PC", 0, "SU", (FARPROC
)MACRO_PopupContext
},
122 {"PopupHash", NULL
, 0, "SU", (FARPROC
)MACRO_PopupHash
},
123 {"PopupId", "PI", 0, "SS", (FARPROC
)MACRO_PopupId
},
124 {"PositionWindow", "PW", 0, "IIUUUS", (FARPROC
)MACRO_PositionWindow
},
125 {"Prev", NULL
, 0, "", (FARPROC
)MACRO_Prev
},
126 {"Print", NULL
, 0, "", (FARPROC
)MACRO_Print
},
127 {"PrinterSetup", NULL
, 0, "", (FARPROC
)MACRO_PrinterSetup
},
128 {"RegisterRoutine", "RR", 0, "SSS", (FARPROC
)MACRO_RegisterRoutine
},
129 {"RemoveAccelerator", "RA", 0, "UU", (FARPROC
)MACRO_RemoveAccelerator
},
130 {"ResetMenu", NULL
, 0, "", (FARPROC
)MACRO_ResetMenu
},
131 {"SaveMark", NULL
, 0, "S", (FARPROC
)MACRO_SaveMark
},
132 {"Search", NULL
, 0, "", (FARPROC
)MACRO_Search
},
133 {"SetContents", NULL
, 0, "SU", (FARPROC
)MACRO_SetContents
},
134 {"SetHelpOnFile", NULL
, 0, "S", (FARPROC
)MACRO_SetHelpOnFile
},
135 {"SetPopupColor", "SPC",0, "UUU", (FARPROC
)MACRO_SetPopupColor
},
136 {"ShellExecute", "SE", 0, "SSUUSS", (FARPROC
)MACRO_ShellExecute
},
137 {"ShortCut", "SH", 0, "SSUUS", (FARPROC
)MACRO_ShortCut
},
138 {"TCard", NULL
, 0, "U", (FARPROC
)MACRO_TCard
},
139 {"Test", NULL
, 0, "U", (FARPROC
)MACRO_Test
},
140 {"TestALink", NULL
, 1, "S", (FARPROC
)MACRO_TestALink
},
141 {"TestKLink", NULL
, 1, "S", (FARPROC
)MACRO_TestKLink
},
142 {"UncheckItem", "UI", 0, "S", (FARPROC
)MACRO_UncheckItem
},
143 {"UpdateWindow", "UW", 0, "SS", (FARPROC
)MACRO_UpdateWindow
},
144 {NULL
, NULL
, 0, NULL
, NULL
}
147 static struct MacroDesc
*MACRO_Loaded
/* = NULL */;
148 static unsigned MACRO_NumLoaded
/* = 0 */;
150 static int MACRO_DoLookUp(struct MacroDesc
* start
, const char* name
, struct lexret
* lr
, unsigned len
)
152 struct MacroDesc
* md
;
154 for (md
= start
; md
->name
&& len
!= 0; md
++, len
--)
156 if (strcasecmp(md
->name
, name
) == 0 || (md
->alias
!= NULL
&& strcasecmp(md
->alias
, name
) == 0))
158 lr
->proto
= md
->arguments
;
159 lr
->function
= md
->fn
;
160 return md
->isBool
? BOOL_FUNCTION
: VOID_FUNCTION
;
166 int MACRO_Lookup(const char* name
, struct lexret
* lr
)
170 if ((ret
= MACRO_DoLookUp(MACRO_Builtins
, name
, lr
, -1)) != EMPTY
)
172 if (MACRO_Loaded
&& (ret
= MACRO_DoLookUp(MACRO_Loaded
, name
, lr
, MACRO_NumLoaded
)) != EMPTY
)
179 /******* helper functions *******/
181 static WINHELP_BUTTON
** MACRO_LookupButton(WINHELP_WINDOW
* win
, LPCSTR name
)
185 for (b
= &win
->first_button
; *b
; b
= &(*b
)->next
)
186 if (!lstrcmpi(name
, (*b
)->lpszID
)) break;
190 /******* real macro implementation *******/
192 void CALLBACK
MACRO_About(void)
197 void CALLBACK
MACRO_AddAccelerator(LONG u1
, LONG u2
, LPCSTR str
)
199 WINE_FIXME("(%u, %u, \"%s\")\n", u1
, u2
, str
);
202 void CALLBACK
MACRO_ALink(LPCSTR str1
, LONG u
, LPCSTR str2
)
204 WINE_FIXME("(\"%s\", %u, \"%s\")\n", str1
, u
, str2
);
207 void CALLBACK
MACRO_Annotate(void)
212 void CALLBACK
MACRO_AppendItem(LPCSTR str1
, LPCSTR str2
, LPCSTR str3
, LPCSTR str4
)
214 WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\")\n", str1
, str2
, str3
, str4
);
217 void CALLBACK
MACRO_Back(void)
219 WINHELP_WINDOW
* win
= Globals
.active_win
;
223 if (win
&& win
->backIndex
>= 2)
224 WINHELP_CreateHelpWindow(win
->back
[--win
->backIndex
- 1],
228 void CALLBACK
MACRO_BackFlush(void)
230 WINHELP_WINDOW
* win
= Globals
.active_win
;
238 for (i
= 0; i
< win
->backIndex
; i
++)
240 HLPFILE_FreeHlpFile(win
->back
[i
]->file
);
247 void CALLBACK
MACRO_BookmarkDefine(void)
252 void CALLBACK
MACRO_BookmarkMore(void)
257 void CALLBACK
MACRO_BrowseButtons(void)
261 MACRO_CreateButton("BTN_PREV", "&<<", "Prev()");
262 MACRO_CreateButton("BTN_NEXT", "&>>", "Next()");
265 void CALLBACK
MACRO_ChangeButtonBinding(LPCSTR id
, LPCSTR macro
)
267 WINHELP_WINDOW
* win
= Globals
.active_win
;
268 WINHELP_BUTTON
* button
;
273 WINE_TRACE("(\"%s\", \"%s\")\n", id
, macro
);
275 b
= MACRO_LookupButton(win
, id
);
276 if (!*b
) {WINE_FIXME("Couldn't find button '%s'\n", id
); return;}
278 size
= sizeof(WINHELP_BUTTON
) + lstrlen(id
) +
279 lstrlen((*b
)->lpszName
) + lstrlen(macro
) + 3;
281 button
= HeapAlloc(GetProcessHeap(), 0, size
);
284 button
->next
= (*b
)->next
;
285 button
->hWnd
= (*b
)->hWnd
;
286 button
->wParam
= (*b
)->wParam
;
288 ptr
= (char*)button
+ sizeof(WINHELP_BUTTON
);
291 button
->lpszID
= ptr
;
292 ptr
+= lstrlen(id
) + 1;
294 lstrcpy(ptr
, (*b
)->lpszName
);
295 button
->lpszName
= ptr
;
296 ptr
+= lstrlen((*b
)->lpszName
) + 1;
299 button
->lpszMacro
= ptr
;
303 SendMessage(win
->hMainWnd
, WM_USER
, 0, 0);
306 void CALLBACK
MACRO_ChangeEnable(LPCSTR id
, LPCSTR macro
)
308 WINE_TRACE("(\"%s\", \"%s\")\n", id
, macro
);
310 MACRO_ChangeButtonBinding(id
, macro
);
311 MACRO_EnableButton(id
);
314 void CALLBACK
MACRO_ChangeItemBinding(LPCSTR str1
, LPCSTR str2
)
316 WINE_FIXME("(\"%s\", \"%s\")\n", str1
, str2
);
319 void CALLBACK
MACRO_CheckItem(LPCSTR str
)
321 WINE_FIXME("(\"%s\")\n", str
);
324 void CALLBACK
MACRO_CloseSecondarys(void)
329 for (win
= Globals
.win_list
; win
; win
= win
->next
)
330 if (win
->lpszName
&& lstrcmpi(win
->lpszName
, "main"))
331 DestroyWindow(win
->hMainWnd
);
334 void CALLBACK
MACRO_CloseWindow(LPCSTR lpszWindow
)
338 WINE_TRACE("(\"%s\")\n", lpszWindow
);
340 if (!lpszWindow
|| !lpszWindow
[0]) lpszWindow
= "main";
342 for (win
= Globals
.win_list
; win
; win
= win
->next
)
343 if (win
->lpszName
&& !lstrcmpi(win
->lpszName
, lpszWindow
))
344 DestroyWindow(win
->hMainWnd
);
347 void CALLBACK
MACRO_Compare(LPCSTR str
)
349 WINE_FIXME("(\"%s\")\n", str
);
352 void CALLBACK
MACRO_Contents(void)
356 if (Globals
.active_win
->page
)
357 MACRO_JumpContents(Globals
.active_win
->page
->file
->lpszPath
, NULL
);
360 void CALLBACK
MACRO_ControlPanel(LPCSTR str1
, LPCSTR str2
, LONG u
)
362 WINE_FIXME("(\"%s\", \"%s\", %u)\n", str1
, str2
, u
);
365 void CALLBACK
MACRO_CopyDialog(void)
370 void CALLBACK
MACRO_CopyTopic(void)
375 void CALLBACK
MACRO_CreateButton(LPCSTR id
, LPCSTR name
, LPCSTR macro
)
377 WINHELP_WINDOW
*win
= Globals
.active_win
;
378 WINHELP_BUTTON
*button
, **b
;
382 WINE_TRACE("(\"%s\", \"%s\", %s)\n", id
, name
, macro
);
384 size
= sizeof(WINHELP_BUTTON
) + lstrlen(id
) + lstrlen(name
) + lstrlen(macro
) + 3;
386 button
= HeapAlloc(GetProcessHeap(), 0, size
);
392 ptr
= (char*)button
+ sizeof(WINHELP_BUTTON
);
395 button
->lpszID
= ptr
;
396 ptr
+= lstrlen(id
) + 1;
399 button
->lpszName
= ptr
;
400 ptr
+= lstrlen(name
) + 1;
403 button
->lpszMacro
= ptr
;
405 button
->wParam
= WH_FIRST_BUTTON
;
406 for (b
= &win
->first_button
; *b
; b
= &(*b
)->next
)
407 button
->wParam
= max(button
->wParam
, (*b
)->wParam
+ 1);
410 SendMessage(win
->hMainWnd
, WM_USER
, 0, 0);
413 void CALLBACK
MACRO_DeleteItem(LPCSTR str
)
415 WINE_FIXME("(\"%s\")\n", str
);
418 void CALLBACK
MACRO_DeleteMark(LPCSTR str
)
420 WINE_FIXME("(\"%s\")\n", str
);
423 void CALLBACK
MACRO_DestroyButton(LPCSTR str
)
425 WINE_FIXME("(\"%s\")\n", str
);
428 void CALLBACK
MACRO_DisableButton(LPCSTR id
)
432 WINE_FIXME("(\"%s\")\n", id
);
434 b
= MACRO_LookupButton(Globals
.active_win
, id
);
435 if (!*b
) {WINE_FIXME("Couldn't find button '%s'\n", id
); return;}
437 EnableWindow((*b
)->hWnd
, FALSE
);
440 void CALLBACK
MACRO_DisableItem(LPCSTR str
)
442 WINE_FIXME("(\"%s\")\n", str
);
445 void CALLBACK
MACRO_EnableButton(LPCSTR id
)
449 WINE_TRACE("(\"%s\")\n", id
);
451 b
= MACRO_LookupButton(Globals
.active_win
, id
);
452 if (!*b
) {WINE_FIXME("Couldn't find button '%s'\n", id
); return;}
454 EnableWindow((*b
)->hWnd
, TRUE
);
457 void CALLBACK
MACRO_EnableItem(LPCSTR str
)
459 WINE_FIXME("(\"%s\")\n", str
);
462 void CALLBACK
MACRO_EndMPrint(void)
467 void CALLBACK
MACRO_ExecFile(LPCSTR str1
, LPCSTR str2
, LONG u
, LPCSTR str3
)
469 WINE_FIXME("(\"%s\", \"%s\", %u, \"%s\")\n", str1
, str2
, u
, str3
);
472 void CALLBACK
MACRO_ExecProgram(LPCSTR str
, LONG u
)
474 WINE_FIXME("(\"%s\", %u)\n", str
, u
);
477 void CALLBACK
MACRO_Exit(void)
481 while (Globals
.win_list
)
482 DestroyWindow(Globals
.win_list
->hMainWnd
);
485 void CALLBACK
MACRO_ExtAbleItem(LPCSTR str
, LONG u
)
487 WINE_FIXME("(\"%s\", %u)\n", str
, u
);
490 void CALLBACK
MACRO_ExtInsertItem(LPCSTR str1
, LPCSTR str2
, LPCSTR str3
, LPCSTR str4
, LONG u1
, LONG u2
)
492 WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\", %u, %u)\n", str1
, str2
, str3
, str4
, u1
, u2
);
495 void CALLBACK
MACRO_ExtInsertMenu(LPCSTR str1
, LPCSTR str2
, LPCSTR str3
, LONG u1
, LONG u2
)
497 WINE_FIXME("(\"%s\", \"%s\", \"%s\", %u, %u)\n", str1
, str2
, str3
, u1
, u2
);
500 BOOL CALLBACK
MACRO_FileExist(LPCSTR str
)
502 WINE_TRACE("(\"%s\")\n", str
);
503 return GetFileAttributes(str
) != INVALID_FILE_ATTRIBUTES
;
506 void CALLBACK
MACRO_FileOpen(void)
508 char szFile
[MAX_PATH
];
510 if (WINHELP_GetOpenFileName(szFile
, MAX_PATH
))
512 HLPFILE
* hlpfile
= WINHELP_LookupHelpFile(szFile
);
514 WINHELP_CreateHelpWindowByHash(hlpfile
, 0,
515 WINHELP_GetWindowInfo(hlpfile
, "main"), SW_SHOWNORMAL
);
519 void CALLBACK
MACRO_Find(void)
524 void CALLBACK
MACRO_Finder(void)
526 WINHELP_CreateIndexWindow();
529 void CALLBACK
MACRO_FloatingMenu(void)
534 void CALLBACK
MACRO_Flush(void)
539 void CALLBACK
MACRO_FocusWindow(LPCSTR lpszWindow
)
543 WINE_TRACE("(\"%s\")\n", lpszWindow
);
545 if (!lpszWindow
|| !lpszWindow
[0]) lpszWindow
= "main";
547 for (win
= Globals
.win_list
; win
; win
= win
->next
)
548 if (win
->lpszName
&& !lstrcmpi(win
->lpszName
, lpszWindow
))
549 SetFocus(win
->hMainWnd
);
552 void CALLBACK
MACRO_Generate(LPCSTR str
, LONG w
, LONG l
)
554 WINE_FIXME("(\"%s\", %x, %x)\n", str
, w
, l
);
557 void CALLBACK
MACRO_GotoMark(LPCSTR str
)
559 WINE_FIXME("(\"%s\")\n", str
);
562 void CALLBACK
MACRO_HelpOn(void)
565 MACRO_JumpContents((Globals
.wVersion
> 4) ? "winhelp32.hlp" : "winhelp.hlp", NULL
);
568 void CALLBACK
MACRO_HelpOnTop(void)
573 void CALLBACK
MACRO_History(void)
577 if (Globals
.active_win
&& !Globals
.active_win
->hHistoryWnd
)
579 HWND hWnd
= CreateWindow(HISTORY_WIN_CLASS_NAME
, "History", WS_OVERLAPPEDWINDOW
,
580 0, 0, 0, 0, 0, 0, Globals
.hInstance
, Globals
.active_win
);
581 ShowWindow(hWnd
, SW_NORMAL
);
585 void CALLBACK
MACRO_IfThen(BOOL b
, LPCSTR t
)
587 if (b
) MACRO_ExecuteMacro(t
);
590 void CALLBACK
MACRO_IfThenElse(BOOL b
, LPCSTR t
, LPCSTR f
)
592 if (b
) MACRO_ExecuteMacro(t
); else MACRO_ExecuteMacro(f
);
595 BOOL CALLBACK
MACRO_InitMPrint(void)
601 void CALLBACK
MACRO_InsertItem(LPCSTR str1
, LPCSTR str2
, LPCSTR str3
, LPCSTR str4
, LONG u
)
603 WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\", %u)\n", str1
, str2
, str3
, str4
, u
);
606 void CALLBACK
MACRO_InsertMenu(LPCSTR str1
, LPCSTR str2
, LONG u
)
608 WINE_FIXME("(\"%s\", \"%s\", %u)\n", str1
, str2
, u
);
611 BOOL CALLBACK
MACRO_IsBook(void)
614 return Globals
.isBook
;
617 BOOL CALLBACK
MACRO_IsMark(LPCSTR str
)
619 WINE_FIXME("(\"%s\")\n", str
);
623 BOOL CALLBACK
MACRO_IsNotMark(LPCSTR str
)
625 WINE_FIXME("(\"%s\")\n", str
);
629 void CALLBACK
MACRO_JumpContents(LPCSTR lpszPath
, LPCSTR lpszWindow
)
633 WINE_TRACE("(\"%s\", \"%s\")\n", lpszPath
, lpszWindow
);
634 hlpfile
= WINHELP_LookupHelpFile(lpszPath
);
635 WINHELP_CreateHelpWindowByHash(hlpfile
, 0,
636 WINHELP_GetWindowInfo(hlpfile
, lpszWindow
),
640 void CALLBACK
MACRO_JumpContext(LPCSTR lpszPath
, LPCSTR lpszWindow
, LONG context
)
644 WINE_TRACE("(\"%s\", \"%s\", %d)\n", lpszPath
, lpszWindow
, context
);
645 hlpfile
= WINHELP_LookupHelpFile(lpszPath
);
646 /* Some madness: what user calls 'context', hlpfile calls 'map' */
647 WINHELP_CreateHelpWindowByMap(hlpfile
, context
,
648 WINHELP_GetWindowInfo(hlpfile
, lpszWindow
),
652 void CALLBACK
MACRO_JumpHash(LPCSTR lpszPath
, LPCSTR lpszWindow
, LONG lHash
)
656 WINE_TRACE("(\"%s\", \"%s\", %u)\n", lpszPath
, lpszWindow
, lHash
);
657 hlpfile
= WINHELP_LookupHelpFile(lpszPath
);
658 WINHELP_CreateHelpWindowByHash(hlpfile
, lHash
,
659 WINHELP_GetWindowInfo(hlpfile
, lpszWindow
),
663 void CALLBACK
MACRO_JumpHelpOn(void)
668 /* FIXME: those two macros are wrong
669 * they should only contain 2 strings, path & window are coded as path>window
671 void CALLBACK
MACRO_JumpID(LPCSTR lpszPath
, LPCSTR lpszWindow
, LPCSTR topic_id
)
673 WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", lpszPath
, lpszWindow
, topic_id
);
674 MACRO_JumpHash(lpszPath
, lpszWindow
, HLPFILE_Hash(topic_id
));
677 void CALLBACK
MACRO_JumpKeyword(LPCSTR lpszPath
, LPCSTR lpszWindow
, LPCSTR keyword
)
679 WINE_FIXME("(\"%s\", \"%s\", \"%s\")\n", lpszPath
, lpszWindow
, keyword
);
682 void CALLBACK
MACRO_KLink(LPCSTR str1
, LONG u
, LPCSTR str2
, LPCSTR str3
)
684 WINE_FIXME("(\"%s\", %u, \"%s\", \"%s\")\n", str1
, u
, str2
, str3
);
687 void CALLBACK
MACRO_Menu(void)
692 void CALLBACK
MACRO_MPrintHash(LONG u
)
694 WINE_FIXME("(%u)\n", u
);
697 void CALLBACK
MACRO_MPrintID(LPCSTR str
)
699 WINE_FIXME("(\"%s\")\n", str
);
702 void CALLBACK
MACRO_Next(void)
707 page
= Globals
.active_win
->page
;
708 page
= HLPFILE_PageByOffset(page
->file
, page
->browse_fwd
);
711 page
->file
->wRefCount
++;
712 WINHELP_CreateHelpWindow(page
, Globals
.active_win
->info
, SW_NORMAL
);
716 void CALLBACK
MACRO_NoShow(void)
721 void CALLBACK
MACRO_PopupContext(LPCSTR str
, LONG u
)
723 WINE_FIXME("(\"%s\", %u)\n", str
, u
);
726 void CALLBACK
MACRO_PopupHash(LPCSTR str
, LONG u
)
728 WINE_FIXME("(\"%s\", %u)\n", str
, u
);
731 void CALLBACK
MACRO_PopupId(LPCSTR str1
, LPCSTR str2
)
733 WINE_FIXME("(\"%s\", \"%s\")\n", str1
, str2
);
736 void CALLBACK
MACRO_PositionWindow(LONG i1
, LONG i2
, LONG u1
, LONG u2
, LONG u3
, LPCSTR str
)
738 WINE_FIXME("(%i, %i, %u, %u, %u, \"%s\")\n", i1
, i2
, u1
, u2
, u3
, str
);
741 void CALLBACK
MACRO_Prev(void)
746 page
= Globals
.active_win
->page
;
747 page
= HLPFILE_PageByOffset(page
->file
, page
->browse_bwd
);
750 page
->file
->wRefCount
++;
751 WINHELP_CreateHelpWindow(page
, Globals
.active_win
->info
, SW_NORMAL
);
755 void CALLBACK
MACRO_Print(void)
761 printer
.lStructSize
= sizeof(printer
);
762 printer
.hwndOwner
= Globals
.active_win
->hMainWnd
;
763 printer
.hInstance
= Globals
.hInstance
;
764 printer
.hDevMode
= 0;
765 printer
.hDevNames
= 0;
768 printer
.nFromPage
= 0;
770 printer
.nMinPage
= 0;
771 printer
.nMaxPage
= 0;
773 printer
.lCustData
= 0;
774 printer
.lpfnPrintHook
= 0;
775 printer
.lpfnSetupHook
= 0;
776 printer
.lpPrintTemplateName
= 0;
777 printer
.lpSetupTemplateName
= 0;
778 printer
.hPrintTemplate
= 0;
779 printer
.hSetupTemplate
= 0;
781 if (PrintDlgA(&printer
)) {
782 WINE_FIXME("Print()\n");
786 void CALLBACK
MACRO_PrinterSetup(void)
791 void CALLBACK
MACRO_RegisterRoutine(LPCSTR dll_name
, LPCSTR proc
, LPCSTR args
)
797 WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", dll_name
, proc
, args
);
799 /* FIXME: are the registered DLLs global or linked to the current file ???
800 * We assume globals (as we did for macros, but is this really the case ???)
802 for (dll
= Globals
.dlls
; dll
; dll
= dll
->next
)
804 if (!strcmp(dll
->name
, dll_name
)) break;
808 HANDLE hLib
= LoadLibrary(dll_name
);
810 /* FIXME: the library will not be unloaded until exit of program
811 * We don't send the DW_TERM message
813 WINE_TRACE("Loading %s\n", dll_name
);
814 /* FIXME: should look in the directory where current hlpfile
819 /* FIXME: internationalisation for error messages */
820 WINE_FIXME("Cannot find dll %s\n", dll_name
);
822 else if ((dll
= HeapAlloc(GetProcessHeap(), 0, sizeof(*dll
))))
825 dll
->name
= strdup(dll_name
); /* FIXME */
826 dll
->next
= Globals
.dlls
;
828 dll
->handler
= (WINHELP_LDLLHandler
)GetProcAddress(dll
->hLib
, "LDLLHandler");
829 dll
->class = dll
->handler
? (dll
->handler
)(DW_WHATMSG
, 0, 0) : DC_NOMSG
;
830 WINE_TRACE("Got class %x for DLL %s\n", dll
->class, dll_name
);
831 if (dll
->class & DC_INITTERM
) dll
->handler(DW_INIT
, 0, 0);
832 if (dll
->class & DC_CALLBACKS
) dll
->handler(DW_CALLBACKS
, (DWORD
)Callbacks
, 0);
834 else WINE_WARN("OOM\n");
836 if (dll
&& !(fn
= GetProcAddress(dll
->hLib
, proc
)))
838 /* FIXME: internationalisation for error messages */
839 WINE_FIXME("Cannot find proc %s in dll %s\n", dll_name
, proc
);
842 size
= ++MACRO_NumLoaded
* sizeof(struct MacroDesc
);
843 if (!MACRO_Loaded
) MACRO_Loaded
= HeapAlloc(GetProcessHeap(), 0, size
);
844 else MACRO_Loaded
= HeapReAlloc(GetProcessHeap(), 0, MACRO_Loaded
, size
);
845 MACRO_Loaded
[MACRO_NumLoaded
- 1].name
= strdup(proc
); /* FIXME */
846 MACRO_Loaded
[MACRO_NumLoaded
- 1].alias
= NULL
;
847 MACRO_Loaded
[MACRO_NumLoaded
- 1].isBool
= 0;
848 MACRO_Loaded
[MACRO_NumLoaded
- 1].arguments
= strdup(args
); /* FIXME */
849 MACRO_Loaded
[MACRO_NumLoaded
- 1].fn
= fn
;
850 WINE_TRACE("Added %s(%s) at %p\n", proc
, args
, fn
);
853 void CALLBACK
MACRO_RemoveAccelerator(LONG u1
, LONG u2
)
855 WINE_FIXME("(%u, %u)\n", u1
, u2
);
858 void CALLBACK
MACRO_ResetMenu(void)
863 void CALLBACK
MACRO_SaveMark(LPCSTR str
)
865 WINE_FIXME("(\"%s\")\n", str
);
868 void CALLBACK
MACRO_Search(void)
873 void CALLBACK
MACRO_SetContents(LPCSTR str
, LONG u
)
875 WINE_FIXME("(\"%s\", %u)\n", str
, u
);
878 void CALLBACK
MACRO_SetHelpOnFile(LPCSTR str
)
880 WINE_FIXME("(\"%s\")\n", str
);
883 void CALLBACK
MACRO_SetPopupColor(LONG u1
, LONG u2
, LONG u3
)
885 WINE_FIXME("(%u, %u, %u)\n", u1
, u2
, u3
);
888 void CALLBACK
MACRO_ShellExecute(LPCSTR str1
, LPCSTR str2
, LONG u1
, LONG u2
, LPCSTR str3
, LPCSTR str4
)
890 WINE_FIXME("(\"%s\", \"%s\", %u, %u, \"%s\", \"%s\")\n", str1
, str2
, u1
, u2
, str3
, str4
);
893 void CALLBACK
MACRO_ShortCut(LPCSTR str1
, LPCSTR str2
, LONG w
, LONG l
, LPCSTR str
)
895 WINE_FIXME("(\"%s\", \"%s\", %x, %x, \"%s\")\n", str1
, str2
, w
, l
, str
);
898 void CALLBACK
MACRO_TCard(LONG u
)
900 WINE_FIXME("(%u)\n", u
);
903 void CALLBACK
MACRO_Test(LONG u
)
905 WINE_FIXME("(%u)\n", u
);
908 BOOL CALLBACK
MACRO_TestALink(LPCSTR str
)
910 WINE_FIXME("(\"%s\")\n", str
);
914 BOOL CALLBACK
MACRO_TestKLink(LPCSTR str
)
916 WINE_FIXME("(\"%s\")\n", str
);
920 void CALLBACK
MACRO_UncheckItem(LPCSTR str
)
922 WINE_FIXME("(\"%s\")\n", str
);
925 void CALLBACK
MACRO_UpdateWindow(LPCSTR str1
, LPCSTR str2
)
927 WINE_FIXME("(\"%s\", \"%s\")\n", str1
, str2
);