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