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