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