No longer directly accessing debuggee memory.
[wine] / programs / winhelp / macro.c
1 /*
2  * Help Viewer
3  *
4  * Copyright 1996 Ulrich Schmid
5  */
6
7 #include <stdio.h>
8 #include "windows.h"
9 #include "commdlg.h"
10 #ifdef WINELIB
11 #include "shell.h"
12 #endif
13 #include "winhelp.h"
14 #include "macro.h"
15
16 VOID MACRO_About(VOID)
17 {
18   fprintf(stderr, "About()\n");
19 }
20
21 VOID MACRO_AddAccelerator(LONG u1, LONG u2, LPCSTR str)
22 {
23   fprintf(stderr, "AddAccelerator(%lu, %lu, \"%s\")\n", u1, u2, str);
24 }
25
26 VOID MACRO_ALink(LPCSTR str1, LONG u, LPCSTR str2)
27 {
28   fprintf(stderr, "ALink(\"%s\", %lu, \"%s\")\n", str1, u, str2);
29 }
30
31 VOID MACRO_Annotate(VOID)
32 {
33   fprintf(stderr, "Annotate()\n");
34 }
35
36 VOID MACRO_AppendItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4)
37 {
38   fprintf(stderr, "AppendItem(\"%s\", \"%s\", \"%s\", \"%s\")\n", str1, str2, str3, str4);
39 }
40
41 VOID MACRO_Back(VOID)
42 {
43   fprintf(stderr, "Back()\n");
44 }
45
46 VOID MACRO_BackFlush(VOID)
47 {
48   fprintf(stderr, "BackFlush()\n");
49 }
50
51 VOID MACRO_BookmarkDefine(VOID)
52 {
53   fprintf(stderr, "BookmarkDefine()\n");
54 }
55
56 VOID MACRO_BookmarkMore(VOID)
57 {
58   fprintf(stderr, "BookmarkMore()\n");
59 }
60
61 VOID MACRO_BrowseButtons(VOID)
62 {
63   MACRO_CreateButton("BTN_PREV", "&<<", "Prev()");
64   MACRO_CreateButton("BTN_NEXT", "&>>", "Next()");
65 }
66
67 VOID MACRO_ChangeButtonBinding(LPCSTR str1, LPCSTR str2)
68 {
69   fprintf(stderr, "ChangeButtonBinding(\"%s\", \"%s\")\n", str1, str2);
70 }
71
72 VOID MACRO_ChangeEnable(LPCSTR str1, LPCSTR str2)
73 {
74   fprintf(stderr, "ChangeEnable(\"%s\", \"%s\")\n", str1, str2);
75 }
76
77 VOID MACRO_ChangeItemBinding(LPCSTR str1, LPCSTR str2)
78 {
79   fprintf(stderr, "ChangeItemBinding(\"%s\", \"%s\")\n", str1, str2);
80 }
81
82 VOID MACRO_CheckItem(LPCSTR str)
83 {
84   fprintf(stderr, "CheckItem(\"%s\")\n", str);
85 }
86
87 VOID MACRO_CloseSecondarys(VOID)
88 {
89   WINHELP_WINDOW *win;
90   for (win = Globals.win_list; win; win = win->next)
91     if (win->lpszName && lstrcmpi(win->lpszName, "main"))
92       DestroyWindow(win->hMainWnd);
93 }
94
95 VOID MACRO_CloseWindow(LPCSTR lpszWindow)
96 {
97   WINHELP_WINDOW *win;
98   if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
99
100   for (win = Globals.win_list; win; win = win->next)
101     if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
102       DestroyWindow(win->hMainWnd);
103 }
104
105 VOID MACRO_Compare(LPCSTR str)
106 {
107   fprintf(stderr, "Compare(\"%s\")\n", str);
108 }
109
110 VOID MACRO_Contents(VOID)
111 {
112   if (Globals.active_win->page)
113     MACRO_JumpContents(Globals.active_win->page->file->lpszPath, NULL);
114 }
115
116 VOID MACRO_ControlPanel(LPCSTR str1, LPCSTR str2, LONG u)
117 {
118   fprintf(stderr, "ControlPanel(\"%s\", \"%s\", %lu)\n", str1, str2, u);
119 }
120
121 VOID MACRO_CopyDialog(VOID)
122 {
123   fprintf(stderr, "CopyDialog()\n");
124 }
125
126 VOID MACRO_CopyTopic(VOID)
127 {
128   fprintf(stderr, "CopyTopic()\n");
129 }
130
131 VOID MACRO_CreateButton(LPCSTR id, LPCSTR name, LPCSTR macro)
132 {
133   WINHELP_WINDOW *win = Globals.active_win;
134   WINHELP_BUTTON *button, **b;
135   LONG            size;
136   HGLOBAL         handle;
137   LPSTR           ptr;
138
139   size = sizeof(WINHELP_BUTTON) + lstrlen(id) + lstrlen(name) + lstrlen(macro) + 3;
140   handle = GlobalAlloc(GMEM_FIXED, size);
141   if (!handle) return;
142
143   button = GlobalLock(handle);
144   button->hSelf = handle;
145   button->next  = 0;
146   button->hWnd  = 0;
147
148   ptr = GlobalLock(handle);
149   ptr += sizeof(WINHELP_BUTTON);
150
151   lstrcpy(ptr, (LPSTR) id);
152   button->lpszID = ptr;
153   ptr += lstrlen(id) + 1;
154
155   lstrcpy(ptr, (LPSTR) name);
156   button->lpszName = ptr;
157   ptr += lstrlen(name) + 1;
158
159   lstrcpy(ptr, (LPSTR) macro);
160   button->lpszMacro = ptr;
161
162   button->wParam = WH_FIRST_BUTTON;
163   for (b = &win->first_button; *b; b = &(*b)->next)
164     button->wParam = MAX(button->wParam, (*b)->wParam + 1);
165   *b = button;
166
167   SendMessage(win->hMainWnd, WM_USER, 0, 0);
168 }
169
170 VOID MACRO_DeleteItem(LPCSTR str)
171 {
172   fprintf(stderr, "DeleteItem(\"%s\")\n", str);
173 }
174
175 VOID MACRO_DeleteMark(LPCSTR str)
176 {
177   fprintf(stderr, "DeleteMark(\"%s\")\n", str);
178 }
179
180 VOID MACRO_DestroyButton(LPCSTR str)
181 {
182   fprintf(stderr, "DestroyButton(\"%s\")\n", str);
183 }
184
185 VOID MACRO_DisableButton(LPCSTR str)
186 {
187   fprintf(stderr, "DisableButton(\"%s\")\n", str);
188 }
189
190 VOID MACRO_DisableItem(LPCSTR str)
191 {
192   fprintf(stderr, "DisableItem(\"%s\")\n", str);
193 }
194
195 VOID MACRO_EnableButton(LPCSTR str)
196 {
197   fprintf(stderr, "EnableButton(\"%s\")\n", str);
198 }
199
200 VOID MACRO_EnableItem(LPCSTR str)
201 {
202   fprintf(stderr, "EnableItem(\"%s\")\n", str);
203 }
204
205 VOID MACRO_EndMPrint(VOID)
206 {
207   fprintf(stderr, "EndMPrint()\n");
208 }
209
210 VOID MACRO_ExecFile(LPCSTR str1, LPCSTR str2, LONG u, LPCSTR str3)
211 {
212   fprintf(stderr, "ExecFile(\"%s\", \"%s\", %lu, \"%s\")\n", str1, str2, u, str3);
213 }
214
215 VOID MACRO_ExecProgram(LPCSTR str, LONG u)
216 {
217   fprintf(stderr, "ExecProgram(\"%s\", %lu)\n", str, u);
218 }
219
220 VOID MACRO_Exit(VOID)
221 {
222   while(Globals.win_list)
223     DestroyWindow(Globals.win_list->hMainWnd);
224 }
225
226 VOID MACRO_ExtAbleItem(LPCSTR str, LONG u)
227 {
228   fprintf(stderr, "ExtAbleItem(\"%s\", %lu)\n", str, u);
229 }
230
231 VOID MACRO_ExtInsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u1, LONG u2)
232 {
233   fprintf(stderr, "ExtInsertItem(\"%s\", \"%s\", \"%s\", \"%s\", %lu, %lu)\n", str1, str2, str3, str4, u1, u2);
234 }
235
236 VOID MACRO_ExtInsertMenu(LPCSTR str1, LPCSTR str2, LPCSTR str3, LONG u1, LONG u2)
237 {
238   fprintf(stderr, "ExtInsertMenu(\"%s\", \"%s\", \"%s\", %lu, %lu)\n", str1, str2, str3, u1, u2);
239 }
240
241 BOOL MACRO_FileExist(LPCSTR str)
242 {
243   fprintf(stderr, "FileExist(\"%s\")\n", str);
244   return TRUE;
245 }
246
247 VOID MACRO_FileOpen(VOID)
248 {
249   OPENFILENAME openfilename;
250   CHAR szPath[MAX_PATHNAME_LEN];
251   CHAR szDir[MAX_PATHNAME_LEN];
252   CHAR szzFilter[2 * MAX_STRING_LEN + 100];
253   LPSTR p = szzFilter;
254
255   LoadString(Globals.hInstance, IDS_HELP_FILES_HLP, p, MAX_STRING_LEN);
256   p += strlen(p) + 1;
257   lstrcpy(p, "*.hlp");
258   p += strlen(p) + 1;
259   LoadString(Globals.hInstance, IDS_ALL_FILES, p, MAX_STRING_LEN);
260   p += strlen(p) + 1;
261   lstrcpy(p, "*.*");
262   p += strlen(p) + 1;
263   *p = '\0';
264
265   GetWindowsDirectory(szDir, sizeof(szDir));
266
267   openfilename.lStructSize       = 0;
268   openfilename.hwndOwner         = Globals.active_win->hMainWnd;
269   openfilename.hInstance         = Globals.hInstance;
270   openfilename.lpstrFilter       = szzFilter;
271   openfilename.lpstrCustomFilter = 0;
272   openfilename.nMaxCustFilter    = 0;
273   openfilename.nFilterIndex      = 0;
274   openfilename.lpstrFile         = szPath;
275   openfilename.nMaxFile          = sizeof(szPath);
276   openfilename.lpstrFileTitle    = 0;
277   openfilename.nMaxFileTitle     = 0;
278   openfilename.lpstrInitialDir   = szDir;
279   openfilename.lpstrTitle        = 0;
280   openfilename.Flags             = 0;
281   openfilename.nFileOffset       = 0;
282   openfilename.nFileExtension    = 0;
283   openfilename.lpstrDefExt       = 0;
284   openfilename.lCustData         = 0;
285   openfilename.lpfnHook          = 0;
286   openfilename.lpTemplateName    = 0;
287
288   if (GetOpenFileName(&openfilename))
289     WINHELP_CreateHelpWindow(szPath, 0, "main", FALSE, NULL, NULL, SW_SHOWNORMAL);
290 }
291
292 VOID MACRO_Find(VOID)
293 {
294   fprintf(stderr, "Find()\n");
295 }
296
297 VOID MACRO_Finder(VOID)
298 {
299   fprintf(stderr, "Finder()\n");
300 }
301
302 VOID MACRO_FloatingMenu(VOID)
303 {
304   fprintf(stderr, "FloatingMenu()\n");
305 }
306
307 VOID MACRO_Flush(VOID)
308 {
309   fprintf(stderr, "Flush()\n");
310 }
311
312 VOID MACRO_FocusWindow(LPCSTR str)
313 {
314   fprintf(stderr, "FocusWindow(\"%s\")\n", str);
315 }
316
317 VOID MACRO_Generate(LPCSTR str, WPARAM w, LPARAM l)
318 {
319   fprintf(stderr, "Generate(\"%s\", %x, %lx)\n", str, w, l);
320 }
321
322 VOID MACRO_GotoMark(LPCSTR str)
323 {
324   fprintf(stderr, "GotoMark(\"%s\")\n", str);
325 }
326
327 VOID MACRO_HelpOn(VOID)
328 {
329   MACRO_JumpContents((Globals.wVersion > 4) ? "winhelp32.hlp" : "winhelp.hlp", NULL);
330 }
331
332 VOID MACRO_HelpOnTop(VOID)
333 {
334   fprintf(stderr, "HelpOnTop()\n");
335 }
336
337 VOID MACRO_History(VOID)
338 {
339   fprintf(stderr, "History()\n");
340 }
341
342 BOOL MACRO_InitMPrint(VOID)
343 {
344   fprintf(stderr, "InitMPrint()\n");
345   return FALSE;
346 }
347
348 VOID MACRO_InsertItem(LPCSTR str1, LPCSTR str2, LPCSTR str3, LPCSTR str4, LONG u)
349 {
350   fprintf(stderr, "InsertItem(\"%s\", \"%s\", \"%s\", \"%s\", %lu)\n", str1, str2, str3, str4, u);
351 }
352
353 VOID MACRO_InsertMenu(LPCSTR str1, LPCSTR str2, LONG u)
354 {
355   fprintf(stderr, "InsertMenu(\"%s\", \"%s\", %lu)\n", str1, str2, u);
356 }
357
358 BOOL MACRO_IsBook(VOID)
359 {
360   fprintf(stderr, "IsBook()\n");
361   return TRUE;
362 }
363
364 BOOL MACRO_IsMark(LPCSTR str)
365 {
366   fprintf(stderr, "IsMark(\"%s\")\n", str);
367   return FALSE;
368 }
369
370 BOOL MACRO_IsNotMark(LPCSTR str)
371 {
372   fprintf(stderr, "IsNotMark(\"%s\")\n", str);
373   return TRUE;
374 }
375
376 VOID MACRO_JumpContents(LPCSTR lpszPath, LPCSTR lpszWindow)
377 {
378   WINHELP_CreateHelpWindow(lpszPath, 0, lpszWindow, FALSE, NULL, NULL, SW_NORMAL);
379 }
380
381 VOID MACRO_JumpContext(LPCSTR lpszPath, LPCSTR lpszWindow, LONG context)
382 {
383   fprintf(stderr, "JumpContext(\"%s\", \"%s\", %lu)\n", lpszPath, lpszWindow, context);
384 }
385
386 VOID MACRO_JumpHash(LPCSTR lpszPath, LPCSTR lpszWindow, LONG lHash)
387 {
388   WINHELP_CreateHelpWindow(lpszPath, lHash, lpszWindow, FALSE, NULL, NULL, SW_NORMAL);
389 }
390
391 VOID MACRO_JumpHelpOn(VOID)
392 {
393   fprintf(stderr, "JumpHelpOn()\n");
394 }
395
396 VOID MACRO_JumpID(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR topic_id)
397 {
398   MACRO_JumpHash(lpszPath, lpszWindow, HLPFILE_Hash(topic_id));
399 }
400
401 VOID MACRO_JumpKeyword(LPCSTR lpszPath, LPCSTR lpszWindow, LPCSTR keyword)
402 {
403   fprintf(stderr, "JumpKeyword(\"%s\", \"%s\", \"%s\")\n", lpszPath, lpszWindow, keyword);
404 }
405
406 VOID MACRO_KLink(LPCSTR str1, LONG u, LPCSTR str2, LPCSTR str3)
407 {
408   fprintf(stderr, "KLink(\"%s\", %lu, \"%s\", \"%s\")\n", str1, u, str2, str3);
409 }
410
411 VOID MACRO_Menu(VOID)
412 {
413   fprintf(stderr, "Menu()\n");
414 }
415
416 VOID MACRO_MPrintHash(LONG u)
417 {
418   fprintf(stderr, "MPrintHash(%lu)\n", u);
419 }
420
421 VOID MACRO_MPrintID(LPCSTR str)
422 {
423   fprintf(stderr, "MPrintID(\"%s\")\n", str);
424 }
425
426 VOID MACRO_Next(VOID)
427 {
428   fprintf(stderr, "Next()\n");
429 }
430
431 VOID MACRO_NoShow(VOID)
432 {
433   fprintf(stderr, "NoShow()\n");
434 }
435
436 VOID MACRO_PopupContext(LPCSTR str, LONG u)
437 {
438   fprintf(stderr, "PopupContext(\"%s\", %lu)\n", str, u);
439 }
440
441 VOID MACRO_PopupHash(LPCSTR str, LONG u)
442 {
443   fprintf(stderr, "PopupHash(\"%s\", %lu)\n", str, u);
444 }
445
446 VOID MACRO_PopupId(LPCSTR str1, LPCSTR str2)
447 {
448   fprintf(stderr, "PopupId(\"%s\", \"%s\")\n", str1, str2);
449 }
450
451 VOID MACRO_PositionWindow(LONG i1, LONG i2, LONG u1, LONG u2, LONG u3, LPCSTR str)
452 {
453   fprintf(stderr, "PositionWindow(%li, %li, %lu, %lu, %lu, \"%s\")\n", i1, i2, u1, u2, u3, str);
454 }
455
456 VOID MACRO_Prev(VOID)
457 {
458   fprintf(stderr, "Prev()\n");
459 }
460
461 VOID MACRO_Print(VOID)
462 {
463     PRINTDLG printer;
464     
465     printer.lStructSize         = sizeof(printer);
466     printer.hwndOwner           = Globals.active_win->hMainWnd;
467     printer.hInstance           = Globals.hInstance;
468     printer.hDevMode            = 0;
469     printer.hDevNames           = 0;
470     printer.hDC                 = 0;
471     printer.Flags               = 0;
472     printer.nFromPage           = 0;
473     printer.nToPage             = 0;
474     printer.nMinPage            = 0;
475     printer.nMaxPage            = 0;
476     printer.nCopies             = 0;
477     printer.lCustData           = 0;
478     printer.lpfnPrintHook       = 0;
479     printer.lpfnSetupHook       = 0;
480     printer.lpPrintTemplateName = 0;
481     printer.lpSetupTemplateName = 0;
482     printer.hPrintTemplate      = 0;
483     printer.hSetupTemplate      = 0;
484         
485     if (PrintDlg16(&printer)) {
486         fprintf(stderr, "Print()\n");
487     };
488 }
489
490 VOID MACRO_PrinterSetup(VOID)
491 {
492   fprintf(stderr, "PrinterSetup()\n");
493 }
494
495 VOID MACRO_RegisterRoutine(LPCSTR str1, LPCSTR str2, LPCSTR str3)
496 {
497   fprintf(stderr, "RegisterRoutine(\"%s\", \"%s\", \"%s\")\n", str1, str2, str3);
498 }
499
500 VOID MACRO_RemoveAccelerator(LONG u1, LONG u2)
501 {
502   fprintf(stderr, "RemoveAccelerator(%lu, %lu)\n", u1, u2);
503 }
504
505 VOID MACRO_ResetMenu(VOID)
506 {
507   fprintf(stderr, "ResetMenu()\n");
508 }
509
510 VOID MACRO_SaveMark(LPCSTR str)
511 {
512   fprintf(stderr, "SaveMark(\"%s\")\n", str);
513 }
514
515 VOID MACRO_Search(VOID)
516 {
517   fprintf(stderr, "Search()\n");
518 }
519
520 VOID MACRO_SetContents(LPCSTR str, LONG u)
521 {
522   fprintf(stderr, "SetContents(\"%s\", %lu)\n", str, u);
523 }
524
525 VOID MACRO_SetHelpOnFile(LPCSTR str)
526 {
527   fprintf(stderr, "SetHelpOnFile(\"%s\")\n", str);
528 }
529
530 VOID MACRO_SetPopupColor(LONG u1, LONG u2, LONG u3)
531 {
532   fprintf(stderr, "SetPopupColor(%lu, %lu, %lu)\n", u1, u2, u3);
533 }
534
535 VOID MACRO_ShellExecute(LPCSTR str1, LPCSTR str2, LONG u1, LONG u2, LPCSTR str3, LPCSTR str4)
536 {
537   fprintf(stderr, "ShellExecute(\"%s\", \"%s\", %lu, %lu, \"%s\", \"%s\")\n", str1, str2, u1, u2, str3, str4);
538 }
539
540 VOID MACRO_ShortCut(LPCSTR str1, LPCSTR str2, WPARAM w, LPARAM l, LPCSTR str)
541 {
542   fprintf(stderr, "ShortCut(\"%s\", \"%s\", %x, %lx, \"%s\")\n", str1, str2, w, l, str);
543 }
544
545 VOID MACRO_TCard(LONG u)
546 {
547   fprintf(stderr, "TCard(%lu)\n", u);
548 }
549
550 VOID MACRO_Test(LONG u)
551 {
552   fprintf(stderr, "Test(%lu)\n", u);
553 }
554
555 BOOL MACRO_TestALink(LPCSTR str)
556 {
557   fprintf(stderr, "TestALink(\"%s\")\n", str);
558   return FALSE;
559 }
560
561 BOOL MACRO_TestKLink(LPCSTR str)
562 {
563   fprintf(stderr, "TestKLink(\"%s\")\n", str);
564   return FALSE;
565 }
566
567 VOID MACRO_UncheckItem(LPCSTR str)
568 {
569   fprintf(stderr, "UncheckItem(\"%s\")\n", str);
570 }
571
572 VOID MACRO_UpdateWindow(LPCSTR str1, LPCSTR str2)
573 {
574   fprintf(stderr, "UpdateWindow(\"%s\", \"%s\")\n", str1, str2);
575 }
576
577 /* Local Variables:    */
578 /* c-file-style: "GNU" */
579 /* End:                */