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