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