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