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 | #ifdef _DOLOGDEBUG_
|
---|
471 | LogDebug( "DialogProcedure: start WM_INITDLG" );
|
---|
472 | #endif
|
---|
473 | pset = PSETTINGS (mp2);
|
---|
474 | #ifdef _DOLOGDEBUG_
|
---|
475 | LogDebug( "DialogProcedure: end WM_INITDLG" );
|
---|
476 | #endif
|
---|
477 | CHAR ucFont[FACESIZE];
|
---|
478 |
|
---|
479 | if (pset->GetLangID() == CZ || pset->GetLangID() == RU || pset->GetLangID() == PL) {
|
---|
480 | UniChar target[300];
|
---|
481 | CHAR ucLangStr[300];
|
---|
482 | UconvObject uconv_object866 = NULL;
|
---|
483 | UconvObject uconv_object860 = 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 | strcpy(ucFont, "9.Times New Roman MT 30");
|
---|
544 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
545 | }
|
---|
546 | else if (g_installer) {
|
---|
547 | strcpy(ucFont, "9.WarpSans");
|
---|
548 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
549 | }
|
---|
550 | return MRESULT (FALSE);
|
---|
551 |
|
---|
552 | case WM_COMMAND:
|
---|
553 | switch (SHORT1FROMMP (mp1))
|
---|
554 | {
|
---|
555 | #if 1
|
---|
556 | case WID_PB_HELP:{
|
---|
557 | HWND hwndPage;
|
---|
558 | USHORT usDlgId;
|
---|
559 | ULONG ulPageId =
|
---|
560 | (ULONG) WinSendMsg(WinWindowFromID(hwnd, WID_NB_SETTINGS),
|
---|
561 | BKM_QUERYPAGEID, 0, MPFROM2SHORT(BKA_TOP,
|
---|
562 | 0));
|
---|
563 | hwndPage =
|
---|
564 | LONGFROMMP(WinSendMsg
|
---|
565 | (WinWindowFromID(hwnd, WID_NB_SETTINGS),
|
---|
566 | BKM_QUERYPAGEWINDOWHWND, MPFROMLONG(ulPageId),
|
---|
567 | 0));
|
---|
568 | usDlgId = WinQueryWindowUShort(hwndPage, QWS_ID);
|
---|
569 |
|
---|
570 | HMQ hmq;
|
---|
571 | BOOL bUniCodeFont = FALSE;
|
---|
572 | CHAR ucFont[FACESIZE];
|
---|
573 |
|
---|
574 | if (pset->GetLangID() == RU) {
|
---|
575 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
576 | WinSetCp(hmq, 866);
|
---|
577 | bUniCodeFont = TRUE;
|
---|
578 | }
|
---|
579 | else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
|
---|
580 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
581 | WinSetCp(hmq, 852);
|
---|
582 | bUniCodeFont = TRUE;
|
---|
583 | }
|
---|
584 | else {
|
---|
585 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
586 | WinSetCp(hmq, 850);
|
---|
587 | }
|
---|
588 | if (usDlgId == ID_DLG_SETTINGSPAGE0)
|
---|
589 | g_phelp->DisplayPanel(2);
|
---|
590 | else if (usDlgId == ID_DLG_SETTINGSPAGE1)
|
---|
591 | g_phelp->DisplayPanel(2210);
|
---|
592 | #ifdef _QUIET_
|
---|
593 | else if (usDlgId == ID_DLG_SETTINGSPAGE2 && (pset->GetLangID() != IT &&
|
---|
594 | pset->GetLangID() != BR))
|
---|
595 | g_phelp->DisplayPanel(2235);
|
---|
596 | #else
|
---|
597 | else if (usDlgId == ID_DLG_SETTINGSPAGE2)
|
---|
598 | g_phelp->DisplayPanel(3);
|
---|
599 | #endif
|
---|
600 | else if (usDlgId == ID_DLG_SETTINGSPAGE3)
|
---|
601 | g_phelp->DisplayPanel(2230);
|
---|
602 | else if (usDlgId == ID_DLG_SETTINGSPAGE4)
|
---|
603 | g_phelp->DisplayPanel(2240);
|
---|
604 | else
|
---|
605 | g_phelp->DisplayPanel(4);
|
---|
606 | break;
|
---|
607 | }
|
---|
608 | #endif
|
---|
609 | case WID_PB_OK:
|
---|
610 | #ifdef _DOLOGDEBUG_
|
---|
611 | LogDebug( "DialogProcedure: start WID_PB_OK" );
|
---|
612 | #endif
|
---|
613 | saveum = TRUE;
|
---|
614 | WinSendMsg (hwnd, WM_CLOSE, 0,0);
|
---|
615 | #ifdef _DOLOGDEBUG_
|
---|
616 | LogDebug( "DialogProcedure: end WID_PB_OK" );
|
---|
617 | #endif
|
---|
618 | break;
|
---|
619 |
|
---|
620 | case WID_PB_UNDO:
|
---|
621 | {
|
---|
622 | ULONG id = (ULONG)
|
---|
623 | WinSendDlgItemMsg (hwnd, WID_NB_SETTINGS,
|
---|
624 | BKM_QUERYPAGEID, 0,
|
---|
625 | MPFROM2SHORT (BKA_TOP, 0));
|
---|
626 | if (id)
|
---|
627 | {
|
---|
628 | HWND hwndPage = (HWND)
|
---|
629 | WinSendDlgItemMsg (hwnd, WID_NB_SETTINGS,
|
---|
630 | BKM_QUERYPAGEWINDOWHWND,
|
---|
631 | MPFROMLONG (id), 0);
|
---|
632 | // Make mp1 1 for default use it to select setting on pages
|
---|
633 | WinSendMsg (hwndPage, UM_SETTINGS2DIALOG, 0,0);
|
---|
634 | }
|
---|
635 | }
|
---|
636 | break;
|
---|
637 | #ifndef _QUIET_
|
---|
638 | case WID_PB_ABOUT:
|
---|
639 | AboutBox (hwnd);
|
---|
640 | break;
|
---|
641 | #endif
|
---|
642 | case DID_CANCEL:
|
---|
643 | {
|
---|
644 | // Undo stuff on all notebook pages:
|
---|
645 | HWND hwndPage;
|
---|
646 |
|
---|
647 | // Get ID of first notebook page.
|
---|
648 | ULONG id =
|
---|
649 | ULONG( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
|
---|
650 | BKM_QUERYPAGEID, 0,
|
---|
651 | MPFROM2SHORT( BKA_FIRST, 0 ) ) );
|
---|
652 | if( id ) {
|
---|
653 | hwndPage =
|
---|
654 | HWND( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
|
---|
655 | BKM_QUERYPAGEWINDOWHWND,
|
---|
656 | MPFROMLONG( id ), 0 ) );
|
---|
657 | WinSendMsg( hwndPage, UM_SETTINGS2DIALOG, 0,0 );
|
---|
658 | }
|
---|
659 |
|
---|
660 | while( id ) {
|
---|
661 | // Get ID of next notebook page.
|
---|
662 | if( ( id =
|
---|
663 | ULONG( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
|
---|
664 | BKM_QUERYPAGEID,
|
---|
665 | MPFROMLONG( id ),
|
---|
666 | MPFROM2SHORT( BKA_NEXT, 0 )
|
---|
667 | ) ) ) ) {
|
---|
668 | hwndPage =
|
---|
669 | HWND( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
|
---|
670 | BKM_QUERYPAGEWINDOWHWND,
|
---|
671 | MPFROMLONG( id ), 0 ) );
|
---|
672 | WinSendMsg( hwndPage, UM_SETTINGS2DIALOG, 0,0 );
|
---|
673 | }
|
---|
674 | }
|
---|
675 | WinSendMsg( hwnd, WM_CLOSE, 0,0 );
|
---|
676 | }
|
---|
677 | break;
|
---|
678 | }
|
---|
679 | return MRESULT (FALSE);
|
---|
680 |
|
---|
681 | #ifdef _DOLOGDEBUG_
|
---|
682 | case WM_DESTROY:
|
---|
683 | LogDebug( "DialogProcedure: WM_DESTROY" );
|
---|
684 | return MRESULT (FALSE);
|
---|
685 | #endif
|
---|
686 |
|
---|
687 | case WM_CLOSE:
|
---|
688 | #ifdef _DOLOGDEBUG_
|
---|
689 | LogDebug( "DialogProcedure: WM_CLOSE" );
|
---|
690 | #endif
|
---|
691 | case WM_QUIT:
|
---|
692 | #ifdef _DOLOGDEBUG_
|
---|
693 | LogDebug( "DialogProcedure: WM_QUIT" );
|
---|
694 | #endif
|
---|
695 | case WM_SAVEAPPLICATION:
|
---|
696 | #ifdef _DOLOGDEBUG_
|
---|
697 | LogDebug( "DialogProcedure: WM_SAVEAPPLICATION" );
|
---|
698 | #endif
|
---|
699 | #ifdef _DOLOGDEBUG_
|
---|
700 | LogDebug( "DialogProcedure: start WM_CLOSE (or WM_QUIT, WM_SAVEAPPLICATION)" );
|
---|
701 | #endif
|
---|
702 | for (USHORT i = 0; i < COUNT_PAGES; i++)
|
---|
703 | WinSendMsg (pset->hwndPage[i], UM_ADJUST, 0,0);
|
---|
704 | #ifdef _DOLOGDEBUG_
|
---|
705 | LogDebug( "DialogProcedure: end WM_CLOSE (or WM_QUIT, WM_SAVEAPPLICATION)" );
|
---|
706 | #endif
|
---|
707 | WinDismissDlg( hwnd, 0L );
|
---|
708 | return MRESULT (FALSE);
|
---|
709 | }
|
---|
710 |
|
---|
711 | #ifdef _DOLOGDEBUG_
|
---|
712 | LogDebug( "DialogProcedure:WinDefDlgProc->0x%04x", msg );
|
---|
713 | #endif
|
---|
714 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
715 | }
|
---|
716 |
|
---|
717 | // ** Page1Procedure ****************************************************** /*FOLD00*/
|
---|
718 |
|
---|
719 | MRESULT EXPENTRY SETTINGS :: Page1Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
720 | {
|
---|
721 | static PSETTINGS pset = NULL;
|
---|
722 |
|
---|
723 | switch (msg)
|
---|
724 | {
|
---|
725 | case WM_INITDLG: {
|
---|
726 | #ifdef _DOLOGDEBUG_
|
---|
727 | LogDebug( "Page1Procedure: start WM_INITDLG" );
|
---|
728 | #endif
|
---|
729 | ULONG ul;
|
---|
730 | pset = PSETTINGS (mp2);
|
---|
731 | for( int i = 0; i < BMF_INVALID; i++ ) {
|
---|
732 | if( pset->ifi[ i ].available ) {
|
---|
733 | ul = WinInsertLboxItem( WinWindowFromID( hwnd, WID_LB_FILEFORMAT ),
|
---|
734 | LIT_END, pset->ifi[ i ].label );
|
---|
735 | WinSendMsg( WinWindowFromID( hwnd, WID_LB_FILEFORMAT ),
|
---|
736 | LM_SETITEMHANDLE, MPFROMLONG(ul), MPFROMP( i ) );
|
---|
737 | }
|
---|
738 | }
|
---|
739 | HMQ hmq;
|
---|
740 | BOOL bUniCodeFont = FALSE;
|
---|
741 | CHAR ucFont[FACESIZE];
|
---|
742 |
|
---|
743 | if (pset->GetLangID() == RU) {
|
---|
744 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
745 | WinSetCp(hmq, 866);
|
---|
746 | bUniCodeFont = TRUE;
|
---|
747 | }
|
---|
748 | else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
|
---|
749 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
750 | WinSetCp(hmq, 852);
|
---|
751 | bUniCodeFont = TRUE;
|
---|
752 | }
|
---|
753 | else {
|
---|
754 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
755 | WinSetCp(hmq, 850);
|
---|
756 | }
|
---|
757 |
|
---|
758 | if (bUniCodeFont) {
|
---|
759 | strcpy(ucFont, "9.Times New Roman MT 30");
|
---|
760 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
761 | }
|
---|
762 | else if (g_installer) {
|
---|
763 | strcpy(ucFont, "9.WarpSans");
|
---|
764 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
765 | }
|
---|
766 |
|
---|
767 | #ifdef _DOLOGDEBUG_
|
---|
768 | LogDebug( "Page1Procedure: end WM_INITDLG" );
|
---|
769 | #endif
|
---|
770 | return MRESULT (FALSE);
|
---|
771 | }
|
---|
772 |
|
---|
773 | case WM_COMMAND:
|
---|
774 | if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
|
---|
775 | WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
|
---|
776 | return MRESULT( FALSE );
|
---|
777 |
|
---|
778 | case UM_SETTINGS2DIALOG: {
|
---|
779 | #ifdef _DOLOGDEBUG_
|
---|
780 | LogDebug( "Page1Procedure: start UM_SETTINGS2DIALOG" );
|
---|
781 | #endif
|
---|
782 | // set num save dir name
|
---|
783 | WinSendDlgItemMsg (hwnd, WID_E_NUMSAVEDIR, EM_SETTEXTLIMIT,
|
---|
784 | MPARAM (_MAX_PATH-1), (MPARAM)0);
|
---|
785 | WinSetDlgItemText (hwnd, WID_E_NUMSAVEDIR,
|
---|
786 | pset->QueryNumSaveDir ());
|
---|
787 | WinSendDlgItemMsg (hwnd, WID_E_NUMSAVEDIR, EM_SETSEL,
|
---|
788 | MPFROM2SHORT (0, _MAX_PATH), (MPARAM)0);
|
---|
789 |
|
---|
790 | // set force file name
|
---|
791 | WinSendDlgItemMsg (hwnd, WID_E_FORCESAVEFILE, EM_SETTEXTLIMIT,
|
---|
792 | MPARAM (_MAX_PATH-1), (MPARAM)0);
|
---|
793 | WinSetDlgItemText (hwnd, WID_E_FORCESAVEFILE,
|
---|
794 | pset->QueryForceSaveFile ());
|
---|
795 | WinSendDlgItemMsg (hwnd, WID_E_FORCESAVEFILE, EM_SETSEL,
|
---|
796 | MPFROM2SHORT (0, _MAX_PATH), (MPARAM)0);
|
---|
797 |
|
---|
798 | // Select the appropriate entry in the fileformat-listbox.
|
---|
799 | HWND hwndLB = WinWindowFromID( hwnd, WID_LB_FILEFORMAT );
|
---|
800 | ULONG c, i;
|
---|
801 |
|
---|
802 | c = WinQueryLboxCount( hwndLB );
|
---|
803 | for( i = 0; i < c; i++ )
|
---|
804 | {
|
---|
805 | ULONG type = ULONG( WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT,
|
---|
806 | LM_QUERYITEMHANDLE,
|
---|
807 | MPFROMLONG(i), NULL ) );
|
---|
808 | if( type == ULONG( pset->QueryFileFormat() ) )
|
---|
809 | break;
|
---|
810 | }
|
---|
811 | if( i < c )
|
---|
812 | WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT, LM_SELECTITEM,
|
---|
813 | MPFROMSHORT(i), MPFROMSHORT(TRUE) );
|
---|
814 | else
|
---|
815 | WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT, LM_SELECTITEM,
|
---|
816 | MPFROMSHORT(0), MPFROMSHORT(TRUE) );
|
---|
817 | #ifdef _QUIET_
|
---|
818 | // set play sound button
|
---|
819 | pset->AdjustButton (hwnd, WID_CB_DOSOUND,
|
---|
820 | pset->DoSound ());
|
---|
821 | #endif
|
---|
822 | // Select appropriate radiobutton for save style.
|
---|
823 | switch (pset->QueryFileSaveStyle ())
|
---|
824 | {
|
---|
825 | case FSS_NUMFILES:
|
---|
826 | WinSendDlgItemMsg (hwnd, WID_RB_FSSNUMFILES, BM_CLICK,
|
---|
827 | MPFROMSHORT(TRUE), 0);
|
---|
828 | AdjustSaveTypeButtons (FALSE);
|
---|
829 | break;
|
---|
830 |
|
---|
831 | case FSS_FORCEFILE:
|
---|
832 | WinSendDlgItemMsg (hwnd, WID_RB_FSSFORCEFILE, BM_CLICK,
|
---|
833 | MPFROMSHORT(TRUE), 0);
|
---|
834 | AdjustSaveTypeButtons (TRUE);
|
---|
835 | break;
|
---|
836 |
|
---|
837 | default:
|
---|
838 | WinSendDlgItemMsg (hwnd, WID_RB_FSSPROMPT, BM_CLICK,
|
---|
839 | MPFROMSHORT(TRUE), 0);
|
---|
840 | AdjustSaveTypeButtons (FALSE);
|
---|
841 | break;
|
---|
842 | }
|
---|
843 | #ifdef _DOLOGDEBUG_
|
---|
844 | LogDebug( "Page1Procedure: end UM_SETTINGS2DIALOG" );
|
---|
845 | #endif
|
---|
846 | return MRESULT (FALSE);
|
---|
847 | }
|
---|
848 |
|
---|
849 | case UM_ADJUST:
|
---|
850 | {
|
---|
851 | #ifdef _DOLOGDEBUG_
|
---|
852 | LogDebug( "Page1Procedure: start UM_ADJUST" );
|
---|
853 | #endif
|
---|
854 | // get file save style
|
---|
855 | if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_FSSNUMFILES),
|
---|
856 | BM_QUERYCHECK, 0,0))
|
---|
857 | pset->SetFileSaveStyle (FSS_NUMFILES);
|
---|
858 | else if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_FSSFORCEFILE),
|
---|
859 | BM_QUERYCHECK, 0,0))
|
---|
860 | pset->SetFileSaveStyle (FSS_FORCEFILE);
|
---|
861 | else
|
---|
862 | pset->SetFileSaveStyle (FSS_PROMPT);
|
---|
863 | #ifdef _QUIET_
|
---|
864 | pset->DoSound(WinQueryButtonCheckstate
|
---|
865 | (hwnd, WID_CB_DOSOUND));
|
---|
866 | #endif
|
---|
867 | #ifdef _DOLOGDEBUG_
|
---|
868 | LogDebug( "Page1Procedure: checkpoint 1" );
|
---|
869 | #endif
|
---|
870 |
|
---|
871 | // Get file format.
|
---|
872 | ULONG ul = USHORT( WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT,
|
---|
873 | LM_QUERYSELECTION,
|
---|
874 | MPFROMLONG( LIT_FIRST ),
|
---|
875 | 0L ) );
|
---|
876 | ul = ULONG( WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT,
|
---|
877 | LM_QUERYITEMHANDLE,
|
---|
878 | MPFROMLONG( ul ), NULL ) );
|
---|
879 | pset->SetFileFormat( SHORT( ul ) );
|
---|
880 |
|
---|
881 | pset->SetSaveFile(AddExtensionToFilename(pset->QuerySaveFile()));
|
---|
882 |
|
---|
883 | #ifdef _DOLOGDEBUG_
|
---|
884 | LogDebug( "Page1Procedure: checkpoint 2" );
|
---|
885 | #endif
|
---|
886 |
|
---|
887 | // num save dir file name
|
---|
888 | CHAR psz[_MAX_PATH];
|
---|
889 | WinQueryDlgItemText (hwnd, WID_E_NUMSAVEDIR, _MAX_PATH, psz);
|
---|
890 | pset->SetNumSaveDir (psz);
|
---|
891 |
|
---|
892 | // force file name
|
---|
893 | WinQueryDlgItemText (hwnd, WID_E_FORCESAVEFILE, _MAX_PATH, psz);
|
---|
894 | pset->SetForceSaveFile (psz);
|
---|
895 |
|
---|
896 | AdjustSaveTypeButtons
|
---|
897 | (BOOL (pset->QueryFileSaveStyle () == FSS_FORCEFILE));
|
---|
898 | pset->saveStyle = pset->QuerySaveStyle ();
|
---|
899 | pset->pNumSaveDir = pset->QueryNumSaveDir ();
|
---|
900 | pset->pForceSaveFile = pset->QueryForceSaveFile();
|
---|
901 |
|
---|
902 | if (saveum)
|
---|
903 | pset->Save ();
|
---|
904 | #ifdef _DOLOGDEBUG_
|
---|
905 | LogDebug( "Page1Procedure: end UM_ADJUST" );
|
---|
906 | #endif
|
---|
907 | }
|
---|
908 | break;
|
---|
909 |
|
---|
910 | case WM_CONTROL:
|
---|
911 | switch (SHORT1FROMMP (mp1))
|
---|
912 | {
|
---|
913 | case WID_RB_FSSFORCEFILE:
|
---|
914 | AdjustSaveTypeButtons (TRUE);
|
---|
915 | break;
|
---|
916 |
|
---|
917 | case WID_RB_FSSPROMPT:
|
---|
918 | case WID_RB_FSSNUMFILES:
|
---|
919 | AdjustSaveTypeButtons (FALSE);
|
---|
920 | break;
|
---|
921 | }
|
---|
922 | return MRESULT (FALSE);
|
---|
923 | }
|
---|
924 |
|
---|
925 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
926 | }
|
---|
927 |
|
---|
928 | // ** Page2Procedure ****************************************************** /*FOLD00*/
|
---|
929 |
|
---|
930 | MRESULT EXPENTRY SETTINGS :: Page2Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
931 | {
|
---|
932 | static PSETTINGS pset = NULL;
|
---|
933 |
|
---|
934 | switch (msg)
|
---|
935 | {
|
---|
936 | case WM_INITDLG: {
|
---|
937 | #ifdef _DOLOGDEBUG_
|
---|
938 | LogDebug( "Page1Procedure: start WM_INITDLG" );
|
---|
939 | #endif
|
---|
940 | pset = PSETTINGS (mp2);
|
---|
941 | #ifdef _DOLOGDEBUG_
|
---|
942 | LogDebug( "Page1Procedure: end WM_INITDLG" );
|
---|
943 | #endif
|
---|
944 | HMQ hmq;
|
---|
945 | BOOL bUniCodeFont = FALSE;
|
---|
946 | CHAR ucFont[FACESIZE];
|
---|
947 |
|
---|
948 | if (pset->GetLangID() == RU) {
|
---|
949 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
950 | WinSetCp(hmq, 866);
|
---|
951 | bUniCodeFont = TRUE;
|
---|
952 | }
|
---|
953 | else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
|
---|
954 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
955 | WinSetCp(hmq, 852);
|
---|
956 | bUniCodeFont = TRUE;
|
---|
957 | }
|
---|
958 | else {
|
---|
959 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
960 | WinSetCp(hmq, 850);
|
---|
961 | }
|
---|
962 |
|
---|
963 | if (bUniCodeFont) {
|
---|
964 | strcpy(ucFont, "9.Times New Roman MT 30");
|
---|
965 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
966 | }
|
---|
967 | else if (g_installer) {
|
---|
968 | strcpy(ucFont, "9.WarpSans");
|
---|
969 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
970 | }
|
---|
971 | return MRESULT (FALSE);
|
---|
972 | }
|
---|
973 | case WM_COMMAND:
|
---|
974 |
|
---|
975 | if( SHORT1FROMMP( mp1 ) == WID_PB_OK) {
|
---|
976 | saveum = TRUE;
|
---|
977 | WinSendMsg ( g_hwndSettingsDialog, WM_CLOSE, 0,0);
|
---|
978 | }
|
---|
979 | if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
|
---|
980 | WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
|
---|
981 | return MRESULT( FALSE );
|
---|
982 |
|
---|
983 | case UM_SETTINGS2DIALOG:
|
---|
984 | #ifdef _DOLOGDEBUG_
|
---|
985 | LogDebug( "Page2Procedure: start UM_SETTINGS2DIALOG" );
|
---|
986 | #endif
|
---|
987 | #ifndef _QUIET_
|
---|
988 | // set state of checkbuttons
|
---|
989 | pset->AdjustButton (hwnd, WID_CB_SSWENABLE,
|
---|
990 | pset->SnapshotWindow ());
|
---|
991 | pset->AdjustButton (hwnd, WID_CB_SSWHIDE,
|
---|
992 | pset->SSWHide ());
|
---|
993 | pset->AdjustButton (hwnd, WID_CB_SSWALWAYSONTOP,
|
---|
994 | pset->SSWAlwaysOnTop ());
|
---|
995 | #else
|
---|
996 | pset->AdjustButton (hwnd, WID_CB_SERIALCAPTURE,
|
---|
997 | pset->SerialCapture ());
|
---|
998 | pset->AdjustButton (hwnd, WID_CB_DELAYCOUNTDOWN,
|
---|
999 | pset->DelayCountdown ());
|
---|
1000 | pset->AdjustButton (hwnd, WID_CB_DELAYEDCAPTURE,
|
---|
1001 | pset->DelayedCapture ());
|
---|
1002 |
|
---|
1003 | // init delay time sb
|
---|
1004 | WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME, SPBM_SETLIMITS,
|
---|
1005 | MPFROMLONG (65536), MPFROMLONG (1));
|
---|
1006 | WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME, SPBM_SETCURRENTVALUE,
|
---|
1007 | MPFROMLONG (pset->QueryDelayTime ()), 0);
|
---|
1008 |
|
---|
1009 | // init serial time sb
|
---|
1010 | WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME, SPBM_SETLIMITS,
|
---|
1011 | MPFROMLONG (65536), MPFROMLONG (1));
|
---|
1012 | WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME, SPBM_SETCURRENTVALUE,
|
---|
1013 | MPFROMLONG (pset->QuerySerialTime ()), 0);
|
---|
1014 | #endif
|
---|
1015 | switch (pset->QuerySSWCaptureType ())
|
---|
1016 | {
|
---|
1017 | case CAP_WINDOWINT:
|
---|
1018 | WinSendDlgItemMsg (hwnd, WID_SSWWINDOWINT, BM_CLICK,
|
---|
1019 | MPFROMSHORT(TRUE), 0);
|
---|
1020 | break;
|
---|
1021 | case CAP_SCREENREGION:
|
---|
1022 | WinSendDlgItemMsg (hwnd, WID_SSWSCREENREGION, BM_CLICK,
|
---|
1023 | MPFROMSHORT(TRUE), 0);
|
---|
1024 | break;
|
---|
1025 | case CAP_WINDOW:
|
---|
1026 | WinSendDlgItemMsg (hwnd, WID_SSWWINDOW, BM_CLICK,
|
---|
1027 | MPFROMSHORT(TRUE), 0);
|
---|
1028 | break;
|
---|
1029 | default:
|
---|
1030 | WinSendDlgItemMsg (hwnd, WID_SSWSCREEN, BM_CLICK,
|
---|
1031 | MPFROMSHORT(TRUE), 0);
|
---|
1032 | break;
|
---|
1033 | }
|
---|
1034 | #ifndef _QUIET_
|
---|
1035 | // show or hide snapshot window
|
---|
1036 | if (! WinSendDlgItemMsg (hwnd, WID_CB_SSWENABLE,
|
---|
1037 | BM_QUERYCHECK, 0, 0))
|
---|
1038 | WinShowWindow (hwndSnapshot, FALSE);
|
---|
1039 | else
|
---|
1040 | WinShowWindow (hwndSnapshot, TRUE);
|
---|
1041 | #endif
|
---|
1042 | #ifdef _DOLOGDEBUG_
|
---|
1043 | LogDebug( "Page1Procedure: end UM_SETTINGS2DIALOG" );
|
---|
1044 | #endif
|
---|
1045 | return MRESULT (FALSE);
|
---|
1046 |
|
---|
1047 | case UM_ADJUST:
|
---|
1048 | #ifdef _DOLOGDEBUG_
|
---|
1049 | LogDebug( "Page2Procedure: start UM_ADJUST" );
|
---|
1050 | #endif
|
---|
1051 | #ifndef _QUIET_
|
---|
1052 | // query state of checkbuttons and set flags
|
---|
1053 | pset->SSWHide(WinQueryButtonCheckstate(hwnd, WID_CB_SSWHIDE));
|
---|
1054 | #ifdef _DOLOGDEBUG_
|
---|
1055 | LogDebug( "Page2Procedure: checkpoint 1" );
|
---|
1056 | #endif
|
---|
1057 | pset->SnapshotWindow(WinQueryButtonCheckstate(hwnd, WID_CB_SSWENABLE));
|
---|
1058 | pset->SSWAlwaysOnTop(WinQueryButtonCheckstate(hwnd,
|
---|
1059 | WID_CB_SSWALWAYSONTOP));
|
---|
1060 | #ifdef _DOLOGDEBUG_
|
---|
1061 | LogDebug( "Page2Procedure: checkpoint 2" );
|
---|
1062 | #endif
|
---|
1063 | #else
|
---|
1064 | // query state of checkbuttons and set flags
|
---|
1065 | pset->SerialCapture(WinQueryButtonCheckstate
|
---|
1066 | (hwnd, WID_CB_SERIALCAPTURE));
|
---|
1067 | #ifdef _DOLOGDEBUG_
|
---|
1068 | LogDebug( "Page3Procedure: checkpoint 1" );
|
---|
1069 | #endif
|
---|
1070 | pset->DelayCountdown(WinQueryButtonCheckstate
|
---|
1071 | (hwnd, WID_CB_DELAYCOUNTDOWN));
|
---|
1072 | pset->DelayedCapture (WinQueryButtonCheckstate
|
---|
1073 | (hwnd,WID_CB_DELAYEDCAPTURE));
|
---|
1074 | #endif
|
---|
1075 | // get ssw capture type
|
---|
1076 | if (WinSendMsg (WinWindowFromID (hwnd, WID_SSWSCREENREGION),
|
---|
1077 | BM_QUERYCHECK, 0,0))
|
---|
1078 | pset->SetSSWCaptureType (CAP_SCREENREGION);
|
---|
1079 | else if (WinSendMsg (WinWindowFromID (hwnd, WID_SSWWINDOW),
|
---|
1080 | BM_QUERYCHECK, 0,0))
|
---|
1081 | pset->SetSSWCaptureType (CAP_WINDOW);
|
---|
1082 | else if (WinSendMsg (WinWindowFromID (hwnd, WID_SSWWINDOWINT),
|
---|
1083 | BM_QUERYCHECK, 0,0))
|
---|
1084 | pset->SetSSWCaptureType (CAP_WINDOWINT);
|
---|
1085 | else
|
---|
1086 | pset->SetSSWCaptureType (CAP_SCREEN);
|
---|
1087 | #ifdef _QUIET_
|
---|
1088 | // delay time
|
---|
1089 | ULONG ul;
|
---|
1090 | if (! BOOL (WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME,
|
---|
1091 | SPBM_QUERYVALUE,
|
---|
1092 | MPFROMP (&ul),
|
---|
1093 | MPFROM2SHORT (0, 0))))
|
---|
1094 | ul = 5L;
|
---|
1095 | pset->SetDelayTime (ul);
|
---|
1096 | #ifdef _DOLOGDEBUG_
|
---|
1097 | LogDebug( "Page3Procedure: checkpoint 3" );
|
---|
1098 | #endif
|
---|
1099 |
|
---|
1100 | // serial time
|
---|
1101 | if (! BOOL (WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME,
|
---|
1102 | SPBM_QUERYVALUE,
|
---|
1103 | MPFROMP (&ul),
|
---|
1104 | MPFROM2SHORT (0, 0))))
|
---|
1105 | ul = 10L;
|
---|
1106 | pset->SetSerialTime (ul);
|
---|
1107 | pset->bSerialCapture = pset->SerialCapture ();
|
---|
1108 | #endif
|
---|
1109 | if (saveum)
|
---|
1110 | pset->Save ();
|
---|
1111 | #ifdef _DOLOGDEBUG_
|
---|
1112 | LogDebug( "Page2Procedure: end UM_ADJUST" );
|
---|
1113 | #endif
|
---|
1114 | break;
|
---|
1115 |
|
---|
1116 | case WM_CONTROL:
|
---|
1117 | switch (SHORT1FROMMP (mp1))
|
---|
1118 | {
|
---|
1119 | #ifndef _QUIET_
|
---|
1120 | case WID_CB_SSWENABLE:
|
---|
1121 | if (! WinSendDlgItemMsg (hwnd, WID_CB_SSWENABLE,
|
---|
1122 | BM_QUERYCHECK, 0, 0))
|
---|
1123 | WinShowWindow (hwndSnapshot, FALSE);
|
---|
1124 | else
|
---|
1125 | WinShowWindow (hwndSnapshot, TRUE);
|
---|
1126 | break;
|
---|
1127 | #endif
|
---|
1128 | case WID_CB_DELAYEDCAPTURE:
|
---|
1129 |
|
---|
1130 | WinSendDlgItemMsg (g_hwndPage0, WID_CB_DELAYEDCAPTURE, BM_SETCHECK,
|
---|
1131 | MPFROMLONG (WinQueryButtonCheckstate
|
---|
1132 | (hwnd,WID_CB_DELAYEDCAPTURE)),
|
---|
1133 | MPFROMLONG (0));
|
---|
1134 | WinSendDlgItemMsg (WinWindowFromID(hwndFrame, FID_CLIENT),
|
---|
1135 | WID_CB_DELAYEDCAPTURE, BM_SETCHECK,
|
---|
1136 | MPFROMLONG (WinQueryButtonCheckstate
|
---|
1137 | (hwnd,WID_CB_DELAYEDCAPTURE)),
|
---|
1138 | MPFROMLONG (0));
|
---|
1139 | break;
|
---|
1140 | }
|
---|
1141 | return MRESULT (FALSE);
|
---|
1142 | }
|
---|
1143 |
|
---|
1144 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
1145 | }
|
---|
1146 |
|
---|
1147 | // ** Page3Procedure ****************************************************** /*FOLD00*/
|
---|
1148 |
|
---|
1149 | MRESULT EXPENTRY SETTINGS :: Page3Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1150 | {
|
---|
1151 | static PSETTINGS pset = NULL;
|
---|
1152 |
|
---|
1153 | switch (msg)
|
---|
1154 | {
|
---|
1155 | case WM_INITDLG: {
|
---|
1156 | #ifdef _DOLOGDEBUG_
|
---|
1157 | LogDebug( "Page3Procedure: start WM_INITDLG" );
|
---|
1158 | #endif
|
---|
1159 | pset = PSETTINGS (mp2);
|
---|
1160 | #ifdef _DOLOGDEBUG_
|
---|
1161 | LogDebug( "Page3Procedure: end WM_INITDLG" );
|
---|
1162 | #endif
|
---|
1163 | HMQ hmq;
|
---|
1164 | BOOL bUniCodeFont = FALSE;
|
---|
1165 | CHAR ucFont[FACESIZE];
|
---|
1166 |
|
---|
1167 | if (pset->GetLangID() == RU) {
|
---|
1168 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
1169 | WinSetCp(hmq, 866);
|
---|
1170 | bUniCodeFont = TRUE;
|
---|
1171 | }
|
---|
1172 | else if (pset->GetLangID() == CZ || pset->GetLangID() == PL) {
|
---|
1173 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
1174 | WinSetCp(hmq, 852);
|
---|
1175 | bUniCodeFont = TRUE;
|
---|
1176 | }
|
---|
1177 | else {
|
---|
1178 | hmq = WinQueryWindowULong( hwnd, QWL_HMQ);
|
---|
1179 | WinSetCp(hmq, 850);
|
---|
1180 | }
|
---|
1181 |
|
---|
1182 | if (bUniCodeFont) {
|
---|
1183 | strcpy(ucFont, "9.Times New Roman MT 30");
|
---|
1184 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
1185 | }
|
---|
1186 | return MRESULT (FALSE);
|
---|
1187 | }
|
---|
1188 |
|
---|
1189 | case WM_COMMAND:
|
---|
1190 | if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
|
---|
1191 | WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
|
---|
1192 | return MRESULT( FALSE );
|
---|
1193 |
|
---|
1194 | case UM_SETTINGS2DIALOG:
|
---|
1195 | #ifdef _DOLOGDEBUG_
|
---|
1196 | LogDebug( "Page3Procedure: start UM_SETTINGS2DIALOG" );
|
---|
1197 | #endif
|
---|
1198 | // set state of checkbuttons
|
---|
1199 | pset->AdjustButton (hwnd, WID_CB_SERIALCAPTURE,
|
---|
1200 | pset->SerialCapture ());
|
---|
1201 | pset->AdjustButton (hwnd, WID_CB_DELAYCOUNTDOWN,
|
---|
1202 | pset->DelayCountdown ());
|
---|
1203 | pset->AdjustButton (hwnd, WID_CB_DOSOUND,
|
---|
1204 | pset->DoSound ());
|
---|
1205 | pset->AdjustButton (hwnd, WID_CB_IDLEPRIORITY,
|
---|
1206 | pset->QueryFlag(SEI_IDLEPRIORITY));
|
---|
1207 |
|
---|
1208 | // init delay time sb
|
---|
1209 | WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME, SPBM_SETLIMITS,
|
---|
1210 | MPFROMLONG (65536), MPFROMLONG (1));
|
---|
1211 | WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME, SPBM_SETCURRENTVALUE,
|
---|
1212 | MPFROMLONG (pset->QueryDelayTime ()), 0);
|
---|
1213 |
|
---|
1214 | // init serial time sb
|
---|
1215 | WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME, SPBM_SETLIMITS,
|
---|
1216 | MPFROMLONG (65536), MPFROMLONG (1));
|
---|
1217 | WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME, SPBM_SETCURRENTVALUE,
|
---|
1218 | MPFROMLONG (pset->QuerySerialTime ()), 0);
|
---|
1219 | #ifdef _DOLOGDEBUG_
|
---|
1220 | LogDebug( "Page3Procedure: end UM_SETTINGS2DIALOG" );
|
---|
1221 | #endif
|
---|
1222 | return MRESULT (FALSE);
|
---|
1223 |
|
---|
1224 | case UM_ADJUST:
|
---|
1225 | {
|
---|
1226 | #ifdef _DOLOGDEBUG_
|
---|
1227 | LogDebug( "Page3Procedure: start UM_ADJUST" );
|
---|
1228 | #endif
|
---|
1229 | // query state of checkbuttons and set flags
|
---|
1230 | pset->SerialCapture(WinQueryButtonCheckstate
|
---|
1231 | (hwnd, WID_CB_SERIALCAPTURE));
|
---|
1232 | #ifdef _DOLOGDEBUG_
|
---|
1233 | LogDebug( "Page3Procedure: checkpoint 1" );
|
---|
1234 | #endif
|
---|
1235 | pset->DelayCountdown(WinQueryButtonCheckstate
|
---|
1236 | (hwnd, WID_CB_DELAYCOUNTDOWN));
|
---|
1237 | pset->DoSound(WinQueryButtonCheckstate
|
---|
1238 | (hwnd, WID_CB_DOSOUND));
|
---|
1239 | pset->SetFlag(SEI_IDLEPRIORITY, WinQueryButtonCheckstate
|
---|
1240 | (hwnd, WID_CB_IDLEPRIORITY));
|
---|
1241 | #ifdef _DOLOGDEBUG_
|
---|
1242 | LogDebug( "Page3Procedure: checkpoint 2" );
|
---|
1243 | #endif
|
---|
1244 |
|
---|
1245 | // delay time
|
---|
1246 | ULONG ul;
|
---|
1247 | if (! BOOL (WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME,
|
---|
1248 | SPBM_QUERYVALUE,
|
---|
1249 | MPFROMP (&ul),
|
---|
1250 | MPFROM2SHORT (0, 0))))
|
---|
1251 | ul = 5L;
|
---|
1252 | pset->SetDelayTime (ul);
|
---|
1253 | #ifdef _DOLOGDEBUG_
|
---|
1254 | LogDebug( "Page3Procedure: checkpoint 3" );
|
---|
1255 | #endif
|
---|
1256 |
|
---|
1257 | // serial time
|
---|
1258 | if (! BOOL (WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME,
|
---|
1259 | SPBM_QUERYVALUE,
|
---|
1260 | MPFROMP (&ul),
|
---|
1261 | MPFROM2SHORT (0, 0))))
|
---|
1262 | ul = 10L;
|
---|
1263 | pset->SetSerialTime (ul);
|
---|
1264 | pset->bSerialCapture = pset->SerialCapture ();
|
---|
1265 | pset->idleSetInIni = pset->QueryFlag(SEI_IDLEPRIORITY);
|
---|
1266 |
|
---|
1267 | if (saveum)
|
---|
1268 | pset->Save ();
|
---|
1269 | #ifdef _DOLOGDEBUG_
|
---|
1270 | LogDebug( "Page3Procedure: end UM_ADJUST" );
|
---|
1271 | #endif
|
---|
1272 | }
|
---|
1273 | break;
|
---|
1274 |
|
---|
1275 | case WM_CONTROL:
|
---|
1276 | switch (SHORT1FROMMP (mp1))
|
---|
1277 | {
|
---|
1278 | case WID_CB_SERIALCAPTURE:
|
---|
1279 | {
|
---|
1280 | HWND hwndButton =
|
---|
1281 | WinWindowFromID (WinWindowFromID (hwndFrame, FID_CLIENT),
|
---|
1282 | WID_CB_DELAYEDCAPTURE);
|
---|
1283 | if (! WinSendDlgItemMsg (hwnd, WID_CB_SERIALCAPTURE,
|
---|
1284 | BM_QUERYCHECK, 0, 0))
|
---|
1285 | WinEnableWindow (hwndButton, TRUE);
|
---|
1286 | else
|
---|
1287 | WinEnableWindow (hwndButton, FALSE);
|
---|
1288 | }
|
---|
1289 | break;
|
---|
1290 | }
|
---|
1291 | return MRESULT (FALSE);
|
---|
1292 | }
|
---|
1293 |
|
---|
1294 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
1295 | }
|
---|
1296 |
|
---|
1297 | // ** Page4Procedure ****************************************************** /*FOLD00*/
|
---|
1298 |
|
---|
1299 | MRESULT EXPENTRY SETTINGS :: Page4Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1300 | {
|
---|
1301 | static PSETTINGS pset = NULL;
|
---|
1302 |
|
---|
1303 | switch (msg)
|
---|
1304 | {
|
---|
1305 | case WM_INITDLG:
|
---|
1306 | {
|
---|
1307 | #ifdef _DOLOGDEBUG_
|
---|
1308 | LogDebug( "Page4Procedure: start WM_INITDLG" );
|
---|
1309 | #endif
|
---|
1310 | pset = PSETTINGS (mp2);
|
---|
1311 |
|
---|
1312 | HMQ hmq = WinQueryWindowULong(hwnd /*WinWindowFromID(hwnd, ID_DLG_SETTINGSPAGE4)*/, QWL_HMQ);
|
---|
1313 | WinSetCp(hmq, 1207); // UPF-8 Unicode
|
---|
1314 | WinRemovePresParam(hwnd, PP_FONTNAMESIZE);
|
---|
1315 | #ifndef _QUIET_ //??
|
---|
1316 | pset->GetLanguages(WinWindowFromID (hwnd, WID_LB_LANGUAGES));
|
---|
1317 | #endif
|
---|
1318 | #ifdef _DOLOGDEBUG_
|
---|
1319 | LogDebug( "Page4Procedure: WM_INITDLG: after GetLanguages()" );
|
---|
1320 | #endif
|
---|
1321 | #ifndef _QUIET_
|
---|
1322 | WinSendMsg (hwnd, UM_SETTINGS2DIALOG, 0,0);
|
---|
1323 |
|
---|
1324 | if (pset->fAutoLanguage)
|
---|
1325 | WinEnableWindow (WinWindowFromID (hwnd, WID_ST_LANGNOTE),
|
---|
1326 | FALSE);
|
---|
1327 | #endif
|
---|
1328 | #ifdef _DOLOGDEBUG_
|
---|
1329 | LogDebug( "Page4Procedure: end WM_INITDLG" );
|
---|
1330 | #endif
|
---|
1331 |
|
---|
1332 | UniChar target[300];
|
---|
1333 | CHAR ucLangStr[300];
|
---|
1334 | UconvObject uconv_object866 = NULL;
|
---|
1335 | UconvObject uconv_object860 = NULL;
|
---|
1336 | UconvObject uconv_object852 = NULL;
|
---|
1337 | UconvObject uconv_object1207 = NULL;
|
---|
1338 | UconvObject uconv_object850 = NULL;
|
---|
1339 | int result;
|
---|
1340 | int i;
|
---|
1341 | HAB hab;
|
---|
1342 | CHAR ucFont[FACESIZE];
|
---|
1343 |
|
---|
1344 | UniCreateUconvObject((UniChar *)L"IBM-852", &uconv_object852);
|
---|
1345 | UniCreateUconvObject((UniChar *)L"IBM-850", &uconv_object850);
|
---|
1346 | UniCreateUconvObject((UniChar *)L"IBM-866", &uconv_object866);
|
---|
1347 |
|
---|
1348 | UniCreateUconvObject((UniChar *)L"IBM-1207", &uconv_object1207);
|
---|
1349 | for (i = 0; i < WID_ST_END - 400; i++) {
|
---|
1350 | WinLoadString(hab, g_hmod, LANG_COPYRIGHT + i, sizeof(ucLangStr), ucLangStr);
|
---|
1351 | if (pset->GetLangID() == 420 ||
|
---|
1352 | pset->GetLangID() == PL) {
|
---|
1353 |
|
---|
1354 | UniStrToUcs( uconv_object852, target, ucLangStr, 299);
|
---|
1355 | }
|
---|
1356 | else if (pset->GetLangID() == RU)
|
---|
1357 | UniStrToUcs( uconv_object866, target, ucLangStr, 299);
|
---|
1358 | else {
|
---|
1359 | UniStrToUcs( uconv_object850, target, ucLangStr, 299);
|
---|
1360 | }
|
---|
1361 | UniStrFromUcs( uconv_object1207, ucLangStr, target, 300);
|
---|
1362 | WinSetDlgItemText(hwnd, WID_ST_COPYRIGHT + i, ucLangStr);
|
---|
1363 | }
|
---|
1364 |
|
---|
1365 | if (uconv_object866)
|
---|
1366 | UniFreeUconvObject(uconv_object866);
|
---|
1367 | if (uconv_object852)
|
---|
1368 | UniFreeUconvObject(uconv_object852);
|
---|
1369 | if (uconv_object850)
|
---|
1370 | UniFreeUconvObject(uconv_object850);
|
---|
1371 | if (uconv_object1207)
|
---|
1372 | UniFreeUconvObject(uconv_object1207);
|
---|
1373 | CHAR *env, *p;
|
---|
1374 | env = getenv("OSDIR");
|
---|
1375 | p = env;
|
---|
1376 | p++;
|
---|
1377 | if (!stricmp(p, ":\\sys") || !stricmp(p, ":\\ecs")) {
|
---|
1378 | strcpy(ucFont, "9.Workplace Sans");
|
---|
1379 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
1380 | }
|
---|
1381 | else {
|
---|
1382 | strcpy(ucFont, "9.Times New Roman MT 30");
|
---|
1383 | WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(ucFont) + 1, ucFont);
|
---|
1384 | }
|
---|
1385 | return MRESULT (FALSE);
|
---|
1386 | }
|
---|
1387 |
|
---|
1388 | case WM_COMMAND:
|
---|
1389 | if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
|
---|
1390 | WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
|
---|
1391 | return MRESULT( FALSE );
|
---|
1392 | #ifndef _QUIET_
|
---|
1393 | case UM_SETTINGS2DIALOG:
|
---|
1394 | {
|
---|
1395 |
|
---|
1396 | #ifdef _DOLOGDEBUG_
|
---|
1397 | LogDebug( "Page4Procedure: start UM_SETTINGS2DIALOG" );
|
---|
1398 | #endif
|
---|
1399 | // select the appropriate entry in the language-listbox
|
---|
1400 | CHAR ach[_MAX_FNAME];
|
---|
1401 | HWND hwndLB = WinWindowFromID (hwnd, WID_LB_LANGUAGES);
|
---|
1402 | ULONG c, i;
|
---|
1403 |
|
---|
1404 | c = WinQueryLboxCount (hwndLB);
|
---|
1405 |
|
---|
1406 | for (i = 0; i < c; i++)
|
---|
1407 | {
|
---|
1408 | #ifdef _DOLOGDEBUG_
|
---|
1409 | LogDebug( "Page4Procedure: UM_SETTINGS2DIALOG: i.1 = %d", i );
|
---|
1410 | #endif
|
---|
1411 | PSZ psz = PSZ(WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES,
|
---|
1412 | LM_QUERYITEMHANDLE,
|
---|
1413 | MPFROMLONG(i), NULL));
|
---|
1414 |
|
---|
1415 | if (stricmp (pset->QueryString(SEI_LANGUAGE), psz) == 0)
|
---|
1416 | break;
|
---|
1417 | }
|
---|
1418 | #ifdef _DOLOGDEBUG_
|
---|
1419 | LogDebug( "Page4Procedure: UM_SETTINGS2DIALOG: after loop 1" );
|
---|
1420 | #endif
|
---|
1421 | if (i < c)
|
---|
1422 | WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES, LM_SELECTITEM,
|
---|
1423 | MPFROMSHORT (i), MPFROMSHORT (TRUE));
|
---|
1424 | else
|
---|
1425 | WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES, LM_SELECTITEM,
|
---|
1426 | MPFROMSHORT (0), MPFROMSHORT (TRUE));
|
---|
1427 | #ifdef _DOLOGDEBUG_
|
---|
1428 | LogDebug( "Page4Procedure: end UM_SETTINGS2DIALOG" );
|
---|
1429 | #endif
|
---|
1430 | }
|
---|
1431 | return MRESULT (FALSE);
|
---|
1432 | #endif
|
---|
1433 | case WM_DESTROY:
|
---|
1434 | #ifndef _QUIET_
|
---|
1435 | {
|
---|
1436 | CHAR ach[_MAX_FNAME];
|
---|
1437 | BOOL fChanged = TRUE;
|
---|
1438 |
|
---|
1439 | ULONG ul = USHORT (WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES,
|
---|
1440 | LM_QUERYSELECTION,
|
---|
1441 | MPFROMLONG (LIT_FIRST), 0L));
|
---|
1442 | PSZ psz = PSZ(WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES,
|
---|
1443 | LM_QUERYITEMHANDLE,
|
---|
1444 | MPFROMLONG(ul), NULL));
|
---|
1445 | if (stricmp (pset->QueryString(SEI_LANGUAGE), psz) == 0)
|
---|
1446 | fChanged = FALSE;
|
---|
1447 | else
|
---|
1448 | pset->SetString(SEI_LANGUAGE, psz);
|
---|
1449 |
|
---|
1450 | if (fChanged) {
|
---|
1451 | if (!stricmp(psz, "gotreses") || !stricmp(psz, "goqreses"))
|
---|
1452 | strcpy(ach, "gotcha_es");
|
---|
1453 | /*else if (!stricmp(psz, "gotresit") || !stricmp(psz, "goqresit"))
|
---|
1454 | strcpy(ach, "gotcha_it");*/
|
---|
1455 | else
|
---|
1456 | strcpy(ach, "gotcha_en");
|
---|
1457 | pset->SetString (SEI_LANGUAGEHELP, ach);
|
---|
1458 | }
|
---|
1459 | if (saveum && fChanged) {
|
---|
1460 | pset->Save ();
|
---|
1461 | #ifdef _QUIET_
|
---|
1462 | HINI hini = PrfOpenProfile (hab, "gotchaq.ini");
|
---|
1463 | #else
|
---|
1464 | HINI hini = PrfOpenProfile (hab, "gotcha.ini");
|
---|
1465 | #endif
|
---|
1466 | BOOL fLChanged = TRUE;
|
---|
1467 | PrfWriteProfileData(hini, "Language", "LangChangeRequested", &fLChanged, sizeof(BOOL));
|
---|
1468 | if (hini)
|
---|
1469 | PrfCloseProfile (hini);
|
---|
1470 | }
|
---|
1471 | }
|
---|
1472 | #endif
|
---|
1473 | return MRESULT (FALSE);
|
---|
1474 | }
|
---|
1475 |
|
---|
1476 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
1477 | }
|
---|
1478 |
|
---|
1479 | // ** AdjustSaveTypeButtons *********************************************** /*FOLD00*/
|
---|
1480 |
|
---|
1481 | VOID AdjustSaveTypeButtons (BOOL f)
|
---|
1482 | {
|
---|
1483 | HWND hwndClient = WinWindowFromID (hwndFrame, FID_CLIENT);
|
---|
1484 |
|
---|
1485 | // FIXME um, em, global variables :-$
|
---|
1486 | WinEnableWindow (WinWindowFromID (hwndClient, WID_RB_CLIPBOARD), !f);
|
---|
1487 | WinEnableWindow (WinWindowFromID (hwndClient, WID_RB_FILE), !f);
|
---|
1488 | }
|
---|
1489 |
|
---|
1490 | // ** QueryWindowData ***************************************************** /*FOLD00*/
|
---|
1491 |
|
---|
1492 | VOID SETTINGS :: QueryWindowData (SWP *pswp, USHORT us[7], BOOL f)
|
---|
1493 | {
|
---|
1494 | // FIXME puke, yukk, choke! get this flag thing away! do it better!
|
---|
1495 | // FIXME what is with US?
|
---|
1496 | if (f)
|
---|
1497 | memcpy (pswp, QueryBinary(SEI_SWPSSW), sizeof (SWP));
|
---|
1498 | else
|
---|
1499 | memcpy (pswp, QueryBinary(SEI_SWP), sizeof (SWP));
|
---|
1500 |
|
---|
1501 | LONG cx, cy;
|
---|
1502 | cx = WinQuerySysValue (HWND_DESKTOP, SV_CXSCREEN);
|
---|
1503 | cy = WinQuerySysValue (HWND_DESKTOP, SV_CYSCREEN);
|
---|
1504 |
|
---|
1505 | if (pswp->cx < 32)
|
---|
1506 | pswp->cx = 32;
|
---|
1507 | // bigger than screen?
|
---|
1508 | if (pswp->cx > cx)
|
---|
1509 | pswp->cx = cx;
|
---|
1510 | // partly outside of screen?
|
---|
1511 | if (pswp->x+pswp->cx >= cx)
|
---|
1512 | pswp->x = cx-pswp->cx;
|
---|
1513 | if (pswp->cy < 32)
|
---|
1514 | pswp->cy = 32;
|
---|
1515 | // bigger than screen?
|
---|
1516 | if (pswp->cy > cy)
|
---|
1517 | pswp->cy = cy;
|
---|
1518 | // partly outside of screen?
|
---|
1519 | if (pswp->y+pswp->cy >= cy)
|
---|
1520 | pswp->y = cy-pswp->cy;
|
---|
1521 | }
|
---|
1522 |
|
---|
1523 | // ** ReloadResources ***************************************************** /*FOLD00*/
|
---|
1524 |
|
---|
1525 | BOOL Settings :: ReloadResources (PSZ psz)
|
---|
1526 | {
|
---|
1527 | if (g_hmod)
|
---|
1528 | DosFreeModule(g_hmod);
|
---|
1529 |
|
---|
1530 | APIRET rc;
|
---|
1531 |
|
---|
1532 | if ((rc = DosLoadModule(PSZ(NULL), 0, psz, &g_hmod)))
|
---|
1533 | {
|
---|
1534 | DisplayError("Error",
|
---|
1535 | "Could not (re)load resource module '%s' (return code %d). "
|
---|
1536 | "Make sure the DLL is in the LIBPATH. If this is the case, "
|
---|
1537 | "try deleting GOTCHA.INI and restart. If this fails, contact "
|
---|
1538 | "the author (ygk@qwest.net).", psz, rc);
|
---|
1539 | exit(1);
|
---|
1540 | }
|
---|
1541 | PVOID pv;
|
---|
1542 | INT Lang;
|
---|
1543 |
|
---|
1544 | DosGetResource(g_hmod, RT_RCDATA, LANG_ID, &pv);
|
---|
1545 | Lang = atoi((PCHAR) pv);
|
---|
1546 | SetLangID(Lang);
|
---|
1547 | ResourceString::Module(g_hmod);
|
---|
1548 | #ifdef _QUIET_
|
---|
1549 | pszPageTab[0] = RSTR (IDS_MAINWIN);
|
---|
1550 | pszPageTab[1] = RSTR (IDS_CAPTURE );
|
---|
1551 | pszPageTab[2] = RSTR (IDS_PAGESAVE);
|
---|
1552 | pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);
|
---|
1553 | #else
|
---|
1554 | pszPageTab[0] = RSTR (IDS_PAGESAVE);
|
---|
1555 | pszPageTab[1] = RSTR (IDS_PAGESNAPSHOT);
|
---|
1556 | pszPageTab[2] = RSTR (IDS_CAPTURE );
|
---|
1557 | pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);
|
---|
1558 | #endif
|
---|
1559 | for( int i = 0; i < BMF_INVALID; i++ ) {
|
---|
1560 | ifi[ i ].label = RSTR ( IDS_BMF_JPG+i ); }
|
---|
1561 |
|
---|
1562 | return TRUE;
|
---|
1563 | }
|
---|
1564 |
|
---|
1565 | // ** SelectLanguage ****************************************************** /*FOLD00*/
|
---|
1566 | #ifndef _QUIET_
|
---|
1567 | VOID Settings :: SelectLanguage (VOID)
|
---|
1568 | {
|
---|
1569 | // set this to some default, as we must open the settings dialog for
|
---|
1570 | // selecting a language
|
---|
1571 | #ifdef _QUIET_
|
---|
1572 | //#if 1
|
---|
1573 | pszPageTab[0] = RSTR (IDS_MAINWIN);
|
---|
1574 | pszPageTab[1] = RSTR (IDS_CAPTURE );
|
---|
1575 | pszPageTab[2] = RSTR (IDS_PAGESAVE);
|
---|
1576 | pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);
|
---|
1577 | #else
|
---|
1578 | pszPageTab[0] = RSTR (IDS_PAGESAVE);
|
---|
1579 | pszPageTab[1] = RSTR (IDS_PAGESNAPSHOT);
|
---|
1580 | pszPageTab[2] = RSTR (IDS_CAPTURE );
|
---|
1581 | pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);
|
---|
1582 | #endif
|
---|
1583 | // bring up the "select language" settings page
|
---|
1584 | Dialog (TRUE);
|
---|
1585 | }
|
---|
1586 | #endif
|
---|
1587 |
|
---|
1588 | // ** GetLanguages ******************************************************** /*FOLD00*/
|
---|
1589 | #ifndef _QUIET_ //??
|
---|
1590 | USHORT Settings :: GetLanguages (HWND hwnd)
|
---|
1591 | {
|
---|
1592 | // find all dlls and add the names to the language list
|
---|
1593 | HDIR hdir;
|
---|
1594 | ULONG c, fl, ul;
|
---|
1595 | FILEFINDBUF3 findbuf;
|
---|
1596 | APIRET rc;
|
---|
1597 | PSZ psz;
|
---|
1598 | HMODULE hmod;
|
---|
1599 |
|
---|
1600 | fl = FILE_NORMAL;
|
---|
1601 | hdir = HDIR_CREATE;
|
---|
1602 | c = 1;
|
---|
1603 | #ifdef _QUIET_
|
---|
1604 | rc = DosFindFirst ("goqres*.dll", &hdir, fl, &findbuf,
|
---|
1605 | sizeof (findbuf), &c, FIL_STANDARD);
|
---|
1606 | #else
|
---|
1607 | rc = DosFindFirst ("gotres*.dll", &hdir, fl, &findbuf,
|
---|
1608 | sizeof (findbuf), &c, FIL_STANDARD);
|
---|
1609 | #endif
|
---|
1610 | while (!rc)
|
---|
1611 | {
|
---|
1612 | // we don't want the extension
|
---|
1613 | if ((psz = strchr (findbuf.achName, '.')))
|
---|
1614 | *psz = '\0';
|
---|
1615 | // try opening the dll and read the version etc. data
|
---|
1616 | if ((rc = DosLoadModule(PSZ(NULL), 0, findbuf.achName, &hmod)) == NO_ERROR) {
|
---|
1617 | PVOID pv;
|
---|
1618 | PVOID pl;
|
---|
1619 |
|
---|
1620 | if (DosGetResource(hmod, RT_RCDATA, DLL_ID, &pv) == NO_ERROR) {
|
---|
1621 | #ifdef _QUIET_
|
---|
1622 | if (strcmp(PSZ(pv), "Gotchaq!") == 0) {
|
---|
1623 | #else
|
---|
1624 | if (strcmp(PSZ(pv), "Gotcha!") == 0) {
|
---|
1625 | #endif
|
---|
1626 | psz = PSZ(pv)+strlen(PSZ(pv)) + 3;
|
---|
1627 |
|
---|
1628 | INT Lang;
|
---|
1629 |
|
---|
1630 | DosGetResource(hmod, RT_RCDATA, LANG_ID, &pl);
|
---|
1631 | Lang = atoi((PCHAR) pl);
|
---|
1632 | #if 1
|
---|
1633 | UniChar target[300];
|
---|
1634 | CHAR ucLangStr[300];
|
---|
1635 | UconvObject uconv_object866 = NULL;
|
---|
1636 | UconvObject uconv_object852 = NULL;
|
---|
1637 | UconvObject uconv_object1207 = NULL;
|
---|
1638 | UconvObject uconv_object850 = NULL;
|
---|
1639 | int i;
|
---|
1640 |
|
---|
1641 | strcpy(ucLangStr, psz);
|
---|
1642 | UniCreateUconvObject((UniChar *)L"IBM-852", &uconv_object852);
|
---|
1643 | UniCreateUconvObject((UniChar *)L"IBM-850", &uconv_object850);
|
---|
1644 | UniCreateUconvObject((UniChar *)L"IBM-866", &uconv_object866);
|
---|
1645 | UniCreateUconvObject((UniChar *)L"IBM-1207", &uconv_object1207);
|
---|
1646 |
|
---|
1647 | if (Lang == CZ) {
|
---|
1648 | UniStrToUcs( uconv_object852, target, ucLangStr, 299);
|
---|
1649 | }
|
---|
1650 | else if (Lang == RU) {
|
---|
1651 | UniStrToUcs( uconv_object866, target, ucLangStr, 299);
|
---|
1652 | }
|
---|
1653 | else {
|
---|
1654 | UniStrToUcs( uconv_object850, target, ucLangStr, 299);
|
---|
1655 | }
|
---|
1656 | UniStrFromUcs( uconv_object1207, ucLangStr, target, 300);
|
---|
1657 | Lang = 0;
|
---|
1658 | if (uconv_object866)
|
---|
1659 | UniFreeUconvObject(uconv_object866);
|
---|
1660 | if (uconv_object852)
|
---|
1661 | UniFreeUconvObject(uconv_object852);
|
---|
1662 | if (uconv_object850)
|
---|
1663 | UniFreeUconvObject(uconv_object850);
|
---|
1664 | if (uconv_object1207)
|
---|
1665 | UniFreeUconvObject(uconv_object1207);
|
---|
1666 |
|
---|
1667 |
|
---|
1668 | #endif
|
---|
1669 | ul = WinInsertLboxItem (hwnd, LIT_END,/*psz*/ucLangStr);
|
---|
1670 | WinSendMsg(hwnd, LM_SETITEMHANDLE, MPFROMLONG(ul),
|
---|
1671 | MPFROMP (strdup(findbuf.achName)));
|
---|
1672 | }
|
---|
1673 | if (pl)
|
---|
1674 | DosFreeResource(pl);
|
---|
1675 | DosFreeResource(pv);
|
---|
1676 | }
|
---|
1677 | DosFreeModule(hmod);
|
---|
1678 | }
|
---|
1679 | c = 1;
|
---|
1680 | rc = DosFindNext (hdir, &findbuf, sizeof (findbuf), &c);
|
---|
1681 | }
|
---|
1682 | DosFindClose (hdir);
|
---|
1683 |
|
---|
1684 | return 1;
|
---|
1685 | }
|
---|
1686 | #endif
|
---|
1687 | // ** GetFileExtension **************************************************** /*FOLD00*/
|
---|
1688 |
|
---|
1689 | PSZ Settings :: GetFileExtension( SHORT type )
|
---|
1690 | {
|
---|
1691 | if( type == BMF_INVALID )
|
---|
1692 | type = SHORT( QueryFileFormat() );
|
---|
1693 | if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
|
---|
1694 | return ifi[ type ].extension;
|
---|
1695 | return "";
|
---|
1696 | }
|
---|
1697 |
|
---|
1698 | #if 0
|
---|
1699 | // ** GetFOURCC *********************************************************** /*FOLD00*/
|
---|
1700 |
|
---|
1701 | FOURCC Settings :: GetFOURCC( SHORT type )
|
---|
1702 | {
|
---|
1703 | if( type == BMF_INVALID )
|
---|
1704 | type = SHORT( QueryFileFormat() );
|
---|
1705 | if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
|
---|
1706 | return ifi[ type ].fourcc;
|
---|
1707 | return 0L;
|
---|
1708 | }
|
---|
1709 | #endif
|
---|
1710 | // ** GetFileEAType ******************************************************* /*FOLD00*/
|
---|
1711 |
|
---|
1712 | PSZ Settings :: GetFileEAType( SHORT type )
|
---|
1713 | {
|
---|
1714 | if( type == BMF_INVALID )
|
---|
1715 | type = SHORT( QueryFileFormat() );
|
---|
1716 | if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
|
---|
1717 | return ifi[ type ].eaType;
|
---|
1718 | return "";
|
---|
1719 | }
|
---|
1720 |
|
---|
1721 | // ************************************************************************
|
---|
1722 |
|
---|
1723 | PSZ Settings :: QueryNumSaveDir( VOID )
|
---|
1724 | {
|
---|
1725 | // Using a static buffer here is not really good, but good enough
|
---|
1726 | // currently as we know there will be no concurrent access.
|
---|
1727 | static CHAR ach[_MAX_PATH];
|
---|
1728 |
|
---|
1729 | if( strspn( QueryString( SEI_NUMSAVEDIR ), " \t\n\r" ) ==
|
---|
1730 | strlen( QueryString( SEI_NUMSAVEDIR ) ) )
|
---|
1731 | return getcwd( ach, _MAX_PATH );
|
---|
1732 | return QueryString( SEI_NUMSAVEDIR );
|
---|
1733 | }
|
---|