[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>
|
---|
[2] | 20 | #include "settings.h"
|
---|
| 21 | #include "ctype.h"
|
---|
| 22 |
|
---|
| 23 | #include "./settings/thth_settings.cpp"
|
---|
| 24 |
|
---|
| 25 | PSZ SETTINGS::pszPageTab[COUNT_PAGES]; /* = {
|
---|
| 26 | "Saving", "Snapshot window", "Misc", "Language" };
|
---|
| 27 | // FIXME nls*/
|
---|
| 28 |
|
---|
[27] | 29 | bool saveum = FALSE;
|
---|
[2] | 30 | SWP swpDef = { 0,0,0, 98,66, 0,0,0,0 };
|
---|
| 31 | SWP swpDefSSW = { 0,0,0, 10,10, 0,0,0,0 };
|
---|
| 32 | USHORT ausDef[7] = { 0 };
|
---|
| 33 | USHORT ausDefSSW[7] = { 0 };
|
---|
| 34 |
|
---|
| 35 | ImageFormatInfo Settings::ifi[BMF_INVALID] =
|
---|
| 36 | {
|
---|
[27] | 37 | { TRUE, BMF_JPG, "JPEG Interchange File Format (jpg)", "jpg", "JPG" },
|
---|
| 38 | { TRUE, BMF_PNG, "Portable Network Graphics (png)", "png", "PNG" },
|
---|
| 39 | { TRUE, BMF_OS20, "OS/2 Bitmap 2.0 (bmp)", "bmp", "Bitmap" },
|
---|
| 40 | { TRUE, BMF_TIF, "Microsoft/Aldus Tagged Image File Format (tif)", "tif", "TIFF" },
|
---|
| 41 | { TRUE, BMF_TGA, "Truevision Targa/Vista (tga)", "tga", "Targa" },
|
---|
| 42 | { TRUE, BMF_PCX, "ZSoft PC Paintbrush Image Format (pcx)", "pcx", "PCX" },
|
---|
| 43 | { TRUE, BMF_GIF, "Portable Anymap (pnm)", "pnm", "PNM" },
|
---|
| 44 | { TRUE, BMF_PBM, "Portable Pixel-map (ppm)", "ppm", "PPM" },
|
---|
| 45 | { TRUE, BMF_JP2, "Jpeg 2000 (provided by the Open Source OpenJPEG library) (jp2)", "jp2", "JP2" },
|
---|
| 46 | { TRUE, BMF_DIB, "Device Independent Bitmap (dib)", "dib", "DIB" }
|
---|
[2] | 47 | };
|
---|
| 48 |
|
---|
[11] | 49 |
|
---|
[2] | 50 | PTHTH_SE apse[] =
|
---|
| 51 | {
|
---|
[11] | 52 | new THTH_SES (SEI_SAVEFILE, "Save", "Filename", "gotcha.png"),
|
---|
| 53 | new THTH_SES (SEI_FORCESAVEFILE, "Save", "ForceSaveFilename", "force.png"),
|
---|
| 54 | new THTH_SEL (SEI_SAVESTYLE, "Save", "Style", SAVESTYLE_FILE),
|
---|
| 55 | new THTH_SEL (SEI_FILEFORMAT, "Save", "FileFormat", BMF_PNG),
|
---|
[2] | 56 | new THTH_SEL (SEI_FILESAVESTYLE, "Save", "FileSaveStyle", FSS_PROMPT),
|
---|
| 57 |
|
---|
| 58 | new THTH_SES (SEI_NUMSAVEDIR, "Save", "NumSaveDir", ""),
|
---|
| 59 | new THTH_SEF (SEI_HIDEWINDOW, "Extras", "HideWindow", TRUE),
|
---|
| 60 | new THTH_SEF (SEI_AUTOADDEXTENSION, "Extras", "AutoaddExtension", TRUE),
|
---|
| 61 | new THTH_SEF (SEI_CONFIRMOVERWRITE, "Extras", "ConfirmOverwrite", TRUE),
|
---|
| 62 | new THTH_SEF (SEI_DOSOUND, "Extras", "DoSound", TRUE),
|
---|
| 63 |
|
---|
| 64 | new THTH_SEF (SEI_DELAYEDCAPTURE, "Extras", "DelayedCapture", FALSE),
|
---|
| 65 | new THTH_SEF (SEI_DELAYCOUNTDOWN, "Extras", "DelayCountdown", FALSE),
|
---|
| 66 | new THTH_SEL (SEI_DELAYTIME, "Extras", "DelayTime", 5),
|
---|
| 67 | new THTH_SEF (SEI_SERIALCAPTURE, "Extras", "SerialCapture", FALSE),
|
---|
| 68 | new THTH_SEL (SEI_SERIALTIME, "Extras", "SerialTime", 10),
|
---|
| 69 |
|
---|
| 70 | new THTH_SEF (SEI_SNAPSHOTWINDOW, "Snapshot", "Enable", FALSE),
|
---|
| 71 | new THTH_SEL (SEI_SSWCAPTURETYPE, "Snapshot", "CaptureType", CAP_SCREEN),
|
---|
| 72 | new THTH_SEF (SEI_SSWHIDE, "Snapshot", "Hide", TRUE),
|
---|
| 73 | new THTH_SEF (SEI_SSWALWAYSONTOP, "Snapshot", "AlwaysOnTop", TRUE),
|
---|
| 74 |
|
---|
| 75 | new THTH_SEF (SEI_IDLEPRIORITY, "Extras", "IdlePriority", FALSE),
|
---|
| 76 |
|
---|
| 77 | new THTH_SEB (SEI_SWP, "Window", "SWP", &swpDef, sizeof (swpDef)),
|
---|
| 78 | new THTH_SEB (SEI_US, "Window", "US", &ausDef, sizeof (ausDef)),
|
---|
| 79 |
|
---|
| 80 | new THTH_SEB (SEI_SWPSSW, "Snapshot", "SWP", &swpDefSSW, sizeof (swpDefSSW)),
|
---|
| 81 | new THTH_SEB (SEI_USSSW, "Snapshot", "US", &ausDefSSW, sizeof (ausDefSSW)),
|
---|
| 82 |
|
---|
[27] | 83 | new THTH_SES (SEI_LANGUAGE, "Language", "Program", PSZ_DEFAULTLANGUAGEMOD),
|
---|
[2] | 84 | new THTH_SES (SEI_LANGUAGEHELP, "Language", "Help", PSZ_DEFAULTLANGUAGEHELP),
|
---|
| 85 |
|
---|
| 86 | new THTH_SEF (SEI_UPDATE178DONE, "Extras", "Update178Done", FALSE),
|
---|
| 87 |
|
---|
| 88 | NULL,
|
---|
| 89 | };
|
---|
| 90 |
|
---|
| 91 | // ** Settings ************************************************************ /*FOLD00*/
|
---|
| 92 |
|
---|
| 93 | Settings :: Settings (VOID) :
|
---|
[30] | 94 | #ifdef _QUIET_
|
---|
| 95 | //#if 1
|
---|
| 96 | ththSettings(apse, "gotchaq.ini", L_PROFILEVERSION)
|
---|
| 97 | #else
|
---|
| 98 | ththSettings(apse, "gotcha.ini", L_PROFILEVERSION)
|
---|
| 99 | #endif
|
---|
[2] | 100 | {
|
---|
| 101 | if( ! QueryFlag( SEI_UPDATE178DONE ) ) {
|
---|
| 102 | //DisplayError( "Updated", "false" );
|
---|
| 103 | SetLong( SEI_SERIALTIME, QueryLong( SEI_SERIALTIME ) * 20 );
|
---|
| 104 | SetFlag( SEI_UPDATE178DONE );
|
---|
| 105 | } else {
|
---|
| 106 | //DisplayError( "NOT Updated", "true" );
|
---|
| 107 | }
|
---|
| 108 |
|
---|
| 109 | // to get the error msgs in default language
|
---|
| 110 | ReloadResources (QueryString(SEI_LANGUAGE));
|
---|
| 111 |
|
---|
| 112 | if (Error () == 1)
|
---|
| 113 | {
|
---|
| 114 | FileNotOpenError ();
|
---|
| 115 | ReloadResources (QueryString(SEI_LANGUAGE));
|
---|
| 116 | }
|
---|
| 117 | else if (Error () == 2)
|
---|
| 118 | {
|
---|
| 119 | VersionError ();
|
---|
| 120 | ReloadResources (QueryString(SEI_LANGUAGE));
|
---|
| 121 | }
|
---|
| 122 | }
|
---|
| 123 |
|
---|
| 124 | // ** VersionError ********************************************************
|
---|
| 125 |
|
---|
| 126 | USHORT SETTINGS :: VersionError (VOID)
|
---|
| 127 | {
|
---|
| 128 | DisplayError (RSTR(IDS_HEADER_WARNING), RSTR(IDS_ERROR_INIFILEWRONGVERSION),
|
---|
| 129 | QueryProfileName ());
|
---|
| 130 | SelectLanguage();
|
---|
| 131 | return 0;
|
---|
| 132 | }
|
---|
| 133 |
|
---|
| 134 | // ** FileNotOpenError **************************************************** /*fold00*/
|
---|
| 135 |
|
---|
| 136 | USHORT SETTINGS :: FileNotOpenError (VOID)
|
---|
| 137 | {
|
---|
| 138 | DisplayError (RSTR(IDS_HEADER_ERROR), RSTR(IDS_ERROR_INIFILENOTOPEN),
|
---|
| 139 | QueryProfileName ());
|
---|
| 140 | SelectLanguage();
|
---|
| 141 | return 0;
|
---|
| 142 | }
|
---|
| 143 |
|
---|
| 144 | // ** Dialog ************************************************************** /*FOLD00*/
|
---|
| 145 |
|
---|
| 146 | // FIXME YUKKI! YUKKI!! YUKKI!!! But I'm too lazy to do it better now :-)
|
---|
| 147 | HWND g_hwndSettingsDialog = NULL;
|
---|
[27] | 148 | HWND g_hwndPage0 = NULL;
|
---|
[2] | 149 |
|
---|
| 150 | BOOL SETTINGS :: Dialog (BOOL fOnlyLanguage)
|
---|
| 151 | {
|
---|
| 152 | #ifdef _DOLOGDEBUG_
|
---|
| 153 | LogDebug( "Dialog: checkpoint 1" );
|
---|
| 154 | #endif
|
---|
| 155 | fAutoLanguage = fOnlyLanguage;
|
---|
| 156 |
|
---|
| 157 | // load the main dialog window
|
---|
| 158 | hwndDlg = WinLoadDlg (HWND_DESKTOP, hwndFrame, PFNWP (DialogProcedure),
|
---|
| 159 | GETMODULE, ID_DLG_SETTINGS, this);
|
---|
| 160 | // FIXME YUKKI! YUKKI!! YUKKI!!! But I'm too lazy to do it better now :-)
|
---|
| 161 | g_hwndSettingsDialog = hwndDlg;
|
---|
| 162 | #ifdef _DOLOGDEBUG_
|
---|
| 163 | LogDebug( "Dialog: checkpoint 2" );
|
---|
| 164 | #endif
|
---|
| 165 |
|
---|
| 166 | // disable this two buttons if only language select
|
---|
| 167 | if (fAutoLanguage)
|
---|
| 168 | {
|
---|
| 169 | WinEnableWindow (WinWindowFromID (hwndDlg, WID_PB_HELP), FALSE);
|
---|
| 170 | WinEnableWindow (WinWindowFromID (hwndDlg, WID_PB_UNDO), FALSE);
|
---|
| 171 | }
|
---|
| 172 |
|
---|
| 173 | HWND hwndNB = WinWindowFromID (hwndDlg, WID_NB_SETTINGS);
|
---|
| 174 | #ifdef _DOLOGDEBUG_
|
---|
| 175 | LogDebug( "Dialog: checkpoint 3" );
|
---|
| 176 | #endif
|
---|
| 177 |
|
---|
| 178 | // set notebook background color
|
---|
| 179 | WinSendMsg (hwndNB, BKM_SETNOTEBOOKCOLORS,
|
---|
| 180 | MPFROMLONG (SYSCLR_DIALOGBACKGROUND),
|
---|
| 181 | MPFROMSHORT (BKA_BACKGROUNDPAGECOLORINDEX));
|
---|
| 182 |
|
---|
| 183 | // set tab dimensions
|
---|
| 184 | WinSendMsg (hwndNB, BKM_SETDIMENSIONS,
|
---|
| 185 | MPFROM2SHORT (80, 25), MPFROMSHORT (BKA_MAJORTAB));
|
---|
| 186 | #ifdef _DOLOGDEBUG_
|
---|
| 187 | LogDebug( "Dialog: checkpoint 4" );
|
---|
| 188 | #endif
|
---|
| 189 |
|
---|
| 190 | ULONG idPage[COUNT_PAGES];
|
---|
| 191 | USHORT i, cPages;
|
---|
| 192 |
|
---|
| 193 | if (fOnlyLanguage)
|
---|
| 194 | {
|
---|
| 195 | cPages = 1;
|
---|
| 196 |
|
---|
| 197 | idPage[0] = (ULONG)
|
---|
| 198 | WinSendMsg (hwndNB, BKM_INSERTPAGE, 0L,
|
---|
| 199 | MPFROM2SHORT (BKA_MAJOR | BKA_AUTOPAGESIZE,
|
---|
| 200 | BKA_LAST));
|
---|
| 201 | WinSendMsg (hwndNB, BKM_SETTABTEXT, MPFROMLONG (idPage[0]),
|
---|
| 202 | MPFROMP (pszPageTab[COUNT_PAGES-1]));
|
---|
| 203 | hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure,
|
---|
| 204 | GETMODULE, ID_DLG_SETTINGSPAGE4, this);
|
---|
| 205 | }
|
---|
| 206 | else
|
---|
| 207 | {
|
---|
| 208 | cPages = COUNT_PAGES;
|
---|
| 209 |
|
---|
| 210 | // insert empty pages
|
---|
| 211 | for (i = 0; i < cPages; i++)
|
---|
| 212 | {
|
---|
| 213 | idPage[i] = (ULONG)
|
---|
| 214 | WinSendMsg (hwndNB, BKM_INSERTPAGE, 0L,
|
---|
| 215 | MPFROM2SHORT (BKA_MAJOR | BKA_AUTOPAGESIZE,
|
---|
| 216 | BKA_LAST));
|
---|
| 217 | WinSendMsg (hwndNB, BKM_SETTABTEXT,
|
---|
| 218 | MPFROMLONG (idPage[i]), MPFROMP (pszPageTab[i]));
|
---|
| 219 | }
|
---|
[30] | 220 | #ifndef _QUIET_
|
---|
| 221 | //#if 0
|
---|
[2] | 222 | // open and assign dialogs to pages
|
---|
| 223 | hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page1Procedure,
|
---|
| 224 | GETMODULE, ID_DLG_SETTINGSPAGE1, this);
|
---|
[30] | 225 | hwndPage[1] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page2Procedure,
|
---|
[2] | 226 | GETMODULE, ID_DLG_SETTINGSPAGE2, this);
|
---|
| 227 | hwndPage[2] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page3Procedure,
|
---|
| 228 | GETMODULE, ID_DLG_SETTINGSPAGE3, this);
|
---|
| 229 | hwndPage[3] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure,
|
---|
| 230 | GETMODULE, ID_DLG_SETTINGSPAGE4, this);
|
---|
[27] | 231 | #else
|
---|
| 232 | hwndPage[0] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) WindowProcedure,
|
---|
| 233 | GETMODULE, ID_DLG_SETTINGSPAGE0, this);
|
---|
[41] | 234 | hwndPage[1] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page2Procedure,
|
---|
| 235 | GETMODULE, ID_DLG_SETTINGSPAGE2, this);
|
---|
| 236 | hwndPage[2] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page1Procedure,
|
---|
[27] | 237 | GETMODULE, ID_DLG_SETTINGSPAGE1, this);
|
---|
| 238 | hwndPage[3] = WinLoadDlg (hwndNB, hwndNB, (PFNWP) Page4Procedure,
|
---|
| 239 | GETMODULE, ID_DLG_SETTINGSPAGE4, this);
|
---|
| 240 | g_hwndPage0 = hwndPage[0];
|
---|
| 241 |
|
---|
| 242 | #endif
|
---|
[2] | 243 | }
|
---|
| 244 | #ifdef _DOLOGDEBUG_
|
---|
| 245 | LogDebug( "Dialog: checkpoint 5" );
|
---|
| 246 | #endif
|
---|
| 247 |
|
---|
| 248 | // combine dlg-handle and page ids
|
---|
| 249 | for (i = 0; i < cPages; i++)
|
---|
| 250 | WinSendMsg (hwndNB, BKM_SETPAGEWINDOWHWND,
|
---|
| 251 | MPFROMLONG (idPage[i]), MPFROMHWND (hwndPage[i]));
|
---|
| 252 |
|
---|
| 253 | /* if (fAutoLanguage)
|
---|
| 254 | WinSendMsg (hwndNB, BKM_TURNTOPAGE, MPFROMLONG (idPage[0]), 0L);
|
---|
| 255 | #if (COUNT_PAGES != 4)
|
---|
| 256 | #warning FIXME settings.cpp 264 or so ...
|
---|
| 257 | #endif */
|
---|
| 258 | for (i = 0; i < cPages; i++)
|
---|
| 259 | WinSendMsg (hwndPage[i], UM_SETTINGS2DIALOG, 0,0);
|
---|
| 260 | #ifdef _DOLOGDEBUG_
|
---|
| 261 | LogDebug( "Dialog: checkpoint 6" );
|
---|
| 262 | #endif
|
---|
[27] | 263 | WinSendDlgItemMsg (g_hwndPage0, WID_RB_FILE, BM_CLICK,
|
---|
| 264 | MPFROMSHORT (TRUE), 0);
|
---|
| 265 | WinSendDlgItemMsg (g_hwndPage0, WID_CB_HIDEWINDOW, BM_SETCHECK,
|
---|
| 266 | MPFROMLONG (TRUE), MPFROMLONG (0));
|
---|
[2] | 267 | //WinSetFocus (WinWindowFromID (hwndDlg, WID_PB_OK), TRUE);
|
---|
| 268 | //WinSetFocus( hwndPage[0], TRUE );
|
---|
[41] | 269 | #ifdef _QUIET_
|
---|
| 270 | if (HACCEL haccel = WinLoadAccelTable (hab, GETMODULE, 1)) {
|
---|
| 271 | int rc = WinSetAccelTable (hab, haccel, hwndDlg);
|
---|
| 272 | _PmpfF(( " Acceltable %i", rc));
|
---|
| 273 | }
|
---|
| 274 | #endif
|
---|
[2] | 275 | WinSetActiveWindow( HWND_DESKTOP, hwndPage[0] );
|
---|
| 276 | #ifdef _DOLOGDEBUG_
|
---|
| 277 | LogDebug( "Dialog: checkpoint 7" );
|
---|
| 278 | #endif
|
---|
| 279 |
|
---|
| 280 | WinProcessDlg (hwndDlg);
|
---|
| 281 | #ifdef _DOLOGDEBUG_
|
---|
| 282 | LogDebug( "Dialog: checkpoint 7.5" );
|
---|
| 283 | #endif
|
---|
| 284 | WinDestroyWindow (hwndDlg);
|
---|
| 285 | #ifdef _DOLOGDEBUG_
|
---|
| 286 | LogDebug( "Dialog: checkpoint 8" );
|
---|
| 287 | #endif
|
---|
[41] | 288 | #ifndef _QUIET_
|
---|
[2] | 289 | // it ain't the best way to do it, but ...
|
---|
| 290 | SetIdlePriority(QueryFlag(SEI_IDLEPRIORITY));
|
---|
[41] | 291 | #endif
|
---|
[2] | 292 | for (i = 0; i < COUNT_PAGES; i++)
|
---|
| 293 | hwndPage[i] = NULL;
|
---|
| 294 |
|
---|
| 295 | hwndDlg = NULLHANDLE;
|
---|
| 296 | #ifdef _DOLOGDEBUG_
|
---|
| 297 | LogDebug( "Dialog: checkpoint 9" );
|
---|
| 298 | #endif
|
---|
| 299 | return TRUE;
|
---|
| 300 | }
|
---|
| 301 |
|
---|
| 302 | // ** DialogProcedure ***************************************************** /*FOLD00*/
|
---|
| 303 |
|
---|
| 304 | MRESULT EXPENTRY
|
---|
| 305 | SETTINGS :: DialogProcedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 306 | {
|
---|
| 307 | static PSETTINGS pset = NULL;
|
---|
| 308 |
|
---|
| 309 | #ifdef _DOLOGDEBUG_
|
---|
| 310 | LogDebug( "DialogProcedure:Message 0x%04x", msg );
|
---|
| 311 | #endif
|
---|
| 312 |
|
---|
| 313 | switch (msg)
|
---|
| 314 | {
|
---|
| 315 | case WM_INITDLG:
|
---|
| 316 | #ifdef _DOLOGDEBUG_
|
---|
| 317 | LogDebug( "DialogProcedure: start WM_INITDLG" );
|
---|
| 318 | #endif
|
---|
| 319 | pset = PSETTINGS (mp2);
|
---|
| 320 | #ifdef _DOLOGDEBUG_
|
---|
| 321 | LogDebug( "DialogProcedure: end WM_INITDLG" );
|
---|
| 322 | #endif
|
---|
| 323 | return MRESULT (FALSE);
|
---|
| 324 |
|
---|
| 325 | case WM_COMMAND:
|
---|
| 326 | switch (SHORT1FROMMP (mp1))
|
---|
| 327 | {
|
---|
| 328 | case WID_PB_OK:
|
---|
| 329 | #ifdef _DOLOGDEBUG_
|
---|
| 330 | LogDebug( "DialogProcedure: start WID_PB_OK" );
|
---|
| 331 | #endif
|
---|
[27] | 332 | saveum = TRUE;
|
---|
[2] | 333 | WinSendMsg (hwnd, WM_CLOSE, 0,0);
|
---|
| 334 | #ifdef _DOLOGDEBUG_
|
---|
| 335 | LogDebug( "DialogProcedure: end WID_PB_OK" );
|
---|
| 336 | #endif
|
---|
| 337 | break;
|
---|
| 338 |
|
---|
| 339 | case WID_PB_UNDO:
|
---|
| 340 | {
|
---|
| 341 | ULONG id = (ULONG)
|
---|
| 342 | WinSendDlgItemMsg (hwnd, WID_NB_SETTINGS,
|
---|
| 343 | BKM_QUERYPAGEID, 0,
|
---|
| 344 | MPFROM2SHORT (BKA_TOP, 0));
|
---|
| 345 | if (id)
|
---|
| 346 | {
|
---|
| 347 | HWND hwndPage = (HWND)
|
---|
| 348 | WinSendDlgItemMsg (hwnd, WID_NB_SETTINGS,
|
---|
| 349 | BKM_QUERYPAGEWINDOWHWND,
|
---|
| 350 | MPFROMLONG (id), 0);
|
---|
[27] | 351 | // Make mp1 1 for default use it to select setting on pages
|
---|
[2] | 352 | WinSendMsg (hwndPage, UM_SETTINGS2DIALOG, 0,0);
|
---|
| 353 | }
|
---|
| 354 | }
|
---|
| 355 | break;
|
---|
| 356 |
|
---|
| 357 | case DID_CANCEL:
|
---|
| 358 | {
|
---|
| 359 | // Undo stuff on all notebook pages:
|
---|
| 360 | HWND hwndPage;
|
---|
| 361 |
|
---|
| 362 | // Get ID of first notebook page.
|
---|
| 363 | ULONG id =
|
---|
| 364 | ULONG( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
|
---|
| 365 | BKM_QUERYPAGEID, 0,
|
---|
| 366 | MPFROM2SHORT( BKA_FIRST, 0 ) ) );
|
---|
| 367 | if( id ) {
|
---|
| 368 | hwndPage =
|
---|
| 369 | HWND( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
|
---|
| 370 | BKM_QUERYPAGEWINDOWHWND,
|
---|
| 371 | MPFROMLONG( id ), 0 ) );
|
---|
| 372 | WinSendMsg( hwndPage, UM_SETTINGS2DIALOG, 0,0 );
|
---|
| 373 | }
|
---|
| 374 |
|
---|
| 375 | while( id ) {
|
---|
| 376 | // Get ID of next notebook page.
|
---|
| 377 | if( ( id =
|
---|
| 378 | ULONG( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
|
---|
| 379 | BKM_QUERYPAGEID,
|
---|
| 380 | MPFROMLONG( id ),
|
---|
| 381 | MPFROM2SHORT( BKA_NEXT, 0 )
|
---|
| 382 | ) ) ) ) {
|
---|
| 383 | hwndPage =
|
---|
| 384 | HWND( WinSendDlgItemMsg( hwnd, WID_NB_SETTINGS,
|
---|
| 385 | BKM_QUERYPAGEWINDOWHWND,
|
---|
| 386 | MPFROMLONG( id ), 0 ) );
|
---|
| 387 | WinSendMsg( hwndPage, UM_SETTINGS2DIALOG, 0,0 );
|
---|
| 388 | }
|
---|
| 389 | }
|
---|
| 390 | WinSendMsg( hwnd, WM_CLOSE, 0,0 );
|
---|
| 391 | }
|
---|
| 392 | break;
|
---|
| 393 | }
|
---|
| 394 | return MRESULT (FALSE);
|
---|
| 395 |
|
---|
| 396 | #ifdef _DOLOGDEBUG_
|
---|
| 397 | case WM_DESTROY:
|
---|
| 398 | LogDebug( "DialogProcedure: WM_DESTROY" );
|
---|
| 399 | return MRESULT (FALSE);
|
---|
| 400 | #endif
|
---|
| 401 |
|
---|
| 402 | case WM_CLOSE:
|
---|
| 403 | #ifdef _DOLOGDEBUG_
|
---|
| 404 | LogDebug( "DialogProcedure: WM_CLOSE" );
|
---|
| 405 | #endif
|
---|
| 406 | case WM_QUIT:
|
---|
| 407 | #ifdef _DOLOGDEBUG_
|
---|
| 408 | LogDebug( "DialogProcedure: WM_QUIT" );
|
---|
| 409 | #endif
|
---|
| 410 | case WM_SAVEAPPLICATION:
|
---|
| 411 | #ifdef _DOLOGDEBUG_
|
---|
| 412 | LogDebug( "DialogProcedure: WM_SAVEAPPLICATION" );
|
---|
| 413 | #endif
|
---|
| 414 | #ifdef _DOLOGDEBUG_
|
---|
| 415 | LogDebug( "DialogProcedure: start WM_CLOSE (or WM_QUIT, WM_SAVEAPPLICATION)" );
|
---|
| 416 | #endif
|
---|
| 417 | for (USHORT i = 0; i < COUNT_PAGES; i++)
|
---|
| 418 | WinSendMsg (pset->hwndPage[i], UM_ADJUST, 0,0);
|
---|
| 419 | #ifdef _DOLOGDEBUG_
|
---|
| 420 | LogDebug( "DialogProcedure: end WM_CLOSE (or WM_QUIT, WM_SAVEAPPLICATION)" );
|
---|
| 421 | #endif
|
---|
| 422 | WinDismissDlg( hwnd, 0L );
|
---|
| 423 | return MRESULT (FALSE);
|
---|
| 424 | }
|
---|
| 425 |
|
---|
| 426 | #ifdef _DOLOGDEBUG_
|
---|
| 427 | LogDebug( "DialogProcedure:WinDefDlgProc->0x%04x", msg );
|
---|
| 428 | #endif
|
---|
| 429 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
| 430 | }
|
---|
| 431 |
|
---|
[11] | 432 | // ** Page1Procedure ****************************************************** /*FOLD00*/
|
---|
[2] | 433 |
|
---|
| 434 | MRESULT EXPENTRY
|
---|
| 435 | SETTINGS :: Page1Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 436 | {
|
---|
| 437 | static PSETTINGS pset = NULL;
|
---|
| 438 |
|
---|
| 439 | switch (msg)
|
---|
| 440 | {
|
---|
| 441 | case WM_INITDLG: {
|
---|
| 442 | #ifdef _DOLOGDEBUG_
|
---|
| 443 | LogDebug( "Page1Procedure: start WM_INITDLG" );
|
---|
| 444 | #endif
|
---|
| 445 | ULONG ul;
|
---|
| 446 | pset = PSETTINGS (mp2);
|
---|
| 447 | for( int i = 0; i < BMF_INVALID; i++ ) {
|
---|
| 448 | if( pset->ifi[ i ].available ) {
|
---|
| 449 | ul = WinInsertLboxItem( WinWindowFromID( hwnd, WID_LB_FILEFORMAT ),
|
---|
| 450 | LIT_END, pset->ifi[ i ].label );
|
---|
| 451 | WinSendMsg( WinWindowFromID( hwnd, WID_LB_FILEFORMAT ),
|
---|
| 452 | LM_SETITEMHANDLE, MPFROMLONG(ul), MPFROMP( i ) );
|
---|
| 453 | }
|
---|
| 454 | }
|
---|
| 455 | #ifdef _DOLOGDEBUG_
|
---|
| 456 | LogDebug( "Page1Procedure: end WM_INITDLG" );
|
---|
| 457 | #endif
|
---|
| 458 | return MRESULT (FALSE);
|
---|
| 459 | }
|
---|
| 460 |
|
---|
| 461 | case WM_COMMAND:
|
---|
| 462 | if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
|
---|
| 463 | WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
|
---|
| 464 | return MRESULT( FALSE );
|
---|
| 465 |
|
---|
| 466 | case UM_SETTINGS2DIALOG: {
|
---|
| 467 | #ifdef _DOLOGDEBUG_
|
---|
| 468 | LogDebug( "Page1Procedure: start UM_SETTINGS2DIALOG" );
|
---|
| 469 | #endif
|
---|
| 470 | // set num save dir name
|
---|
| 471 | WinSendDlgItemMsg (hwnd, WID_E_NUMSAVEDIR, EM_SETTEXTLIMIT,
|
---|
| 472 | MPARAM (_MAX_PATH-1), (MPARAM)0);
|
---|
| 473 | WinSetDlgItemText (hwnd, WID_E_NUMSAVEDIR,
|
---|
| 474 | pset->QueryNumSaveDir ());
|
---|
| 475 | WinSendDlgItemMsg (hwnd, WID_E_NUMSAVEDIR, EM_SETSEL,
|
---|
| 476 | MPFROM2SHORT (0, _MAX_PATH), (MPARAM)0);
|
---|
| 477 |
|
---|
| 478 | // set force file name
|
---|
| 479 | WinSendDlgItemMsg (hwnd, WID_E_FORCESAVEFILE, EM_SETTEXTLIMIT,
|
---|
| 480 | MPARAM (_MAX_PATH-1), (MPARAM)0);
|
---|
| 481 | WinSetDlgItemText (hwnd, WID_E_FORCESAVEFILE,
|
---|
| 482 | pset->QueryForceSaveFile ());
|
---|
| 483 | WinSendDlgItemMsg (hwnd, WID_E_FORCESAVEFILE, EM_SETSEL,
|
---|
| 484 | MPFROM2SHORT (0, _MAX_PATH), (MPARAM)0);
|
---|
| 485 |
|
---|
| 486 | // Select the appropriate entry in the fileformat-listbox.
|
---|
| 487 | HWND hwndLB = WinWindowFromID( hwnd, WID_LB_FILEFORMAT );
|
---|
| 488 | ULONG c, i;
|
---|
| 489 |
|
---|
| 490 | c = WinQueryLboxCount( hwndLB );
|
---|
| 491 | for( i = 0; i < c; i++ )
|
---|
| 492 | {
|
---|
| 493 | ULONG type = ULONG( WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT,
|
---|
| 494 | LM_QUERYITEMHANDLE,
|
---|
| 495 | MPFROMLONG(i), NULL ) );
|
---|
| 496 | if( type == ULONG( pset->QueryFileFormat() ) )
|
---|
| 497 | break;
|
---|
| 498 | }
|
---|
| 499 | if( i < c )
|
---|
| 500 | WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT, LM_SELECTITEM,
|
---|
| 501 | MPFROMSHORT(i), MPFROMSHORT(TRUE) );
|
---|
| 502 | else
|
---|
| 503 | WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT, LM_SELECTITEM,
|
---|
| 504 | MPFROMSHORT(0), MPFROMSHORT(TRUE) );
|
---|
[30] | 505 | #ifdef _QUIET_
|
---|
| 506 | //#if 1
|
---|
[27] | 507 | // set play sound button
|
---|
| 508 | pset->AdjustButton (hwnd, WID_CB_DOSOUND,
|
---|
| 509 | pset->DoSound ());
|
---|
| 510 | #endif
|
---|
[2] | 511 | // Select appropriate radiobutton for save style.
|
---|
| 512 | switch (pset->QueryFileSaveStyle ())
|
---|
| 513 | {
|
---|
| 514 | case FSS_NUMFILES:
|
---|
| 515 | WinSendDlgItemMsg (hwnd, WID_RB_FSSNUMFILES, BM_CLICK,
|
---|
| 516 | MPFROMSHORT(TRUE), 0);
|
---|
| 517 | AdjustSaveTypeButtons (FALSE);
|
---|
| 518 | break;
|
---|
| 519 |
|
---|
| 520 | case FSS_FORCEFILE:
|
---|
| 521 | WinSendDlgItemMsg (hwnd, WID_RB_FSSFORCEFILE, BM_CLICK,
|
---|
| 522 | MPFROMSHORT(TRUE), 0);
|
---|
| 523 | AdjustSaveTypeButtons (TRUE);
|
---|
| 524 | break;
|
---|
| 525 |
|
---|
| 526 | default:
|
---|
| 527 | WinSendDlgItemMsg (hwnd, WID_RB_FSSPROMPT, BM_CLICK,
|
---|
| 528 | MPFROMSHORT(TRUE), 0);
|
---|
| 529 | AdjustSaveTypeButtons (FALSE);
|
---|
| 530 | break;
|
---|
| 531 | }
|
---|
| 532 | #ifdef _DOLOGDEBUG_
|
---|
| 533 | LogDebug( "Page1Procedure: end UM_SETTINGS2DIALOG" );
|
---|
| 534 | #endif
|
---|
| 535 | return MRESULT (FALSE);
|
---|
| 536 | }
|
---|
| 537 |
|
---|
| 538 | case UM_ADJUST:
|
---|
| 539 | {
|
---|
| 540 | #ifdef _DOLOGDEBUG_
|
---|
| 541 | LogDebug( "Page1Procedure: start UM_ADJUST" );
|
---|
| 542 | #endif
|
---|
| 543 | // get file save style
|
---|
| 544 | if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_FSSNUMFILES),
|
---|
| 545 | BM_QUERYCHECK, 0,0))
|
---|
| 546 | pset->SetFileSaveStyle (FSS_NUMFILES);
|
---|
| 547 | else if (WinSendMsg (WinWindowFromID (hwnd, WID_RB_FSSFORCEFILE),
|
---|
| 548 | BM_QUERYCHECK, 0,0))
|
---|
| 549 | pset->SetFileSaveStyle (FSS_FORCEFILE);
|
---|
| 550 | else
|
---|
| 551 | pset->SetFileSaveStyle (FSS_PROMPT);
|
---|
[30] | 552 | #ifdef _QUIET_
|
---|
| 553 | //#if 1
|
---|
[27] | 554 | pset->DoSound(WinQueryButtonCheckstate
|
---|
| 555 | (hwnd, WID_CB_DOSOUND));
|
---|
| 556 | #endif
|
---|
[2] | 557 | #ifdef _DOLOGDEBUG_
|
---|
| 558 | LogDebug( "Page1Procedure: checkpoint 1" );
|
---|
| 559 | #endif
|
---|
| 560 |
|
---|
| 561 | // Get file format.
|
---|
| 562 | ULONG ul = USHORT( WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT,
|
---|
| 563 | LM_QUERYSELECTION,
|
---|
| 564 | MPFROMLONG( LIT_FIRST ),
|
---|
| 565 | 0L ) );
|
---|
| 566 | ul = ULONG( WinSendDlgItemMsg( hwnd, WID_LB_FILEFORMAT,
|
---|
| 567 | LM_QUERYITEMHANDLE,
|
---|
| 568 | MPFROMLONG( ul ), NULL ) );
|
---|
| 569 | pset->SetFileFormat( SHORT( ul ) );
|
---|
[11] | 570 |
|
---|
| 571 | pset->SetSaveFile(AddExtensionToFilename(pset->QuerySaveFile()));
|
---|
| 572 |
|
---|
[2] | 573 | #ifdef _DOLOGDEBUG_
|
---|
| 574 | LogDebug( "Page1Procedure: checkpoint 2" );
|
---|
| 575 | #endif
|
---|
| 576 |
|
---|
| 577 | // num save dir file name
|
---|
| 578 | CHAR psz[_MAX_PATH];
|
---|
| 579 | WinQueryDlgItemText (hwnd, WID_E_NUMSAVEDIR, _MAX_PATH, psz);
|
---|
| 580 | pset->SetNumSaveDir (psz);
|
---|
| 581 |
|
---|
| 582 | // force file name
|
---|
| 583 | WinQueryDlgItemText (hwnd, WID_E_FORCESAVEFILE, _MAX_PATH, psz);
|
---|
| 584 | pset->SetForceSaveFile (psz);
|
---|
| 585 |
|
---|
| 586 | AdjustSaveTypeButtons
|
---|
| 587 | (BOOL (pset->QueryFileSaveStyle () == FSS_FORCEFILE));
|
---|
[27] | 588 | pset->saveStyle = pset->QuerySaveStyle ();
|
---|
| 589 | pset->pNumSaveDir = pset->QueryNumSaveDir ();
|
---|
| 590 | pset->pForceSaveFile = pset->QueryForceSaveFile();
|
---|
| 591 |
|
---|
| 592 | if (saveum)
|
---|
| 593 | pset->Save ();
|
---|
[2] | 594 | #ifdef _DOLOGDEBUG_
|
---|
| 595 | LogDebug( "Page1Procedure: end UM_ADJUST" );
|
---|
| 596 | #endif
|
---|
| 597 | }
|
---|
| 598 | break;
|
---|
| 599 |
|
---|
| 600 | case WM_CONTROL:
|
---|
| 601 | switch (SHORT1FROMMP (mp1))
|
---|
| 602 | {
|
---|
| 603 | case WID_RB_FSSFORCEFILE:
|
---|
| 604 | AdjustSaveTypeButtons (TRUE);
|
---|
| 605 | break;
|
---|
| 606 |
|
---|
| 607 | case WID_RB_FSSPROMPT:
|
---|
| 608 | case WID_RB_FSSNUMFILES:
|
---|
| 609 | AdjustSaveTypeButtons (FALSE);
|
---|
| 610 | break;
|
---|
| 611 | }
|
---|
| 612 | return MRESULT (FALSE);
|
---|
| 613 | }
|
---|
| 614 |
|
---|
| 615 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
| 616 | }
|
---|
| 617 |
|
---|
[27] | 618 | // ** Page2Procedure ****************************************************** /*FOLD00*/
|
---|
[2] | 619 |
|
---|
| 620 | MRESULT EXPENTRY
|
---|
| 621 | SETTINGS :: Page2Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 622 | {
|
---|
| 623 | static PSETTINGS pset = NULL;
|
---|
| 624 |
|
---|
| 625 | switch (msg)
|
---|
| 626 | {
|
---|
| 627 | case WM_INITDLG:
|
---|
| 628 | #ifdef _DOLOGDEBUG_
|
---|
| 629 | LogDebug( "Page1Procedure: start WM_INITDLG" );
|
---|
| 630 | #endif
|
---|
| 631 | pset = PSETTINGS (mp2);
|
---|
| 632 | #ifdef _DOLOGDEBUG_
|
---|
| 633 | LogDebug( "Page1Procedure: end WM_INITDLG" );
|
---|
| 634 | #endif
|
---|
| 635 | return MRESULT (FALSE);
|
---|
| 636 |
|
---|
| 637 | case WM_COMMAND:
|
---|
| 638 | if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
|
---|
| 639 | WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
|
---|
| 640 | return MRESULT( FALSE );
|
---|
| 641 |
|
---|
| 642 | case UM_SETTINGS2DIALOG:
|
---|
| 643 | #ifdef _DOLOGDEBUG_
|
---|
| 644 | LogDebug( "Page2Procedure: start UM_SETTINGS2DIALOG" );
|
---|
| 645 | #endif
|
---|
| 646 | // set state of checkbuttons
|
---|
| 647 | pset->AdjustButton (hwnd, WID_CB_SSWENABLE,
|
---|
| 648 | pset->SnapshotWindow ());
|
---|
| 649 | pset->AdjustButton (hwnd, WID_CB_SSWHIDE,
|
---|
| 650 | pset->SSWHide ());
|
---|
| 651 | pset->AdjustButton (hwnd, WID_CB_SSWALWAYSONTOP,
|
---|
| 652 | pset->SSWAlwaysOnTop ());
|
---|
[30] | 653 | #ifdef _QUIET_
|
---|
| 654 | //#if 1
|
---|
[27] | 655 | pset->AdjustButton (hwnd, WID_CB_SERIALCAPTURE,
|
---|
| 656 | pset->SerialCapture ());
|
---|
| 657 | pset->AdjustButton (hwnd, WID_CB_DELAYCOUNTDOWN,
|
---|
| 658 | pset->DelayCountdown ());
|
---|
[2] | 659 |
|
---|
[27] | 660 | // init delay time sb
|
---|
| 661 | WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME, SPBM_SETLIMITS,
|
---|
| 662 | MPFROMLONG (65536), MPFROMLONG (1));
|
---|
| 663 | WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME, SPBM_SETCURRENTVALUE,
|
---|
| 664 | MPFROMLONG (pset->QueryDelayTime ()), 0);
|
---|
| 665 |
|
---|
| 666 | // init serial time sb
|
---|
| 667 | WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME, SPBM_SETLIMITS,
|
---|
| 668 | MPFROMLONG (65536), MPFROMLONG (1));
|
---|
| 669 | WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME, SPBM_SETCURRENTVALUE,
|
---|
| 670 | MPFROMLONG (pset->QuerySerialTime ()), 0);
|
---|
| 671 | #endif
|
---|
[2] | 672 | switch (pset->QuerySSWCaptureType ())
|
---|
| 673 | {
|
---|
| 674 | case CAP_WINDOWINT:
|
---|
| 675 | WinSendDlgItemMsg (hwnd, WID_SSWWINDOWINT, BM_CLICK,
|
---|
| 676 | MPFROMSHORT(TRUE), 0);
|
---|
| 677 | break;
|
---|
| 678 | case CAP_SCREENREGION:
|
---|
| 679 | WinSendDlgItemMsg (hwnd, WID_SSWSCREENREGION, BM_CLICK,
|
---|
| 680 | MPFROMSHORT(TRUE), 0);
|
---|
| 681 | break;
|
---|
| 682 | case CAP_WINDOW:
|
---|
| 683 | WinSendDlgItemMsg (hwnd, WID_SSWWINDOW, BM_CLICK,
|
---|
| 684 | MPFROMSHORT(TRUE), 0);
|
---|
| 685 | break;
|
---|
| 686 | default:
|
---|
| 687 | WinSendDlgItemMsg (hwnd, WID_SSWSCREEN, BM_CLICK,
|
---|
| 688 | MPFROMSHORT(TRUE), 0);
|
---|
| 689 | break;
|
---|
| 690 | }
|
---|
| 691 |
|
---|
| 692 | // show or hide snapshot window
|
---|
| 693 | if (! WinSendDlgItemMsg (hwnd, WID_CB_SSWENABLE,
|
---|
| 694 | BM_QUERYCHECK, 0, 0))
|
---|
| 695 | WinShowWindow (hwndSnapshot, FALSE);
|
---|
| 696 | else
|
---|
| 697 | WinShowWindow (hwndSnapshot, TRUE);
|
---|
| 698 |
|
---|
| 699 | #ifdef _DOLOGDEBUG_
|
---|
| 700 | LogDebug( "Page1Procedure: end UM_SETTINGS2DIALOG" );
|
---|
| 701 | #endif
|
---|
| 702 | return MRESULT (FALSE);
|
---|
| 703 |
|
---|
| 704 | case UM_ADJUST:
|
---|
| 705 | #ifdef _DOLOGDEBUG_
|
---|
| 706 | LogDebug( "Page2Procedure: start UM_ADJUST" );
|
---|
| 707 | #endif
|
---|
[30] | 708 | #ifndef _QUIET_
|
---|
| 709 | //#if 0
|
---|
[2] | 710 | // query state of checkbuttons and set flags
|
---|
| 711 | pset->SSWHide(WinQueryButtonCheckstate(hwnd, WID_CB_SSWHIDE));
|
---|
| 712 | #ifdef _DOLOGDEBUG_
|
---|
| 713 | LogDebug( "Page2Procedure: checkpoint 1" );
|
---|
| 714 | #endif
|
---|
| 715 | pset->SnapshotWindow(WinQueryButtonCheckstate(hwnd, WID_CB_SSWENABLE));
|
---|
| 716 | pset->SSWAlwaysOnTop(WinQueryButtonCheckstate(hwnd,
|
---|
| 717 | WID_CB_SSWALWAYSONTOP));
|
---|
| 718 | #ifdef _DOLOGDEBUG_
|
---|
| 719 | LogDebug( "Page2Procedure: checkpoint 2" );
|
---|
| 720 | #endif
|
---|
[27] | 721 | #else
|
---|
| 722 | // query state of checkbuttons and set flags
|
---|
| 723 | pset->SerialCapture(WinQueryButtonCheckstate
|
---|
| 724 | (hwnd, WID_CB_SERIALCAPTURE));
|
---|
| 725 | #ifdef _DOLOGDEBUG_
|
---|
| 726 | LogDebug( "Page3Procedure: checkpoint 1" );
|
---|
| 727 | #endif
|
---|
| 728 | pset->DelayCountdown(WinQueryButtonCheckstate
|
---|
| 729 | (hwnd, WID_CB_DELAYCOUNTDOWN));
|
---|
| 730 | #endif
|
---|
[2] | 731 | // get ssw capture type
|
---|
| 732 | if (WinSendMsg (WinWindowFromID (hwnd, WID_SSWSCREENREGION),
|
---|
| 733 | BM_QUERYCHECK, 0,0))
|
---|
| 734 | pset->SetSSWCaptureType (CAP_SCREENREGION);
|
---|
| 735 | else if (WinSendMsg (WinWindowFromID (hwnd, WID_SSWWINDOW),
|
---|
| 736 | BM_QUERYCHECK, 0,0))
|
---|
| 737 | pset->SetSSWCaptureType (CAP_WINDOW);
|
---|
| 738 | else if (WinSendMsg (WinWindowFromID (hwnd, WID_SSWWINDOWINT),
|
---|
| 739 | BM_QUERYCHECK, 0,0))
|
---|
| 740 | pset->SetSSWCaptureType (CAP_WINDOWINT);
|
---|
| 741 | else
|
---|
| 742 | pset->SetSSWCaptureType (CAP_SCREEN);
|
---|
[30] | 743 | #ifdef _QUIET_
|
---|
| 744 | //#if 1
|
---|
[27] | 745 | // delay time
|
---|
| 746 | ULONG ul;
|
---|
| 747 | if (! BOOL (WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME,
|
---|
| 748 | SPBM_QUERYVALUE,
|
---|
| 749 | MPFROMP (&ul),
|
---|
| 750 | MPFROM2SHORT (0, 0))))
|
---|
| 751 | ul = 5L;
|
---|
| 752 | pset->SetDelayTime (ul);
|
---|
[2] | 753 | #ifdef _DOLOGDEBUG_
|
---|
[27] | 754 | LogDebug( "Page3Procedure: checkpoint 3" );
|
---|
| 755 | #endif
|
---|
| 756 |
|
---|
| 757 | // serial time
|
---|
| 758 | if (! BOOL (WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME,
|
---|
| 759 | SPBM_QUERYVALUE,
|
---|
| 760 | MPFROMP (&ul),
|
---|
| 761 | MPFROM2SHORT (0, 0))))
|
---|
| 762 | ul = 10L;
|
---|
| 763 | pset->SetSerialTime (ul);
|
---|
| 764 | pset->bSerialCapture = pset->SerialCapture ();
|
---|
| 765 | #endif
|
---|
| 766 | if (saveum)
|
---|
| 767 | pset->Save ();
|
---|
| 768 | #ifdef _DOLOGDEBUG_
|
---|
[2] | 769 | LogDebug( "Page2Procedure: end UM_ADJUST" );
|
---|
| 770 | #endif
|
---|
| 771 | break;
|
---|
| 772 |
|
---|
| 773 | case WM_CONTROL:
|
---|
| 774 | switch (SHORT1FROMMP (mp1))
|
---|
| 775 | {
|
---|
| 776 | case WID_CB_SSWENABLE:
|
---|
| 777 | if (! WinSendDlgItemMsg (hwnd, WID_CB_SSWENABLE,
|
---|
| 778 | BM_QUERYCHECK, 0, 0))
|
---|
| 779 | WinShowWindow (hwndSnapshot, FALSE);
|
---|
| 780 | else
|
---|
| 781 | WinShowWindow (hwndSnapshot, TRUE);
|
---|
| 782 | break;
|
---|
| 783 | }
|
---|
| 784 | return MRESULT (FALSE);
|
---|
| 785 | }
|
---|
| 786 |
|
---|
| 787 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
| 788 | }
|
---|
| 789 |
|
---|
| 790 | // ** Page3Procedure ****************************************************** /*FOLD00*/
|
---|
| 791 |
|
---|
| 792 | MRESULT EXPENTRY
|
---|
| 793 | SETTINGS :: Page3Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 794 | {
|
---|
| 795 | static PSETTINGS pset = NULL;
|
---|
| 796 |
|
---|
| 797 | switch (msg)
|
---|
| 798 | {
|
---|
| 799 | case WM_INITDLG:
|
---|
| 800 | #ifdef _DOLOGDEBUG_
|
---|
| 801 | LogDebug( "Page3Procedure: start WM_INITDLG" );
|
---|
| 802 | #endif
|
---|
| 803 | pset = PSETTINGS (mp2);
|
---|
| 804 | #ifdef _DOLOGDEBUG_
|
---|
| 805 | LogDebug( "Page3Procedure: end WM_INITDLG" );
|
---|
| 806 | #endif
|
---|
| 807 | return MRESULT (FALSE);
|
---|
| 808 |
|
---|
| 809 | case WM_COMMAND:
|
---|
| 810 | if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
|
---|
| 811 | WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
|
---|
| 812 | return MRESULT( FALSE );
|
---|
| 813 |
|
---|
| 814 | case UM_SETTINGS2DIALOG:
|
---|
| 815 | #ifdef _DOLOGDEBUG_
|
---|
| 816 | LogDebug( "Page3Procedure: start UM_SETTINGS2DIALOG" );
|
---|
| 817 | #endif
|
---|
| 818 | // set state of checkbuttons
|
---|
| 819 | pset->AdjustButton (hwnd, WID_CB_SERIALCAPTURE,
|
---|
| 820 | pset->SerialCapture ());
|
---|
| 821 | pset->AdjustButton (hwnd, WID_CB_DELAYCOUNTDOWN,
|
---|
| 822 | pset->DelayCountdown ());
|
---|
| 823 | pset->AdjustButton (hwnd, WID_CB_DOSOUND,
|
---|
| 824 | pset->DoSound ());
|
---|
| 825 | pset->AdjustButton (hwnd, WID_CB_IDLEPRIORITY,
|
---|
| 826 | pset->QueryFlag(SEI_IDLEPRIORITY));
|
---|
| 827 |
|
---|
| 828 | // init delay time sb
|
---|
| 829 | WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME, SPBM_SETLIMITS,
|
---|
| 830 | MPFROMLONG (65536), MPFROMLONG (1));
|
---|
| 831 | WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME, SPBM_SETCURRENTVALUE,
|
---|
| 832 | MPFROMLONG (pset->QueryDelayTime ()), 0);
|
---|
| 833 |
|
---|
| 834 | // init serial time sb
|
---|
| 835 | WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME, SPBM_SETLIMITS,
|
---|
| 836 | MPFROMLONG (65536), MPFROMLONG (1));
|
---|
| 837 | WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME, SPBM_SETCURRENTVALUE,
|
---|
| 838 | MPFROMLONG (pset->QuerySerialTime ()), 0);
|
---|
| 839 | #ifdef _DOLOGDEBUG_
|
---|
| 840 | LogDebug( "Page3Procedure: end UM_SETTINGS2DIALOG" );
|
---|
| 841 | #endif
|
---|
| 842 | return MRESULT (FALSE);
|
---|
| 843 |
|
---|
| 844 | case UM_ADJUST:
|
---|
| 845 | {
|
---|
| 846 | #ifdef _DOLOGDEBUG_
|
---|
| 847 | LogDebug( "Page3Procedure: start UM_ADJUST" );
|
---|
| 848 | #endif
|
---|
| 849 | // query state of checkbuttons and set flags
|
---|
| 850 | pset->SerialCapture(WinQueryButtonCheckstate
|
---|
| 851 | (hwnd, WID_CB_SERIALCAPTURE));
|
---|
| 852 | #ifdef _DOLOGDEBUG_
|
---|
| 853 | LogDebug( "Page3Procedure: checkpoint 1" );
|
---|
| 854 | #endif
|
---|
| 855 | pset->DelayCountdown(WinQueryButtonCheckstate
|
---|
| 856 | (hwnd, WID_CB_DELAYCOUNTDOWN));
|
---|
| 857 | pset->DoSound(WinQueryButtonCheckstate
|
---|
| 858 | (hwnd, WID_CB_DOSOUND));
|
---|
| 859 | pset->SetFlag(SEI_IDLEPRIORITY, WinQueryButtonCheckstate
|
---|
| 860 | (hwnd, WID_CB_IDLEPRIORITY));
|
---|
| 861 | #ifdef _DOLOGDEBUG_
|
---|
| 862 | LogDebug( "Page3Procedure: checkpoint 2" );
|
---|
| 863 | #endif
|
---|
| 864 |
|
---|
| 865 | // delay time
|
---|
| 866 | ULONG ul;
|
---|
| 867 | if (! BOOL (WinSendDlgItemMsg (hwnd, WID_SB_DELAYTIME,
|
---|
| 868 | SPBM_QUERYVALUE,
|
---|
| 869 | MPFROMP (&ul),
|
---|
| 870 | MPFROM2SHORT (0, 0))))
|
---|
| 871 | ul = 5L;
|
---|
| 872 | pset->SetDelayTime (ul);
|
---|
| 873 | #ifdef _DOLOGDEBUG_
|
---|
| 874 | LogDebug( "Page3Procedure: checkpoint 3" );
|
---|
| 875 | #endif
|
---|
| 876 |
|
---|
| 877 | // serial time
|
---|
| 878 | if (! BOOL (WinSendDlgItemMsg (hwnd, WID_SB_SERIALTIME,
|
---|
| 879 | SPBM_QUERYVALUE,
|
---|
| 880 | MPFROMP (&ul),
|
---|
| 881 | MPFROM2SHORT (0, 0))))
|
---|
| 882 | ul = 10L;
|
---|
| 883 | pset->SetSerialTime (ul);
|
---|
[27] | 884 | pset->bSerialCapture = pset->SerialCapture ();
|
---|
| 885 | pset->idleSetInIni = pset->QueryFlag(SEI_IDLEPRIORITY);
|
---|
| 886 |
|
---|
| 887 | if (saveum)
|
---|
| 888 | pset->Save ();
|
---|
[2] | 889 | #ifdef _DOLOGDEBUG_
|
---|
| 890 | LogDebug( "Page3Procedure: end UM_ADJUST" );
|
---|
| 891 | #endif
|
---|
| 892 | }
|
---|
| 893 | break;
|
---|
| 894 |
|
---|
| 895 | case WM_CONTROL:
|
---|
| 896 | switch (SHORT1FROMMP (mp1))
|
---|
| 897 | {
|
---|
| 898 | case WID_CB_SERIALCAPTURE:
|
---|
| 899 | {
|
---|
| 900 | HWND hwndButton =
|
---|
| 901 | WinWindowFromID (WinWindowFromID (hwndFrame, FID_CLIENT),
|
---|
| 902 | WID_CB_DELAYEDCAPTURE);
|
---|
| 903 | if (! WinSendDlgItemMsg (hwnd, WID_CB_SERIALCAPTURE,
|
---|
| 904 | BM_QUERYCHECK, 0, 0))
|
---|
| 905 | WinEnableWindow (hwndButton, TRUE);
|
---|
| 906 | else
|
---|
| 907 | WinEnableWindow (hwndButton, FALSE);
|
---|
| 908 | }
|
---|
| 909 | break;
|
---|
| 910 | }
|
---|
| 911 | return MRESULT (FALSE);
|
---|
| 912 | }
|
---|
| 913 |
|
---|
| 914 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
| 915 | }
|
---|
| 916 |
|
---|
| 917 | // ** Page4Procedure ****************************************************** /*FOLD00*/
|
---|
| 918 |
|
---|
| 919 | MRESULT EXPENTRY
|
---|
| 920 | SETTINGS :: Page4Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 921 | {
|
---|
| 922 | static PSETTINGS pset = NULL;
|
---|
| 923 |
|
---|
| 924 | switch (msg)
|
---|
| 925 | {
|
---|
| 926 | case WM_INITDLG:
|
---|
| 927 | {
|
---|
| 928 | #ifdef _DOLOGDEBUG_
|
---|
| 929 | LogDebug( "Page4Procedure: start WM_INITDLG" );
|
---|
| 930 | #endif
|
---|
| 931 | pset = PSETTINGS (mp2);
|
---|
| 932 |
|
---|
| 933 | pset->GetLanguages(WinWindowFromID (hwnd, WID_LB_LANGUAGES));
|
---|
| 934 |
|
---|
| 935 | #ifdef _DOLOGDEBUG_
|
---|
| 936 | LogDebug( "Page4Procedure: WM_INITDLG: after GetLanguages()" );
|
---|
| 937 | #endif
|
---|
| 938 | HDIR hdir;
|
---|
| 939 | ULONG c, fl;
|
---|
| 940 | FILEFINDBUF3 findbuf;
|
---|
| 941 | APIRET rc;
|
---|
| 942 | PSZ psz;
|
---|
| 943 |
|
---|
| 944 | // find all hlps and add the names to the language list
|
---|
| 945 | fl = FILE_NORMAL;
|
---|
| 946 | hdir = HDIR_CREATE;
|
---|
| 947 | c = 1;
|
---|
| 948 | rc = DosFindFirst ("*.hlp", &hdir, fl, &findbuf,
|
---|
| 949 | sizeof (findbuf), &c, FIL_STANDARD);
|
---|
| 950 | #ifdef _DOLOGDEBUG_
|
---|
| 951 | LogDebug( "Page4Procedure: WM_INITDLG: Entering help file loop ..." );
|
---|
| 952 | #endif
|
---|
| 953 | while (!rc)
|
---|
| 954 | {
|
---|
| 955 | #ifdef _DOLOGDEBUG_
|
---|
| 956 | LogDebug( "Page4Procedure: WM_INITDLG: Doing '%s' ...", findbuf.achName );
|
---|
| 957 | #endif
|
---|
[11] | 958 | if ((psz = strchr (findbuf.achName, '.')))
|
---|
[2] | 959 | *psz = '\0';
|
---|
| 960 | findbuf.achName[0] = toupper (findbuf.achName[0]);
|
---|
| 961 | WinInsertLboxItem (WinWindowFromID (hwnd, WID_LB_LANGUAGESHELP),
|
---|
| 962 | LIT_END, findbuf.achName);
|
---|
| 963 | c = 1;
|
---|
| 964 | rc = DosFindNext (hdir, &findbuf, sizeof (findbuf), &c);
|
---|
| 965 | }
|
---|
| 966 | DosFindClose (hdir);
|
---|
| 967 | #ifdef _DOLOGDEBUG_
|
---|
| 968 | LogDebug( "Page4Procedure: WM_INITDLG: help file loop done." );
|
---|
| 969 | #endif
|
---|
| 970 |
|
---|
| 971 | WinSendMsg (hwnd, UM_SETTINGS2DIALOG, 0,0);
|
---|
| 972 |
|
---|
| 973 | if (pset->fAutoLanguage)
|
---|
| 974 | WinEnableWindow (WinWindowFromID (hwnd, WID_ST_LANGNOTE),
|
---|
| 975 | FALSE);
|
---|
| 976 | #ifdef _DOLOGDEBUG_
|
---|
| 977 | LogDebug( "Page4Procedure: end WM_INITDLG" );
|
---|
| 978 | #endif
|
---|
| 979 | }
|
---|
| 980 | return MRESULT (FALSE);
|
---|
| 981 |
|
---|
| 982 | case WM_COMMAND:
|
---|
| 983 | if( SHORT1FROMMP( mp1 ) == DID_CANCEL )
|
---|
| 984 | WinPostMsg( g_hwndSettingsDialog, msg, mp1, mp2 );
|
---|
| 985 | return MRESULT( FALSE );
|
---|
| 986 |
|
---|
| 987 | case UM_SETTINGS2DIALOG:
|
---|
| 988 | {
|
---|
| 989 |
|
---|
| 990 | #ifdef _DOLOGDEBUG_
|
---|
| 991 | LogDebug( "Page4Procedure: start UM_SETTINGS2DIALOG" );
|
---|
| 992 | #endif
|
---|
| 993 | // select the appropriate entry in the language-listbox
|
---|
| 994 | CHAR ach[_MAX_FNAME];
|
---|
| 995 | HWND hwndLB = WinWindowFromID (hwnd, WID_LB_LANGUAGES);
|
---|
| 996 | ULONG c, i;
|
---|
| 997 |
|
---|
| 998 | c = WinQueryLboxCount (hwndLB);
|
---|
| 999 |
|
---|
| 1000 | for (i = 0; i < c; i++)
|
---|
| 1001 | {
|
---|
| 1002 | #ifdef _DOLOGDEBUG_
|
---|
| 1003 | LogDebug( "Page4Procedure: UM_SETTINGS2DIALOG: i.1 = %d", i );
|
---|
| 1004 | #endif
|
---|
| 1005 | PSZ psz = PSZ(WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES,
|
---|
| 1006 | LM_QUERYITEMHANDLE,
|
---|
| 1007 | MPFROMLONG(i), NULL));
|
---|
| 1008 | // WinQueryLboxItemText (hwndLB, i, ach, sizeof (ach));
|
---|
| 1009 | if (stricmp (pset->QueryString(SEI_LANGUAGE), psz) == 0)
|
---|
| 1010 | break;
|
---|
| 1011 | }
|
---|
| 1012 | #ifdef _DOLOGDEBUG_
|
---|
| 1013 | LogDebug( "Page4Procedure: UM_SETTINGS2DIALOG: after loop 1" );
|
---|
| 1014 | #endif
|
---|
| 1015 | if (i < c)
|
---|
| 1016 | WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES, LM_SELECTITEM,
|
---|
| 1017 | MPFROMSHORT (i), MPFROMSHORT (TRUE));
|
---|
| 1018 | else
|
---|
| 1019 | WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES, LM_SELECTITEM,
|
---|
| 1020 | MPFROMSHORT (0), MPFROMSHORT (TRUE));
|
---|
| 1021 | hwndLB = WinWindowFromID (hwnd, WID_LB_LANGUAGESHELP);
|
---|
| 1022 | c = WinQueryLboxCount (hwndLB);
|
---|
| 1023 |
|
---|
| 1024 | for (i = 0; i < c; i++)
|
---|
| 1025 | {
|
---|
| 1026 | #ifdef _DOLOGDEBUG_
|
---|
| 1027 | LogDebug( "Page4Procedure: UM_SETTINGS2DIALOG: i.2 = %d", i );
|
---|
| 1028 | #endif
|
---|
| 1029 | WinQueryLboxItemText (hwndLB, i, ach, sizeof (ach));
|
---|
| 1030 | if (stricmp (pset->QueryString (SEI_LANGUAGEHELP), ach) == 0)
|
---|
| 1031 | break;
|
---|
| 1032 | }
|
---|
| 1033 | #ifdef _DOLOGDEBUG_
|
---|
| 1034 | LogDebug( "Page4Procedure: UM_SETTINGS2DIALOG: after loop 2" );
|
---|
| 1035 | #endif
|
---|
| 1036 | if (i < c)
|
---|
| 1037 | WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGESHELP, LM_SELECTITEM,
|
---|
| 1038 | MPFROMSHORT (i), MPFROMSHORT (TRUE));
|
---|
| 1039 | else
|
---|
| 1040 | WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGESHELP, LM_SELECTITEM,
|
---|
| 1041 | MPFROMSHORT (0), MPFROMSHORT (TRUE));
|
---|
| 1042 | #ifdef _DOLOGDEBUG_
|
---|
| 1043 | LogDebug( "Page4Procedure: end UM_SETTINGS2DIALOG" );
|
---|
| 1044 | #endif
|
---|
| 1045 | }
|
---|
| 1046 | return MRESULT (FALSE);
|
---|
| 1047 |
|
---|
| 1048 | case WM_DESTROY:
|
---|
| 1049 | {
|
---|
| 1050 | CHAR ach[_MAX_FNAME];
|
---|
| 1051 |
|
---|
| 1052 | ULONG ul = USHORT (WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES,
|
---|
| 1053 | LM_QUERYSELECTION,
|
---|
| 1054 | MPFROMLONG (LIT_FIRST), 0L));
|
---|
| 1055 | PSZ psz = PSZ(WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGES,
|
---|
| 1056 | LM_QUERYITEMHANDLE,
|
---|
| 1057 | MPFROMLONG(ul), NULL));
|
---|
| 1058 | pset->SetString(SEI_LANGUAGE, psz);
|
---|
| 1059 |
|
---|
| 1060 | ul = USHORT (WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGESHELP,
|
---|
| 1061 | LM_QUERYSELECTION,
|
---|
| 1062 | MPFROMLONG (LIT_FIRST), 0L));
|
---|
| 1063 | WinSendDlgItemMsg (hwnd, WID_LB_LANGUAGESHELP, LM_QUERYITEMTEXT,
|
---|
| 1064 | MPFROM2SHORT (ul, sizeof (ach)), MPFROMP (ach));
|
---|
| 1065 | pset->SetString (SEI_LANGUAGEHELP, ach);
|
---|
[27] | 1066 |
|
---|
| 1067 | if (saveum)
|
---|
| 1068 | pset->Save ();
|
---|
[2] | 1069 | }
|
---|
| 1070 | return MRESULT (FALSE);
|
---|
| 1071 | }
|
---|
| 1072 |
|
---|
| 1073 | return WinDefDlgProc (hwnd, msg, mp1, mp2);
|
---|
| 1074 | }
|
---|
| 1075 |
|
---|
[27] | 1076 | // ** AdjustSaveTypeButtons *********************************************** /*FOLD00*/
|
---|
[2] | 1077 |
|
---|
| 1078 | VOID AdjustSaveTypeButtons (BOOL f)
|
---|
| 1079 | {
|
---|
| 1080 | HWND hwndClient = WinWindowFromID (hwndFrame, FID_CLIENT);
|
---|
| 1081 |
|
---|
| 1082 | // FIXME um, em, global variables :-$
|
---|
| 1083 | WinEnableWindow (WinWindowFromID (hwndClient, WID_RB_CLIPBOARD), !f);
|
---|
| 1084 | WinEnableWindow (WinWindowFromID (hwndClient, WID_RB_FILE), !f);
|
---|
| 1085 | }
|
---|
| 1086 |
|
---|
| 1087 | // ** QueryWindowData ***************************************************** /*fold00*/
|
---|
| 1088 |
|
---|
| 1089 | VOID SETTINGS :: QueryWindowData (SWP *pswp, USHORT us[7], BOOL f)
|
---|
| 1090 | {
|
---|
| 1091 | // FIXME puke, yukk, choke! get this flag thing away! do it better!
|
---|
| 1092 | // FIXME what is with US?
|
---|
| 1093 | if (f)
|
---|
| 1094 | memcpy (pswp, QueryBinary(SEI_SWPSSW), sizeof (SWP));
|
---|
| 1095 | else
|
---|
| 1096 | memcpy (pswp, QueryBinary(SEI_SWP), sizeof (SWP));
|
---|
| 1097 |
|
---|
| 1098 | LONG cx, cy;
|
---|
| 1099 | cx = WinQuerySysValue (HWND_DESKTOP, SV_CXSCREEN);
|
---|
| 1100 | cy = WinQuerySysValue (HWND_DESKTOP, SV_CYSCREEN);
|
---|
| 1101 |
|
---|
| 1102 | if (pswp->cx < 32)
|
---|
| 1103 | pswp->cx = 32;
|
---|
| 1104 | // bigger than screen?
|
---|
| 1105 | if (pswp->cx > cx)
|
---|
| 1106 | pswp->cx = cx;
|
---|
| 1107 | // partly outside of screen?
|
---|
| 1108 | if (pswp->x+pswp->cx >= cx)
|
---|
| 1109 | pswp->x = cx-pswp->cx;
|
---|
| 1110 | if (pswp->cy < 32)
|
---|
| 1111 | pswp->cy = 32;
|
---|
| 1112 | // bigger than screen?
|
---|
| 1113 | if (pswp->cy > cy)
|
---|
| 1114 | pswp->cy = cy;
|
---|
| 1115 | // partly outside of screen?
|
---|
| 1116 | if (pswp->y+pswp->cy >= cy)
|
---|
| 1117 | pswp->y = cy-pswp->cy;
|
---|
| 1118 | }
|
---|
| 1119 |
|
---|
[11] | 1120 | // ** ReloadResources ***************************************************** /*FOLD00*/
|
---|
[2] | 1121 |
|
---|
| 1122 | BOOL Settings :: ReloadResources (PSZ psz)
|
---|
| 1123 | {
|
---|
| 1124 | if (g_hmod)
|
---|
| 1125 | DosFreeModule(g_hmod);
|
---|
| 1126 |
|
---|
| 1127 | APIRET rc;
|
---|
| 1128 |
|
---|
[27] | 1129 | if ((rc = DosLoadModule(PSZ(NULL), 0, psz, &g_hmod)))
|
---|
[2] | 1130 | {
|
---|
| 1131 | DisplayError("ERROR", "Could not (re)load Gotcha! resource module "
|
---|
| 1132 | "'%s' (DosLoadModule() return code %d). First make sure the DLL is in the LIBPATH. If this is the case, try to delete "
|
---|
| 1133 | "GOTCHA.INI and start Gotcha! again. If it does not work "
|
---|
| 1134 | "then, contact the author (thth@c2226.de).", psz, rc);
|
---|
| 1135 | exit(1);
|
---|
| 1136 | }
|
---|
| 1137 |
|
---|
| 1138 | ResourceString::Module(g_hmod);
|
---|
[30] | 1139 | #ifdef _QUIET_
|
---|
| 1140 | //#if 1
|
---|
[27] | 1141 | pszPageTab[0] = RSTR (IDS_MAINWIN);
|
---|
[41] | 1142 | pszPageTab[1] = RSTR (IDS_PAGEMISC);
|
---|
| 1143 | pszPageTab[2] = RSTR (IDS_PAGESAVE);
|
---|
[27] | 1144 | pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);
|
---|
| 1145 | #else
|
---|
[2] | 1146 | pszPageTab[0] = RSTR (IDS_PAGESAVE);
|
---|
| 1147 | pszPageTab[1] = RSTR (IDS_PAGESNAPSHOT);
|
---|
| 1148 | pszPageTab[2] = RSTR (IDS_PAGEMISC);
|
---|
| 1149 | pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);
|
---|
[27] | 1150 | #endif
|
---|
[2] | 1151 | for( int i = 0; i < BMF_INVALID; i++ ) {
|
---|
[11] | 1152 | ifi[ i ].label = RSTR ( IDS_BMF_JPG+i ); }
|
---|
[2] | 1153 |
|
---|
| 1154 | return TRUE;
|
---|
| 1155 | }
|
---|
| 1156 |
|
---|
[27] | 1157 | // ** SelectLanguage ****************************************************** /*FOLD00*/
|
---|
[2] | 1158 |
|
---|
| 1159 | VOID Settings :: SelectLanguage (VOID)
|
---|
| 1160 | {
|
---|
| 1161 | // set this to some default, as we must open the settings dialog for
|
---|
| 1162 | // selecting a language
|
---|
[30] | 1163 | #ifdef _QUIET_
|
---|
| 1164 | //#if 1
|
---|
[27] | 1165 | pszPageTab[0] = RSTR (IDS_MAINWIN);
|
---|
[41] | 1166 | pszPageTab[1] = RSTR (IDS_PAGEMISC);
|
---|
| 1167 | pszPageTab[2] = RSTR (IDS_PAGESAVE);
|
---|
[27] | 1168 | pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);
|
---|
| 1169 | #else
|
---|
[2] | 1170 | pszPageTab[0] = RSTR (IDS_PAGESAVE);
|
---|
| 1171 | pszPageTab[1] = RSTR (IDS_PAGESNAPSHOT);
|
---|
| 1172 | pszPageTab[2] = RSTR (IDS_PAGEMISC);
|
---|
| 1173 | pszPageTab[3] = RSTR (IDS_PAGELANGUAGE);
|
---|
[27] | 1174 | #endif
|
---|
[2] | 1175 | // bring up the "select language" settings page
|
---|
| 1176 | Dialog (TRUE);
|
---|
| 1177 | }
|
---|
| 1178 |
|
---|
[11] | 1179 | // ** GetLanguages ******************************************************** /*FOLD00*/
|
---|
[2] | 1180 |
|
---|
| 1181 | USHORT Settings :: GetLanguages (HWND hwnd)
|
---|
| 1182 | {
|
---|
| 1183 | // find all dlls and add the names to the language list
|
---|
| 1184 | HDIR hdir;
|
---|
| 1185 | ULONG c, fl, ul;
|
---|
| 1186 | FILEFINDBUF3 findbuf;
|
---|
| 1187 | APIRET rc;
|
---|
| 1188 | PSZ psz;
|
---|
| 1189 | HMODULE hmod;
|
---|
| 1190 |
|
---|
| 1191 | fl = FILE_NORMAL;
|
---|
| 1192 | hdir = HDIR_CREATE;
|
---|
| 1193 | c = 1;
|
---|
[30] | 1194 | #ifdef _QUIET_
|
---|
[37] | 1195 | rc = DosFindFirst ("goqres*.dll", &hdir, fl, &findbuf,
|
---|
[2] | 1196 | sizeof (findbuf), &c, FIL_STANDARD);
|
---|
[30] | 1197 | #else
|
---|
[37] | 1198 | rc = DosFindFirst ("gotres*.dll", &hdir, fl, &findbuf,
|
---|
[30] | 1199 | sizeof (findbuf), &c, FIL_STANDARD);
|
---|
| 1200 | #endif
|
---|
[2] | 1201 | while (!rc)
|
---|
| 1202 | {
|
---|
| 1203 | // we don't want the extension
|
---|
[11] | 1204 | if ((psz = strchr (findbuf.achName, '.')))
|
---|
[2] | 1205 | *psz = '\0';
|
---|
| 1206 | // try opening the dll and read the version etc. data
|
---|
| 1207 | if ((rc = DosLoadModule(PSZ(NULL), 0, findbuf.achName, &hmod)) == NO_ERROR) {
|
---|
| 1208 | PVOID pv;
|
---|
| 1209 | if (DosGetResource(hmod, RT_RCDATA, DLL_ID, &pv) == NO_ERROR) {
|
---|
[37] | 1210 | #ifdef _QUIET_
|
---|
| 1211 | if (strcmp(PSZ(pv), "Gotchaq!") == 0) {
|
---|
| 1212 | #else
|
---|
[2] | 1213 | if (strcmp(PSZ(pv), "Gotcha!") == 0) {
|
---|
[37] | 1214 | #endif
|
---|
[2] | 1215 | psz = PSZ(pv)+strlen(PSZ(pv))+3;
|
---|
| 1216 | ul = WinInsertLboxItem (hwnd, LIT_END, psz);
|
---|
| 1217 | WinSendMsg(hwnd, LM_SETITEMHANDLE, MPFROMLONG(ul),
|
---|
| 1218 | MPFROMP (strdup(findbuf.achName)));
|
---|
| 1219 | }
|
---|
| 1220 | DosFreeResource(pv);
|
---|
| 1221 | }
|
---|
| 1222 | DosFreeModule(hmod);
|
---|
| 1223 | }
|
---|
| 1224 | c = 1;
|
---|
| 1225 | rc = DosFindNext (hdir, &findbuf, sizeof (findbuf), &c);
|
---|
| 1226 | }
|
---|
| 1227 | DosFindClose (hdir);
|
---|
| 1228 |
|
---|
| 1229 | return 1;
|
---|
| 1230 | }
|
---|
| 1231 |
|
---|
[11] | 1232 | // ** GetFileExtension **************************************************** /*FOLD00*/
|
---|
[2] | 1233 |
|
---|
[11] | 1234 | PSZ Settings :: GetFileExtension( SHORT type )
|
---|
[2] | 1235 | {
|
---|
| 1236 | if( type == BMF_INVALID )
|
---|
| 1237 | type = SHORT( QueryFileFormat() );
|
---|
[11] | 1238 | if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
|
---|
[2] | 1239 | return ifi[ type ].extension;
|
---|
| 1240 | return "";
|
---|
| 1241 | }
|
---|
| 1242 |
|
---|
[27] | 1243 | #if 0
|
---|
[11] | 1244 | // ** GetFOURCC *********************************************************** /*FOLD00*/
|
---|
[2] | 1245 |
|
---|
[11] | 1246 | FOURCC Settings :: GetFOURCC( SHORT type )
|
---|
[2] | 1247 | {
|
---|
| 1248 | if( type == BMF_INVALID )
|
---|
| 1249 | type = SHORT( QueryFileFormat() );
|
---|
[11] | 1250 | if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
|
---|
[2] | 1251 | return ifi[ type ].fourcc;
|
---|
| 1252 | return 0L;
|
---|
| 1253 | }
|
---|
[27] | 1254 | #endif
|
---|
[11] | 1255 | // ** GetFileEAType ******************************************************* /*FOLD00*/
|
---|
[2] | 1256 |
|
---|
[11] | 1257 | PSZ Settings :: GetFileEAType( SHORT type )
|
---|
[2] | 1258 | {
|
---|
| 1259 | if( type == BMF_INVALID )
|
---|
| 1260 | type = SHORT( QueryFileFormat() );
|
---|
[11] | 1261 | if( ( type >= BMF_JPG ) && ( type < BMF_INVALID ) )
|
---|
[2] | 1262 | return ifi[ type ].eaType;
|
---|
| 1263 | return "";
|
---|
| 1264 | }
|
---|
| 1265 |
|
---|
| 1266 | // ************************************************************************
|
---|
| 1267 |
|
---|
| 1268 | PSZ Settings :: QueryNumSaveDir( VOID )
|
---|
| 1269 | {
|
---|
| 1270 | // Using a static buffer here is not really good, but good enough
|
---|
| 1271 | // currently as we know there will be no concurrent access.
|
---|
| 1272 | static CHAR ach[_MAX_PATH];
|
---|
| 1273 |
|
---|
| 1274 | if( strspn( QueryString( SEI_NUMSAVEDIR ), " \t\n\r" ) ==
|
---|
| 1275 | strlen( QueryString( SEI_NUMSAVEDIR ) ) )
|
---|
| 1276 | return getcwd( ach, _MAX_PATH );
|
---|
| 1277 | return QueryString( SEI_NUMSAVEDIR );
|
---|
| 1278 | }
|
---|
| 1279 |
|
---|
| 1280 | // ************************************************************************
|
---|