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 | #include <direct.h>
|
---|
20 | #include <uconv.h>
|
---|
21 | #include "settings.h"
|
---|
22 | #include "ctype.h"
|
---|
23 |
|
---|
24 | #include "./settings/thth_settings.cpp"
|
---|
25 |
|
---|
26 | PSZ SETTINGS::pszPageTab[COUNT_PAGES]; /* = {
|
---|
27 | "Saving", "Snapshot window", "Misc", "Language" };
|
---|
28 | // FIXME nls*/
|
---|
29 |
|
---|
30 | bool saveum = FALSE;
|
---|
31 | SWP swpDef = { 0,0,0, 98,66, 0,0,0,0 };
|
---|
32 | SWP swpDefSSW = { 0,0,0, 10,10, 0,0,0,0 };
|
---|
33 | USHORT ausDef[7] = { 0 };
|
---|
34 | USHORT ausDefSSW[7] = { 0 };
|
---|
35 |
|
---|
36 | ImageFormatInfo Settings::ifi[BMF_INVALID] =
|
---|
37 | {
|
---|
38 | { TRUE, BMF_JPG, "JPEG Interchange File Format (jpg)", "jpg", "JPG" },
|
---|
39 | { TRUE, BMF_PNG, "Portable Network Graphics (png)", "png", "PNG" },
|
---|
40 | { TRUE, BMF_OS20, "OS/2 Bitmap 2.0 (bmp)", "bmp", "Bitmap" },
|
---|
41 | { TRUE, BMF_TIF, "Microsoft/Aldus Tagged Image File Format (tif)", "tif", "TIFF" },
|
---|
42 | { TRUE, BMF_TGA, "Truevision Targa/Vista (tga)", "tga", "Targa" },
|
---|
43 | { TRUE, BMF_PCX, "ZSoft PC Paintbrush Image Format (pcx)", "pcx", "PCX" },
|
---|
44 | { TRUE, BMF_GIF, "Portable Anymap (pnm)", "pnm", "PNM" },
|
---|
45 | { TRUE, BMF_PBM, "Portable Pixel-map (ppm)", "ppm", "PPM" },
|
---|
46 | { TRUE, BMF_JP2, "Jpeg 2000 (provided by the Open Source OpenJPEG library) (jp2)", "jp2", "JP2" },
|
---|
47 | { TRUE, BMF_DIB, "Device Independent Bitmap (dib)", "dib", "DIB" }
|
---|
48 | };
|
---|
49 |
|
---|
50 |
|
---|
51 | PTHTH_SE apse[] =
|
---|
52 | {
|
---|
53 | new THTH_SES (SEI_SAVEFILE, "Save", "Filename", "gotcha.png"),
|
---|
54 | new THTH_SES (SEI_FORCESAVEFILE, "Save", "ForceSaveFilename", "force.png"),
|
---|
55 | new THTH_SEL (SEI_SAVESTYLE, "Save", "Style", SAVESTYLE_FILE),
|
---|
56 | new THTH_SEL (SEI_FILEFORMAT, "Save", "FileFormat", BMF_PNG),
|
---|
57 | new THTH_SEL (SEI_FILESAVESTYLE, "Save", "FileSaveStyle", FSS_PROMPT),
|
---|
58 |
|
---|
59 | new THTH_SES (SEI_NUMSAVEDIR, "Save", "NumSaveDir", ""),
|
---|
60 | new THTH_SEF (SEI_HIDEWINDOW, "Extras", "HideWindow", TRUE),
|
---|
61 | new THTH_SEF (SEI_AUTOADDEXTENSION, "Extras", "AutoaddExtension", TRUE),
|
---|
62 | new THTH_SEF (SEI_CONFIRMOVERWRITE, "Extras", "ConfirmOverwrite", TRUE),
|
---|
63 | new THTH_SEF (SEI_DOSOUND, "Extras", "DoSound", TRUE),
|
---|
64 |
|
---|
65 | new THTH_SEF (SEI_DELAYEDCAPTURE, "Extras", "DelayedCapture", FALSE),
|
---|
66 | new THTH_SEF (SEI_DELAYCOUNTDOWN, "Extras", "DelayCountdown", FALSE),
|
---|
67 | new THTH_SEL (SEI_DELAYTIME, "Extras", "DelayTime", 5),
|
---|
68 | new THTH_SEF (SEI_SERIALCAPTURE, "Extras", "SerialCapture", FALSE),
|
---|
69 | new THTH_SEL (SEI_SERIALTIME, "Extras", "SerialTime", 10),
|
---|
70 | #ifdef _QUIET_
|
---|
71 | new THTH_SEL (SEI_SSWCAPTURETYPE, "Extras", "CaptureType", CAP_SCREEN),
|
---|
72 | new THTH_SEF (SEI_SNAPSHOTWINDOW, "Snapshot", NULL, NULL),
|
---|
73 | #else
|
---|
74 | new THTH_SEF (SEI_SNAPSHOTWINDOW, "Snapshot", "Enable", FALSE),
|
---|
75 | new THTH_SEL (SEI_SSWCAPTURETYPE, "Snapshot", "CaptureType", CAP_SCREEN),
|
---|
76 | new THTH_SEF (SEI_SSWHIDE, "Snapshot", "Hide", TRUE),
|
---|
77 | new THTH_SEF (SEI_SSWALWAYSONTOP, "Snapshot", "AlwaysOnTop", TRUE),
|
---|
78 | #endif
|
---|
79 | new THTH_SEF (SEI_IDLEPRIORITY, "Extras", "IdlePriority", FALSE),
|
---|
80 |
|
---|
81 | new THTH_SEB (SEI_SWP, "Window", "SWP", &swpDef, sizeof (swpDef)),
|
---|
82 | new THTH_SEB (SEI_US, "Window", "US", &ausDef, sizeof (ausDef)),
|
---|
83 | #ifndef _QUIET_
|
---|
84 | new THTH_SEB (SEI_SWPSSW, "Snapshot", "SWP", &swpDefSSW, sizeof (swpDefSSW)),
|
---|
85 | new THTH_SEB (SEI_USSSW, "Snapshot", "US", &ausDefSSW, sizeof (ausDefSSW)),
|
---|
86 | #endif
|
---|
87 | new THTH_SES (SEI_LANGUAGE, "Language", "Program", PSZ_DEFAULTLANGUAGEMOD),
|
---|
88 | new THTH_SES (SEI_LANGUAGEHELP, "Language", "Help", PSZ_DEFAULTLANGUAGEHELP),
|
---|
89 |
|
---|
90 | new THTH_SEF (SEI_UPDATE178DONE, "Extras", "Update178Done", FALSE),
|
---|
91 |
|
---|
92 | NULL,
|
---|
93 | };
|
---|
94 |
|
---|
95 | PTHTH_SE apse2[] =
|
---|
96 | {
|
---|
97 | new THTH_SES (SEI_SAVEFILE, "Save", "Filename", "gotcha.png"),
|
---|
98 | new THTH_SES (SEI_FORCESAVEFILE, "Save", "ForceSaveFilename", "force.png"),
|
---|
99 | new THTH_SEL (SEI_SAVESTYLE, "Save", "Style", SAVESTYLE_FILE),
|
---|
100 | new THTH_SEL (SEI_FILEFORMAT, "Save", "FileFormat", BMF_PNG),
|
---|
101 | new THTH_SEL (SEI_FILESAVESTYLE, "Save", "FileSaveStyle", FSS_NUMFILES),
|
---|
102 |
|
---|
103 | new THTH_SES (SEI_NUMSAVEDIR, "Save", "NumSaveDir", ""),
|
---|
104 | new THTH_SEF (SEI_HIDEWINDOW, "Extras", "HideWindow", TRUE),
|
---|
105 | new THTH_SEF (SEI_AUTOADDEXTENSION, "Extras", "AutoaddExtension", TRUE),
|
---|
106 | new THTH_SEF (SEI_CONFIRMOVERWRITE, "Extras", "ConfirmOverwrite", TRUE),
|
---|
107 | new THTH_SEF (SEI_DOSOUND, "Extras", "DoSound", TRUE),
|
---|
108 |
|
---|
109 | new THTH_SEF (SEI_DELAYEDCAPTURE, "Extras", "DelayedCapture", FALSE),
|
---|
110 | new THTH_SEF (SEI_DELAYCOUNTDOWN, "Extras", "DelayCountdown", FALSE),
|
---|
111 | new THTH_SEL (SEI_DELAYTIME, "Extras", "DelayTime", 5),
|
---|
112 | new THTH_SEF (SEI_SERIALCAPTURE, "Extras", "SerialCapture", FALSE),
|
---|
113 | new THTH_SEL (SEI_SERIALTIME, "Extras", "SerialTime", 10),
|
---|
114 | #ifdef _QUIET_
|
---|
115 | new THTH_SEL (SEI_SSWCAPTURETYPE, "Extras", "CaptureType", CAP_SCREEN),
|
---|
116 | new THTH_SEF (SEI_SNAPSHOTWINDOW, "Snapshot", NULL, NULL),
|
---|
117 | #else
|
---|
118 | new THTH_SEF (SEI_SNAPSHOTWINDOW, "Snapshot", "Enable", FALSE),
|
---|
119 | new THTH_SEL (SEI_SSWCAPTURETYPE, "Snapshot", "CaptureType", CAP_SCREEN),
|
---|
120 | new THTH_SEF (SEI_SSWHIDE, "Snapshot", "Hide", TRUE),
|
---|
121 | new THTH_SEF (SEI_SSWALWAYSONTOP, "Snapshot", "AlwaysOnTop", TRUE),
|
---|
122 | #endif
|
---|
123 | new THTH_SEF (SEI_IDLEPRIORITY, "Extras", "IdlePriority", FALSE),
|
---|
124 |
|
---|
125 | new THTH_SEB (SEI_SWP, "Window", "SWP", &swpDef, sizeof (swpDef)),
|
---|
126 | new THTH_SEB (SEI_US, "Window", "US", &ausDef, sizeof (ausDef)),
|
---|
127 | #ifndef _QUIET_
|
---|
128 | new THTH_SEB (SEI_SWPSSW, "Snapshot", "SWP", &swpDefSSW, sizeof (swpDefSSW)),
|
---|
129 | new THTH_SEB (SEI_USSSW, "Snapshot", "US", &ausDefSSW, sizeof (ausDefSSW)),
|
---|
130 | #endif
|
---|
131 | new THTH_SES (SEI_LANGUAGE, "Language", "Program", PSZ_DEFAULTLANGUAGEMOD),
|
---|
132 | new THTH_SES (SEI_LANGUAGEHELP, "Language", "Help", PSZ_DEFAULTLANGUAGEHELP),
|
---|
133 |
|
---|
134 | new THTH_SEF (SEI_UPDATE178DONE, "Extras", "Update178Done", FALSE),
|
---|
135 |
|
---|
136 | NULL,
|
---|
137 | };
|
---|
138 |
|
---|
139 | // ** Settings ************************************************************ /*FOLD00*/
|
---|
140 |
|
---|
141 | Settings :: Settings (VOID) :
|
---|
142 | #ifdef _QUIET_
|
---|
143 | ththSettings(g_installer ? apse2 : apse, g_installer ? g_installerINI : "gotchaq.ini",
|
---|
144 | L_PROFILEVERSION)
|
---|
145 | #else
|
---|
146 | ththSettings(apse, "gotcha.ini", L_PROFILEVERSION)
|
---|
147 | #endif
|
---|
148 | {
|
---|
149 | if( ! QueryFlag( SEI_UPDATE178DONE ) ) {
|
---|
150 | SetLong( SEI_SERIALTIME, QueryLong( SEI_SERIALTIME ) * 20 );
|
---|
151 | SetFlag( SEI_UPDATE178DONE );
|
---|
152 | }
|
---|
153 | #ifdef _QUIET_
|
---|
154 | HINI hini;
|
---|
155 | if (!g_installer)
|
---|
156 | hini = PrfOpenProfile (hab, "gotchaq.ini");
|
---|
157 | #else
|
---|
158 | HINI hini = PrfOpenProfile (hab, "gotcha.ini");
|
---|
159 | #endif
|
---|
160 | BOOL fLChange = FALSE;
|
---|
161 | if (!g_installer) {
|
---|
162 | ULONG ulDataSize;
|
---|
163 | PrfQueryProfileSize(hini, "Language", "LangChangeRequested", &ulDataSize );
|
---|
164 | PrfQueryProfileData(hini, "Language", "LangChangeRequested", &fLChange, &ulDataSize);
|
---|
165 | }
|
---|
166 | if (!fLChange) {
|
---|
167 | CHAR *lang = getenv("LANG");
|
---|
168 | #ifdef _QUIET_
|
---|
169 | PSZ psz = "goqresen";
|
---|
170 | #else
|
---|
171 | PSZ psz = "gotresen";
|
---|
172 | #endif
|
---|
173 | PSZ pszh = "gotcha_en";
|
---|
174 | if (lang) {
|
---|
175 | if (!strnicmp(lang, "es", 2)) {
|
---|
176 | #ifdef _QUIET_
|
---|
177 | psz = "goqreses";
|
---|
178 | #else
|
---|
179 | psz = "gotreses";
|
---|
180 | #endif
|
---|
181 | pszh = "gotcha_es";
|
---|
182 | }
|
---|
183 | else if (!strnicmp(lang, "cs", 2)) {
|
---|
184 | #ifdef _QUIET_
|
---|
185 | psz = "goqrescz";
|
---|
186 | #else
|
---|
187 | psz = "gotrescz";
|
---|
188 | #endif
|
---|
189 | }
|
---|
190 | else if (!strnicmp(lang, "de", 2)) {
|
---|
191 | #ifdef _QUIET_
|
---|
192 | psz = "goqresde";
|
---|
193 | #else
|
---|
194 | psz = "gotresde";
|
---|
195 | #endif
|
---|
196 | }
|
---|
197 | #if 0
|
---|
198 | else if (!strnicmp(lang, "it", 2)) {
|
---|
199 | #ifdef _QUIET_
|
---|
200 | psz = "goqresit";
|
---|
201 | #else
|
---|
202 | psz = "gotresit";
|
---|
203 | #endif
|
---|
204 | }
|
---|
205 | else if (!strnicmp(lang, "br", 2)) {
|
---|
206 | #ifdef _QUIET_
|
---|
207 | psz = "goqresbr";
|
---|
208 | #else
|
---|
209 | psz = "gotresbr";
|
---|
210 | #endif
|
---|
211 | }
|
---|
212 | #endif
|
---|
213 | }
|
---|
214 | SetString(SEI_LANGUAGE, psz);
|
---|
215 | SetString (SEI_LANGUAGEHELP, pszh);
|
---|
216 | if (!g_installer) {
|
---|
217 | Save ();
|
---|
218 |
|
---|
219 | if (hini)
|
---|
220 | PrfCloseProfile (hini);
|
---|
221 | }
|
---|
222 | }
|
---|
223 | //Reset Save directory for installer
|
---|
224 | if (g_installer) {
|
---|
225 | SetNumSaveDir (g_installerSavePath);
|
---|
226 | }
|
---|
227 | // to get the error msgs in default language
|
---|
228 | ReloadResources (QueryString(SEI_LANGUAGE));
|
---|
229 | #ifdef _QUIET_
|
---|
230 | if (!g_installer) {
|
---|
231 | #endif
|
---|
232 | if (Error () == 1)
|
---|
233 | {
|
---|
234 | FileNotOpenError ();
|
---|
235 | ReloadResources (QueryString(SEI_LANGUAGE));
|
---|
236 | }
|
---|
237 | else if (Error () == 2)
|
---|
238 | {
|
---|
239 | VersionError ();
|
---|
240 | ReloadResources (QueryString(SEI_LANGUAGE));
|
---|
241 | }
|
---|
242 | #ifdef _QUIET_
|
---|
243 | }
|
---|
244 | #endif
|
---|
245 | }
|
---|
246 |
|
---|
247 | // ** VersionError ********************************************************
|
---|
248 |
|
---|
249 | USHORT SETTINGS :: VersionError (VOID)
|
---|
250 | {
|
---|
251 | DisplayError (RSTR(IDS_HEADER_WARNING), RSTR(IDS_ERROR_INIFILEWRONGVERSION),
|
---|
252 | QueryProfileName ());
|
---|
253 | #ifndef _QUIET_
|
---|
254 | SelectLanguage();
|
---|
255 | #endif
|
---|
256 | return 0;
|
---|
257 | }
|
---|
258 |
|
---|
259 | // ** FileNotOpenError **************************************************** /*FOLD00*/
|
---|
260 |
|
---|
261 | USHORT SETTINGS :: FileNotOpenError (VOID)
|
---|
262 | {
|
---|
263 | DisplayError (RSTR(IDS_HEADER_ERROR), RSTR(IDS_ERROR_INIFILENOTOPEN),
|
---|
264 | QueryProfileName ());
|
---|
265 | #ifndef _QUIET_
|
---|
266 | SelectLanguage();
|
---|
267 | #endif
|
---|
268 | return 0;
|
---|
269 | }
|
---|
270 |
|
---|
271 | // ** Dialog ************************************************************** /*FOLD00*/
|
---|
272 |
|
---|
273 | // FIXME YUKKI! YUKKI!! YUKKI!!! But I'm too lazy to do it better now :-)
|
---|
274 | HWND g_hwndSettingsDialog = NULL;
|
---|
275 | HWND g_hwndPage0 = NULL;
|
---|
276 |
|
---|
277 | BOOL SETTINGS :: Dialog (BOOL fOnlyLanguage)
|
---|
278 | {
|
---|
279 | #ifdef _DOLOGDEBUG_
|
---|
280 | LogDebug( "Dialog: checkpoint 1" );
|
---|
281 | #endif
|
---|
282 | fAutoLanguage = fOnlyLanguage;
|
---|
283 |
|
---|
284 | // load the main dialog window
|
---|
285 | hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndFrame, PFNWP (DialogProcedure),
|
---|
286 | GETMODULE, ID_DLG_SETTINGS, this);
|
---|
287 | // FIXME YUKKI! YUKKI!! YUKKI!!! But I'm too lazy to do it better now :-)
|
---|
288 | g_hwndSettingsDialog = hwndDlg;
|
---|
289 | #ifdef _DOLOGDEBUG_
|
---|
290 | LogDebug( "Dialog: checkpoint 2" );
|
---|
291 | #endif
|
---|
292 |
|
---|
293 | // disable this two buttons if only language select
|
---|
294 | if (fAutoLanguage)
|
---|
295 | {
|
---|
296 | WinEnableWindow (WinWindowFromID (hwndDlg, WID_PB_HELP), FALSE);
|
---|
297 | WinEnableWindow (WinWindowFromID (hwndDlg, WID_PB_UNDO), FALSE);
|
---|
298 | }
|
---|
299 |
|
---|
300 | HWND hwndNB = WinWindowFromID (hwndDlg, WID_NB_SETTINGS);
|
---|
301 | #ifdef _DOLOGDEBUG_
|
---|
302 | LogDebug( "Dialog: checkpoint 3" );
|
---|
303 | #endif
|
---|
304 |
|
---|
305 | // set notebook background color
|
---|
306 | WinSendMsg (hwndNB, BKM_SETNOTEBOOKCOLORS,
|
---|
307 | MPFROMLONG (SYSCLR_DIALOGBACKGROUND),
|
---|
308 | MPFROMSHORT (BKA_BACKGROUNDPAGECOLORINDEX));
|
---|
309 |
|
---|
310 | // set tab dimensions
|
---|
311 | WinSendMsg (hwndNB, BKM_SETDIMENSIONS,
|
---|
312 | MPFROM2SHORT (80, 25), MPFROMSHORT (BKA_MAJORTAB));
|
---|
313 | #ifdef _DOLOGDEBUG_
|
---|
314 | LogDebug( "Dialog: checkpoint 4" );
|
---|
315 | #endif
|
---|
316 |
|
---|
317 | ULONG idPage[COUNT_PAGES];
|
---|
318 | USHORT i, cPages;
|
---|
319 |
|
---|
320 | if (fOnlyLanguage)
|
---|
321 | {
|
---|
322 | cPages = 1;
|
---|
323 |
|
---|
324 | idPage[0] = (ULONG)
|
---|
325 | WinSendMsg (hwndDlg, BKM_INSERTPAGE, 0L,
|
---|
326 | MPFROM2SHORT (BKA_MAJOR | BKA_AUTOPAGESIZE,
|
---|
327 | BKA_LAST));
|
---|
328 | WinSendMsg (hwndDlg, BKM_SETTABTEXT, MPFROMLONG (idPage[0]),
|
---|
329 | MPFROMP (pszPageTab[COUNT_PAGES-1]));
|
---|
330 | hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure,
|
---|
331 | GETMODULE, ID_DLG_SETTINGSPAGE4, this);
|
---|
332 | }
|
---|
333 | else
|
---|
334 | {
|
---|
335 | cPages = COUNT_PAGES;
|
---|
336 |
|
---|
337 | // insert empty pages
|
---|
338 | for (i = 0; i < cPages; i++)
|
---|
339 | {
|
---|
340 | idPage[i] = (ULONG)
|
---|
341 | WinSendMsg (hwndNB, BKM_INSERTPAGE, 0L,
|
---|
342 | MPFROM2SHORT (BKA_MAJOR | BKA_AUTOPAGESIZE,
|
---|
343 | BKA_LAST));
|
---|
344 | //if (pset->GetLangID() == CZ || pset->GetLangID() == RU || pset->GetLangID() == PL) {
|
---|
345 | UniChar target[300];
|
---|
346 | CHAR ucLangStr[300];
|
---|
347 | UconvObject uconv_object866 = NULL;
|
---|
348 | UconvObject uconv_object852 = NULL;
|
---|
349 | UconvObject uconv_object1207 = NULL;
|
---|
350 | UconvObject uconv_object850 = NULL;
|
---|
351 | HAB hab;
|
---|
352 | CHAR ucFont[FACESIZE];
|
---|
353 |
|
---|
354 | UniCreateUconvObject((UniChar *)L"IBM-852", &uconv_object852);
|
---|
355 | UniCreateUconvObject((UniChar *)L"IBM-850", &uconv_object850);
|
---|
356 | UniCreateUconvObject((UniChar *)L"IBM-866", &uconv_object866);
|
---|
357 | UniCreateUconvObject((UniChar *)L"IBM-1207", &uconv_object1207);
|
---|
358 |
|
---|
359 | strcpy(ucLangStr, pszPageTab[i]);
|
---|
360 | if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
|
---|
361 |
|
---|
362 | UniStrToUcs( uconv_object852, target, ucLangStr, 299);
|
---|
363 | }
|
---|
364 | else if (pset->GetLangID() == RU)
|
---|
365 | UniStrToUcs( uconv_object866, target, ucLangStr, 299);
|
---|
366 | else {
|
---|
367 | UniStrToUcs( uconv_object850, target, ucLangStr, 299);
|
---|
368 | }
|
---|
369 | UniStrFromUcs( uconv_object1207, ucLangStr, target, 300);
|
---|
370 | WinSendMsg (hwndNB, BKM_SETTABTEXT,
|
---|
371 | MPFROMLONG (idPage[i]), MPFROMP (ucLangStr));
|
---|
372 | if (uconv_object866)
|
---|
373 | UniFreeUconvObject(uconv_object866);
|
---|
374 | if (uconv_object852)
|
---|
375 | UniFreeUconvObject(uconv_object852);
|
---|
376 | if (uconv_object850)
|
---|
377 | UniFreeUconvObject(uconv_object850);
|
---|
378 | if (uconv_object1207)
|
---|
379 | UniFreeUconvObject(uconv_object1207);
|
---|
380 | //}
|
---|
381 | else
|
---|
382 | WinSendMsg (hwndNB, BKM_SETTABTEXT,
|
---|
383 | MPFROMLONG (idPage[i]), MPFROMP (pszPageTab[i]));
|
---|
384 | }
|
---|
385 | #ifndef _QUIET_
|
---|
386 | // open and assign dialogs to pages
|
---|
387 | hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page1Procedure,
|
---|
388 | GETMODULE, ID_DLG_SETTINGSPAGE1, this);
|
---|
389 | hwndPage[1] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page2Procedure,
|
---|
390 | GETMODULE, ID_DLG_SETTINGSPAGE2, this);
|
---|
391 | hwndPage[2] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page3Procedure,
|
---|
392 | GETMODULE, ID_DLG_SETTINGSPAGE3, this);
|
---|
393 | hwndPage[3] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure,
|
---|
394 | GETMODULE, ID_DLG_SETTINGSPAGE4, this);
|
---|
395 | #else
|
---|
396 | hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) WindowProcedure,
|
---|
397 | GETMODULE, ID_DLG_SETTINGSPAGE0, this);
|
---|
398 | hwndPage[1] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page2Procedure,
|
---|
399 | GETMODULE, ID_DLG_SETTINGSPAGE2, this);
|
---|
400 | hwndPage[2] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page1Procedure,
|
---|
401 | GETMODULE, ID_DLG_SETTINGSPAGE1, this);
|
---|
402 | hwndPage[3] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure,
|
---|
403 | GETMODULE, ID_DLG_SETTINGSPAGE4, this);
|
---|
404 | g_hwndPage0 = hwndPage[0];
|
---|
405 |
|
---|
406 | #endif
|
---|
407 | }
|
---|
408 | #ifdef _DOLOGDEBUG_
|
---|
409 | LogDebug( "Dialog: checkpoint 5" );
|
---|
410 | #endif
|
---|
411 |
|
---|
412 | // combine dlg-handle and page ids
|
---|
413 | for (i = 0; i < cPages; i++)
|
---|
414 | WinSendMsg (hwndNB, BKM_SETPAGEWINDOWHWND,
|
---|
415 | MPFROMLONG (idPage[i]), MPFROMHWND (hwndPage[i]));
|
---|
416 |
|
---|
417 | for (i = 0; i < cPages; i++)
|
---|
418 | WinSendMsg (hwndPage[i], UM_SETTINGS2DIALOG, 0,0);
|
---|
419 | #ifdef _DOLOGDEBUG_
|
---|
420 | LogDebug( "Dialog: checkpoint 6" );
|
---|
421 | #endif
|
---|
422 | WinSendDlgItemMsg (g_hwndPage0, WID_RB_FILE, BM_CLICK,
|
---|
423 | MPFROMSHORT (TRUE), 0);
|
---|
424 | #ifdef _QUIET_
|
---|
425 | if (HACCEL haccel = WinLoadAccelTable (hab, GETMODULE, 1)) {
|
---|
426 | int rc = WinSetAccelTable (hab, haccel, hwndDlg);
|
---|
427 | }
|
---|
428 | #endif
|
---|
429 | WinSetActiveWindow( HWND_DESKTOP, hwndDlg );
|
---|
430 | #ifdef _DOLOGDEBUG_
|
---|
431 | LogDebug( "Dialog: checkpoint 7" );
|
---|
432 | #endif
|
---|
433 |
|
---|
434 | WinProcessDlg (hwndDlg);
|
---|
435 | #ifdef _DOLOGDEBUG_
|
---|
436 | LogDebug( "Dialog: checkpoint 7.5" );
|
---|
437 | #endif
|
---|
438 | WinDestroyWindow (hwndDlg);
|
---|
439 | #ifdef _DOLOGDEBUG_
|
---|
440 | LogDebug( "Dialog: checkpoint 8" );
|
---|
441 | #endif
|
---|
442 | #ifndef _QUIET_
|
---|
443 | // it ain't the best way to do it, but ...
|
---|
444 | SetIdlePriority(QueryFlag(SEI_IDLEPRIORITY));
|
---|
445 | #endif
|
---|
446 | for (i = 0; i < COUNT_PAGES; i++)
|
---|
447 | hwndPage[i] = NULL;
|
---|
448 |
|
---|
449 | hwndDlg = NULLHANDLE;
|
---|
450 | #ifdef _DOLOGDEBUG_
|
---|
451 | LogDebug( "Dialog: checkpoint 9" );
|
---|
452 | #endif
|
---|
453 | return TRUE;
|
---|
454 | }
|
---|
455 |
|
---|
456 |
|
---|
457 | // ** DialogProcedure ***************************************************** /*FOLD00*/
|
---|
458 |
|
---|
459 | MRESULT EXPENTRY SETTINGS :: DialogProcedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
460 | {
|
---|
461 | static PSETTINGS pset = NULL;
|
---|
462 |
|
---|
463 | #ifdef _DOLOGDEBUG_
|
---|
464 | LogDebug( "DialogProcedure:Message 0x%04x", msg );
|
---|
465 | #endif
|
---|
466 |
|
---|
467 | switch (msg)
|
---|
468 | {
|
---|
469 | case WM_INITDLG:
|
---|
470 | {
|
---|
471 | #ifdef _DOLOGDEBUG_
|
---|
472 | LogDebug( "DialogProcedure: start WM_INITDLG" );
|
---|
473 | #endif
|
---|
474 | pset = PSETTINGS (mp2);
|
---|
475 | #ifdef _DOLOGDEBUG_
|
---|
476 | LogDebug( "DialogProcedure: end WM_INITDLG" );
|
---|
477 | #endif
|
---|
478 | CHAR ucFont[FACESIZE];
|
---|
479 |
|
---|
480 | //if (pset->GetLangID() == CZ || pset->GetLangID() == RU || pset->GetLangID() == PL) {
|
---|
481 | UniChar target[300];
|
---|
482 | CHAR ucLangStr[300];
|
---|
483 | UconvObject uconv_object866 = NULL;
|
---|
484 | UconvObject uconv_object852 = NULL;
|
---|
485 | UconvObject uconv_object1207 = NULL;
|
---|
486 | UconvObject uconv_object850 = NULL;
|
---|
487 | HAB hab;
|
---|
488 | //CHAR ucFont[FACESIZE];
|
---|
489 |
|
---|
490 | UniCreateUconvObject((UniChar *)L"IBM-852", &uconv_object852);
|
---|
491 | UniCreateUconvObject((UniChar *)L"IBM-850", &uconv_object850);
|
---|
492 | UniCreateUconvObject((UniChar *)L"IBM-866", &uconv_object866);
|
---|
493 | UniCreateUconvObject((UniChar *)L"IBM-1207", &uconv_object1207);
|
---|
494 |
|
---|
495 | WinLoadString(hab, g_hmod, IDS_OK, sizeof(ucLangStr), ucLangStr);
|
---|
496 | if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
|
---|
497 |
|
---|
498 | UniStrToUcs( uconv_object852, target, ucLangStr, 299);
|
---|
499 | }
|
---|
500 | else if (pset->GetLangID() == RU)
|
---|
501 | UniStrToUcs( uconv_object866, target, ucLangStr, 299);
|
---|
502 | else {
|
---|
503 | UniStrToUcs( uconv_object850, target, ucLangStr, 299);
|
---|
504 | }
|
---|
505 | UniStrFromUcs( uconv_object1207, ucLangStr, target, 300);
|
---|
506 | WinSetDlgItemText(hwnd, WID_PB_OK, ucLangStr);
|
---|
507 |
|
---|
508 | WinLoadString(hab, g_hmod, IDS_UNDO, sizeof(ucLangStr), ucLangStr);
|
---|
509 | if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
|
---|
510 |
|
---|
511 | UniStrToUcs( uconv_object852, target, ucLangStr, 299);
|
---|
512 | }
|
---|
513 | else if (pset->GetLangID() == RU)
|
---|
514 | UniStrToUcs( uconv_object866, target, ucLangStr, 299);
|
---|
515 | else {
|
---|
516 | UniStrToUcs( uconv_object850, target, ucLangStr, 299);
|
---|
517 | }
|
---|
518 | UniStrFromUcs( uconv_object1207, ucLangStr, target, 300);
|
---|
519 | WinSetDlgItemText(hwnd, WID_PB_UNDO, ucLangStr);
|
---|
520 | WinLoadString(hab, g_hmod, IDS_HELP, sizeof(ucLangStr), ucLangStr);
|
---|
521 |
|
---|
522 | if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
|
---|
523 |
|
---|
524 | UniStrToUcs( uconv_object852, target, ucLangStr, 299);
|
---|
525 | }
|
---|
526 | else if (pset->GetLangID() == RU)
|
---|
527 | UniStrToUcs( uconv_object866, target, ucLangStr, 299);
|
---|
528 | else {
|
---|
529 | UniStrToUcs( uconv_object850, target, ucLangStr, 299);
|
---|
530 | }
|
---|
531 | UniStrFromUcs( uconv_object1207, ucLangStr, target, 300);
|
---|
532 | WinSetDlgItemText(hwnd, WID_PB_HELP, ucLangStr);
|
---|
533 | if (uconv_object866)
|
---|
534 | UniFreeUconvObject(uconv_object866);
|
---|
535 | if (uconv_object852)
|
---|
536 | UniFreeUconvObject(uconv_object852);
|
---|
537 | if (uconv_object850)
|
---|
538 | UniFreeUconvObject(uconv_object850);
|
---|
539 | if (uconv_object1207)
|
---|
540 | UniFreeUconvObject(uconv_object1207);
|
---|
541 | HMQ hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
542 | WinSetCp(hmq, 1207);
|
---|
543 | if (pset->GetLangID() == CZ || pset->GetLangID() == RU || pset->GetLangID() == PL) {
|
---|
544 | strcpy(ucFont, "9.Times New Roman MT 30");
|
---|
545 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
546 | }
|
---|
547 | //}
|
---|
548 | else if (g_installer) {
|
---|
549 | strcpy(ucFont, "9.WarpSans");
|
---|
550 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
551 | }
|
---|
552 | return MRESULT (FALSE);
|
---|
553 | }
|
---|
554 | case WM_COMMAND:
|
---|
555 | switch (SHORT1FROMMP (mp1))
|
---|
556 | {
|
---|
557 | #if 1
|
---|
558 | case WID_PB_HELP:{
|
---|
559 | HWND hwndPage;
|
---|
560 | USHORT usDlgId;
|
---|
561 | ULONG ulPageId =
|
---|
562 | (ULONG) WinSendMsg(WinWindowFromID(hwnd, WID_NB_SETTINGS),
|
---|
563 | BKM_QUERYPAGEID, 0, MPFROM2SHORT(BKA_TOP,
|
---|
564 | 0));
|
---|
565 | hwndPage =
|
---|
566 | LONGFROMMP(WinSendMsg
|
---|
567 | (WinWindowFromID(hwnd, WID_NB_SETTINGS),
|
---|
568 | BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(ulPageId),
|
---|
569 | 0));
|
---|
570 | usDlgId = WinQueryWindowUShort(hwndPage, QWS_ID);
|
---|
571 |
|
---|
572 | HMQ hmq;
|
---|
573 | BOOL bUniCodeFont = FALSE;
|
---|
574 | CHAR ucFont[FACESIZE];
|
---|
575 |
|
---|
576 | if (pset->GetLangID() == RU) {
|
---|
577 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
578 | WinSetCp(hmq, 866);
|
---|
579 | bUniCodeFont = TRUE;
|
---|
580 | }
|
---|
581 | else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
|
---|
582 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
583 | WinSetCp(hmq, 852);
|
---|
584 | bUniCodeFont = TRUE;
|
---|
585 | }
|
---|
586 | else {
|
---|
587 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
588 | WinSetCp(hmq, 850);
|
---|
589 | }
|
---|
590 | if (usDlgId == ID_DLG_SETTINGSPAGE0)
|
---|
591 | g_phelp->DisplayPanel(2);
|
---|
592 | else if (usDlgId == ID_DLG_SETTINGSPAGE1)
|
---|
593 | g_phelp->DisplayPanel(2210);
|
---|
594 | #ifdef _QUIET_
|
---|
595 | else if (usDlgId == ID_DLG_SETTINGSPAGE2 && (pset->GetLangID() != IT &&
|
---|
596 | pset->GetLangID() != BR))
|
---|
597 | g_phelp->DisplayPanel(2235);
|
---|
598 | #else
|
---|
599 | else if (usDlgId == ID_DLG_SETTINGSPAGE2)
|
---|
600 | g_phelp->DisplayPanel(3);
|
---|
601 | #endif
|
---|
602 | else if (usDlgId == ID_DLG_SETTINGSPAGE3)
|
---|
603 | g_phelp->DisplayPanel(2230);
|
---|
604 | else if (usDlgId == ID_DLG_SETTINGSPAGE4)
|
---|
605 | g_phelp->DisplayPanel(2240);
|
---|
606 | else
|
---|
607 | g_phelp->DisplayPanel(4);
|
---|
608 | break;
|
---|
609 | }
|
---|
610 | #endif
|
---|
611 | case WID_PB_OK:
|
---|
612 | #ifdef _DOLOGDEBUG_
|
---|
613 | LogDebug( "DialogProcedure: start WID_PB_OK" );
|
---|
614 | #endif
|
---|
615 | saveum = TRUE;
|
---|
616 | WinSendMsg (hwnd, WM_CLOSE, 0,0);
|
---|
617 | #ifdef _DOLOGDEBUG_
|
---|
618 | LogDebug( "DialogProcedure: end WID_PB_OK" );
|
---|
619 | #endif
|
---|
620 | break;
|
---|
621 |
|
---|
622 | case WID_PB_UNDO:
|
---|
623 | {
|
---|
624 | ULONG id = (ULONG)
|
---|
625 | WinSendDlgItemMsg (hwnd, WID_NB_SETTINGS,
|
---|
626 | BKM_QUERYPAGEID, 0,
|
---|
627 | MPFROM2SHORT (BKA_TOP, 0));
|
---|
628 | if (id)
|
---|
629 | {
|
---|
630 | HWND hwndPage = (HWND)
|
---|
631 | WinSendDlgItemMsg (hwnd, WID_NB_SETTINGS,
|
---|
632 | BKM_QUERYPAGEWINDOWHWND,
|
---|
633 | MPFROMLONG (id), 0);
|
---|
634 | // Make mp1 1 for default use it to select setting on pages
|
---|
635 | WinSendMsg (hwndPage, UM_SETTINGS2DIALOG, 0,0);
|
---|
636 | }
|
---|
637 | }
|
---|
638 | break;
|
---|
639 | #ifndef _QUIET_
|
---|
640 | case WID_PB_ABOUT:
|
---|
641 | AboutBox (hwnd);
|
---|
642 | break;
|
---|
643 | #endif
|
---|
644 | case DID_CANCEL:
|
---|
645 | {
|
---|
646 | // Undo stuff on all notebook pages:
|
---|
647 | HWND hwndPage;
|
---|
648 |
|
---|
649 | // Get ID of first notebook page.
|
---|
650 | ULONG id =
|
---|
651 | ULONG( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
|
---|
652 | BKM_QUERYPAGEID, 0,
|
---|
653 | MPFROM2SHORT( BKA_FIRST, 0 ) ) );
|
---|
654 | if( id ) {
|
---|
655 | hwndPage =
|
---|
656 | HWND( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
|
---|
657 | BKM_QUERYPAGEWINDOWHWND,
|
---|
658 | MPFROMLONG( id ), 0 ) );
|
---|
659 | WinSendMsg( hwndPage, UM_SETTINGS2DIALOG, 0,0 );
|
---|
660 | }
|
---|
661 |
|
---|
662 | while( id ) {
|
---|
663 | // Get ID of next notebook page.
|
---|
664 | if( ( id =
|
---|
665 | ULONG( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
|
---|
666 | BKM_QUERYPAGEID,
|
---|
667 | MPFROMLONG( id ),
|
---|
668 | MPFROM2SHORT( BKA_NEXT, 0 )
|
---|
669 | ) ) ) ) {
|
---|
670 | hwndPage =
|
---|
671 | HWND( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
|
---|
672 | BKM_QUERYPAGEWINDOWHWND,
|
---|
673 | MPFROMLONG( id ), 0 ) );
|
---|
674 | WinSendMsg( hwndPage, UM_SETTINGS2DIALOG, 0,0 );
|
---|
675 | }
|
---|
676 | }
|
---|
677 | WinSendMsg( hwnd, WM_CLOSE, 0,0 );
|
---|
678 | }
|
---|
679 | break;
|
---|
680 | }
|
---|
681 | return MRESULT (FALSE);
|
---|
682 |
|
---|
683 | #ifdef _DOLOGDEBUG_
|
---|
684 | case WM_DESTROY:
|
---|
685 | LogDebug( "DialogProcedure: WM_DESTROY" );
|
---|
686 | return MRESULT (FALSE);
|
---|
687 | #endif
|
---|
688 |
|
---|
689 | case WM_CLOSE:
|
---|
690 | #ifdef _DOLOGDEBUG_
|
---|
691 | LogDebug( "DialogProcedure: WM_CLOSE" );
|
---|
692 | #endif
|
---|
693 | case WM_QUIT:
|
---|
694 | #ifdef _DOLOGDEBUG_
|
---|
695 | LogDebug( "DialogProcedure: WM_QUIT" );
|
---|
696 | #endif
|
---|
697 | case WM_SAVEAPPLICATION:
|
---|
698 | #ifdef _DOLOGDEBUG_
|
---|
699 | LogDebug( "DialogProcedure: WM_SAVEAPPLICATION" );
|
---|
700 | #endif
|
---|
701 | #ifdef _DOLOGDEBUG_
|
---|
702 | LogDebug( "DialogProcedure: start WM_CLOSE (or WM_QUIT, WM_SAVEAPPLICATION)" );
|
---|
703 | #endif
|
---|
704 | for (USHORT i = 0; i < COUNT_PAGES; i++)
|
---|
705 | WinSendMsg (pset->hwndPage[i], UM_ADJUST, 0,0);
|
---|
706 | #ifdef _DOLOGDEBUG_
|
---|
707 | LogDebug( "DialogProcedure: end WM_CLOSE (or WM_QUIT, WM_SAVEAPPLICATION)" );
|
---|
708 | #endif
|
---|
709 | WinDismissDlg( hwnd, 0L );
|
---|
710 | return MRESULT (FALSE);
|
---|
711 | }
|
---|
712 |
|
---|
713 | #ifdef _DOLOGDEBUG_
|
---|
714 | LogDebug( "DialogProcedure:WinDefDlgProc->0x%04x", msg );
|
---|
715 | #endif
|
---|
716 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
717 | }
|
---|
718 |
|
---|
719 | // ** Page1Procedure ****************************************************** /*FOLD00*/
|
---|
720 |
|
---|
721 | MRESULT EXPENTRY SETTINGS :: Page1Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
722 | {
|
---|
723 | static PSETTINGS pset = NULL;
|
---|
724 |
|
---|
725 | switch (msg)
|
---|
726 | {
|
---|
727 | case WM_INITDLG: {
|
---|
728 | #ifdef _DOLOGDEBUG_
|
---|
729 | LogDebug( "Page1Procedure: start WM_INITDLG" );
|
---|
730 | #endif
|
---|
731 | ULONG ul;
|
---|
732 | pset = PSETTINGS (mp2);
|
---|
733 | for( int i = 0; i < BMF_INVALID; i++ ) {
|
---|
734 | if( pset->ifi[ i ].available ) {
|
---|
735 | ul = WinInsertLboxItem( WinWindowFromID( hwnd, WID_LB_FILEFORMAT ),
|
---|
736 | LIT_END, pset->ifi[ i ].label );
|
---|
737 | WinSendMsg( WinWindowFromID( hwnd, WID_LB_FILEFORMAT ),
|
---|
738 | LM_SETITEMHANDLE, MPFROMLONG(ul), MPFROMP( i ) );
|
---|
739 | }
|
---|
740 | }
|
---|
741 | HMQ hmq;
|
---|
742 | BOOL bUniCodeFont = FALSE;
|
---|
743 | CHAR ucFont[FACESIZE];
|
---|
744 |
|
---|
745 | if (pset->GetLangID() == RU) {
|
---|
746 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
747 | WinSetCp(hmq, 866);
|
---|
748 | bUniCodeFont = TRUE;
|
---|
749 | }
|
---|
750 | else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
|
---|
751 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
752 | WinSetCp(hmq, 852);
|
---|
753 | bUniCodeFont = TRUE;
|
---|
754 | }
|
---|
755 | else {
|
---|
756 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
757 | WinSetCp(hmq, 850);
|
---|
758 | }
|
---|
759 |
|
---|
760 | if (bUniCodeFont) {
|
---|
761 | strcpy(ucFont, "9.Times New Roman MT 30");
|
---|
762 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
763 | }
|
---|
764 | else if (g_installer) {
|
---|
765 | strcpy(ucFont, "9.WarpSans");
|
---|
766 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
767 | }
|
---|
768 |
|
---|
769 | #ifdef _DOLOGDEBUG_
|
---|
770 | LogDebug( "Page1Procedure: end WM_INITDLG" );
|
---|
771 | #endif
|
---|
772 | return MRESULT (FALSE);
|
---|
773 | }
|
---|
774 |
|
---|
775 | case WM_COMMAND:
|
---|
776 | if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
|
---|
777 | WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
|
---|
778 | return MRESULT( FALSE );
|
---|
779 |
|
---|
780 | case UM_SETTINGS2DIALOG: {
|
---|
781 | #ifdef _DOLOGDEBUG_
|
---|
782 | LogDebug( "Page1Procedure: start UM_SETTINGS2DIALOG" );
|
---|
783 | #endif
|
---|
784 | // set num save dir name
|
---|
785 | WinSendDlgItemMsg (hwnd, WID_E_NUMSAVEDIR, EM_SETTEXTLIMIT,
|
---|
786 | MPARAM (_MAX_PATH-1), (MPARAM)0);
|
---|
787 | WinSetDlgItemText (hwnd, WID_E_NUMSAVEDIR,
|
---|
788 | pset->QueryNumSaveDir ());
|
---|
789 | WinSendDlgItemMsg (hwnd, WID_E_NUMSAVEDIR, EM_SETSEL,
|
---|
790 | MPFROM2SHORT (0, _MAX_PATH), (MPARAM)0);
|
---|
791 |
|
---|
792 | // set force file name
|
---|
793 | WinSendDlgItemMsg (hwnd, WID_E_FORCESAVEFILE, EM_SETTEXTLIMIT,
|
---|
794 | MPARAM (_MAX_PATH-1), (MPARAM)0);
|
---|
795 | WinSetDlgItemText (hwnd, WID_E_FORCESAVEFILE,
|
---|
796 | pset->QueryForceSaveFile ());
|
---|
797 | WinSendDlgItemMsg (hwnd, WID_E_FORCESAVEFILE, EM_SETSEL,
|
---|
798 | MPFROM2SHORT (0, _MAX_PATH), (MPARAM)0);
|
---|
799 |
|
---|
800 | // Select the appropriate entry in the fileformat-listbox.
|
---|
801 | HWND hwndLB = WinWindowFromID( hwnd, WID_LB_FILEFORMAT );
|
---|
802 | ULONG c, i;
|
---|
803 |
|
---|
804 | c = WinQueryLboxCount( hwndLB );
|
---|
805 | for( i = 0; i < c; i++ )
|
---|
806 | {
|
---|
807 | ULONG type = ULONG( WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT,
|
---|
808 | LM_QUERYITEMHANDLE,
|
---|
809 | MPFROMLONG(i), NULL ) );
|
---|
810 | if( type == ULONG( pset->QueryFileFormat() ) )
|
---|
811 | break;
|
---|
812 | }
|
---|
813 | if( i < c )
|
---|
814 | WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT, LM_SELECTITEM,
|
---|
815 | MPFROMSHORT(i), MPFROMSHORT(TRUE) );
|
---|
816 | else
|
---|
817 | WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT, LM_SELECTITEM,
|
---|
818 | MPFROMSHORT(0), MPFROMSHORT(TRUE) );
|
---|
819 | #ifdef _QUIET_
|
---|
820 | // set play sound button
|
---|
821 | pset->AdjustButton (hwnd, WID_CB_DOSOUND,
|
---|
822 | pset->DoSound ());
|
---|
823 | #endif
|
---|
824 | // Select appropriate radiobutton for save style.
|
---|
825 | switch (pset->QueryFileSaveStyle ())
|
---|
826 | {
|
---|
827 | case FSS_NUMFILES:
|
---|
828 | WinSendDlgItemMsg (hwnd, WID_RB_FSSNUMFILES, BM_CLICK,
|
---|
829 | MPFROMSHORT(TRUE), 0);
|
---|
830 | AdjustSaveTypeButtons (FALSE);
|
---|
831 | break;
|
---|
832 |
|
---|
833 | case FSS_FORCEFILE:
|
---|
834 | WinSendDlgItemMsg (hwnd, WID_RB_FSSFORCEFILE, BM_CLICK,
|
---|
835 | MPFROMSHORT(TRUE), 0);
|
---|
836 | AdjustSaveTypeButtons (TRUE);
|
---|
837 | break;
|
---|
838 |
|
---|
839 | default:
|
---|
840 | WinSendDlgItemMsg (hwnd, WID_RB_FSSPROMPT, BM_CLICK,
|
---|
841 | MPFROMSHORT(TRUE), 0);
|
---|
842 | AdjustSaveTypeButtons (FALSE);
|
---|
843 | break;
|
---|
844 | }
|
---|
845 | #ifdef _DOLOGDEBUG_
|
---|
846 | LogDebug( "Page1Procedure: end UM_SETTINGS2DIALOG" );
|
---|
847 | #endif
|
---|
848 | return MRESULT (FALSE);
|
---|
849 | }
|
---|
850 |
|
---|
851 | case UM_ADJUST:
|
---|
852 | {
|
---|
853 | #ifdef _DOLOGDEBUG_
|
---|
854 | LogDebug( "Page1Procedure: start UM_ADJUST" );
|
---|
855 | #endif
|
---|
856 | // get file save style
|
---|
857 | if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_FSSNUMFILES),
|
---|
858 | BM_QUERYCHECK, 0,0))
|
---|
859 | pset->SetFileSaveStyle (FSS_NUMFILES);
|
---|
860 | else if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_FSSFORCEFILE),
|
---|
861 | BM_QUERYCHECK, 0,0))
|
---|
862 | pset->SetFileSaveStyle (FSS_FORCEFILE);
|
---|
863 | else
|
---|
864 | pset->SetFileSaveStyle (FSS_PROMPT);
|
---|
865 | #ifdef _QUIET_
|
---|
866 | pset->DoSound(WinQueryButtonCheckstate
|
---|
867 | (hwnd, WID_CB_DOSOUND));
|
---|
868 | #endif
|
---|
869 | #ifdef _DOLOGDEBUG_
|
---|
870 | LogDebug( "Page1Procedure: checkpoint 1" );
|
---|
871 | #endif
|
---|
872 |
|
---|
873 | // Get file format.
|
---|
874 | ULONG ul = USHORT( WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT,
|
---|
875 | LM_QUERYSELECTION,
|
---|
876 | MPFROMLONG( LIT_FIRST ),
|
---|
877 | 0L ) );
|
---|
878 | ul = ULONG( WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT,
|
---|
879 | LM_QUERYITEMHANDLE,
|
---|
880 | MPFROMLONG( ul ), NULL ) );
|
---|
881 | pset->SetFileFormat( SHORT( ul ) );
|
---|
882 |
|
---|
883 | pset->SetSaveFile(AddExtensionToFilename(pset->QuerySaveFile()));
|
---|
884 |
|
---|
885 | #ifdef _DOLOGDEBUG_
|
---|
886 | LogDebug( "Page1Procedure: checkpoint 2" );
|
---|
887 | #endif
|
---|
888 |
|
---|
889 | // num save dir file name
|
---|
890 | CHAR psz[_MAX_PATH];
|
---|
891 | WinQueryDlgItemText (hwnd, WID_E_NUMSAVEDIR, _MAX_PATH, psz);
|
---|
892 | pset->SetNumSaveDir (psz);
|
---|
893 |
|
---|
894 | // force file name
|
---|
895 | WinQueryDlgItemText (hwnd, WID_E_FORCESAVEFILE, _MAX_PATH, psz);
|
---|
896 | pset->SetForceSaveFile (psz);
|
---|
897 |
|
---|
898 | AdjustSaveTypeButtons
|
---|
899 | (BOOL (pset->QueryFileSaveStyle () == FSS_FORCEFILE));
|
---|
900 | pset->saveStyle = pset->QuerySaveStyle ();
|
---|
901 | pset->pNumSaveDir = pset->QueryNumSaveDir ();
|
---|
902 | pset->pForceSaveFile = pset->QueryForceSaveFile();
|
---|
903 |
|
---|
904 | if (saveum)
|
---|
905 | pset->Save ();
|
---|
906 | #ifdef _DOLOGDEBUG_
|
---|
907 | LogDebug( "Page1Procedure: end UM_ADJUST" );
|
---|
908 | #endif
|
---|
909 | }
|
---|
910 | break;
|
---|
911 |
|
---|
912 | case WM_CONTROL:
|
---|
913 | switch (SHORT1FROMMP (mp1))
|
---|
914 | {
|
---|
915 | case WID_RB_FSSFORCEFILE:
|
---|
916 | AdjustSaveTypeButtons (TRUE);
|
---|
917 | break;
|
---|
918 |
|
---|
919 | case WID_RB_FSSPROMPT:
|
---|
920 | case WID_RB_FSSNUMFILES:
|
---|
921 | AdjustSaveTypeButtons (FALSE);
|
---|
922 | break;
|
---|
923 | }
|
---|
924 | return MRESULT (FALSE);
|
---|
925 | }
|
---|
926 |
|
---|
927 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
928 | }
|
---|
929 |
|
---|
930 | // ** Page2Procedure ****************************************************** /*FOLD00*/
|
---|
931 |
|
---|
932 | MRESULT EXPENTRY SETTINGS :: Page2Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
933 | {
|
---|
934 | static PSETTINGS pset = NULL;
|
---|
935 |
|
---|
936 | switch (msg)
|
---|
937 | {
|
---|
938 | case WM_INITDLG: {
|
---|
939 | #ifdef _DOLOGDEBUG_
|
---|
940 | LogDebug( "Page1Procedure: start WM_INITDLG" );
|
---|
941 | #endif
|
---|
942 | pset = PSETTINGS (mp2);
|
---|
943 | #ifdef _DOLOGDEBUG_
|
---|
944 | LogDebug( "Page1Procedure: end WM_INITDLG" );
|
---|
945 | #endif
|
---|
946 | HMQ hmq;
|
---|
947 | BOOL bUniCodeFont = FALSE;
|
---|
948 | CHAR ucFont[FACESIZE];
|
---|
949 |
|
---|
950 | if (pset->GetLangID() == RU) {
|
---|
951 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
952 | WinSetCp(hmq, 866);
|
---|
953 | bUniCodeFont = TRUE;
|
---|
954 | }
|
---|
955 | else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
|
---|
956 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
957 | WinSetCp(hmq, 852);
|
---|
958 | bUniCodeFont = TRUE;
|
---|
959 | }
|
---|
960 | else {
|
---|
961 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
962 | WinSetCp(hmq, 850);
|
---|
963 | }
|
---|
964 |
|
---|
965 | if (bUniCodeFont) {
|
---|
966 | strcpy(ucFont, "9.Times New Roman MT 30");
|
---|
967 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
968 | }
|
---|
969 | else if (g_installer) {
|
---|
970 | strcpy(ucFont, "9.WarpSans");
|
---|
971 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
972 | }
|
---|
973 | return MRESULT (FALSE);
|
---|
974 | }
|
---|
975 | case WM_COMMAND:
|
---|
976 |
|
---|
977 | if( SHORT1FROMMP( mp1 ) == WID_PB_OK) {
|
---|
978 | saveum = TRUE;
|
---|
979 | WinSendMsg ( g_hwndSettingsDialog, WM_CLOSE, 0,0);
|
---|
980 | }
|
---|
981 | if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
|
---|
982 | WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
|
---|
983 | return MRESULT( FALSE );
|
---|
984 |
|
---|
985 | case UM_SETTINGS2DIALOG:
|
---|
986 | #ifdef _DOLOGDEBUG_
|
---|
987 | LogDebug( "Page2Procedure: start UM_SETTINGS2DIALOG" );
|
---|
988 | #endif
|
---|
989 | #ifndef _QUIET_
|
---|
990 | // set state of checkbuttons
|
---|
991 | pset->AdjustButton (hwnd, WID_CB_SSWENABLE,
|
---|
992 | pset->SnapshotWindow ());
|
---|
993 | pset->AdjustButton (hwnd, WID_CB_SSWHIDE,
|
---|
994 | pset->SSWHide ());
|
---|
995 | pset->AdjustButton (hwnd, WID_CB_SSWALWAYSONTOP,
|
---|
996 | pset->SSWAlwaysOnTop ());
|
---|
997 | #else
|
---|
998 | pset->AdjustButton (hwnd, WID_CB_SERIALCAPTURE,
|
---|
999 | pset->SerialCapture ());
|
---|
1000 | pset->AdjustButton (hwnd, WID_CB_DELAYCOUNTDOWN,
|
---|
1001 | pset->DelayCountdown ());
|
---|
1002 | pset->AdjustButton (hwnd, WID_CB_DELAYEDCAPTURE,
|
---|
1003 | pset->DelayedCapture ());
|
---|
1004 |
|
---|
1005 | // init delay time sb
|
---|
1006 | WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME, SPBM_SETLIMITS,
|
---|
1007 | MPFROMLONG (65536), MPFROMLONG (1));
|
---|
1008 | WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME, SPBM_SETCURRENTVALUE,
|
---|
1009 | MPFROMLONG (pset->QueryDelayTime ()), 0);
|
---|
1010 |
|
---|
1011 | // init serial time sb
|
---|
1012 | WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME, SPBM_SETLIMITS,
|
---|
1013 | MPFROMLONG (65536), MPFROMLONG (1));
|
---|
1014 | WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME, SPBM_SETCURRENTVALUE,
|
---|
1015 | MPFROMLONG (pset->QuerySerialTime ()), 0);
|
---|
1016 | #endif
|
---|
1017 | switch (pset->QuerySSWCaptureType ())
|
---|
1018 | {
|
---|
1019 | case CAP_WINDOWINT:
|
---|
1020 | WinSendDlgItemMsg (hwnd, WID_SSWWINDOWINT, BM_CLICK,
|
---|
1021 | MPFROMSHORT(TRUE), 0);
|
---|
1022 | break;
|
---|
1023 | case CAP_SCREENREGION:
|
---|
1024 | WinSendDlgItemMsg (hwnd, WID_SSWSCREENREGION, BM_CLICK,
|
---|
1025 | MPFROMSHORT(TRUE), 0);
|
---|
1026 | break;
|
---|
1027 | case CAP_WINDOW:
|
---|
1028 | WinSendDlgItemMsg (hwnd, WID_SSWWINDOW, BM_CLICK,
|
---|
1029 | MPFROMSHORT(TRUE), 0);
|
---|
1030 | break;
|
---|
1031 | default:
|
---|
1032 | WinSendDlgItemMsg (hwnd, WID_SSWSCREEN, BM_CLICK,
|
---|
1033 | MPFROMSHORT(TRUE), 0);
|
---|
1034 | break;
|
---|
1035 | }
|
---|
1036 | #ifndef _QUIET_
|
---|
1037 | // show or hide snapshot window
|
---|
1038 | if (! WinSendDlgItemMsg (hwnd, WID_CB_SSWENABLE,
|
---|
1039 | BM_QUERYCHECK, 0, 0))
|
---|
1040 | WinShowWindow (hwndSnapshot, FALSE);
|
---|
1041 | else
|
---|
1042 | WinShowWindow (hwndSnapshot, TRUE);
|
---|
1043 | #endif
|
---|
1044 | #ifdef _DOLOGDEBUG_
|
---|
1045 | LogDebug( "Page1Procedure: end UM_SETTINGS2DIALOG" );
|
---|
1046 | #endif
|
---|
1047 | return MRESULT (FALSE);
|
---|
1048 |
|
---|
1049 | case UM_ADJUST:
|
---|
1050 | #ifdef _DOLOGDEBUG_
|
---|
1051 | LogDebug( "Page2Procedure: start UM_ADJUST" );
|
---|
1052 | #endif
|
---|
1053 | #ifndef _QUIET_
|
---|
1054 | // query state of checkbuttons and set flags
|
---|
1055 | pset->SSWHide(WinQueryButtonCheckstate(hwnd, WID_CB_SSWHIDE));
|
---|
1056 | #ifdef _DOLOGDEBUG_
|
---|
1057 | LogDebug( "Page2Procedure: checkpoint 1" );
|
---|
1058 | #endif
|
---|
1059 | pset->SnapshotWindow(WinQueryButtonCheckstate(hwnd, WID_CB_SSWENABLE));
|
---|
1060 | pset->SSWAlwaysOnTop(WinQueryButtonCheckstate(hwnd,
|
---|
1061 | WID_CB_SSWALWAYSONTOP));
|
---|
1062 | #ifdef _DOLOGDEBUG_
|
---|
1063 | LogDebug( "Page2Procedure: checkpoint 2" );
|
---|
1064 | #endif
|
---|
1065 | #else
|
---|
1066 | // query state of checkbuttons and set flags
|
---|
1067 | pset->SerialCapture(WinQueryButtonCheckstate
|
---|
1068 | (hwnd, WID_CB_SERIALCAPTURE));
|
---|
1069 | #ifdef _DOLOGDEBUG_
|
---|
1070 | LogDebug( "Page3Procedure: checkpoint 1" );
|
---|
1071 | #endif
|
---|
1072 | pset->DelayCountdown(WinQueryButtonCheckstate
|
---|
1073 | (hwnd, WID_CB_DELAYCOUNTDOWN));
|
---|
1074 | pset->DelayedCapture (WinQueryButtonCheckstate
|
---|
1075 | (hwnd,WID_CB_DELAYEDCAPTURE));
|
---|
1076 | #endif
|
---|
1077 | // get ssw capture type
|
---|
1078 | if (WinSendMsg (WinWindowFromID (hwnd, WID_SSWSCREENREGION),
|
---|
1079 | BM_QUERYCHECK, 0,0))
|
---|
1080 | pset->SetSSWCaptureType (CAP_SCREENREGION);
|
---|
1081 | else if (WinSendMsg (WinWindowFromID (hwnd, WID_SSWWINDOW),
|
---|
1082 | BM_QUERYCHECK, 0,0))
|
---|
1083 | pset->SetSSWCaptureType (CAP_WINDOW);
|
---|
1084 | else if (WinSendMsg (WinWindowFromID (hwnd, WID_SSWWINDOWINT),
|
---|
1085 | BM_QUERYCHECK, 0,0))
|
---|
1086 | pset->SetSSWCaptureType (CAP_WINDOWINT);
|
---|
1087 | else
|
---|
1088 | pset->SetSSWCaptureType (CAP_SCREEN);
|
---|
1089 | #ifdef _QUIET_
|
---|
1090 | // delay time
|
---|
1091 | ULONG ul;
|
---|
1092 | if (! BOOL (WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME,
|
---|
1093 | SPBM_QUERYVALUE,
|
---|
1094 | MPFROMP (&ul),
|
---|
1095 | MPFROM2SHORT (0, 0))))
|
---|
1096 | ul = 5L;
|
---|
1097 | pset->SetDelayTime (ul);
|
---|
1098 | #ifdef _DOLOGDEBUG_
|
---|
1099 | LogDebug( "Page3Procedure: checkpoint 3" );
|
---|
1100 | #endif
|
---|
1101 |
|
---|
1102 | // serial time
|
---|
1103 | if (! BOOL (WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME,
|
---|
1104 | SPBM_QUERYVALUE,
|
---|
1105 | MPFROMP (&ul),
|
---|
1106 | MPFROM2SHORT (0, 0))))
|
---|
1107 | ul = 10L;
|
---|
1108 | pset->SetSerialTime (ul);
|
---|
1109 | pset->bSerialCapture = pset->SerialCapture ();
|
---|
1110 | #endif
|
---|
1111 | if (saveum)
|
---|
1112 | pset->Save ();
|
---|
1113 | #ifdef _DOLOGDEBUG_
|
---|
1114 | LogDebug( "Page2Procedure: end UM_ADJUST" );
|
---|
1115 | #endif
|
---|
1116 | break;
|
---|
1117 |
|
---|
1118 | case WM_CONTROL:
|
---|
1119 | switch (SHORT1FROMMP (mp1))
|
---|
1120 | {
|
---|
1121 | #ifndef _QUIET_
|
---|
1122 | case WID_CB_SSWENABLE:
|
---|
1123 | if (! WinSendDlgItemMsg (hwnd, WID_CB_SSWENABLE,
|
---|
1124 | BM_QUERYCHECK, 0, 0))
|
---|
1125 | WinShowWindow (hwndSnapshot, FALSE);
|
---|
1126 | else
|
---|
1127 | WinShowWindow (hwndSnapshot, TRUE);
|
---|
1128 | break;
|
---|
1129 | #endif
|
---|
1130 | case WID_CB_DELAYEDCAPTURE:
|
---|
1131 |
|
---|
1132 | WinSendDlgItemMsg (g_hwndPage0, WID_CB_DELAYEDCAPTURE, BM_SETCHECK,
|
---|
1133 | MPFROMLONG (WinQueryButtonCheckstate
|
---|
1134 | (hwnd,WID_CB_DELAYEDCAPTURE)),
|
---|
1135 | MPFROMLONG (0));
|
---|
1136 | WinSendDlgItemMsg (WinWindowFromID(hwndFrame, FID_CLIENT),
|
---|
1137 | WID_CB_DELAYEDCAPTURE, BM_SETCHECK,
|
---|
1138 | MPFROMLONG (WinQueryButtonCheckstate
|
---|
1139 | (hwnd,WID_CB_DELAYEDCAPTURE)),
|
---|
1140 | MPFROMLONG (0));
|
---|
1141 | break;
|
---|
1142 | }
|
---|
1143 | return MRESULT (FALSE);
|
---|
1144 | }
|
---|
1145 |
|
---|
1146 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
1147 | }
|
---|
1148 |
|
---|
1149 | // ** Page3Procedure ****************************************************** /*FOLD00*/
|
---|
1150 |
|
---|
1151 | MRESULT EXPENTRY SETTINGS :: Page3Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1152 | {
|
---|
1153 | static PSETTINGS pset = NULL;
|
---|
1154 |
|
---|
1155 | switch (msg)
|
---|
1156 | {
|
---|
1157 | case WM_INITDLG: {
|
---|
1158 | #ifdef _DOLOGDEBUG_
|
---|
1159 | LogDebug( "Page3Procedure: start WM_INITDLG" );
|
---|
1160 | #endif
|
---|
1161 | pset = PSETTINGS (mp2);
|
---|
1162 | #ifdef _DOLOGDEBUG_
|
---|
1163 | LogDebug( "Page3Procedure: end WM_INITDLG" );
|
---|
1164 | #endif
|
---|
1165 | HMQ hmq;
|
---|
1166 | BOOL bUniCodeFont = FALSE;
|
---|
1167 | CHAR ucFont[FACESIZE];
|
---|
1168 |
|
---|
1169 | if (pset->GetLangID() == RU) {
|
---|
1170 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
1171 | WinSetCp(hmq, 866);
|
---|
1172 | bUniCodeFont = TRUE;
|
---|
1173 | }
|
---|
1174 | else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
|
---|
1175 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
1176 | WinSetCp(hmq, 852);
|
---|
1177 | bUniCodeFont = TRUE;
|
---|
1178 | }
|
---|
1179 | else {
|
---|
1180 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
1181 | WinSetCp(hmq, 850);
|
---|
1182 | }
|
---|
1183 |
|
---|
1184 | if (bUniCodeFont) {
|
---|
1185 | strcpy(ucFont, "9.Times New Roman MT 30");
|
---|
1186 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
1187 | }
|
---|
1188 | return MRESULT (FALSE);
|
---|
1189 | }
|
---|
1190 |
|
---|
1191 | case WM_COMMAND:
|
---|
1192 | if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
|
---|
1193 | WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
|
---|
1194 | return MRESULT( FALSE );
|
---|
1195 |
|
---|
1196 | case UM_SETTINGS2DIALOG:
|
---|
1197 | #ifdef _DOLOGDEBUG_
|
---|
1198 | LogDebug( "Page3Procedure: start UM_SETTINGS2DIALOG" );
|
---|
1199 | #endif
|
---|
1200 | // set state of checkbuttons
|
---|
1201 | pset->AdjustButton (hwnd, WID_CB_SERIALCAPTURE,
|
---|
1202 | pset->SerialCapture ());
|
---|
1203 | pset->AdjustButton (hwnd, WID_CB_DELAYCOUNTDOWN,
|
---|
1204 | pset->DelayCountdown ());
|
---|
1205 | pset->AdjustButton (hwnd, WID_CB_DOSOUND,
|
---|
1206 | pset->DoSound ());
|
---|
1207 | pset->AdjustButton (hwnd, WID_CB_IDLEPRIORITY,
|
---|
1208 | pset->QueryFlag(SEI_IDLEPRIORITY));
|
---|
1209 |
|
---|
1210 | // init delay time sb
|
---|
1211 | WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME, SPBM_SETLIMITS,
|
---|
1212 | MPFROMLONG (65536), MPFROMLONG (1));
|
---|
1213 | WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME, SPBM_SETCURRENTVALUE,
|
---|
1214 | MPFROMLONG (pset->QueryDelayTime ()), 0);
|
---|
1215 |
|
---|
1216 | // init serial time sb
|
---|
1217 | WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME, SPBM_SETLIMITS,
|
---|
1218 | MPFROMLONG (65536), MPFROMLONG (1));
|
---|
1219 | WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME, SPBM_SETCURRENTVALUE,
|
---|
1220 | MPFROMLONG (pset->QuerySerialTime ()), 0);
|
---|
1221 | #ifdef _DOLOGDEBUG_
|
---|
1222 | LogDebug( "Page3Procedure: end UM_SETTINGS2DIALOG" );
|
---|
1223 | #endif
|
---|
1224 | return MRESULT (FALSE);
|
---|
1225 |
|
---|
1226 | case UM_ADJUST:
|
---|
1227 | {
|
---|
1228 | #ifdef _DOLOGDEBUG_
|
---|
1229 | LogDebug( "Page3Procedure: start UM_ADJUST" );
|
---|
1230 | #endif
|
---|
1231 | // query state of checkbuttons and set flags
|
---|
1232 | pset->SerialCapture(WinQueryButtonCheckstate
|
---|
1233 | (hwnd, WID_CB_SERIALCAPTURE));
|
---|
1234 | #ifdef _DOLOGDEBUG_
|
---|
1235 | LogDebug( "Page3Procedure: checkpoint 1" );
|
---|
1236 | #endif
|
---|
1237 | pset->DelayCountdown(WinQueryButtonCheckstate
|
---|
1238 | (hwnd, WID_CB_DELAYCOUNTDOWN));
|
---|
1239 | pset->DoSound(WinQueryButtonCheckstate
|
---|
1240 | (hwnd, WID_CB_DOSOUND));
|
---|
1241 | pset->SetFlag(SEI_IDLEPRIORITY, WinQueryButtonCheckstate
|
---|
1242 | (hwnd, WID_CB_IDLEPRIORITY));
|
---|
1243 | #ifdef _DOLOGDEBUG_
|
---|
1244 | LogDebug( "Page3Procedure: checkpoint 2" );
|
---|
1245 | #endif
|
---|
1246 |
|
---|
1247 | // delay time
|
---|
1248 | ULONG ul;
|
---|
1249 | if (! BOOL (WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME,
|
---|
1250 | SPBM_QUERYVALUE,
|
---|
1251 | MPFROMP (&ul),
|
---|
1252 | MPFROM2SHORT (0, 0))))
|
---|
1253 | ul = 5L;
|
---|
1254 | pset->SetDelayTime (ul);
|
---|
1255 | #ifdef _DOLOGDEBUG_
|
---|
1256 | LogDebug( "Page3Procedure: checkpoint 3" );
|
---|
1257 | #endif
|
---|
1258 |
|
---|
1259 | // serial time
|
---|
1260 | if (! BOOL (WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME,
|
---|
1261 | SPBM_QUERYVALUE,
|
---|
1262 | MPFROMP (&ul),
|
---|
1263 | MPFROM2SHORT (0, 0))))
|
---|
1264 | ul = 10L;
|
---|
1265 | pset->SetSerialTime (ul);
|
---|
1266 | pset->bSerialCapture = pset->SerialCapture ();
|
---|
1267 | pset->idleSetInIni = pset->QueryFlag(SEI_IDLEPRIORITY);
|
---|
1268 |
|
---|
1269 | if (saveum)
|
---|
1270 | pset->Save ();
|
---|
1271 | #ifdef _DOLOGDEBUG_
|
---|
1272 | LogDebug( "Page3Procedure: end UM_ADJUST" );
|
---|
1273 | #endif
|
---|
1274 | }
|
---|
1275 | break;
|
---|
1276 |
|
---|
1277 | case WM_CONTROL:
|
---|
1278 | switch (SHORT1FROMMP (mp1))
|
---|
1279 | {
|
---|
1280 | case WID_CB_SERIALCAPTURE:
|
---|
1281 | {
|
---|
1282 | HWND hwndButton =
|
---|
1283 | WinWindowFromID (WinWindowFromID (hwndFrame, FID_CLIENT),
|
---|
1284 | WID_CB_DELAYEDCAPTURE);
|
---|
1285 | if (! WinSendDlgItemMsg (hwnd, WID_CB_SERIALCAPTURE,
|
---|
1286 | BM_QUERYCHECK, 0, 0))
|
---|
1287 | WinEnableWindow (hwndButton, TRUE);
|
---|
1288 | else
|
---|
1289 | WinEnableWindow (hwndButton, FALSE);
|
---|
1290 | }
|
---|
1291 | break;
|
---|
1292 | }
|
---|
1293 | return MRESULT (FALSE);
|
---|
1294 | }
|
---|
1295 |
|
---|
1296 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
1297 | }
|
---|
1298 |
|
---|
1299 | // ** Page4Procedure ****************************************************** /*FOLD00*/
|
---|
1300 |
|
---|
1301 | MRESULT EXPENTRY SETTINGS :: Page4Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1302 | {
|
---|
1303 | static PSETTINGS pset = NULL;
|
---|
1304 |
|
---|
1305 | switch (msg)
|
---|
1306 | {
|
---|
1307 | case WM_INITDLG:
|
---|
1308 | {
|
---|
1309 | #ifdef _DOLOGDEBUG_
|
---|
1310 | LogDebug( "Page4Procedure: start WM_INITDLG" );
|
---|
1311 | #endif
|
---|
1312 | pset = PSETTINGS (mp2);
|
---|
1313 |
|
---|
1314 | HMQ hmq = WinQueryWindowULong(hwnd /*WinWindowFromID(hwnd, ID_DLG_SETTINGSPAGE4)*/, QWL_HMQ);
|
---|
1315 | WinSetCp(hmq, 1207); // UPF-8 Unicode
|
---|
1316 | WinRemovePresParam(hwnd, PP_FONTNAMESIZE);
|
---|
1317 | #ifndef _QUIET_ //??
|
---|
1318 | pset->GetLanguages(WinWindowFromID (hwnd, WID_LB_LANGUAGES));
|
---|
1319 | #endif
|
---|
1320 | #ifdef _DOLOGDEBUG_
|
---|
1321 | LogDebug( "Page4Procedure: WM_INITDLG: after GetLanguages()" );
|
---|
1322 | #endif
|
---|
1323 | #ifndef _QUIET_
|
---|
1324 | WinSendMsg (hwnd, UM_SETTINGS2DIALOG, 0,0);
|
---|
1325 |
|
---|
1326 | if (pset->fAutoLanguage)
|
---|
1327 | WinEnableWindow (WinWindowFromID (hwnd, WID_ST_LANGNOTE),
|
---|
1328 | FALSE);
|
---|
1329 | #endif
|
---|
1330 | #ifdef _DOLOGDEBUG_
|
---|
1331 | LogDebug( "Page4Procedure: end WM_INITDLG" );
|
---|
1332 | #endif
|
---|
1333 |
|
---|
1334 | UniChar target[300];
|
---|
1335 | CHAR ucLangStr[300];
|
---|
1336 | UconvObject uconv_object866 = NULL;
|
---|
1337 | UconvObject uconv_object860 = NULL;
|
---|
1338 | UconvObject uconv_object852 = NULL;
|
---|
1339 | UconvObject uconv_object1207 = NULL;
|
---|
1340 | UconvObject uconv_object850 = NULL;
|
---|
1341 | int result;
|
---|
1342 | int i;
|
---|
1343 | HAB hab;
|
---|
1344 | CHAR ucFont[FACESIZE];
|
---|
1345 |
|
---|
1346 | UniCreateUconvObject((UniChar *)L"IBM-852", &uconv_object852);
|
---|
1347 | UniCreateUconvObject((UniChar *)L"IBM-850", &uconv_object850);
|
---|
1348 | UniCreateUconvObject((UniChar *)L"IBM-866", &uconv_object866);
|
---|
1349 |
|
---|
1350 | UniCreateUconvObject((UniChar *)L"IBM-1207", &uconv_object1207);
|
---|
1351 | for (i = 0; i < WID_ST_END - 400; i++) {
|
---|
1352 | WinLoadString(hab, g_hmod, LANG_COPYRIGHT + i, sizeof(ucLangStr), ucLangStr);
|
---|
1353 | if (pset->GetLangID() == 420 ||
|
---|
1354 | pset->GetLangID() == PL) {
|
---|
1355 |
|
---|
1356 | UniStrToUcs( uconv_object852, target, ucLangStr, 299);
|
---|
1357 | }
|
---|
1358 | else if (pset->GetLangID() == RU)
|
---|
1359 | UniStrToUcs( uconv_object866, target, ucLangStr, 299);
|
---|
1360 | else {
|
---|
1361 | UniStrToUcs( uconv_object850, target, ucLangStr, 299);
|
---|
1362 | }
|
---|
1363 | UniStrFromUcs( uconv_object1207, ucLangStr, target, 300);
|
---|
1364 | WinSetDlgItemText(hwnd, WID_ST_COPYRIGHT + i, ucLangStr);
|
---|
1365 | }
|
---|
1366 |
|
---|
1367 | if (uconv_object866)
|
---|
1368 | UniFreeUconvObject(uconv_object866);
|
---|
1369 | if (uconv_object852)
|
---|
1370 | UniFreeUconvObject(uconv_object852);
|
---|
1371 | if (uconv_object850)
|
---|
1372 | UniFreeUconvObject(uconv_object850);
|
---|
1373 | if (uconv_object1207)
|
---|
1374 | UniFreeUconvObject(uconv_object1207);
|
---|
1375 | CHAR *env, *p;
|
---|
1376 | env = getenv("OSDIR");
|
---|
1377 | p = env;
|
---|
1378 | p++;
|
---|
1379 | if (!stricmp(p, ":\\sys") || !stricmp(p, ":\\ecs")) {
|
---|
1380 | strcpy(ucFont, "9.Workplace Sans");
|
---|
1381 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
1382 | }
|
---|
1383 | else {
|
---|
1384 | strcpy(ucFont, "9.Times New Roman MT 30");
|
---|
1385 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
1386 | }
|
---|
1387 | return MRESULT (FALSE);
|
---|
1388 | }
|
---|
1389 |
|
---|
1390 | case WM_COMMAND:
|
---|
1391 | if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
|
---|
1392 | WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
|
---|
1393 | return MRESULT( FALSE );
|
---|
1394 | #ifndef _QUIET_
|
---|
1395 | case UM_SETTINGS2DIALOG:
|
---|
1396 | {
|
---|
1397 |
|
---|
1398 | #ifdef _DOLOGDEBUG_
|
---|
1399 | LogDebug( "Page4Procedure: start UM_SETTINGS2DIALOG" );
|
---|
1400 | #endif
|
---|
1401 | // select the appropriate entry in the language-listbox
|
---|
1402 | CHAR ach[_MAX_FNAME];
|
---|
1403 | HWND hwndLB = WinWindowFromID (hwnd, WID_LB_LANGUAGES);
|
---|
1404 | ULONG c, i;
|
---|
1405 |
|
---|
1406 | c = WinQueryLboxCount (hwndLB);
|
---|
1407 |
|
---|
1408 | for (i = 0; i < c; i++)
|
---|
1409 | {
|
---|
1410 | #ifdef _DOLOGDEBUG_
|
---|
1411 | LogDebug( "Page4Procedure: UM_SETTINGS2DIALOG: i.1 = %d", i );
|
---|
1412 | #endif
|
---|
1413 | PSZ psz = PSZ(WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES,
|
---|
1414 | LM_QUERYITEMHANDLE,
|
---|
1415 | MPFROMLONG(i), NULL));
|
---|
1416 |
|
---|
1417 | if (stricmp (pset->QueryString(SEI_LANGUAGE), psz) == 0)
|
---|
1418 | break;
|
---|
1419 | }
|
---|
1420 | #ifdef _DOLOGDEBUG_
|
---|
1421 | LogDebug( "Page4Procedure: UM_SETTINGS2DIALOG: after loop 1" );
|
---|
1422 | #endif
|
---|
1423 | if (i < c)
|
---|
1424 | WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES, LM_SELECTITEM,
|
---|
1425 | MPFROMSHORT (i), MPFROMSHORT (TRUE));
|
---|
1426 | else
|
---|
1427 | WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES, LM_SELECTITEM,
|
---|
1428 | MPFROMSHORT (0), MPFROMSHORT (TRUE));
|
---|
1429 | #ifdef _DOLOGDEBUG_
|
---|
1430 | LogDebug( "Page4Procedure: end UM_SETTINGS2DIALOG" );
|
---|
1431 | #endif
|
---|
1432 | }
|
---|
1433 | return MRESULT (FALSE);
|
---|
1434 | #endif
|
---|
1435 | case WM_DESTROY:
|
---|
1436 | #ifndef _QUIET_
|
---|
1437 | {
|
---|
1438 | CHAR ach[_MAX_FNAME];
|
---|
1439 | BOOL fChanged = TRUE;
|
---|
1440 |
|
---|
1441 | ULONG ul = USHORT (WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES,
|
---|
1442 | LM_QUERYSELECTION,
|
---|
1443 | MPFROMLONG (LIT_FIRST), 0L));
|
---|
1444 | PSZ psz = PSZ(WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES,
|
---|
1445 | LM_QUERYITEMHANDLE,
|
---|
1446 | MPFROMLONG(ul), NULL));
|
---|
1447 | if (stricmp (pset->QueryString(SEI_LANGUAGE), psz) == 0)
|
---|
1448 | fChanged = FALSE;
|
---|
1449 | else
|
---|
1450 | pset->SetString(SEI_LANGUAGE, psz);
|
---|
1451 |
|
---|
1452 | if (fChanged) {
|
---|
1453 | if (!stricmp(psz, "gotreses") || !stricmp(psz, "goqreses"))
|
---|
1454 | strcpy(ach, "gotcha_es");
|
---|
1455 | /*else if (!stricmp(psz, "gotresit") || !stricmp(psz, "goqresit"))
|
---|
1456 | strcpy(ach, "gotcha_it");*/
|
---|
1457 | else
|
---|
1458 | strcpy(ach, "gotcha_en");
|
---|
1459 | pset->SetString (SEI_LANGUAGEHELP, ach);
|
---|
1460 | }
|
---|
1461 | if (saveum && fChanged) {
|
---|
1462 | pset->Save ();
|
---|
1463 | #ifdef _QUIET_
|
---|
1464 | HINI hini = PrfOpenProfile (hab, "gotchaq.ini");
|
---|
1465 | #else
|
---|
1466 | HINI hini = PrfOpenProfile (hab, "gotcha.ini");
|
---|
1467 | #endif
|
---|
1468 | BOOL fLChanged = TRUE;
|
---|
1469 | PrfWriteProfileData(hini, "Language", "LangChangeRequested", &fLChanged, sizeof(BOOL));
|
---|
1470 | if (hini)
|
---|
1471 | PrfCloseProfile (hini);
|
---|
1472 | }
|
---|
1473 | }
|
---|
1474 | #endif
|
---|
1475 | return MRESULT (FALSE);
|
---|
1476 | }
|
---|
1477 |
|
---|
1478 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
1479 | }
|
---|
1480 |
|
---|
1481 | // ** AdjustSaveTypeButtons *********************************************** /*FOLD00*/
|
---|
1482 |
|
---|
1483 | VOID AdjustSaveTypeButtons (BOOL f)
|
---|
1484 | {
|
---|
1485 | HWND hwndClient = WinWindowFromID (hwndFrame, FID_CLIENT);
|
---|
1486 |
|
---|
1487 | // FIXME um, em, global variables :-$
|
---|
1488 | WinEnableWindow (WinWindowFromID (hwndClient, WID_RB_CLIPBOARD), !f);
|
---|
1489 | WinEnableWindow (WinWindowFromID (hwndClient, WID_RB_FILE), !f);
|
---|
1490 | }
|
---|
1491 |
|
---|
1492 | // ** QueryWindowData ***************************************************** /*FOLD00*/
|
---|
1493 |
|
---|
1494 | VOID SETTINGS :: QueryWindowData (SWP *pswp, USHORT us[7], BOOL f)
|
---|
1495 | {
|
---|
1496 | // FIXME puke, yukk, choke! get this flag thing away! do it better!
|
---|
1497 | // FIXME what is with US?
|
---|
1498 | if (f)
|
---|
1499 | memcpy (pswp, QueryBinary(SEI_SWPSSW), sizeof (SWP));
|
---|
1500 | else
|
---|
1501 | memcpy (pswp, QueryBinary(SEI_SWP), sizeof (SWP));
|
---|
1502 |
|
---|
1503 | LONG cx, cy;
|
---|
1504 | cx = WinQuerySysValue (HWND_DESKTOP, SV_CXSCREEN);
|
---|
1505 | cy = WinQuerySysValue (HWND_DESKTOP, SV_CYSCREEN);
|
---|
1506 |
|
---|
1507 | if (pswp->cx < 32)
|
---|
1508 | pswp->cx = 32;
|
---|
1509 | // bigger than screen?
|
---|
1510 | if (pswp->cx > cx)
|
---|
1511 | pswp->cx = cx;
|
---|
1512 | // partly outside of screen?
|
---|
1513 | if (pswp->x+pswp->cx >= cx)
|
---|
1514 | pswp->x = cx-pswp->cx;
|
---|
1515 | if (pswp->cy < 32)
|
---|
1516 | pswp->cy = 32;
|
---|
1517 | // bigger than screen?
|
---|
1518 | if (pswp->cy > cy)
|
---|
1519 | pswp->cy = cy;
|
---|
1520 | // partly outside of screen?
|
---|
1521 | if (pswp->y+pswp->cy >= cy)
|
---|
1522 | pswp->y = cy-pswp->cy;
|
---|
1523 | }
|
---|
1524 |
|
---|
1525 | // ** ReloadResources ***************************************************** /*FOLD00*/
|
---|
1526 |
|
---|
1527 | BOOL Settings :: ReloadResources (PSZ psz)
|
---|
1528 | {
|
---|
1529 | if (g_hmod)
|
---|
1530 | DosFreeModule(g_hmod);
|
---|
1531 |
|
---|
1532 | APIRET rc;
|
---|
1533 |
|
---|
1534 | if ((rc = DosLoadModule(PSZ(NULL), 0, psz, &g_hmod)))
|
---|
1535 | {
|
---|
1536 | DisplayError("Error",
|
---|
1537 | "Could not (re)load resource module '%s' (return code %d). "
|
---|
1538 | "Make sure the DLL is in the LIBPATH. If this is the case, "
|
---|
1539 | "try deleting GOTCHA.INI and restart. If this fails, contact "
|
---|
1540 | "the author (ygk@qwest.net).", psz, rc);
|
---|
1541 | exit(1);
|
---|
1542 | }
|
---|
1543 | PVOID pv;
|
---|
1544 | INT Lang;
|
---|
1545 |
|
---|
1546 | DosGetResource(g_hmod, RT_RCDATA, LANG_ID, &pv);
|
---|
1547 | Lang = atoi((PCHAR) pv);
|
---|
1548 | SetLangID(Lang);
|
---|
1549 | ResourceString::Module(g_hmod);
|
---|
1550 | #ifdef _QUIET_
|
---|
1551 | pszPageTab[0] = RSTR (IDS_MAINWIN);
|
---|
1552 | pszPageTab[1] = RSTR (IDS_CAPTURE );
|
---|
1553 | pszPageTab[2] = RSTR (IDS_PAGESAVE);
|
---|
1554 | pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);
|
---|
1555 | #else
|
---|
1556 | pszPageTab[0] = RSTR (IDS_PAGESAVE);
|
---|
1557 | pszPageTab[1] = RSTR (IDS_PAGESNAPSHOT);
|
---|
1558 | pszPageTab[2] = RSTR (IDS_CAPTURE );
|
---|
1559 | pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);
|
---|
1560 | #endif
|
---|
1561 | for( int i = 0; i < BMF_INVALID; i++ ) {
|
---|
1562 | ifi[ i ].label = RSTR ( IDS_BMF_JPG+i ); }
|
---|
1563 |
|
---|
1564 | return TRUE;
|
---|
1565 | }
|
---|
1566 |
|
---|
1567 | // ** SelectLanguage ****************************************************** /*FOLD00*/
|
---|
1568 | #ifndef _QUIET_
|
---|
1569 | VOID Settings :: SelectLanguage (VOID)
|
---|
1570 | {
|
---|
1571 | // set this to some default, as we must open the settings dialog for
|
---|
1572 | // selecting a language
|
---|
1573 | #ifdef _QUIET_
|
---|
1574 | //#if 1
|
---|
1575 | pszPageTab[0] = RSTR (IDS_MAINWIN);
|
---|
1576 | pszPageTab[1] = RSTR (IDS_CAPTURE );
|
---|
1577 | pszPageTab[2] = RSTR (IDS_PAGESAVE);
|
---|
1578 | pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);
|
---|
1579 | #else
|
---|
1580 | pszPageTab[0] = RSTR (IDS_PAGESAVE);
|
---|
1581 | pszPageTab[1] = RSTR (IDS_PAGESNAPSHOT);
|
---|
1582 | pszPageTab[2] = RSTR (IDS_CAPTURE );
|
---|
1583 | pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);
|
---|
1584 | #endif
|
---|
1585 | // bring up the "select language" settings page
|
---|
1586 | Dialog (TRUE);
|
---|
1587 | }
|
---|
1588 | #endif
|
---|
1589 |
|
---|
1590 | // ** GetLanguages ******************************************************** /*FOLD00*/
|
---|
1591 | #ifndef _QUIET_ //??
|
---|
1592 | USHORT Settings :: GetLanguages (HWND hwnd)
|
---|
1593 | {
|
---|
1594 | // find all dlls and add the names to the language list
|
---|
1595 | HDIR hdir;
|
---|
1596 | ULONG c, fl, ul;
|
---|
1597 | FILEFINDBUF3 findbuf;
|
---|
1598 | APIRET rc;
|
---|
1599 | PSZ psz;
|
---|
1600 | HMODULE hmod;
|
---|
1601 |
|
---|
1602 | fl = FILE_NORMAL;
|
---|
1603 | hdir = HDIR_CREATE;
|
---|
1604 | c = 1;
|
---|
1605 | #ifdef _QUIET_
|
---|
1606 | rc = DosFindFirst ("goqres*.dll", &hdir, fl, &findbuf,
|
---|
1607 | sizeof (findbuf), &c, FIL_STANDARD);
|
---|
1608 | #else
|
---|
1609 | rc = DosFindFirst ("gotres*.dll", &hdir, fl, &findbuf,
|
---|
1610 | sizeof (findbuf), &c, FIL_STANDARD);
|
---|
1611 | #endif
|
---|
1612 | while (!rc)
|
---|
1613 | {
|
---|
1614 | // we don't want the extension
|
---|
1615 | if ((psz = strchr (findbuf.achName, '.')))
|
---|
1616 | *psz = '\0';
|
---|
1617 | // try opening the dll and read the version etc. data
|
---|
1618 | if ((rc = DosLoadModule(PSZ(NULL), 0, findbuf.achName, &hmod)) == NO_ERROR) {
|
---|
1619 | PVOID pv;
|
---|
1620 | PVOID pl;
|
---|
1621 |
|
---|
1622 | if (DosGetResource(hmod, RT_RCDATA, DLL_ID, &pv) == NO_ERROR) {
|
---|
1623 | #ifdef _QUIET_
|
---|
1624 | if (strcmp(PSZ(pv), "Gotchaq!") == 0) {
|
---|
1625 | #else
|
---|
1626 | if (strcmp(PSZ(pv), "Gotcha!") == 0) {
|
---|
1627 | #endif
|
---|
1628 | psz = PSZ(pv)+strlen(PSZ(pv)) + 3;
|
---|
1629 |
|
---|
1630 | INT Lang;
|
---|
1631 |
|
---|
1632 | DosGetResource(hmod, RT_RCDATA, LANG_ID, &pl);
|
---|
1633 | Lang = atoi((PCHAR) pl);
|
---|
1634 | #if 1
|
---|
1635 | UniChar target[300];
|
---|
1636 | CHAR ucLangStr[300];
|
---|
1637 | UconvObject uconv_object866 = NULL;
|
---|
1638 | UconvObject uconv_object852 = NULL;
|
---|
1639 | UconvObject uconv_object1207 = NULL;
|
---|
1640 | UconvObject uconv_object850 = NULL;
|
---|
1641 | int i;
|
---|
1642 |
|
---|
1643 | strcpy(ucLangStr, psz);
|
---|
1644 | UniCreateUconvObject((UniChar *)L"IBM-852", &uconv_object852);
|
---|
1645 | UniCreateUconvObject((UniChar *)L"IBM-850", &uconv_object850);
|
---|
1646 | UniCreateUconvObject((UniChar *)L"IBM-866", &uconv_object866);
|
---|
1647 | UniCreateUconvObject((UniChar *)L"IBM-1207", &uconv_object1207);
|
---|
1648 |
|
---|
1649 | if (Lang == CZ) {
|
---|
1650 | UniStrToUcs( uconv_object852, target, ucLangStr, 299);
|
---|
1651 | }
|
---|
1652 | else if (Lang == RU) {
|
---|
1653 | UniStrToUcs( uconv_object866, target, ucLangStr, 299);
|
---|
1654 | }
|
---|
1655 | else {
|
---|
1656 | UniStrToUcs( uconv_object850, target, ucLangStr, 299);
|
---|
1657 | }
|
---|
1658 | UniStrFromUcs( uconv_object1207, ucLangStr, target, 300);
|
---|
1659 | Lang = 0;
|
---|
1660 | if (uconv_object866)
|
---|
1661 | UniFreeUconvObject(uconv_object866);
|
---|
1662 | if (uconv_object852)
|
---|
1663 | UniFreeUconvObject(uconv_object852);
|
---|
1664 | if (uconv_object850)
|
---|
1665 | UniFreeUconvObject(uconv_object850);
|
---|
1666 | if (uconv_object1207)
|
---|
1667 | UniFreeUconvObject(uconv_object1207);
|
---|
1668 |
|
---|
1669 |
|
---|
1670 | #endif
|
---|
1671 | ul = WinInsertLboxItem (hwnd, LIT_END,/*psz*/ucLangStr);
|
---|
1672 | WinSendMsg(hwnd, LM_SETITEMHANDLE, MPFROMLONG(ul),
|
---|
1673 | MPFROMP (strdup(findbuf.achName)));
|
---|
1674 | }
|
---|
1675 | if (pl)
|
---|
1676 | DosFreeResource(pl);
|
---|
1677 | DosFreeResource(pv);
|
---|
1678 | }
|
---|
1679 | DosFreeModule(hmod);
|
---|
1680 | }
|
---|
1681 | c = 1;
|
---|
1682 | rc = DosFindNext (hdir, &findbuf, sizeof (findbuf), &c);
|
---|
1683 | }
|
---|
1684 | DosFindClose (hdir);
|
---|
1685 |
|
---|
1686 | return 1;
|
---|
1687 | }
|
---|
1688 | #endif
|
---|
1689 | // ** GetFileExtension **************************************************** /*FOLD00*/
|
---|
1690 |
|
---|
1691 | PSZ Settings :: GetFileExtension( SHORT type )
|
---|
1692 | {
|
---|
1693 | if( type == BMF_INVALID )
|
---|
1694 | type = SHORT( QueryFileFormat() );
|
---|
1695 | if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
|
---|
1696 | return ifi[ type ].extension;
|
---|
1697 | return "";
|
---|
1698 | }
|
---|
1699 |
|
---|
1700 | #if 0
|
---|
1701 | // ** GetFOURCC *********************************************************** /*FOLD00*/
|
---|
1702 |
|
---|
1703 | FOURCC Settings :: GetFOURCC( SHORT type )
|
---|
1704 | {
|
---|
1705 | if( type == BMF_INVALID )
|
---|
1706 | type = SHORT( QueryFileFormat() );
|
---|
1707 | if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
|
---|
1708 | return ifi[ type ].fourcc;
|
---|
1709 | return 0L;
|
---|
1710 | }
|
---|
1711 | #endif
|
---|
1712 | // ** GetFileEAType ******************************************************* /*FOLD00*/
|
---|
1713 |
|
---|
1714 | PSZ Settings :: GetFileEAType( SHORT type )
|
---|
1715 | {
|
---|
1716 | if( type == BMF_INVALID )
|
---|
1717 | type = SHORT( QueryFileFormat() );
|
---|
1718 | if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
|
---|
1719 | return ifi[ type ].eaType;
|
---|
1720 | return "";
|
---|
1721 | }
|
---|
1722 |
|
---|
1723 | // ************************************************************************
|
---|
1724 |
|
---|
1725 | PSZ Settings :: QueryNumSaveDir( VOID )
|
---|
1726 | {
|
---|
1727 | // Using a static buffer here is not really good, but good enough
|
---|
1728 | // currently as we know there will be no concurrent access.
|
---|
1729 | static CHAR ach[_MAX_PATH];
|
---|
1730 |
|
---|
1731 | if( strspn( QueryString( SEI_NUMSAVEDIR ), " \t\n\r" ) ==
|
---|
1732 | strlen( QueryString( SEI_NUMSAVEDIR ) ) )
|
---|
1733 | return getcwd( ach, _MAX_PATH );
|
---|
1734 | return QueryString( SEI_NUMSAVEDIR );
|
---|
1735 | }
|
---|