winex11: Allow wintab devices with less than 5 axes.
[wine/wine64.git] / programs / winhelp / macro.c
blob66eac0fb02fb9da00cdf398e427e39ad1cbf6e68
1 /*
2 * Help Viewer
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
24 #include <stdio.h>
26 #include "windows.h"
27 #include "commdlg.h"
28 #include "winhelp.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
34 /**************************************************/
35 /* Macro table */
36 /**************************************************/
37 struct MacroDesc {
38 const char* name;
39 const char* alias;
40 BOOL isBool;
41 const char* arguments;
42 FARPROC fn;
45 /* types:
46 * U: 32 bit unsigned int
47 * I: 32 bit signed int
48 * S: string
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, "SS", (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;
163 return EMPTY;
166 int MACRO_Lookup(const char* name, struct lexret* lr)
168 int ret;
170 if ((ret = MACRO_DoLookUp(MACRO_Builtins, name, lr, -1)) != EMPTY)
171 return ret;
172 if (MACRO_Loaded && (ret = MACRO_DoLookUp(MACRO_Loaded, name, lr, MACRO_NumLoaded)) != EMPTY)
173 return ret;
175 lr->string = name;
176 return IDENTIFIER;
179 /******* helper functions *******/
181 static WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name)
183 WINHELP_BUTTON** b;
185 for (b = &win->first_button; *b; b = &(*b)->next)
186 if (!lstrcmpi(name, (*b)->lpszID)) break;
187 return b;
190 /******* real macro implementation *******/
192 void CALLBACK MACRO_About(void)
194 WINE_FIXME("()\n");
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)
209 WINE_FIXME("()\n");
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;
221 WINE_TRACE("()\n");
223 if (win && win->back.index >= 2)
224 WINHELP_CreateHelpWindow(&win->back.set[--win->back.index - 1], SW_SHOW, FALSE);
227 void CALLBACK MACRO_BackFlush(void)
229 WINHELP_WINDOW* win = Globals.active_win;
231 WINE_TRACE("()\n");
233 if (win) WINHELP_DeleteBackSet(win);
236 void CALLBACK MACRO_BookmarkDefine(void)
238 WINE_FIXME("()\n");
241 void CALLBACK MACRO_BookmarkMore(void)
243 WINE_FIXME("()\n");
246 void CALLBACK MACRO_BrowseButtons(void)
248 HLPFILE_PAGE* page = Globals.active_win->page;
249 ULONG relative;
251 WINE_TRACE("()\n");
253 MACRO_CreateButton("BTN_PREV", "&<<", "Prev()");
254 MACRO_CreateButton("BTN_NEXT", "&>>", "Next()");
256 if (!HLPFILE_PageByOffset(page->file, page->browse_bwd, &relative))
257 MACRO_DisableButton("BTN_PREV");
258 if (!HLPFILE_PageByOffset(page->file, page->browse_fwd, &relative))
259 MACRO_DisableButton("BTN_NEXT");
262 void CALLBACK MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
264 WINHELP_WINDOW* win = Globals.active_win;
265 WINHELP_BUTTON* button;
266 WINHELP_BUTTON** b;
267 LONG size;
268 LPSTR ptr;
270 WINE_TRACE("(\"%s\", \"%s\")\n", id, macro);
272 b = MACRO_LookupButton(win, id);
273 if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
275 size = sizeof(WINHELP_BUTTON) + lstrlen(id) +
276 lstrlen((*b)->lpszName) + lstrlen(macro) + 3;
278 button = HeapAlloc(GetProcessHeap(), 0, size);
279 if (!button) return;
281 button->next = (*b)->next;
282 button->hWnd = (*b)->hWnd;
283 button->wParam = (*b)->wParam;
285 ptr = (char*)button + sizeof(WINHELP_BUTTON);
287 lstrcpy(ptr, id);
288 button->lpszID = ptr;
289 ptr += lstrlen(id) + 1;
291 lstrcpy(ptr, (*b)->lpszName);
292 button->lpszName = ptr;
293 ptr += lstrlen((*b)->lpszName) + 1;
295 lstrcpy(ptr, macro);
296 button->lpszMacro = ptr;
298 *b = button;
300 WINHELP_LayoutMainWindow(win);
303 void CALLBACK MACRO_ChangeEnable(LPCSTR id, LPCSTR macro)
305 WINE_TRACE("(\"%s\", \"%s\")\n", id, macro);
307 MACRO_ChangeButtonBinding(id, macro);
308 MACRO_EnableButton(id);
311 void CALLBACK MACRO_ChangeItemBinding(LPCSTR str1, LPCSTR str2)
313 WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);
316 void CALLBACK MACRO_CheckItem(LPCSTR str)
318 WINE_FIXME("(\"%s\")\n", str);
321 void CALLBACK MACRO_CloseSecondarys(void)
323 WINHELP_WINDOW *win;
325 WINE_TRACE("()\n");
326 for (win = Globals.win_list; win; win = win->next)
327 if (win->lpszName && lstrcmpi(win->lpszName, "main"))
328 DestroyWindow(win->hMainWnd);
331 void CALLBACK MACRO_CloseWindow(LPCSTR lpszWindow)
333 WINHELP_WINDOW *win;
335 WINE_TRACE("(\"%s\")\n", lpszWindow);
337 if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
339 for (win = Globals.win_list; win; win = win->next)
340 if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
341 DestroyWindow(win->hMainWnd);
344 void CALLBACK MACRO_Compare(LPCSTR str)
346 WINE_FIXME("(\"%s\")\n", str);
349 void CALLBACK MACRO_Contents(void)
351 WINE_TRACE("()\n");
353 if (Globals.active_win->page)
354 MACRO_JumpContents(Globals.active_win->page->file->lpszPath, NULL);
357 void CALLBACK MACRO_ControlPanel(LPCSTR str1, LPCSTR str2, LONG u)
359 WINE_FIXME("(\"%s\", \"%s\", %u)\n", str1, str2, u);
362 void CALLBACK MACRO_CopyDialog(void)
364 WINE_FIXME("()\n");
367 void CALLBACK MACRO_CopyTopic(void)
369 WINE_FIXME("()\n");
372 void CALLBACK MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
374 WINHELP_WINDOW *win = Globals.active_win;
375 WINHELP_BUTTON *button, **b;
376 LONG size;
377 LPSTR ptr;
379 WINE_TRACE("(\"%s\", \"%s\", %s)\n", id, name, macro);
381 size = sizeof(WINHELP_BUTTON) + lstrlen(id) + lstrlen(name) + lstrlen(macro) + 3;
383 button = HeapAlloc(GetProcessHeap(), 0, size);
384 if (!button) return;
386 button->next = 0;
387 button->hWnd = 0;
389 ptr = (char*)button + sizeof(WINHELP_BUTTON);
391 lstrcpy(ptr, id);
392 button->lpszID = ptr;
393 ptr += lstrlen(id) + 1;
395 lstrcpy(ptr, name);
396 button->lpszName = ptr;
397 ptr += lstrlen(name) + 1;
399 lstrcpy(ptr, macro);
400 button->lpszMacro = ptr;
402 button->wParam = WH_FIRST_BUTTON;
403 for (b = &win->first_button; *b; b = &(*b)->next)
404 button->wParam = max(button->wParam, (*b)->wParam + 1);
405 *b = button;
407 WINHELP_LayoutMainWindow(win);
410 void CALLBACK MACRO_DeleteItem(LPCSTR str)
412 WINE_FIXME("(\"%s\")\n", str);
415 void CALLBACK MACRO_DeleteMark(LPCSTR str)
417 WINE_FIXME("(\"%s\")\n", str);
420 void CALLBACK MACRO_DestroyButton(LPCSTR str)
422 WINE_FIXME("(\"%s\")\n", str);
425 void CALLBACK MACRO_DisableButton(LPCSTR id)
427 WINHELP_BUTTON** b;
429 WINE_TRACE("(\"%s\")\n", id);
431 b = MACRO_LookupButton(Globals.active_win, id);
432 if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
434 EnableWindow((*b)->hWnd, FALSE);
437 void CALLBACK MACRO_DisableItem(LPCSTR str)
439 WINE_FIXME("(\"%s\")\n", str);
442 void CALLBACK MACRO_EnableButton(LPCSTR id)
444 WINHELP_BUTTON** b;
446 WINE_TRACE("(\"%s\")\n", id);
448 b = MACRO_LookupButton(Globals.active_win, id);
449 if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
451 EnableWindow((*b)->hWnd, TRUE);
454 void CALLBACK MACRO_EnableItem(LPCSTR str)
456 WINE_FIXME("(\"%s\")\n", str);
459 void CALLBACK MACRO_EndMPrint(void)
461 WINE_FIXME("()\n");
464 void CALLBACK MACRO_ExecFile(LPCSTR str1, LPCSTR str2, LONG u, LPCSTR str3)
466 WINE_FIXME("(\"%s\", \"%s\", %u, \"%s\")\n", str1, str2, u, str3);
469 void CALLBACK MACRO_ExecProgram(LPCSTR str, LONG u)
471 WINE_FIXME("(\"%s\", %u)\n", str, u);
474 void CALLBACK MACRO_Exit(void)
476 WINE_TRACE("()\n");
478 while (Globals.win_list)
479 DestroyWindow(Globals.win_list->hMainWnd);
482 void CALLBACK MACRO_ExtAbleItem(LPCSTR str, LONG u)
484 WINE_FIXME("(\"%s\", %u)\n", str, u);
487 void CALLBACK MACRO_ExtInsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u1, LONG u2)
489 WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\", %u, %u)\n", str1, str2, str3, str4, u1, u2);
492 void CALLBACK MACRO_ExtInsertMenu(LPCSTR str1, LPCSTR str2, LPCSTR str3, LONG u1, LONG u2)
494 WINE_FIXME("(\"%s\", \"%s\", \"%s\", %u, %u)\n", str1, str2, str3, u1, u2);
497 BOOL CALLBACK MACRO_FileExist(LPCSTR str)
499 WINE_TRACE("(\"%s\")\n", str);
500 return GetFileAttributes(str) != INVALID_FILE_ATTRIBUTES;
503 void CALLBACK MACRO_FileOpen(void)
505 char szFile[MAX_PATH];
507 if (WINHELP_GetOpenFileName(szFile, MAX_PATH))
509 MACRO_JumpContents(szFile, "main");
513 void CALLBACK MACRO_Find(void)
515 WINE_FIXME("()\n");
518 void CALLBACK MACRO_Finder(void)
520 WINHELP_CreateIndexWindow();
523 void CALLBACK MACRO_FloatingMenu(void)
525 WINE_FIXME("()\n");
528 void CALLBACK MACRO_Flush(void)
530 WINE_FIXME("()\n");
533 void CALLBACK MACRO_FocusWindow(LPCSTR lpszWindow)
535 WINHELP_WINDOW *win;
537 WINE_TRACE("(\"%s\")\n", lpszWindow);
539 if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
541 for (win = Globals.win_list; win; win = win->next)
542 if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
543 SetFocus(win->hMainWnd);
546 void CALLBACK MACRO_Generate(LPCSTR str, LONG w, LONG l)
548 WINE_FIXME("(\"%s\", %x, %x)\n", str, w, l);
551 void CALLBACK MACRO_GotoMark(LPCSTR str)
553 WINE_FIXME("(\"%s\")\n", str);
556 void CALLBACK MACRO_HelpOn(void)
558 WINE_TRACE("()\n");
559 MACRO_JumpContents((Globals.wVersion > 4) ? "winhelp32.hlp" : "winhelp.hlp", NULL);
562 void CALLBACK MACRO_HelpOnTop(void)
564 WINE_FIXME("()\n");
567 void CALLBACK MACRO_History(void)
569 WINE_TRACE("()\n");
571 if (Globals.active_win && !Globals.active_win->hHistoryWnd)
573 HWND hWnd = CreateWindow(HISTORY_WIN_CLASS_NAME, "History", WS_OVERLAPPEDWINDOW,
574 0, 0, 0, 0, 0, 0, Globals.hInstance, Globals.active_win);
575 ShowWindow(hWnd, SW_NORMAL);
579 void CALLBACK MACRO_IfThen(BOOL b, LPCSTR t)
581 if (b) MACRO_ExecuteMacro(t);
584 void CALLBACK MACRO_IfThenElse(BOOL b, LPCSTR t, LPCSTR f)
586 if (b) MACRO_ExecuteMacro(t); else MACRO_ExecuteMacro(f);
589 BOOL CALLBACK MACRO_InitMPrint(void)
591 WINE_FIXME("()\n");
592 return FALSE;
595 void CALLBACK MACRO_InsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u)
597 WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\", %u)\n", str1, str2, str3, str4, u);
600 void CALLBACK MACRO_InsertMenu(LPCSTR str1, LPCSTR str2, LONG u)
602 WINE_FIXME("(\"%s\", \"%s\", %u)\n", str1, str2, u);
605 BOOL CALLBACK MACRO_IsBook(void)
607 WINE_TRACE("()\n");
608 return Globals.isBook;
611 BOOL CALLBACK MACRO_IsMark(LPCSTR str)
613 WINE_FIXME("(\"%s\")\n", str);
614 return FALSE;
617 BOOL CALLBACK MACRO_IsNotMark(LPCSTR str)
619 WINE_FIXME("(\"%s\")\n", str);
620 return TRUE;
623 void CALLBACK MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
625 HLPFILE* hlpfile;
627 WINE_TRACE("(\"%s\", \"%s\")\n", lpszPath, lpszWindow);
628 if ((hlpfile = WINHELP_LookupHelpFile(lpszPath)))
629 WINHELP_OpenHelpWindow(HLPFILE_PageByHash, hlpfile, 0,
630 WINHELP_GetWindowInfo(hlpfile, lpszWindow),
631 SW_NORMAL);
634 void CALLBACK MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context)
636 HLPFILE* hlpfile;
638 WINE_TRACE("(\"%s\", \"%s\", %d)\n", lpszPath, lpszWindow, context);
639 hlpfile = WINHELP_LookupHelpFile(lpszPath);
640 /* Some madness: what user calls 'context', hlpfile calls 'map' */
641 WINHELP_OpenHelpWindow(HLPFILE_PageByMap, hlpfile, context,
642 WINHELP_GetWindowInfo(hlpfile, lpszWindow),
643 SW_NORMAL);
646 void CALLBACK MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
648 HLPFILE* hlpfile;
650 WINE_TRACE("(\"%s\", \"%s\", %u)\n", lpszPath, lpszWindow, lHash);
651 hlpfile = WINHELP_LookupHelpFile(lpszPath);
652 WINHELP_OpenHelpWindow(HLPFILE_PageByHash, hlpfile, lHash,
653 WINHELP_GetWindowInfo(hlpfile, lpszWindow),
654 SW_NORMAL);
657 void CALLBACK MACRO_JumpHelpOn(void)
659 WINE_FIXME("()\n");
662 void CALLBACK MACRO_JumpID(LPCSTR lpszPathWindow, LPCSTR topic_id)
664 LPSTR ptr;
666 WINE_TRACE("(\"%s\", \"%s\")\n", lpszPathWindow, topic_id);
667 if ((ptr = strchr(lpszPathWindow, '>')) != NULL)
669 LPSTR tmp;
670 size_t sz = ptr - lpszPathWindow;
672 tmp = HeapAlloc(GetProcessHeap(), 0, sz + 1);
673 if (tmp)
675 memcpy(tmp, lpszPathWindow, sz);
676 tmp[sz] = '\0';
677 MACRO_JumpHash(tmp, ptr + 1, HLPFILE_Hash(topic_id));
678 HeapFree(GetProcessHeap(), 0, tmp);
681 else
682 MACRO_JumpHash(lpszPathWindow, NULL, HLPFILE_Hash(topic_id));
685 /* FIXME: this macros is wrong
686 * it should only contain 2 strings, path & window are coded as path>window
688 void CALLBACK MACRO_JumpKeyword(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR keyword)
690 WINE_FIXME("(\"%s\", \"%s\", \"%s\")\n", lpszPath, lpszWindow, keyword);
693 void CALLBACK MACRO_KLink(LPCSTR str1, LONG u, LPCSTR str2, LPCSTR str3)
695 WINE_FIXME("(\"%s\", %u, \"%s\", \"%s\")\n", str1, u, str2, str3);
698 void CALLBACK MACRO_Menu(void)
700 WINE_FIXME("()\n");
703 void CALLBACK MACRO_MPrintHash(LONG u)
705 WINE_FIXME("(%u)\n", u);
708 void CALLBACK MACRO_MPrintID(LPCSTR str)
710 WINE_FIXME("(\"%s\")\n", str);
713 void CALLBACK MACRO_Next(void)
715 WINHELP_WNDPAGE wp;
717 WINE_TRACE("()\n");
718 wp.page = Globals.active_win->page;
719 wp.page = HLPFILE_PageByOffset(wp.page->file, wp.page->browse_fwd, &wp.relative);
720 if (wp.page)
722 wp.page->file->wRefCount++;
723 wp.wininfo = Globals.active_win->info;
724 WINHELP_CreateHelpWindow(&wp, SW_NORMAL, TRUE);
728 void CALLBACK MACRO_NoShow(void)
730 WINE_FIXME("()\n");
733 void CALLBACK MACRO_PopupContext(LPCSTR str, LONG u)
735 WINE_FIXME("(\"%s\", %u)\n", str, u);
738 void CALLBACK MACRO_PopupHash(LPCSTR str, LONG u)
740 WINE_FIXME("(\"%s\", %u)\n", str, u);
743 void CALLBACK MACRO_PopupId(LPCSTR str1, LPCSTR str2)
745 WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);
748 void CALLBACK MACRO_PositionWindow(LONG i1, LONG i2, LONG u1, LONG u2, LONG u3, LPCSTR str)
750 WINE_FIXME("(%i, %i, %u, %u, %u, \"%s\")\n", i1, i2, u1, u2, u3, str);
753 void CALLBACK MACRO_Prev(void)
755 WINHELP_WNDPAGE wp;
757 WINE_TRACE("()\n");
758 wp.page = Globals.active_win->page;
759 wp.page = HLPFILE_PageByOffset(wp.page->file, wp.page->browse_bwd, &wp.relative);
760 if (wp.page)
762 wp.page->file->wRefCount++;
763 wp.wininfo = Globals.active_win->info;
764 WINHELP_CreateHelpWindow(&wp, SW_NORMAL, TRUE);
768 void CALLBACK MACRO_Print(void)
770 PRINTDLG printer;
772 WINE_TRACE("()\n");
774 printer.lStructSize = sizeof(printer);
775 printer.hwndOwner = Globals.active_win->hMainWnd;
776 printer.hInstance = Globals.hInstance;
777 printer.hDevMode = 0;
778 printer.hDevNames = 0;
779 printer.hDC = 0;
780 printer.Flags = 0;
781 printer.nFromPage = 0;
782 printer.nToPage = 0;
783 printer.nMinPage = 0;
784 printer.nMaxPage = 0;
785 printer.nCopies = 0;
786 printer.lCustData = 0;
787 printer.lpfnPrintHook = 0;
788 printer.lpfnSetupHook = 0;
789 printer.lpPrintTemplateName = 0;
790 printer.lpSetupTemplateName = 0;
791 printer.hPrintTemplate = 0;
792 printer.hSetupTemplate = 0;
794 if (PrintDlgA(&printer)) {
795 WINE_FIXME("Print()\n");
799 void CALLBACK MACRO_PrinterSetup(void)
801 WINE_FIXME("()\n");
804 void CALLBACK MACRO_RegisterRoutine(LPCSTR dll_name, LPCSTR proc, LPCSTR args)
806 FARPROC fn = NULL;
807 int size;
808 WINHELP_DLL* dll;
810 WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", dll_name, proc, args);
812 /* FIXME: are the registered DLLs global or linked to the current file ???
813 * We assume globals (as we did for macros, but is this really the case ???)
815 for (dll = Globals.dlls; dll; dll = dll->next)
817 if (!strcmp(dll->name, dll_name)) break;
819 if (!dll)
821 HANDLE hLib = LoadLibrary(dll_name);
823 /* FIXME: the library will not be unloaded until exit of program
824 * We don't send the DW_TERM message
826 WINE_TRACE("Loading %s\n", dll_name);
827 /* FIXME: should look in the directory where current hlpfile
828 * is loaded from
830 if (hLib == NULL)
832 /* FIXME: internationalisation for error messages */
833 WINE_FIXME("Cannot find dll %s\n", dll_name);
835 else if ((dll = HeapAlloc(GetProcessHeap(), 0, sizeof(*dll))))
837 dll->hLib = hLib;
838 dll->name = strdup(dll_name); /* FIXME */
839 dll->next = Globals.dlls;
840 Globals.dlls = dll;
841 dll->handler = (WINHELP_LDLLHandler)GetProcAddress(dll->hLib, "LDLLHandler");
842 dll->class = dll->handler ? (dll->handler)(DW_WHATMSG, 0, 0) : DC_NOMSG;
843 WINE_TRACE("Got class %x for DLL %s\n", dll->class, dll_name);
844 if (dll->class & DC_INITTERM) dll->handler(DW_INIT, 0, 0);
845 if (dll->class & DC_CALLBACKS) dll->handler(DW_CALLBACKS, (DWORD)Callbacks, 0);
847 else WINE_WARN("OOM\n");
849 if (dll && !(fn = GetProcAddress(dll->hLib, proc)))
851 /* FIXME: internationalisation for error messages */
852 WINE_FIXME("Cannot find proc %s in dll %s\n", dll_name, proc);
855 size = ++MACRO_NumLoaded * sizeof(struct MacroDesc);
856 if (!MACRO_Loaded) MACRO_Loaded = HeapAlloc(GetProcessHeap(), 0, size);
857 else MACRO_Loaded = HeapReAlloc(GetProcessHeap(), 0, MACRO_Loaded, size);
858 MACRO_Loaded[MACRO_NumLoaded - 1].name = strdup(proc); /* FIXME */
859 MACRO_Loaded[MACRO_NumLoaded - 1].alias = NULL;
860 MACRO_Loaded[MACRO_NumLoaded - 1].isBool = 0;
861 MACRO_Loaded[MACRO_NumLoaded - 1].arguments = strdup(args); /* FIXME */
862 MACRO_Loaded[MACRO_NumLoaded - 1].fn = fn;
863 WINE_TRACE("Added %s(%s) at %p\n", proc, args, fn);
866 void CALLBACK MACRO_RemoveAccelerator(LONG u1, LONG u2)
868 WINE_FIXME("(%u, %u)\n", u1, u2);
871 void CALLBACK MACRO_ResetMenu(void)
873 WINE_FIXME("()\n");
876 void CALLBACK MACRO_SaveMark(LPCSTR str)
878 WINE_FIXME("(\"%s\")\n", str);
881 void CALLBACK MACRO_Search(void)
883 WINE_FIXME("()\n");
886 void CALLBACK MACRO_SetContents(LPCSTR str, LONG u)
888 WINE_FIXME("(\"%s\", %u)\n", str, u);
891 void CALLBACK MACRO_SetHelpOnFile(LPCSTR str)
893 WINE_FIXME("(\"%s\")\n", str);
896 void CALLBACK MACRO_SetPopupColor(LONG u1, LONG u2, LONG u3)
898 WINE_FIXME("(%u, %u, %u)\n", u1, u2, u3);
901 void CALLBACK MACRO_ShellExecute(LPCSTR str1, LPCSTR str2, LONG u1, LONG u2, LPCSTR str3, LPCSTR str4)
903 WINE_FIXME("(\"%s\", \"%s\", %u, %u, \"%s\", \"%s\")\n", str1, str2, u1, u2, str3, str4);
906 void CALLBACK MACRO_ShortCut(LPCSTR str1, LPCSTR str2, LONG w, LONG l, LPCSTR str)
908 WINE_FIXME("(\"%s\", \"%s\", %x, %x, \"%s\")\n", str1, str2, w, l, str);
911 void CALLBACK MACRO_TCard(LONG u)
913 WINE_FIXME("(%u)\n", u);
916 void CALLBACK MACRO_Test(LONG u)
918 WINE_FIXME("(%u)\n", u);
921 BOOL CALLBACK MACRO_TestALink(LPCSTR str)
923 WINE_FIXME("(\"%s\")\n", str);
924 return FALSE;
927 BOOL CALLBACK MACRO_TestKLink(LPCSTR str)
929 WINE_FIXME("(\"%s\")\n", str);
930 return FALSE;
933 void CALLBACK MACRO_UncheckItem(LPCSTR str)
935 WINE_FIXME("(\"%s\")\n", str);
938 void CALLBACK MACRO_UpdateWindow(LPCSTR str1, LPCSTR str2)
940 WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);