1 | /***
|
---|
2 | This file belongs to the Gotcha! distribution.
|
---|
3 | Copyright (C) 1998-2002 Thorsten Thielen <thth@c2226.de>
|
---|
4 |
|
---|
5 | This program is free software; you can redistribute it and/or modify
|
---|
6 | it under the terms of the GNU General Public License as published by
|
---|
7 | the Free Software Foundation; either version 2 of the License, or
|
---|
8 | (at your option) any later version.
|
---|
9 |
|
---|
10 | This program is distributed in the hope that it will be useful,
|
---|
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
13 | GNU General Public License for more details.
|
---|
14 |
|
---|
15 | You should have received a copy of the GNU General Public License
|
---|
16 | along with this program; if not, write to the Free Software
|
---|
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
---|
18 | ***/
|
---|
19 |
|
---|
20 | #include "helper.h"
|
---|
21 |
|
---|
22 | // ** Helper ************************************************************** /*FOLD00*/
|
---|
23 |
|
---|
24 | Helper :: Helper (HWND hwnd)
|
---|
25 | {
|
---|
26 | HELPINIT helpInit;
|
---|
27 |
|
---|
28 | // if we return because of an error, Help will be disabled
|
---|
29 | fHelpEnabled = TRUE;
|
---|
30 |
|
---|
31 | // inititalize help init structure
|
---|
32 | helpInit.cb = sizeof (HELPINIT);
|
---|
33 | helpInit.ulReturnCode = 0L;
|
---|
34 | helpInit.pszTutorialName = PSZ (NULL);
|
---|
35 | helpInit.phtHelpTable = PHELPTABLE (MAKELONG (MAIN_HELP_TABLE,
|
---|
36 | 0xFFFF));
|
---|
37 | helpInit.hmodHelpTableModule = GETMODULE;
|
---|
38 | helpInit.hmodAccelActionBarModule = GETMODULE;
|
---|
39 | helpInit.idAccelTable = 0;
|
---|
40 | helpInit.idActionBar = 0;
|
---|
41 | helpInit.pszHelpWindowTitle = PSZ (PSZ_NAMEVERSION);
|
---|
42 | helpInit.fShowPanelId = CMIC_HIDE_PANEL_ID;
|
---|
43 |
|
---|
44 | CHAR ach[_MAX_FNAME+_MAX_EXT];
|
---|
45 | sprintf (ach, "%s.hlp", pset->QueryString (SEI_LANGUAGEHELP));
|
---|
46 | helpInit.pszHelpLibraryName = PSZ (ach);
|
---|
47 |
|
---|
48 | // create the help instance
|
---|
49 | hwndHelpInstance = WinCreateHelpInstance (hab, &helpInit);
|
---|
50 | if (!hwndHelpInstance || helpInit.ulReturnCode)
|
---|
51 | {
|
---|
52 | DisplayError (RSTR (IDS_ERROR_HELPERHEADING),
|
---|
53 | RSTR (IDS_ERROR_COULDNOTINITHELPFILE), ach);
|
---|
54 | fHelpEnabled = FALSE;
|
---|
55 | }
|
---|
56 |
|
---|
57 | // associate help instance with main frame
|
---|
58 | if (! WinAssociateHelpInstance (hwndHelpInstance, hwnd))
|
---|
59 | {
|
---|
60 | DisplayError (RSTR (IDS_ERROR_HELPERHEADING),
|
---|
61 | RSTR (IDS_ERROR_COULDNOTINITHELP));
|
---|
62 | fHelpEnabled = FALSE;
|
---|
63 | }
|
---|
64 | }
|
---|
65 |
|
---|
66 | // ** ~Helper ************************************************************* /*FOLD00*/
|
---|
67 |
|
---|
68 | Helper :: ~Helper (VOID)
|
---|
69 | {
|
---|
70 | if (hwndHelpInstance)
|
---|
71 | WinDestroyHelpInstance (hwndHelpInstance);
|
---|
72 | }
|
---|
73 |
|
---|
74 | // ** DisplayPanel ******************************************************** /*FOLD00*/
|
---|
75 |
|
---|
76 | VOID Helper :: DisplayPanel (SHORT idPanel)
|
---|
77 | {
|
---|
78 | if (fHelpEnabled)
|
---|
79 | {
|
---|
80 | WinSendMsg (hwndHelpInstance, HM_DISPLAY_HELP,
|
---|
81 | MPFROM2SHORT (idPanel, NULL), MPFROMSHORT (HM_RESOURCEID));
|
---|
82 | }
|
---|
83 | }
|
---|
84 |
|
---|
85 | // ************************************************************************
|
---|