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