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