Add missing DTBG_* defines.
[wine.git] / programs / winhelp / macro.c
blobc25d209fed2b80818e4603f60dedf3366f2edf38
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <stdio.h>
24 #include "windows.h"
25 #include "commdlg.h"
26 #include "winhelp.h"
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
32 /**************************************************/
33 /* Macro table */
34 /**************************************************/
35 struct MacroDesc {
36 char* name;
37 char* alias;
38 BOOL isBool;
39 char* arguments;
40 void (*fn)();
43 /* types:
44 * U: 32 bit unsigned int
45 * I: 32 bit signed int
46 * S: string
47 * v: unknown (32 bit entity)
50 static struct MacroDesc MACRO_Builtins[] = {
51 {"About", NULL, 0, "", MACRO_About},
52 {"AddAccelerator", "AA", 0, "UUS", MACRO_AddAccelerator},
53 {"ALink", "AL", 0, "SUS", MACRO_ALink},
54 {"Annotate", NULL, 0, "", MACRO_Annotate},
55 {"AppendItem", NULL, 0, "SSSS", MACRO_AppendItem},
56 {"Back", NULL, 0, "", MACRO_Back},
57 {"BackFlush", "BF", 0, "", MACRO_BackFlush},
58 {"BookmarkDefine", NULL, 0, "", MACRO_BookmarkDefine},
59 {"BookmarkMore", NULL, 0, "", MACRO_BookmarkMore},
60 {"BrowseButtons", NULL, 0, "", MACRO_BrowseButtons},
61 {"ChangeButtonBinding", "CBB",0, "SS", MACRO_ChangeButtonBinding},
62 {"ChangeEnable", "CE", 0, "SS", MACRO_ChangeEnable},
63 {"ChangeItemBinding", "CIB",0, "SS", MACRO_ChangeItemBinding},
64 {"CheckItem", "CI", 0, "S", MACRO_CheckItem},
65 {"CloseSecondarys", "CS", 0, "", MACRO_CloseSecondarys},
66 {"CloseWindow", "CW", 0, "S", MACRO_CloseWindow},
67 {"Compare", NULL, 0, "S", MACRO_Compare},
68 {"Contents", NULL, 0, "", MACRO_Contents},
69 {"ControlPanel", NULL, 0, "SSU", MACRO_ControlPanel},
70 {"CopyDialog", NULL, 0, "", MACRO_CopyDialog},
71 {"CopyTopic", "CT", 0, "", MACRO_CopyTopic},
72 {"CreateButton", "CB", 0, "SSS", MACRO_CreateButton},
73 {"DeleteItem", NULL, 0, "S", MACRO_DeleteItem},
74 {"DeleteMark", NULL, 0, "S", MACRO_DeleteMark},
75 {"DestroyButton", NULL, 0, "S", MACRO_DestroyButton},
76 {"DisableButton", "DB", 0, "S", MACRO_DisableButton},
77 {"DisableItem", "DI", 0, "S", MACRO_DisableItem},
78 {"EnableButton", "EB", 0, "S", MACRO_EnableButton},
79 {"EnableItem", "EI", 0, "S", MACRO_EnableItem},
80 {"EndMPrint", NULL, 0, "", MACRO_EndMPrint},
81 {"ExecFile", "EF", 0, "SSUS", MACRO_ExecFile},
82 {"ExecProgram", "EP", 0, "SU", MACRO_ExecProgram},
83 {"Exit", NULL, 0, "", MACRO_Exit},
84 {"ExtAbleItem", NULL, 0, "SU", MACRO_ExtAbleItem},
85 {"ExtInsertItem", NULL, 0, "SSSSUU", MACRO_ExtInsertItem},
86 {"ExtInsertMenu", NULL, 0, "SSSUU", MACRO_ExtInsertMenu},
87 {"FileExist", "FE", 1, "S", (void (*)())MACRO_FileExist},
88 {"FileOpen", "FO", 0, "", MACRO_FileOpen},
89 {"Find", NULL, 0, "", MACRO_Find},
90 {"Finder", "FD", 0, "", MACRO_Finder},
91 {"FloatingMenu", NULL, 0, "", MACRO_FloatingMenu},
92 {"Flush", "FH", 0, "", MACRO_Flush},
93 {"FocusWindow", NULL, 0, "S", MACRO_FocusWindow},
94 {"Generate", NULL, 0, "SUU", MACRO_Generate},
95 {"GotoMark", NULL, 0, "S", MACRO_GotoMark},
96 {"HelpOn", NULL, 0, "", MACRO_HelpOn},
97 {"HelpOnTop", NULL, 0, "", MACRO_HelpOnTop},
98 {"History", NULL, 0, "", MACRO_History},
99 {"InitMPrint", NULL, 1, "", (void (*)())MACRO_InitMPrint},
100 {"InsertItem", NULL, 0, "SSSSU", MACRO_InsertItem},
101 {"InsertMenu", NULL, 0, "SSU", MACRO_InsertMenu},
102 {"IfThen", "IF", 0, "BS", MACRO_IfThen},
103 {"IfThenElse", "IE", 0, "BSS", MACRO_IfThenElse},
104 {"IsBook", NULL, 1, "", (void (*)())MACRO_IsBook},
105 {"IsMark", NULL, 1, "S", (void (*)())MACRO_IsMark},
106 {"IsNotMark", "NM", 1, "S", (void (*)())MACRO_IsNotMark},
107 {"JumpContents", NULL, 0, "SS", MACRO_JumpContents},
108 {"JumpContext", "JC", 0, "SSU", MACRO_JumpContext},
109 {"JumpHash", "JH", 0, "SSU", MACRO_JumpHash},
110 {"JumpHelpOn", NULL, 0, "", MACRO_JumpHelpOn},
111 {"JumpID", "JI", 0, "SSS", MACRO_JumpID},
112 {"JumpKeyword", "JK", 0, "SSS", MACRO_JumpKeyword},
113 {"KLink", "KL", 0, "SUSS", MACRO_KLink},
114 {"Menu", "MU", 0, "", MACRO_Menu},
115 {"MPrintHash", NULL, 0, "U", MACRO_MPrintHash},
116 {"MPrintID", NULL, 0, "S", MACRO_MPrintID},
117 {"Next", NULL, 0, "", MACRO_Next},
118 {"NoShow", NULL, 0, "", MACRO_NoShow},
119 {"PopupContext", "PC", 0, "SU", MACRO_PopupContext},
120 {"PopupHash", NULL, 0, "SU", MACRO_PopupHash},
121 {"PopupId", "PI", 0, "SS", MACRO_PopupId},
122 {"PositionWindow", "PW", 0, "IIUUUS", MACRO_PositionWindow},
123 {"Prev", NULL, 0, "", MACRO_Prev},
124 {"Print", NULL, 0, "", MACRO_Print},
125 {"PrinterSetup", NULL, 0, "", MACRO_PrinterSetup},
126 {"RegisterRoutine", "RR", 0, "SSS", MACRO_RegisterRoutine},
127 {"RemoveAccelerator", "RA", 0, "UU", MACRO_RemoveAccelerator},
128 {"ResetMenu", NULL, 0, "", MACRO_ResetMenu},
129 {"SaveMark", NULL, 0, "S", MACRO_SaveMark},
130 {"Search", NULL, 0, "", MACRO_Search},
131 {"SetContents", NULL, 0, "SU", MACRO_SetContents},
132 {"SetHelpOnFile", NULL, 0, "S", MACRO_SetHelpOnFile},
133 {"SetPopupColor", "SPC",0, "UUU", MACRO_SetPopupColor},
134 {"ShellExecute", "SE", 0, "SSUUSS", MACRO_ShellExecute},
135 {"ShortCut", "SH", 0, "SSUUS", MACRO_ShortCut},
136 {"TCard", NULL, 0, "U", MACRO_TCard},
137 {"Test", NULL, 0, "U", MACRO_Test},
138 {"TestALink", NULL, 1, "S", (void (*)())MACRO_TestALink},
139 {"TestKLink", NULL, 1, "S", (void (*)())MACRO_TestKLink},
140 {"UncheckItem", "UI", 0, "S", MACRO_UncheckItem},
141 {"UpdateWindow", "UW", 0, "SS", MACRO_UpdateWindow},
142 {NULL, NULL, 0, NULL, NULL}
145 static struct MacroDesc*MACRO_Loaded /* = NULL */;
146 static unsigned MACRO_NumLoaded /* = 0 */;
148 static int MACRO_DoLookUp(struct MacroDesc* start, const char* name, struct lexret* lr, unsigned len)
150 struct MacroDesc* md;
152 for (md = start; md->name && len != 0; md++, len--)
154 if (strcasecmp(md->name, name) == 0 || (md->alias != NULL && strcasecmp(md->alias, name) == 0))
156 lr->proto = md->arguments;
157 if (md->isBool)
159 lr->bool_function = (BOOL (*)())md->fn;
160 return BOOL_FUNCTION;
162 else
164 lr->void_function = md->fn;
165 return VOID_FUNCTION;
169 return EMPTY;
172 int MACRO_Lookup(const char* name, struct lexret* lr)
174 int ret;
176 if ((ret = MACRO_DoLookUp(MACRO_Builtins, name, lr, -1)) != EMPTY)
177 return ret;
178 if (MACRO_Loaded && (ret = MACRO_DoLookUp(MACRO_Loaded, name, lr, MACRO_NumLoaded)) != EMPTY)
179 return ret;
181 lr->string = name;
182 return IDENTIFIER;
185 /******* helper functions *******/
187 WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name)
189 WINHELP_BUTTON** b;
191 for (b = &win->first_button; *b; b = &(*b)->next)
192 if (!lstrcmpi(name, (*b)->lpszID)) break;
193 return b;
196 /******* real macro implementation *******/
198 void MACRO_About(void)
200 WINE_FIXME("()\n");
203 void MACRO_AddAccelerator(LONG u1, LONG u2, LPCSTR str)
205 WINE_FIXME("(%lu, %lu, \"%s\")\n", u1, u2, str);
208 void MACRO_ALink(LPCSTR str1, LONG u, LPCSTR str2)
210 WINE_FIXME("(\"%s\", %lu, \"%s\")\n", str1, u, str2);
213 void MACRO_Annotate(void)
215 WINE_FIXME("()\n");
218 void MACRO_AppendItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4)
220 WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\")\n", str1, str2, str3, str4);
223 void MACRO_Back(void)
225 WINHELP_WINDOW* win = Globals.active_win;
227 WINE_TRACE("()\n");
229 if (win && win->backIndex >= 2)
230 WINHELP_CreateHelpWindow(win->back[--win->backIndex - 1],
231 win->info, SW_SHOW);
234 void MACRO_BackFlush(void)
236 WINHELP_WINDOW* win = Globals.active_win;
238 WINE_TRACE("()\n");
240 if (win)
242 int i;
244 for (i = 0; i < win->backIndex; i++)
246 HLPFILE_FreeHlpFile(win->back[i]->file);
247 win->back[i] = NULL;
249 win->backIndex = 0;
253 void MACRO_BookmarkDefine(void)
255 WINE_FIXME("()\n");
258 void MACRO_BookmarkMore(void)
260 WINE_FIXME("()\n");
263 void MACRO_BrowseButtons(void)
265 WINE_TRACE("()\n");
267 MACRO_CreateButton("BTN_PREV", "&<<", "Prev()");
268 MACRO_CreateButton("BTN_NEXT", "&>>", "Next()");
271 void MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
273 WINHELP_WINDOW* win = Globals.active_win;
274 WINHELP_BUTTON* button;
275 WINHELP_BUTTON** b;
276 LONG size;
277 LPSTR ptr;
279 WINE_TRACE("(\"%s\", \"%s\")\n", id, macro);
281 b = MACRO_LookupButton(win, id);
282 if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
284 size = sizeof(WINHELP_BUTTON) + lstrlen(id) +
285 lstrlen((*b)->lpszName) + lstrlen(macro) + 3;
287 button = HeapAlloc(GetProcessHeap(), 0, size);
288 if (!button) return;
290 button->next = (*b)->next;
291 button->hWnd = (*b)->hWnd;
292 button->wParam = (*b)->wParam;
294 ptr = (char*)button + sizeof(WINHELP_BUTTON);
296 lstrcpy(ptr, (LPSTR) id);
297 button->lpszID = ptr;
298 ptr += lstrlen(id) + 1;
300 lstrcpy(ptr, (LPSTR) (*b)->lpszName);
301 button->lpszName = ptr;
302 ptr += lstrlen((*b)->lpszName) + 1;
304 lstrcpy(ptr, (LPSTR) macro);
305 button->lpszMacro = ptr;
307 *b = button;
309 SendMessage(win->hMainWnd, WM_USER, 0, 0);
312 void MACRO_ChangeEnable(LPCSTR id, LPCSTR macro)
314 WINE_TRACE("(\"%s\", \"%s\")\n", id, macro);
316 MACRO_ChangeButtonBinding(id, macro);
317 MACRO_EnableButton(id);
320 void MACRO_ChangeItemBinding(LPCSTR str1, LPCSTR str2)
322 WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);
325 void MACRO_CheckItem(LPCSTR str)
327 WINE_FIXME("(\"%s\")\n", str);
330 void MACRO_CloseSecondarys(void)
332 WINHELP_WINDOW *win;
334 WINE_TRACE("()\n");
335 for (win = Globals.win_list; win; win = win->next)
336 if (win->lpszName && lstrcmpi(win->lpszName, "main"))
337 DestroyWindow(win->hMainWnd);
340 void MACRO_CloseWindow(LPCSTR lpszWindow)
342 WINHELP_WINDOW *win;
344 WINE_TRACE("(\"%s\")\n", lpszWindow);
346 if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
348 for (win = Globals.win_list; win; win = win->next)
349 if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
350 DestroyWindow(win->hMainWnd);
353 void MACRO_Compare(LPCSTR str)
355 WINE_FIXME("(\"%s\")\n", str);
358 void MACRO_Contents(void)
360 WINE_TRACE("()\n");
362 if (Globals.active_win->page)
363 MACRO_JumpContents(Globals.active_win->page->file->lpszPath, NULL);
366 void MACRO_ControlPanel(LPCSTR str1, LPCSTR str2, LONG u)
368 WINE_FIXME("(\"%s\", \"%s\", %lu)\n", str1, str2, u);
371 void MACRO_CopyDialog(void)
373 WINE_FIXME("()\n");
376 void MACRO_CopyTopic(void)
378 WINE_FIXME("()\n");
381 void MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
383 WINHELP_WINDOW *win = Globals.active_win;
384 WINHELP_BUTTON *button, **b;
385 LONG size;
386 LPSTR ptr;
388 WINE_TRACE("(\"%s\", \"%s\", %s)\n", id, name, macro);
390 size = sizeof(WINHELP_BUTTON) + lstrlen(id) + lstrlen(name) + lstrlen(macro) + 3;
392 button = HeapAlloc(GetProcessHeap(), 0, size);
393 if (!button) return;
395 button->next = 0;
396 button->hWnd = 0;
398 ptr = (char*)button + sizeof(WINHELP_BUTTON);
400 lstrcpy(ptr, (LPSTR) id);
401 button->lpszID = ptr;
402 ptr += lstrlen(id) + 1;
404 lstrcpy(ptr, (LPSTR) name);
405 button->lpszName = ptr;
406 ptr += lstrlen(name) + 1;
408 lstrcpy(ptr, (LPSTR) macro);
409 button->lpszMacro = ptr;
411 button->wParam = WH_FIRST_BUTTON;
412 for (b = &win->first_button; *b; b = &(*b)->next)
413 button->wParam = max(button->wParam, (*b)->wParam + 1);
414 *b = button;
416 SendMessage(win->hMainWnd, WM_USER, 0, 0);
419 void MACRO_DeleteItem(LPCSTR str)
421 WINE_FIXME("(\"%s\")\n", str);
424 void MACRO_DeleteMark(LPCSTR str)
426 WINE_FIXME("(\"%s\")\n", str);
429 void MACRO_DestroyButton(LPCSTR str)
431 WINE_FIXME("(\"%s\")\n", str);
434 void MACRO_DisableButton(LPCSTR id)
436 WINHELP_BUTTON** b;
438 WINE_FIXME("(\"%s\")\n", id);
440 b = MACRO_LookupButton(Globals.active_win, id);
441 if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
443 EnableWindow((*b)->hWnd, FALSE);
446 void MACRO_DisableItem(LPCSTR str)
448 WINE_FIXME("(\"%s\")\n", str);
451 void MACRO_EnableButton(LPCSTR id)
453 WINHELP_BUTTON** b;
455 WINE_TRACE("(\"%s\")\n", id);
457 b = MACRO_LookupButton(Globals.active_win, id);
458 if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
460 EnableWindow((*b)->hWnd, TRUE);
463 void MACRO_EnableItem(LPCSTR str)
465 WINE_FIXME("(\"%s\")\n", str);
468 void MACRO_EndMPrint(void)
470 WINE_FIXME("()\n");
473 void MACRO_ExecFile(LPCSTR str1, LPCSTR str2, LONG u, LPCSTR str3)
475 WINE_FIXME("(\"%s\", \"%s\", %lu, \"%s\")\n", str1, str2, u, str3);
478 void MACRO_ExecProgram(LPCSTR str, LONG u)
480 WINE_FIXME("(\"%s\", %lu)\n", str, u);
483 void MACRO_Exit(void)
485 WINE_TRACE("()\n");
487 while (Globals.win_list)
488 DestroyWindow(Globals.win_list->hMainWnd);
491 void MACRO_ExtAbleItem(LPCSTR str, LONG u)
493 WINE_FIXME("(\"%s\", %lu)\n", str, u);
496 void MACRO_ExtInsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u1, LONG u2)
498 WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\", %lu, %lu)\n", str1, str2, str3, str4, u1, u2);
501 void MACRO_ExtInsertMenu(LPCSTR str1, LPCSTR str2, LPCSTR str3, LONG u1, LONG u2)
503 WINE_FIXME("(\"%s\", \"%s\", \"%s\", %lu, %lu)\n", str1, str2, str3, u1, u2);
506 BOOL MACRO_FileExist(LPCSTR str)
508 WINE_TRACE("(\"%s\")\n", str);
509 return GetFileAttributes(str) != INVALID_FILE_ATTRIBUTES;
512 void MACRO_FileOpen(void)
514 OPENFILENAME openfilename;
515 CHAR szPath[MAX_PATHNAME_LEN];
516 CHAR szDir[MAX_PATHNAME_LEN];
517 CHAR szzFilter[2 * MAX_STRING_LEN + 100];
518 LPSTR p = szzFilter;
520 WINE_TRACE("()\n");
522 LoadString(Globals.hInstance, STID_HELP_FILES_HLP, p, MAX_STRING_LEN);
523 p += strlen(p) + 1;
524 lstrcpy(p, "*.hlp");
525 p += strlen(p) + 1;
526 LoadString(Globals.hInstance, STID_ALL_FILES, p, MAX_STRING_LEN);
527 p += strlen(p) + 1;
528 lstrcpy(p, "*.*");
529 p += strlen(p) + 1;
530 *p = '\0';
532 GetCurrentDirectory(sizeof(szDir), szDir);
534 szPath[0]='\0';
536 openfilename.lStructSize = sizeof(OPENFILENAME);
537 openfilename.hwndOwner = Globals.active_win->hMainWnd;
538 openfilename.hInstance = Globals.hInstance;
539 openfilename.lpstrFilter = szzFilter;
540 openfilename.lpstrCustomFilter = 0;
541 openfilename.nMaxCustFilter = 0;
542 openfilename.nFilterIndex = 1;
543 openfilename.lpstrFile = szPath;
544 openfilename.nMaxFile = sizeof(szPath);
545 openfilename.lpstrFileTitle = 0;
546 openfilename.nMaxFileTitle = 0;
547 openfilename.lpstrInitialDir = szDir;
548 openfilename.lpstrTitle = 0;
549 openfilename.Flags = 0;
550 openfilename.nFileOffset = 0;
551 openfilename.nFileExtension = 0;
552 openfilename.lpstrDefExt = 0;
553 openfilename.lCustData = 0;
554 openfilename.lpfnHook = 0;
555 openfilename.lpTemplateName = 0;
557 if (GetOpenFileName(&openfilename))
559 HLPFILE* hlpfile = WINHELP_LookupHelpFile(szPath);
561 WINHELP_CreateHelpWindowByHash(hlpfile, 0,
562 WINHELP_GetWindowInfo(hlpfile, "main"), SW_SHOWNORMAL);
566 void MACRO_Find(void)
568 WINE_FIXME("()\n");
571 void MACRO_Finder(void)
573 WINE_FIXME("()\n");
576 void MACRO_FloatingMenu(void)
578 WINE_FIXME("()\n");
581 void MACRO_Flush(void)
583 WINE_FIXME("()\n");
586 void MACRO_FocusWindow(LPCSTR lpszWindow)
588 WINHELP_WINDOW *win;
590 WINE_TRACE("(\"%s\")\n", lpszWindow);
592 if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
594 for (win = Globals.win_list; win; win = win->next)
595 if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
596 SetFocus(win->hMainWnd);
599 void MACRO_Generate(LPCSTR str, LONG w, LONG l)
601 WINE_FIXME("(\"%s\", %lx, %lx)\n", str, w, l);
604 void MACRO_GotoMark(LPCSTR str)
606 WINE_FIXME("(\"%s\")\n", str);
609 void MACRO_HelpOn(void)
611 WINE_TRACE("()\n");
612 MACRO_JumpContents((Globals.wVersion > 4) ? "winhelp32.hlp" : "winhelp.hlp", NULL);
615 void MACRO_HelpOnTop(void)
617 WINE_FIXME("()\n");
620 void MACRO_History(void)
622 WINE_TRACE("()\n");
624 if (Globals.active_win && !Globals.active_win->hHistoryWnd)
626 HWND hWnd = CreateWindow(HISTORY_WIN_CLASS_NAME, "History", WS_OVERLAPPEDWINDOW,
627 0, 0, 0, 0, 0, 0, Globals.hInstance, Globals.active_win);
628 ShowWindow(hWnd, SW_NORMAL);
632 void MACRO_IfThen(BOOL b, LPCSTR t)
634 if (b) MACRO_ExecuteMacro(t);
637 void MACRO_IfThenElse(BOOL b, LPCSTR t, LPCSTR f)
639 if (b) MACRO_ExecuteMacro(t); else MACRO_ExecuteMacro(f);
642 BOOL MACRO_InitMPrint(void)
644 WINE_FIXME("()\n");
645 return FALSE;
648 void MACRO_InsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u)
650 WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\", %lu)\n", str1, str2, str3, str4, u);
653 void MACRO_InsertMenu(LPCSTR str1, LPCSTR str2, LONG u)
655 WINE_FIXME("(\"%s\", \"%s\", %lu)\n", str1, str2, u);
658 BOOL MACRO_IsBook(void)
660 WINE_TRACE("()\n");
661 return Globals.isBook;
664 BOOL MACRO_IsMark(LPCSTR str)
666 WINE_FIXME("(\"%s\")\n", str);
667 return FALSE;
670 BOOL MACRO_IsNotMark(LPCSTR str)
672 WINE_FIXME("(\"%s\")\n", str);
673 return TRUE;
676 void MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
678 HLPFILE* hlpfile;
680 WINE_TRACE("(\"%s\", \"%s\")\n", lpszPath, lpszWindow);
681 hlpfile = WINHELP_LookupHelpFile(lpszPath);
682 WINHELP_CreateHelpWindowByHash(hlpfile, 0,
683 WINHELP_GetWindowInfo(hlpfile, lpszWindow),
684 SW_NORMAL);
687 void MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context)
689 WINE_FIXME("(\"%s\", \"%s\", %lu)\n", lpszPath, lpszWindow, context);
692 void MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
694 HLPFILE* hlpfile;
696 WINE_TRACE("(\"%s\", \"%s\", %lu)\n", lpszPath, lpszWindow, lHash);
697 hlpfile = WINHELP_LookupHelpFile(lpszPath);
698 WINHELP_CreateHelpWindowByHash(hlpfile, lHash,
699 WINHELP_GetWindowInfo(hlpfile, lpszWindow),
700 SW_NORMAL);
703 void MACRO_JumpHelpOn(void)
705 WINE_FIXME("()\n");
708 /* FIXME: those two macros are wrong
709 * they should only contain 2 strings, path & window are coded as path>window
711 void MACRO_JumpID(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR topic_id)
713 WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", lpszPath, lpszWindow, topic_id);
714 MACRO_JumpHash(lpszPath, lpszWindow, HLPFILE_Hash(topic_id));
717 void MACRO_JumpKeyword(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR keyword)
719 WINE_FIXME("(\"%s\", \"%s\", \"%s\")\n", lpszPath, lpszWindow, keyword);
722 void MACRO_KLink(LPCSTR str1, LONG u, LPCSTR str2, LPCSTR str3)
724 WINE_FIXME("(\"%s\", %lu, \"%s\", \"%s\")\n", str1, u, str2, str3);
727 void MACRO_Menu(void)
729 WINE_FIXME("()\n");
732 void MACRO_MPrintHash(LONG u)
734 WINE_FIXME("(%lu)\n", u);
737 void MACRO_MPrintID(LPCSTR str)
739 WINE_FIXME("(\"%s\")\n", str);
742 void MACRO_Next(void)
744 HLPFILE_PAGE* page;
746 WINE_TRACE("()\n");
747 page = Globals.active_win->page;
748 page = HLPFILE_PageByOffset(page->file, page->browse_fwd);
749 if (page)
751 page->file->wRefCount++;
752 WINHELP_CreateHelpWindow(page, Globals.active_win->info, SW_NORMAL);
756 void MACRO_NoShow(void)
758 WINE_FIXME("()\n");
761 void MACRO_PopupContext(LPCSTR str, LONG u)
763 WINE_FIXME("(\"%s\", %lu)\n", str, u);
766 void MACRO_PopupHash(LPCSTR str, LONG u)
768 WINE_FIXME("(\"%s\", %lu)\n", str, u);
771 void MACRO_PopupId(LPCSTR str1, LPCSTR str2)
773 WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);
776 void MACRO_PositionWindow(LONG i1, LONG i2, LONG u1, LONG u2, LONG u3, LPCSTR str)
778 WINE_FIXME("(%li, %li, %lu, %lu, %lu, \"%s\")\n", i1, i2, u1, u2, u3, str);
781 void MACRO_Prev(void)
783 HLPFILE_PAGE* page;
785 WINE_TRACE("()\n");
786 page = Globals.active_win->page;
787 page = HLPFILE_PageByOffset(page->file, page->browse_bwd);
788 if (page)
790 page->file->wRefCount++;
791 WINHELP_CreateHelpWindow(page, Globals.active_win->info, SW_NORMAL);
795 void MACRO_Print(void)
797 PRINTDLG printer;
799 WINE_TRACE("()\n");
801 printer.lStructSize = sizeof(printer);
802 printer.hwndOwner = Globals.active_win->hMainWnd;
803 printer.hInstance = Globals.hInstance;
804 printer.hDevMode = 0;
805 printer.hDevNames = 0;
806 printer.hDC = 0;
807 printer.Flags = 0;
808 printer.nFromPage = 0;
809 printer.nToPage = 0;
810 printer.nMinPage = 0;
811 printer.nMaxPage = 0;
812 printer.nCopies = 0;
813 printer.lCustData = 0;
814 printer.lpfnPrintHook = 0;
815 printer.lpfnSetupHook = 0;
816 printer.lpPrintTemplateName = 0;
817 printer.lpSetupTemplateName = 0;
818 printer.hPrintTemplate = 0;
819 printer.hSetupTemplate = 0;
821 if (PrintDlgA(&printer)) {
822 WINE_FIXME("Print()\n");
826 void MACRO_PrinterSetup(void)
828 WINE_FIXME("()\n");
831 void MACRO_RegisterRoutine(LPCSTR dll, LPCSTR proc, LPCSTR args)
833 HANDLE hLib;
834 void (*fn)();
835 int size;
837 WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", dll, proc, args);
839 if ((hLib = LoadLibrary(dll)) == NULL)
841 /* FIXME: internationalisation for error messages */
842 WINE_FIXME("Cannot find dll %s\n", dll);
843 fn = NULL;
845 else if (!(fn = (void (*)())GetProcAddress(hLib, proc)))
847 /* FIXME: internationalisation for error messages */
848 WINE_FIXME("Cannot find proc %s in dll %s\n", dll, proc);
849 fn = NULL;
852 /* FIXME: the library will not be unloaded until exit of program */
853 size = ++MACRO_NumLoaded * sizeof(struct MacroDesc);
854 if (!MACRO_Loaded) MACRO_Loaded = HeapAlloc(GetProcessHeap(), 0, size);
855 else MACRO_Loaded = HeapReAlloc(GetProcessHeap(), 0, MACRO_Loaded, size);
856 MACRO_Loaded[MACRO_NumLoaded - 1].name = strdup(proc); /* FIXME */
857 MACRO_Loaded[MACRO_NumLoaded - 1].alias = NULL;
858 MACRO_Loaded[MACRO_NumLoaded - 1].isBool = 0;
859 MACRO_Loaded[MACRO_NumLoaded - 1].arguments = strdup(args); /* FIXME */
860 MACRO_Loaded[MACRO_NumLoaded - 1].fn = fn;
863 void MACRO_RemoveAccelerator(LONG u1, LONG u2)
865 WINE_FIXME("(%lu, %lu)\n", u1, u2);
868 void MACRO_ResetMenu(void)
870 WINE_FIXME("()\n");
873 void MACRO_SaveMark(LPCSTR str)
875 WINE_FIXME("(\"%s\")\n", str);
878 void MACRO_Search(void)
880 WINE_FIXME("()\n");
883 void MACRO_SetContents(LPCSTR str, LONG u)
885 WINE_FIXME("(\"%s\", %lu)\n", str, u);
888 void MACRO_SetHelpOnFile(LPCSTR str)
890 WINE_FIXME("(\"%s\")\n", str);
893 void MACRO_SetPopupColor(LONG u1, LONG u2, LONG u3)
895 WINE_FIXME("(%lu, %lu, %lu)\n", u1, u2, u3);
898 void MACRO_ShellExecute(LPCSTR str1, LPCSTR str2, LONG u1, LONG u2, LPCSTR str3, LPCSTR str4)
900 WINE_FIXME("(\"%s\", \"%s\", %lu, %lu, \"%s\", \"%s\")\n", str1, str2, u1, u2, str3, str4);
903 void MACRO_ShortCut(LPCSTR str1, LPCSTR str2, LONG w, LONG l, LPCSTR str)
905 WINE_FIXME("(\"%s\", \"%s\", %lx, %lx, \"%s\")\n", str1, str2, w, l, str);
908 void MACRO_TCard(LONG u)
910 WINE_FIXME("(%lu)\n", u);
913 void MACRO_Test(LONG u)
915 WINE_FIXME("(%lu)\n", u);
918 BOOL MACRO_TestALink(LPCSTR str)
920 WINE_FIXME("(\"%s\")\n", str);
921 return FALSE;
924 BOOL MACRO_TestKLink(LPCSTR str)
926 WINE_FIXME("(\"%s\")\n", str);
927 return FALSE;
930 void MACRO_UncheckItem(LPCSTR str)
932 WINE_FIXME("(\"%s\")\n", str);
935 void MACRO_UpdateWindow(LPCSTR str1, LPCSTR str2)
937 WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);