4 * Copyright 1996 Ulrich Schmid
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(winhelp);
30 /******* helper functions *******/
31 WINHELP_BUTTON** MACRO_LookupButton(WINHELP_WINDOW* win, LPCSTR name)
35 for (b = &win->first_button; *b; b = &(*b)->next)
36 if (!lstrcmpi(name, (*b)->lpszID)) break;
40 /******* real macro implementation *******/
42 void MACRO_About(void)
44 WINE_FIXME("About()\n");
47 void MACRO_AddAccelerator(LONG u1, LONG u2, LPCSTR str)
49 WINE_FIXME("AddAccelerator(%lu, %lu, \"%s\")\n", u1, u2, str);
52 void MACRO_ALink(LPCSTR str1, LONG u, LPCSTR str2)
54 WINE_FIXME("ALink(\"%s\", %lu, \"%s\")\n", str1, u, str2);
57 void MACRO_Annotate(void)
59 WINE_FIXME("Annotate()\n");
62 void MACRO_AppendItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4)
64 WINE_FIXME("AppendItem(\"%s\", \"%s\", \"%s\", \"%s\")\n", str1, str2, str3, str4);
69 WINE_FIXME("Back()\n");
72 void MACRO_BackFlush(void)
74 WINE_FIXME("BackFlush()\n");
77 void MACRO_BookmarkDefine(void)
79 WINE_FIXME("BookmarkDefine()\n");
82 void MACRO_BookmarkMore(void)
84 WINE_FIXME("BookmarkMore()\n");
87 void MACRO_BrowseButtons(void)
89 MACRO_CreateButton("BTN_PREV", "&<<", "Prev()");
90 MACRO_CreateButton("BTN_NEXT", "&>>", "Next()");
93 void MACRO_ChangeButtonBinding(LPCSTR id, LPCSTR macro)
95 WINHELP_WINDOW* win = Globals.active_win;
96 WINHELP_BUTTON* button;
101 b = MACRO_LookupButton(win, id);
102 if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
104 size = sizeof(WINHELP_BUTTON) + lstrlen(id) +
105 lstrlen((*b)->lpszName) + lstrlen(macro) + 3;
107 button = HeapAlloc(GetProcessHeap(), 0, size);
110 button->next = (*b)->next;
111 button->hWnd = (*b)->hWnd;
112 button->wParam = (*b)->wParam;
114 ptr = (char*)button + sizeof(WINHELP_BUTTON);
116 lstrcpy(ptr, (LPSTR) id);
117 button->lpszID = ptr;
118 ptr += lstrlen(id) + 1;
120 lstrcpy(ptr, (LPSTR) (*b)->lpszName);
121 button->lpszName = ptr;
122 ptr += lstrlen((*b)->lpszName) + 1;
124 lstrcpy(ptr, (LPSTR) macro);
125 button->lpszMacro = ptr;
129 SendMessage(win->hMainWnd, WM_USER, 0, 0);
132 void MACRO_ChangeEnable(LPCSTR id, LPCSTR macro)
134 MACRO_ChangeButtonBinding(id, macro);
135 MACRO_EnableButton(id);
138 void MACRO_ChangeItemBinding(LPCSTR str1, LPCSTR str2)
140 WINE_FIXME("ChangeItemBinding(\"%s\", \"%s\")\n", str1, str2);
143 void MACRO_CheckItem(LPCSTR str)
145 WINE_FIXME("CheckItem(\"%s\")\n", str);
148 void MACRO_CloseSecondarys(void)
151 for (win = Globals.win_list; win; win = win->next)
152 if (win->lpszName && lstrcmpi(win->lpszName, "main"))
153 DestroyWindow(win->hMainWnd);
156 void MACRO_CloseWindow(LPCSTR lpszWindow)
159 if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
161 for (win = Globals.win_list; win; win = win->next)
162 if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
163 DestroyWindow(win->hMainWnd);
166 void MACRO_Compare(LPCSTR str)
168 WINE_FIXME("Compare(\"%s\")\n", str);
171 void MACRO_Contents(void)
173 if (Globals.active_win->page)
174 MACRO_JumpContents(Globals.active_win->page->file->lpszPath, NULL);
177 void MACRO_ControlPanel(LPCSTR str1, LPCSTR str2, LONG u)
179 WINE_FIXME("ControlPanel(\"%s\", \"%s\", %lu)\n", str1, str2, u);
182 void MACRO_CopyDialog(void)
184 WINE_FIXME("CopyDialog()\n");
187 void MACRO_CopyTopic(void)
189 WINE_FIXME("CopyTopic()\n");
192 void MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
194 WINHELP_WINDOW *win = Globals.active_win;
195 WINHELP_BUTTON *button, **b;
199 size = sizeof(WINHELP_BUTTON) + lstrlen(id) + lstrlen(name) + lstrlen(macro) + 3;
201 button = HeapAlloc(GetProcessHeap(), 0, size);
207 ptr = (char*)button + sizeof(WINHELP_BUTTON);
209 lstrcpy(ptr, (LPSTR) id);
210 button->lpszID = ptr;
211 ptr += lstrlen(id) + 1;
213 lstrcpy(ptr, (LPSTR) name);
214 button->lpszName = ptr;
215 ptr += lstrlen(name) + 1;
217 lstrcpy(ptr, (LPSTR) macro);
218 button->lpszMacro = ptr;
220 button->wParam = WH_FIRST_BUTTON;
221 for (b = &win->first_button; *b; b = &(*b)->next)
222 button->wParam = max(button->wParam, (*b)->wParam + 1);
225 SendMessage(win->hMainWnd, WM_USER, 0, 0);
228 void MACRO_DeleteItem(LPCSTR str)
230 WINE_FIXME("DeleteItem(\"%s\")\n", str);
233 void MACRO_DeleteMark(LPCSTR str)
235 WINE_FIXME("DeleteMark(\"%s\")\n", str);
238 void MACRO_DestroyButton(LPCSTR str)
240 WINE_FIXME("DestroyButton(\"%s\")\n", str);
243 void MACRO_DisableButton(LPCSTR id)
247 b = MACRO_LookupButton(Globals.active_win, id);
248 if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
250 EnableWindow((*b)->hWnd, FALSE);
253 void MACRO_DisableItem(LPCSTR str)
255 WINE_FIXME("DisableItem(\"%s\")\n", str);
258 void MACRO_EnableButton(LPCSTR id)
262 b = MACRO_LookupButton(Globals.active_win, id);
263 if (!*b) {WINE_FIXME("Couldn't find button '%s'\n", id); return;}
265 EnableWindow((*b)->hWnd, TRUE);
268 void MACRO_EnableItem(LPCSTR str)
270 WINE_FIXME("EnableItem(\"%s\")\n", str);
273 void MACRO_EndMPrint(void)
275 WINE_FIXME("EndMPrint()\n");
278 void MACRO_ExecFile(LPCSTR str1, LPCSTR str2, LONG u, LPCSTR str3)
280 WINE_FIXME("ExecFile(\"%s\", \"%s\", %lu, \"%s\")\n", str1, str2, u, str3);
283 void MACRO_ExecProgram(LPCSTR str, LONG u)
285 WINE_FIXME("ExecProgram(\"%s\", %lu)\n", str, u);
288 void MACRO_Exit(void)
290 while (Globals.win_list)
291 DestroyWindow(Globals.win_list->hMainWnd);
294 void MACRO_ExtAbleItem(LPCSTR str, LONG u)
296 WINE_FIXME("ExtAbleItem(\"%s\", %lu)\n", str, u);
299 void MACRO_ExtInsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u1, LONG u2)
301 WINE_FIXME("ExtInsertItem(\"%s\", \"%s\", \"%s\", \"%s\", %lu, %lu)\n", str1, str2, str3, str4, u1, u2);
304 void MACRO_ExtInsertMenu(LPCSTR str1, LPCSTR str2, LPCSTR str3, LONG u1, LONG u2)
306 WINE_FIXME("ExtInsertMenu(\"%s\", \"%s\", \"%s\", %lu, %lu)\n", str1, str2, str3, u1, u2);
309 BOOL MACRO_FileExist(LPCSTR str)
311 return GetFileAttributes(str) != 0xFFFFFFFF;
314 void MACRO_FileOpen(void)
316 OPENFILENAME openfilename;
317 CHAR szPath[MAX_PATHNAME_LEN];
318 CHAR szDir[MAX_PATHNAME_LEN];
319 CHAR szzFilter[2 * MAX_STRING_LEN + 100];
322 LoadString(Globals.hInstance, STID_HELP_FILES_HLP, p, MAX_STRING_LEN);
326 LoadString(Globals.hInstance, STID_ALL_FILES, p, MAX_STRING_LEN);
332 GetCurrentDirectory(sizeof(szDir), szDir);
336 openfilename.lStructSize = 0;
337 openfilename.hwndOwner = Globals.active_win->hMainWnd;
338 openfilename.hInstance = Globals.hInstance;
339 openfilename.lpstrFilter = szzFilter;
340 openfilename.lpstrCustomFilter = 0;
341 openfilename.nMaxCustFilter = 0;
342 openfilename.nFilterIndex = 1;
343 openfilename.lpstrFile = szPath;
344 openfilename.nMaxFile = sizeof(szPath);
345 openfilename.lpstrFileTitle = 0;
346 openfilename.nMaxFileTitle = 0;
347 openfilename.lpstrInitialDir = szDir;
348 openfilename.lpstrTitle = 0;
349 openfilename.Flags = 0;
350 openfilename.nFileOffset = 0;
351 openfilename.nFileExtension = 0;
352 openfilename.lpstrDefExt = 0;
353 openfilename.lCustData = 0;
354 openfilename.lpfnHook = 0;
355 openfilename.lpTemplateName = 0;
357 if (GetOpenFileName(&openfilename))
358 WINHELP_CreateHelpWindowByHash(szPath, 0, "main", FALSE, 0, NULL, SW_SHOWNORMAL);
361 void MACRO_Find(void)
363 WINE_FIXME("Find()\n");
366 void MACRO_Finder(void)
368 WINE_FIXME("Finder()\n");
371 void MACRO_FloatingMenu(void)
373 WINE_FIXME("FloatingMenu()\n");
376 void MACRO_Flush(void)
378 WINE_FIXME("Flush()\n");
381 void MACRO_FocusWindow(LPCSTR str)
383 WINE_FIXME("FocusWindow(\"%s\")\n", str);
386 void MACRO_Generate(LPCSTR str, WPARAM w, LPARAM l)
388 WINE_FIXME("Generate(\"%s\", %x, %lx)\n", str, w, l);
391 void MACRO_GotoMark(LPCSTR str)
393 WINE_FIXME("GotoMark(\"%s\")\n", str);
396 void MACRO_HelpOn(void)
398 MACRO_JumpContents((Globals.wVersion > 4) ? "winhelp32.hlp" : "winhelp.hlp", NULL);
401 void MACRO_HelpOnTop(void)
403 WINE_FIXME("HelpOnTop()\n");
406 void MACRO_History(void)
408 WINE_FIXME("History()\n");
411 BOOL MACRO_InitMPrint(void)
413 WINE_FIXME("InitMPrint()\n");
417 void MACRO_InsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u)
419 WINE_FIXME("InsertItem(\"%s\", \"%s\", \"%s\", \"%s\", %lu)\n", str1, str2, str3, str4, u);
422 void MACRO_InsertMenu(LPCSTR str1, LPCSTR str2, LONG u)
424 WINE_FIXME("InsertMenu(\"%s\", \"%s\", %lu)\n", str1, str2, u);
427 BOOL MACRO_IsBook(void)
429 WINE_FIXME("IsBook()\n");
433 BOOL MACRO_IsMark(LPCSTR str)
435 WINE_FIXME("IsMark(\"%s\")\n", str);
439 BOOL MACRO_IsNotMark(LPCSTR str)
441 WINE_FIXME("IsNotMark(\"%s\")\n", str);
445 void MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
447 WINHELP_CreateHelpWindowByHash(lpszPath, 0, lpszWindow, FALSE, 0, NULL, SW_NORMAL);
450 void MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context)
452 WINE_FIXME("JumpContext(\"%s\", \"%s\", %lu)\n", lpszPath, lpszWindow, context);
455 void MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
457 WINHELP_CreateHelpWindowByHash(lpszPath, lHash, lpszWindow, FALSE, 0, NULL, SW_NORMAL);
460 void MACRO_JumpHelpOn(void)
462 WINE_FIXME("JumpHelpOn()\n");
465 void MACRO_JumpID(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR topic_id)
467 MACRO_JumpHash(lpszPath, lpszWindow, HLPFILE_Hash(topic_id));
470 void MACRO_JumpKeyword(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR keyword)
472 WINE_FIXME("JumpKeyword(\"%s\", \"%s\", \"%s\")\n", lpszPath, lpszWindow, keyword);
475 void MACRO_KLink(LPCSTR str1, LONG u, LPCSTR str2, LPCSTR str3)
477 WINE_FIXME("KLink(\"%s\", %lu, \"%s\", \"%s\")\n", str1, u, str2, str3);
480 void MACRO_Menu(void)
482 WINE_FIXME("Menu()\n");
485 void MACRO_MPrintHash(LONG u)
487 WINE_FIXME("MPrintHash(%lu)\n", u);
490 void MACRO_MPrintID(LPCSTR str)
492 WINE_FIXME("MPrintID(\"%s\")\n", str);
495 void MACRO_Next(void)
497 if (Globals.active_win->page->next)
498 WINHELP_CreateHelpWindowByPage(Globals.active_win->page->next, "main", FALSE, 0, NULL, SW_NORMAL);
501 void MACRO_NoShow(void)
503 WINE_FIXME("NoShow()\n");
506 void MACRO_PopupContext(LPCSTR str, LONG u)
508 WINE_FIXME("PopupContext(\"%s\", %lu)\n", str, u);
511 void MACRO_PopupHash(LPCSTR str, LONG u)
513 WINE_FIXME("PopupHash(\"%s\", %lu)\n", str, u);
516 void MACRO_PopupId(LPCSTR str1, LPCSTR str2)
518 WINE_FIXME("PopupId(\"%s\", \"%s\")\n", str1, str2);
521 void MACRO_PositionWindow(LONG i1, LONG i2, LONG u1, LONG u2, LONG u3, LPCSTR str)
523 WINE_FIXME("PositionWindow(%li, %li, %lu, %lu, %lu, \"%s\")\n", i1, i2, u1, u2, u3, str);
526 void MACRO_Prev(void)
528 if (Globals.active_win->page->prev)
529 WINHELP_CreateHelpWindowByPage(Globals.active_win->page->prev, "main", FALSE, 0, NULL, SW_NORMAL);
532 void MACRO_Print(void)
536 printer.lStructSize = sizeof(printer);
537 printer.hwndOwner = Globals.active_win->hMainWnd;
538 printer.hInstance = Globals.hInstance;
539 printer.hDevMode = 0;
540 printer.hDevNames = 0;
543 printer.nFromPage = 0;
545 printer.nMinPage = 0;
546 printer.nMaxPage = 0;
548 printer.lCustData = 0;
549 printer.lpfnPrintHook = 0;
550 printer.lpfnSetupHook = 0;
551 printer.lpPrintTemplateName = 0;
552 printer.lpSetupTemplateName = 0;
553 printer.hPrintTemplate = 0;
554 printer.hSetupTemplate = 0;
556 if (PrintDlgA(&printer)) {
557 WINE_FIXME("Print()\n");
561 void MACRO_PrinterSetup(void)
563 WINE_FIXME("PrinterSetup()\n");
566 void MACRO_RegisterRoutine(LPCSTR str1, LPCSTR str2, LPCSTR str3)
568 WINE_FIXME("RegisterRoutine(\"%s\", \"%s\", \"%s\")\n", str1, str2, str3);
571 void MACRO_RemoveAccelerator(LONG u1, LONG u2)
573 WINE_FIXME("RemoveAccelerator(%lu, %lu)\n", u1, u2);
576 void MACRO_ResetMenu(void)
578 WINE_FIXME("ResetMenu()\n");
581 void MACRO_SaveMark(LPCSTR str)
583 WINE_FIXME("SaveMark(\"%s\")\n", str);
586 void MACRO_Search(void)
588 WINE_FIXME("Search()\n");
591 void MACRO_SetContents(LPCSTR str, LONG u)
593 WINE_FIXME("SetContents(\"%s\", %lu)\n", str, u);
596 void MACRO_SetHelpOnFile(LPCSTR str)
598 WINE_FIXME("SetHelpOnFile(\"%s\")\n", str);
601 void MACRO_SetPopupColor(LONG u1, LONG u2, LONG u3)
603 WINE_FIXME("SetPopupColor(%lu, %lu, %lu)\n", u1, u2, u3);
606 void MACRO_ShellExecute(LPCSTR str1, LPCSTR str2, LONG u1, LONG u2, LPCSTR str3, LPCSTR str4)
608 WINE_FIXME("ShellExecute(\"%s\", \"%s\", %lu, %lu, \"%s\", \"%s\")\n", str1, str2, u1, u2, str3, str4);
611 void MACRO_ShortCut(LPCSTR str1, LPCSTR str2, WPARAM w, LPARAM l, LPCSTR str)
613 WINE_FIXME("ShortCut(\"%s\", \"%s\", %x, %lx, \"%s\")\n", str1, str2, w, l, str);
616 void MACRO_TCard(LONG u)
618 WINE_FIXME("TCard(%lu)\n", u);
621 void MACRO_Test(LONG u)
623 WINE_FIXME("Test(%lu)\n", u);
626 BOOL MACRO_TestALink(LPCSTR str)
628 WINE_FIXME("TestALink(\"%s\")\n", str);
632 BOOL MACRO_TestKLink(LPCSTR str)
634 WINE_FIXME("TestKLink(\"%s\")\n", str);
638 void MACRO_UncheckItem(LPCSTR str)
640 WINE_FIXME("UncheckItem(\"%s\")\n", str);
643 void MACRO_UpdateWindow(LPCSTR str1, LPCSTR str2)
645 WINE_FIXME("UpdateWindow(\"%s\", \"%s\")\n", str1, str2);