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
28 #include "wine/debug.h"
30 WINE_DEFAULT_DEBUG_CHANNEL(winhelp
);
32 /**************************************************/
34 /**************************************************/
44 * U: 32 bit unsigned int
45 * I: 32 bit signed int
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
;
164 int MACRO_Lookup(const char* name
, struct lexret
* lr
)
168 if ((ret
= MACRO_DoLookUp(MACRO_Builtins
, name
, lr
, -1)) != EMPTY
)
170 if (MACRO_Loaded
&& (ret
= MACRO_DoLookUp(MACRO_Loaded
, name
, lr
, MACRO_NumLoaded
)) != EMPTY
)
177 /******* helper functions *******/
179 static WINHELP_BUTTON
** MACRO_LookupButton(WINHELP_WINDOW
* win
, LPCSTR name
)
183 for (b
= &win
->first_button
; *b
; b
= &(*b
)->next
)
184 if (!lstrcmpi(name
, (*b
)->lpszID
)) break;
188 /******* real macro implementation *******/
190 void CALLBACK
MACRO_About(void)
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)
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
;
221 if (win
&& win
->backIndex
>= 2)
222 WINHELP_CreateHelpWindow(win
->back
[--win
->backIndex
- 1],
226 void CALLBACK
MACRO_BackFlush(void)
228 WINHELP_WINDOW
* win
= Globals
.active_win
;
236 for (i
= 0; i
< win
->backIndex
; i
++)
238 HLPFILE_FreeHlpFile(win
->back
[i
]->file
);
245 void CALLBACK
MACRO_BookmarkDefine(void)
250 void CALLBACK
MACRO_BookmarkMore(void)
255 void CALLBACK
MACRO_BrowseButtons(void)
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
;
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
);
282 button
->next
= (*b
)->next
;
283 button
->hWnd
= (*b
)->hWnd
;
284 button
->wParam
= (*b
)->wParam
;
286 ptr
= (char*)button
+ sizeof(WINHELP_BUTTON
);
289 button
->lpszID
= ptr
;
290 ptr
+= lstrlen(id
) + 1;
292 lstrcpy(ptr
, (*b
)->lpszName
);
293 button
->lpszName
= ptr
;
294 ptr
+= lstrlen((*b
)->lpszName
) + 1;
297 button
->lpszMacro
= ptr
;
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)
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
)
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)
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)
368 void CALLBACK
MACRO_CopyTopic(void)
373 void CALLBACK
MACRO_CreateButton(LPCSTR id
, LPCSTR name
, LPCSTR macro
)
375 WINHELP_WINDOW
*win
= Globals
.active_win
;
376 WINHELP_BUTTON
*button
, **b
;
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
);
390 ptr
= (char*)button
+ sizeof(WINHELP_BUTTON
);
393 button
->lpszID
= ptr
;
394 ptr
+= lstrlen(id
) + 1;
397 button
->lpszName
= ptr
;
398 ptr
+= lstrlen(name
) + 1;
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);
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
)
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
)
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)
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)
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];
514 LoadString(Globals
.hInstance
, STID_HELP_FILES_HLP
, p
, MAX_STRING_LEN
);
518 LoadString(Globals
.hInstance
, STID_ALL_FILES
, p
, MAX_STRING_LEN
);
524 GetCurrentDirectory(sizeof(szDir
), szDir
);
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)
563 void CALLBACK
MACRO_Finder(void)
568 void CALLBACK
MACRO_FloatingMenu(void)
573 void CALLBACK
MACRO_Flush(void)
578 void CALLBACK
MACRO_FocusWindow(LPCSTR lpszWindow
)
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)
604 MACRO_JumpContents((Globals
.wVersion
> 4) ? "winhelp32.hlp" : "winhelp.hlp", NULL
);
607 void CALLBACK
MACRO_HelpOnTop(void)
612 void CALLBACK
MACRO_History(void)
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)
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)
653 return Globals
.isBook
;
656 BOOL CALLBACK
MACRO_IsMark(LPCSTR str
)
658 WINE_FIXME("(\"%s\")\n", str
);
662 BOOL CALLBACK
MACRO_IsNotMark(LPCSTR str
)
664 WINE_FIXME("(\"%s\")\n", str
);
668 void CALLBACK
MACRO_JumpContents(LPCSTR lpszPath
, LPCSTR lpszWindow
)
672 WINE_TRACE("(\"%s\", \"%s\")\n", lpszPath
, lpszWindow
);
673 hlpfile
= WINHELP_LookupHelpFile(lpszPath
);
674 WINHELP_CreateHelpWindowByHash(hlpfile
, 0,
675 WINHELP_GetWindowInfo(hlpfile
, lpszWindow
),
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
)
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
),
696 void CALLBACK
MACRO_JumpHelpOn(void)
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)
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)
740 page
= Globals
.active_win
->page
;
741 page
= HLPFILE_PageByOffset(page
->file
, page
->browse_fwd
);
744 page
->file
->wRefCount
++;
745 WINHELP_CreateHelpWindow(page
, Globals
.active_win
->info
, SW_NORMAL
);
749 void CALLBACK
MACRO_NoShow(void)
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)
779 page
= Globals
.active_win
->page
;
780 page
= HLPFILE_PageByOffset(page
->file
, page
->browse_bwd
);
783 page
->file
->wRefCount
++;
784 WINHELP_CreateHelpWindow(page
, Globals
.active_win
->info
, SW_NORMAL
);
788 void CALLBACK
MACRO_Print(void)
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;
801 printer
.nFromPage
= 0;
803 printer
.nMinPage
= 0;
804 printer
.nMaxPage
= 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)
824 void CALLBACK
MACRO_RegisterRoutine(LPCSTR dll_name
, LPCSTR proc
, LPCSTR args
)
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;
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
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
))))
858 dll
->name
= strdup(dll_name
); /* FIXME */
859 dll
->next
= Globals
.dlls
;
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)
896 void CALLBACK
MACRO_SaveMark(LPCSTR str
)
898 WINE_FIXME("(\"%s\")\n", str
);
901 void CALLBACK
MACRO_Search(void)
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
);
947 BOOL CALLBACK
MACRO_TestKLink(LPCSTR str
)
949 WINE_FIXME("(\"%s\")\n", str
);
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
);