Define GL_EXT_framebuffer_object and GL_EXT_pixelbuffer_object openGL
[wine.git] / programs / winhelp / macro.c
blobe34a4dccdb555ea8372c66008666ecc8496aecdf
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 const char* name;
37 const char* alias;
38 BOOL isBool;
39 const char* arguments;
40 FARPROC 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, "", (FARPROC)MACRO_About},
52 {"AddAccelerator", "AA", 0, "UUS", (FARPROC)MACRO_AddAccelerator},
53 {"ALink", "AL", 0, "SUS", (FARPROC)MACRO_ALink},
54 {"Annotate", NULL, 0, "", (FARPROC)MACRO_Annotate},
55 {"AppendItem", NULL, 0, "SSSS", (FARPROC)MACRO_AppendItem},
56 {"Back", NULL, 0, "", (FARPROC)MACRO_Back},
57 {"BackFlush", "BF", 0, "", (FARPROC)MACRO_BackFlush},
58 {"BookmarkDefine", NULL, 0, "", (FARPROC)MACRO_BookmarkDefine},
59 {"BookmarkMore", NULL, 0, "", (FARPROC)MACRO_BookmarkMore},
60 {"BrowseButtons", NULL, 0, "", (FARPROC)MACRO_BrowseButtons},
61 {"ChangeButtonBinding", "CBB",0, "SS", (FARPROC)MACRO_ChangeButtonBinding},
62 {"ChangeEnable", "CE", 0, "SS", (FARPROC)MACRO_ChangeEnable},
63 {"ChangeItemBinding", "CIB",0, "SS", (FARPROC)MACRO_ChangeItemBinding},
64 {"CheckItem", "CI", 0, "S", (FARPROC)MACRO_CheckItem},
65 {"CloseSecondarys", "CS", 0, "", (FARPROC)MACRO_CloseSecondarys},
66 {"CloseWindow", "CW", 0, "S", (FARPROC)MACRO_CloseWindow},
67 {"Compare", NULL, 0, "S", (FARPROC)MACRO_Compare},
68 {"Contents", NULL, 0, "", (FARPROC)MACRO_Contents},
69 {"ControlPanel", NULL, 0, "SSU", (FARPROC)MACRO_ControlPanel},
70 {"CopyDialog", NULL, 0, "", (FARPROC)MACRO_CopyDialog},
71 {"CopyTopic", "CT", 0, "", (FARPROC)MACRO_CopyTopic},
72 {"CreateButton", "CB", 0, "SSS", (FARPROC)MACRO_CreateButton},
73 {"DeleteItem", NULL, 0, "S", (FARPROC)MACRO_DeleteItem},
74 {"DeleteMark", NULL, 0, "S", (FARPROC)MACRO_DeleteMark},
75 {"DestroyButton", NULL, 0, "S", (FARPROC)MACRO_DestroyButton},
76 {"DisableButton", "DB", 0, "S", (FARPROC)MACRO_DisableButton},
77 {"DisableItem", "DI", 0, "S", (FARPROC)MACRO_DisableItem},
78 {"EnableButton", "EB", 0, "S", (FARPROC)MACRO_EnableButton},
79 {"EnableItem", "EI", 0, "S", (FARPROC)MACRO_EnableItem},
80 {"EndMPrint", NULL, 0, "", (FARPROC)MACRO_EndMPrint},
81 {"ExecFile", "EF", 0, "SSUS", (FARPROC)MACRO_ExecFile},
82 {"ExecProgram", "EP", 0, "SU", (FARPROC)MACRO_ExecProgram},
83 {"Exit", NULL, 0, "", (FARPROC)MACRO_Exit},
84 {"ExtAbleItem", NULL, 0, "SU", (FARPROC)MACRO_ExtAbleItem},
85 {"ExtInsertItem", NULL, 0, "SSSSUU", (FARPROC)MACRO_ExtInsertItem},
86 {"ExtInsertMenu", NULL, 0, "SSSUU", (FARPROC)MACRO_ExtInsertMenu},
87 {"FileExist", "FE", 1, "S", (FARPROC)MACRO_FileExist},
88 {"FileOpen", "FO", 0, "", (FARPROC)MACRO_FileOpen},
89 {"Find", NULL, 0, "", (FARPROC)MACRO_Find},
90 {"Finder", "FD", 0, "", (FARPROC)MACRO_Finder},
91 {"FloatingMenu", NULL, 0, "", (FARPROC)MACRO_FloatingMenu},
92 {"Flush", "FH", 0, "", (FARPROC)MACRO_Flush},
93 {"FocusWindow", NULL, 0, "S", (FARPROC)MACRO_FocusWindow},
94 {"Generate", NULL, 0, "SUU", (FARPROC)MACRO_Generate},
95 {"GotoMark", NULL, 0, "S", (FARPROC)MACRO_GotoMark},
96 {"HelpOn", NULL, 0, "", (FARPROC)MACRO_HelpOn},
97 {"HelpOnTop", NULL, 0, "", (FARPROC)MACRO_HelpOnTop},
98 {"History", NULL, 0, "", (FARPROC)MACRO_History},
99 {"InitMPrint", NULL, 1, "", (FARPROC)MACRO_InitMPrint},
100 {"InsertItem", NULL, 0, "SSSSU", (FARPROC)MACRO_InsertItem},
101 {"InsertMenu", NULL, 0, "SSU", (FARPROC)MACRO_InsertMenu},
102 {"IfThen", "IF", 0, "BS", (FARPROC)MACRO_IfThen},
103 {"IfThenElse", "IE", 0, "BSS", (FARPROC)MACRO_IfThenElse},
104 {"IsBook", NULL, 1, "", (FARPROC)MACRO_IsBook},
105 {"IsMark", NULL, 1, "S", (FARPROC)MACRO_IsMark},
106 {"IsNotMark", "NM", 1, "S", (FARPROC)MACRO_IsNotMark},
107 {"JumpContents", NULL, 0, "SS", (FARPROC)MACRO_JumpContents},
108 {"JumpContext", "JC", 0, "SSU", (FARPROC)MACRO_JumpContext},
109 {"JumpHash", "JH", 0, "SSU", (FARPROC)MACRO_JumpHash},
110 {"JumpHelpOn", NULL, 0, "", (FARPROC)MACRO_JumpHelpOn},
111 {"JumpID", "JI", 0, "SSS", (FARPROC)MACRO_JumpID},
112 {"JumpKeyword", "JK", 0, "SSS", (FARPROC)MACRO_JumpKeyword},
113 {"KLink", "KL", 0, "SUSS", (FARPROC)MACRO_KLink},
114 {"Menu", "MU", 0, "", (FARPROC)MACRO_Menu},
115 {"MPrintHash", NULL, 0, "U", (FARPROC)MACRO_MPrintHash},
116 {"MPrintID", NULL, 0, "S", (FARPROC)MACRO_MPrintID},
117 {"Next", NULL, 0, "", (FARPROC)MACRO_Next},
118 {"NoShow", NULL, 0, "", (FARPROC)MACRO_NoShow},
119 {"PopupContext", "PC", 0, "SU", (FARPROC)MACRO_PopupContext},
120 {"PopupHash", NULL, 0, "SU", (FARPROC)MACRO_PopupHash},
121 {"PopupId", "PI", 0, "SS", (FARPROC)MACRO_PopupId},
122 {"PositionWindow", "PW", 0, "IIUUUS", (FARPROC)MACRO_PositionWindow},
123 {"Prev", NULL, 0, "", (FARPROC)MACRO_Prev},
124 {"Print", NULL, 0, "", (FARPROC)MACRO_Print},
125 {"PrinterSetup", NULL, 0, "", (FARPROC)MACRO_PrinterSetup},
126 {"RegisterRoutine", "RR", 0, "SSS", (FARPROC)MACRO_RegisterRoutine},
127 {"RemoveAccelerator", "RA", 0, "UU", (FARPROC)MACRO_RemoveAccelerator},
128 {"ResetMenu", NULL, 0, "", (FARPROC)MACRO_ResetMenu},
129 {"SaveMark", NULL, 0, "S", (FARPROC)MACRO_SaveMark},
130 {"Search", NULL, 0, "", (FARPROC)MACRO_Search},
131 {"SetContents", NULL, 0, "SU", (FARPROC)MACRO_SetContents},
132 {"SetHelpOnFile", NULL, 0, "S", (FARPROC)MACRO_SetHelpOnFile},
133 {"SetPopupColor", "SPC",0, "UUU", (FARPROC)MACRO_SetPopupColor},
134 {"ShellExecute", "SE", 0, "SSUUSS", (FARPROC)MACRO_ShellExecute},
135 {"ShortCut", "SH", 0, "SSUUS", (FARPROC)MACRO_ShortCut},
136 {"TCard", NULL, 0, "U", (FARPROC)MACRO_TCard},
137 {"Test", NULL, 0, "U", (FARPROC)MACRO_Test},
138 {"TestALink", NULL, 1, "S", (FARPROC)MACRO_TestALink},
139 {"TestKLink", NULL, 1, "S", (FARPROC)MACRO_TestKLink},
140 {"UncheckItem", "UI", 0, "S", (FARPROC)MACRO_UncheckItem},
141 {"UpdateWindow", "UW", 0, "SS", (FARPROC)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 lr->function = md->fn;
158 return md->isBool ? BOOL_FUNCTION : VOID_FUNCTION;
161 return EMPTY;
164 int MACRO_Lookup(const char* name, struct lexret* lr)
166 int ret;
168 if ((ret = MACRO_DoLookUp(MACRO_Builtins, name, lr, -1)) != EMPTY)
169 return ret;
170 if (MACRO_Loaded && (ret = MACRO_DoLookUp(MACRO_Loaded, name, lr, MACRO_NumLoaded)) != EMPTY)
171 return ret;
173 lr->string = name;
174 return IDENTIFIER;
177 /******* helper functions *******/
179 static WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name)
181 WINHELP_BUTTON** b;
183 for (b = &win->first_button; *b; b = &(*b)->next)
184 if (!lstrcmpi(name, (*b)->lpszID)) break;
185 return b;
188 /******* real macro implementation *******/
190 void CALLBACK MACRO_About(void)
192 WINE_FIXME("()\n");
195 void CALLBACK MACRO_AddAccelerator(LONG u1, LONG u2, LPCSTR str)
197 WINE_FIXME("(%lu, %lu, \"%s\")\n", u1, u2, str);
200 void CALLBACK MACRO_ALink(LPCSTR str1, LONG u, LPCSTR str2)
202 WINE_FIXME("(\"%s\", %lu, \"%s\")\n", str1, u, str2);
205 void CALLBACK MACRO_Annotate(void)
207 WINE_FIXME("()\n");
210 void CALLBACK MACRO_AppendItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4)
212 WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\")\n", str1, str2, str3, str4);
215 void CALLBACK MACRO_Back(void)
217 WINHELP_WINDOW* win = Globals.active_win;
219 WINE_TRACE("()\n");
221 if (win && win->backIndex >= 2)
222 WINHELP_CreateHelpWindow(win->back[--win->backIndex - 1],
223 win->info, SW_SHOW);
226 void CALLBACK MACRO_BackFlush(void)
228 WINHELP_WINDOW* win = Globals.active_win;
230 WINE_TRACE("()\n");
232 if (win)
234 int i;
236 for (i = 0; i < win->backIndex; i++)
238 HLPFILE_FreeHlpFile(win->back[i]->file);
239 win->back[i] = NULL;
241 win->backIndex = 0;
245 void CALLBACK MACRO_BookmarkDefine(void)
247 WINE_FIXME("()\n");
250 void CALLBACK MACRO_BookmarkMore(void)
252 WINE_FIXME("()\n");
255 void CALLBACK MACRO_BrowseButtons(void)
257 WINE_TRACE("()\n");
259 MACRO_CreateButton("BTN_PREV", "&<<", "Prev()");
260 MACRO_CreateButton("BTN_NEXT", "&>>", "Next()");
263 void CALLBACK MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
265 WINHELP_WINDOW* win = Globals.active_win;
266 WINHELP_BUTTON* button;
267 WINHELP_BUTTON** b;
268 LONG size;
269 LPSTR ptr;
271 WINE_TRACE("(\"%s\", \"%s\")\n", id, macro);
273 b = MACRO_LookupButton(win, id);
274 if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
276 size = sizeof(WINHELP_BUTTON) + lstrlen(id) +
277 lstrlen((*b)->lpszName) + lstrlen(macro) + 3;
279 button = HeapAlloc(GetProcessHeap(), 0, size);
280 if (!button) return;
282 button->next = (*b)->next;
283 button->hWnd = (*b)->hWnd;
284 button->wParam = (*b)->wParam;
286 ptr = (char*)button + sizeof(WINHELP_BUTTON);
288 lstrcpy(ptr, id);
289 button->lpszID = ptr;
290 ptr += lstrlen(id) + 1;
292 lstrcpy(ptr, (*b)->lpszName);
293 button->lpszName = ptr;
294 ptr += lstrlen((*b)->lpszName) + 1;
296 lstrcpy(ptr, macro);
297 button->lpszMacro = ptr;
299 *b = button;
301 SendMessage(win->hMainWnd, WM_USER, 0, 0);
304 void CALLBACK MACRO_ChangeEnable(LPCSTR id, LPCSTR macro)
306 WINE_TRACE("(\"%s\", \"%s\")\n", id, macro);
308 MACRO_ChangeButtonBinding(id, macro);
309 MACRO_EnableButton(id);
312 void CALLBACK MACRO_ChangeItemBinding(LPCSTR str1, LPCSTR str2)
314 WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);
317 void CALLBACK MACRO_CheckItem(LPCSTR str)
319 WINE_FIXME("(\"%s\")\n", str);
322 void CALLBACK MACRO_CloseSecondarys(void)
324 WINHELP_WINDOW *win;
326 WINE_TRACE("()\n");
327 for (win = Globals.win_list; win; win = win->next)
328 if (win->lpszName && lstrcmpi(win->lpszName, "main"))
329 DestroyWindow(win->hMainWnd);
332 void CALLBACK MACRO_CloseWindow(LPCSTR lpszWindow)
334 WINHELP_WINDOW *win;
336 WINE_TRACE("(\"%s\")\n", lpszWindow);
338 if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
340 for (win = Globals.win_list; win; win = win->next)
341 if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
342 DestroyWindow(win->hMainWnd);
345 void CALLBACK MACRO_Compare(LPCSTR str)
347 WINE_FIXME("(\"%s\")\n", str);
350 void CALLBACK MACRO_Contents(void)
352 WINE_TRACE("()\n");
354 if (Globals.active_win->page)
355 MACRO_JumpContents(Globals.active_win->page->file->lpszPath, NULL);
358 void CALLBACK MACRO_ControlPanel(LPCSTR str1, LPCSTR str2, LONG u)
360 WINE_FIXME("(\"%s\", \"%s\", %lu)\n", str1, str2, u);
363 void CALLBACK MACRO_CopyDialog(void)
365 WINE_FIXME("()\n");
368 void CALLBACK MACRO_CopyTopic(void)
370 WINE_FIXME("()\n");
373 void CALLBACK MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
375 WINHELP_WINDOW *win = Globals.active_win;
376 WINHELP_BUTTON *button, **b;
377 LONG size;
378 LPSTR ptr;
380 WINE_TRACE("(\"%s\", \"%s\", %s)\n", id, name, macro);
382 size = sizeof(WINHELP_BUTTON) + lstrlen(id) + lstrlen(name) + lstrlen(macro) + 3;
384 button = HeapAlloc(GetProcessHeap(), 0, size);
385 if (!button) return;
387 button->next = 0;
388 button->hWnd = 0;
390 ptr = (char*)button + sizeof(WINHELP_BUTTON);
392 lstrcpy(ptr, id);
393 button->lpszID = ptr;
394 ptr += lstrlen(id) + 1;
396 lstrcpy(ptr, name);
397 button->lpszName = ptr;
398 ptr += lstrlen(name) + 1;
400 lstrcpy(ptr, macro);
401 button->lpszMacro = ptr;
403 button->wParam = WH_FIRST_BUTTON;
404 for (b = &win->first_button; *b; b = &(*b)->next)
405 button->wParam = max(button->wParam, (*b)->wParam + 1);
406 *b = button;
408 SendMessage(win->hMainWnd, WM_USER, 0, 0);
411 void CALLBACK MACRO_DeleteItem(LPCSTR str)
413 WINE_FIXME("(\"%s\")\n", str);
416 void CALLBACK MACRO_DeleteMark(LPCSTR str)
418 WINE_FIXME("(\"%s\")\n", str);
421 void CALLBACK MACRO_DestroyButton(LPCSTR str)
423 WINE_FIXME("(\"%s\")\n", str);
426 void CALLBACK MACRO_DisableButton(LPCSTR id)
428 WINHELP_BUTTON** b;
430 WINE_FIXME("(\"%s\")\n", id);
432 b = MACRO_LookupButton(Globals.active_win, id);
433 if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
435 EnableWindow((*b)->hWnd, FALSE);
438 void CALLBACK MACRO_DisableItem(LPCSTR str)
440 WINE_FIXME("(\"%s\")\n", str);
443 void CALLBACK MACRO_EnableButton(LPCSTR id)
445 WINHELP_BUTTON** b;
447 WINE_TRACE("(\"%s\")\n", id);
449 b = MACRO_LookupButton(Globals.active_win, id);
450 if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
452 EnableWindow((*b)->hWnd, TRUE);
455 void CALLBACK MACRO_EnableItem(LPCSTR str)
457 WINE_FIXME("(\"%s\")\n", str);
460 void CALLBACK MACRO_EndMPrint(void)
462 WINE_FIXME("()\n");
465 void CALLBACK MACRO_ExecFile(LPCSTR str1, LPCSTR str2, LONG u, LPCSTR str3)
467 WINE_FIXME("(\"%s\", \"%s\", %lu, \"%s\")\n", str1, str2, u, str3);
470 void CALLBACK MACRO_ExecProgram(LPCSTR str, LONG u)
472 WINE_FIXME("(\"%s\", %lu)\n", str, u);
475 void CALLBACK MACRO_Exit(void)
477 WINE_TRACE("()\n");
479 while (Globals.win_list)
480 DestroyWindow(Globals.win_list->hMainWnd);
483 void CALLBACK MACRO_ExtAbleItem(LPCSTR str, LONG u)
485 WINE_FIXME("(\"%s\", %lu)\n", str, u);
488 void CALLBACK MACRO_ExtInsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u1, LONG u2)
490 WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\", %lu, %lu)\n", str1, str2, str3, str4, u1, u2);
493 void CALLBACK MACRO_ExtInsertMenu(LPCSTR str1, LPCSTR str2, LPCSTR str3, LONG u1, LONG u2)
495 WINE_FIXME("(\"%s\", \"%s\", \"%s\", %lu, %lu)\n", str1, str2, str3, u1, u2);
498 BOOL CALLBACK MACRO_FileExist(LPCSTR str)
500 WINE_TRACE("(\"%s\")\n", str);
501 return GetFileAttributes(str) != INVALID_FILE_ATTRIBUTES;
504 void CALLBACK MACRO_FileOpen(void)
506 OPENFILENAME openfilename;
507 CHAR szPath[MAX_PATHNAME_LEN];
508 CHAR szDir[MAX_PATHNAME_LEN];
509 CHAR szzFilter[2 * MAX_STRING_LEN + 100];
510 LPSTR p = szzFilter;
512 WINE_TRACE("()\n");
514 LoadString(Globals.hInstance, STID_HELP_FILES_HLP, p, MAX_STRING_LEN);
515 p += strlen(p) + 1;
516 lstrcpy(p, "*.hlp");
517 p += strlen(p) + 1;
518 LoadString(Globals.hInstance, STID_ALL_FILES, p, MAX_STRING_LEN);
519 p += strlen(p) + 1;
520 lstrcpy(p, "*.*");
521 p += strlen(p) + 1;
522 *p = '\0';
524 GetCurrentDirectory(sizeof(szDir), szDir);
526 szPath[0]='\0';
528 openfilename.lStructSize = sizeof(OPENFILENAME);
529 openfilename.hwndOwner = Globals.active_win->hMainWnd;
530 openfilename.hInstance = Globals.hInstance;
531 openfilename.lpstrFilter = szzFilter;
532 openfilename.lpstrCustomFilter = 0;
533 openfilename.nMaxCustFilter = 0;
534 openfilename.nFilterIndex = 1;
535 openfilename.lpstrFile = szPath;
536 openfilename.nMaxFile = sizeof(szPath);
537 openfilename.lpstrFileTitle = 0;
538 openfilename.nMaxFileTitle = 0;
539 openfilename.lpstrInitialDir = szDir;
540 openfilename.lpstrTitle = 0;
541 openfilename.Flags = 0;
542 openfilename.nFileOffset = 0;
543 openfilename.nFileExtension = 0;
544 openfilename.lpstrDefExt = 0;
545 openfilename.lCustData = 0;
546 openfilename.lpfnHook = 0;
547 openfilename.lpTemplateName = 0;
549 if (GetOpenFileName(&openfilename))
551 HLPFILE* hlpfile = WINHELP_LookupHelpFile(szPath);
553 WINHELP_CreateHelpWindowByHash(hlpfile, 0,
554 WINHELP_GetWindowInfo(hlpfile, "main"), SW_SHOWNORMAL);
558 void CALLBACK MACRO_Find(void)
560 WINE_FIXME("()\n");
563 void CALLBACK MACRO_Finder(void)
565 WINE_FIXME("()\n");
568 void CALLBACK MACRO_FloatingMenu(void)
570 WINE_FIXME("()\n");
573 void CALLBACK MACRO_Flush(void)
575 WINE_FIXME("()\n");
578 void CALLBACK MACRO_FocusWindow(LPCSTR lpszWindow)
580 WINHELP_WINDOW *win;
582 WINE_TRACE("(\"%s\")\n", lpszWindow);
584 if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
586 for (win = Globals.win_list; win; win = win->next)
587 if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
588 SetFocus(win->hMainWnd);
591 void CALLBACK MACRO_Generate(LPCSTR str, LONG w, LONG l)
593 WINE_FIXME("(\"%s\", %lx, %lx)\n", str, w, l);
596 void CALLBACK MACRO_GotoMark(LPCSTR str)
598 WINE_FIXME("(\"%s\")\n", str);
601 void CALLBACK MACRO_HelpOn(void)
603 WINE_TRACE("()\n");
604 MACRO_JumpContents((Globals.wVersion > 4) ? "winhelp32.hlp" : "winhelp.hlp", NULL);
607 void CALLBACK MACRO_HelpOnTop(void)
609 WINE_FIXME("()\n");
612 void CALLBACK MACRO_History(void)
614 WINE_TRACE("()\n");
616 if (Globals.active_win && !Globals.active_win->hHistoryWnd)
618 HWND hWnd = CreateWindow(HISTORY_WIN_CLASS_NAME, "History", WS_OVERLAPPEDWINDOW,
619 0, 0, 0, 0, 0, 0, Globals.hInstance, Globals.active_win);
620 ShowWindow(hWnd, SW_NORMAL);
624 void CALLBACK MACRO_IfThen(BOOL b, LPCSTR t)
626 if (b) MACRO_ExecuteMacro(t);
629 void CALLBACK MACRO_IfThenElse(BOOL b, LPCSTR t, LPCSTR f)
631 if (b) MACRO_ExecuteMacro(t); else MACRO_ExecuteMacro(f);
634 BOOL CALLBACK MACRO_InitMPrint(void)
636 WINE_FIXME("()\n");
637 return FALSE;
640 void CALLBACK MACRO_InsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u)
642 WINE_FIXME("(\"%s\", \"%s\", \"%s\", \"%s\", %lu)\n", str1, str2, str3, str4, u);
645 void CALLBACK MACRO_InsertMenu(LPCSTR str1, LPCSTR str2, LONG u)
647 WINE_FIXME("(\"%s\", \"%s\", %lu)\n", str1, str2, u);
650 BOOL CALLBACK MACRO_IsBook(void)
652 WINE_TRACE("()\n");
653 return Globals.isBook;
656 BOOL CALLBACK MACRO_IsMark(LPCSTR str)
658 WINE_FIXME("(\"%s\")\n", str);
659 return FALSE;
662 BOOL CALLBACK MACRO_IsNotMark(LPCSTR str)
664 WINE_FIXME("(\"%s\")\n", str);
665 return TRUE;
668 void CALLBACK MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
670 HLPFILE* hlpfile;
672 WINE_TRACE("(\"%s\", \"%s\")\n", lpszPath, lpszWindow);
673 hlpfile = WINHELP_LookupHelpFile(lpszPath);
674 WINHELP_CreateHelpWindowByHash(hlpfile, 0,
675 WINHELP_GetWindowInfo(hlpfile, lpszWindow),
676 SW_NORMAL);
679 void CALLBACK MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context)
681 WINE_FIXME("(\"%s\", \"%s\", %ld)semi-stub\n", lpszPath, lpszWindow, context);
682 return MACRO_JumpContents(lpszPath, lpszWindow);
685 void CALLBACK MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
687 HLPFILE* hlpfile;
689 WINE_TRACE("(\"%s\", \"%s\", %lu)\n", lpszPath, lpszWindow, lHash);
690 hlpfile = WINHELP_LookupHelpFile(lpszPath);
691 WINHELP_CreateHelpWindowByHash(hlpfile, lHash,
692 WINHELP_GetWindowInfo(hlpfile, lpszWindow),
693 SW_NORMAL);
696 void CALLBACK MACRO_JumpHelpOn(void)
698 WINE_FIXME("()\n");
701 /* FIXME: those two macros are wrong
702 * they should only contain 2 strings, path & window are coded as path>window
704 void CALLBACK MACRO_JumpID(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR topic_id)
706 WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", lpszPath, lpszWindow, topic_id);
707 MACRO_JumpHash(lpszPath, lpszWindow, HLPFILE_Hash(topic_id));
710 void CALLBACK MACRO_JumpKeyword(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR keyword)
712 WINE_FIXME("(\"%s\", \"%s\", \"%s\")\n", lpszPath, lpszWindow, keyword);
715 void CALLBACK MACRO_KLink(LPCSTR str1, LONG u, LPCSTR str2, LPCSTR str3)
717 WINE_FIXME("(\"%s\", %lu, \"%s\", \"%s\")\n", str1, u, str2, str3);
720 void CALLBACK MACRO_Menu(void)
722 WINE_FIXME("()\n");
725 void CALLBACK MACRO_MPrintHash(LONG u)
727 WINE_FIXME("(%lu)\n", u);
730 void CALLBACK MACRO_MPrintID(LPCSTR str)
732 WINE_FIXME("(\"%s\")\n", str);
735 void CALLBACK MACRO_Next(void)
737 HLPFILE_PAGE* page;
739 WINE_TRACE("()\n");
740 page = Globals.active_win->page;
741 page = HLPFILE_PageByOffset(page->file, page->browse_fwd);
742 if (page)
744 page->file->wRefCount++;
745 WINHELP_CreateHelpWindow(page, Globals.active_win->info, SW_NORMAL);
749 void CALLBACK MACRO_NoShow(void)
751 WINE_FIXME("()\n");
754 void CALLBACK MACRO_PopupContext(LPCSTR str, LONG u)
756 WINE_FIXME("(\"%s\", %lu)\n", str, u);
759 void CALLBACK MACRO_PopupHash(LPCSTR str, LONG u)
761 WINE_FIXME("(\"%s\", %lu)\n", str, u);
764 void CALLBACK MACRO_PopupId(LPCSTR str1, LPCSTR str2)
766 WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);
769 void CALLBACK MACRO_PositionWindow(LONG i1, LONG i2, LONG u1, LONG u2, LONG u3, LPCSTR str)
771 WINE_FIXME("(%li, %li, %lu, %lu, %lu, \"%s\")\n", i1, i2, u1, u2, u3, str);
774 void CALLBACK MACRO_Prev(void)
776 HLPFILE_PAGE* page;
778 WINE_TRACE("()\n");
779 page = Globals.active_win->page;
780 page = HLPFILE_PageByOffset(page->file, page->browse_bwd);
781 if (page)
783 page->file->wRefCount++;
784 WINHELP_CreateHelpWindow(page, Globals.active_win->info, SW_NORMAL);
788 void CALLBACK MACRO_Print(void)
790 PRINTDLG printer;
792 WINE_TRACE("()\n");
794 printer.lStructSize = sizeof(printer);
795 printer.hwndOwner = Globals.active_win->hMainWnd;
796 printer.hInstance = Globals.hInstance;
797 printer.hDevMode = 0;
798 printer.hDevNames = 0;
799 printer.hDC = 0;
800 printer.Flags = 0;
801 printer.nFromPage = 0;
802 printer.nToPage = 0;
803 printer.nMinPage = 0;
804 printer.nMaxPage = 0;
805 printer.nCopies = 0;
806 printer.lCustData = 0;
807 printer.lpfnPrintHook = 0;
808 printer.lpfnSetupHook = 0;
809 printer.lpPrintTemplateName = 0;
810 printer.lpSetupTemplateName = 0;
811 printer.hPrintTemplate = 0;
812 printer.hSetupTemplate = 0;
814 if (PrintDlgA(&printer)) {
815 WINE_FIXME("Print()\n");
819 void CALLBACK MACRO_PrinterSetup(void)
821 WINE_FIXME("()\n");
824 void CALLBACK MACRO_RegisterRoutine(LPCSTR dll_name, LPCSTR proc, LPCSTR args)
826 FARPROC fn = NULL;
827 int size;
828 WINHELP_DLL* dll;
830 WINE_TRACE("(\"%s\", \"%s\", \"%s\")\n", dll_name, proc, args);
832 /* FIXME: are the registered DLLs global or linked to the current file ???
833 * We assume globals (as we did for macros, but is this really the case ???)
835 for (dll = Globals.dlls; dll; dll = dll->next)
837 if (!strcmp(dll->name, dll_name)) break;
839 if (!dll)
841 HANDLE hLib = LoadLibrary(dll_name);
843 /* FIXME: the library will not be unloaded until exit of program
844 * We don't send the DW_TERM message
846 WINE_TRACE("Loading %s\n", dll_name);
847 /* FIXME: should look in the directory where current hlpfile
848 * is loaded from
850 if (hLib == NULL)
852 /* FIXME: internationalisation for error messages */
853 WINE_FIXME("Cannot find dll %s\n", dll_name);
855 else if ((dll = HeapAlloc(GetProcessHeap(), 0, sizeof(*dll))))
857 dll->hLib = hLib;
858 dll->name = strdup(dll_name); /* FIXME */
859 dll->next = Globals.dlls;
860 Globals.dlls = dll;
861 dll->handler = (WINHELP_LDLLHandler)GetProcAddress(dll->hLib, "LDLLHandler");
862 dll->class = dll->handler ? (dll->handler)(DW_WHATMSG, 0, 0) : DC_NOMSG;
863 WINE_TRACE("Got class %lx for DLL %s\n", dll->class, dll_name);
864 if (dll->class & DC_INITTERM) dll->handler(DW_INIT, 0, 0);
865 if (dll->class & DC_CALLBACKS) dll->handler(DW_CALLBACKS, (DWORD)Callbacks, 0);
867 else WINE_WARN("OOM\n");
869 if (dll && !(fn = GetProcAddress(dll->hLib, proc)))
871 /* FIXME: internationalisation for error messages */
872 WINE_FIXME("Cannot find proc %s in dll %s\n", dll_name, proc);
875 size = ++MACRO_NumLoaded * sizeof(struct MacroDesc);
876 if (!MACRO_Loaded) MACRO_Loaded = HeapAlloc(GetProcessHeap(), 0, size);
877 else MACRO_Loaded = HeapReAlloc(GetProcessHeap(), 0, MACRO_Loaded, size);
878 MACRO_Loaded[MACRO_NumLoaded - 1].name = strdup(proc); /* FIXME */
879 MACRO_Loaded[MACRO_NumLoaded - 1].alias = NULL;
880 MACRO_Loaded[MACRO_NumLoaded - 1].isBool = 0;
881 MACRO_Loaded[MACRO_NumLoaded - 1].arguments = strdup(args); /* FIXME */
882 MACRO_Loaded[MACRO_NumLoaded - 1].fn = fn;
883 WINE_TRACE("Added %s(%s) at %p\n", proc, args, fn);
886 void CALLBACK MACRO_RemoveAccelerator(LONG u1, LONG u2)
888 WINE_FIXME("(%lu, %lu)\n", u1, u2);
891 void CALLBACK MACRO_ResetMenu(void)
893 WINE_FIXME("()\n");
896 void CALLBACK MACRO_SaveMark(LPCSTR str)
898 WINE_FIXME("(\"%s\")\n", str);
901 void CALLBACK MACRO_Search(void)
903 WINE_FIXME("()\n");
906 void CALLBACK MACRO_SetContents(LPCSTR str, LONG u)
908 WINE_FIXME("(\"%s\", %lu)\n", str, u);
911 void CALLBACK MACRO_SetHelpOnFile(LPCSTR str)
913 WINE_FIXME("(\"%s\")\n", str);
916 void CALLBACK MACRO_SetPopupColor(LONG u1, LONG u2, LONG u3)
918 WINE_FIXME("(%lu, %lu, %lu)\n", u1, u2, u3);
921 void CALLBACK MACRO_ShellExecute(LPCSTR str1, LPCSTR str2, LONG u1, LONG u2, LPCSTR str3, LPCSTR str4)
923 WINE_FIXME("(\"%s\", \"%s\", %lu, %lu, \"%s\", \"%s\")\n", str1, str2, u1, u2, str3, str4);
926 void CALLBACK MACRO_ShortCut(LPCSTR str1, LPCSTR str2, LONG w, LONG l, LPCSTR str)
928 WINE_FIXME("(\"%s\", \"%s\", %lx, %lx, \"%s\")\n", str1, str2, w, l, str);
931 void CALLBACK MACRO_TCard(LONG u)
933 WINE_FIXME("(%lu)\n", u);
936 void CALLBACK MACRO_Test(LONG u)
938 WINE_FIXME("(%lu)\n", u);
941 BOOL CALLBACK MACRO_TestALink(LPCSTR str)
943 WINE_FIXME("(\"%s\")\n", str);
944 return FALSE;
947 BOOL CALLBACK MACRO_TestKLink(LPCSTR str)
949 WINE_FIXME("(\"%s\")\n", str);
950 return FALSE;
953 void CALLBACK MACRO_UncheckItem(LPCSTR str)
955 WINE_FIXME("(\"%s\")\n", str);
958 void CALLBACK MACRO_UpdateWindow(LPCSTR str1, LPCSTR str2)
960 WINE_FIXME("(\"%s\", \"%s\")\n", str1, str2);