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