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