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