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