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