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