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