[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 | ***/
|
---|
| 19 |
|
---|
| 20 | #ifndef _Settings_H_
|
---|
| 21 | #define _Settings_H_
|
---|
| 22 |
|
---|
| 23 | // ** defines & stuff ***************************************************** /*FOLD00*/
|
---|
| 24 |
|
---|
| 25 | #include "gotcha.h"
|
---|
| 26 | #include "./settings/thth_settings.h"
|
---|
| 27 |
|
---|
[37] | 28 | #ifdef _QUIET
|
---|
| 29 | #define PSZ_PROFILENAME "gotchaq.ini"
|
---|
| 30 | #else
|
---|
[2] | 31 | #define PSZ_PROFILENAME "gotcha.ini"
|
---|
[37] | 32 | #endif
|
---|
[2] | 33 |
|
---|
| 34 | // this should be increased every time the format of the proFile changes
|
---|
| 35 | #define L_PROFILEVERSION 2
|
---|
| 36 |
|
---|
| 37 | #define COUNT_PAGES 4
|
---|
| 38 |
|
---|
| 39 | enum { SAVESTYLE_CLIPBOARD, SAVESTYLE_FILE, };
|
---|
[27] | 40 |
|
---|
[2] | 41 | enum {
|
---|
[11] | 42 | BMF_JPG, BMF_PNG, BMF_OS20, BMF_TIF, BMF_TGA, BMF_PCX, BMF_GIF,
|
---|
[27] | 43 | BMF_PBM, BMF_JP2, BMF_DIB,
|
---|
[11] | 44 | BMF_INVALID
|
---|
| 45 | };
|
---|
[27] | 46 |
|
---|
[2] | 47 | enum { FSS_PROMPT, FSS_NUMFILES, FSS_FORCEFILE, };
|
---|
| 48 |
|
---|
| 49 | class ImageFormatInfo
|
---|
| 50 | {
|
---|
| 51 | public:
|
---|
| 52 | BOOL available;
|
---|
| 53 | USHORT type;
|
---|
[27] | 54 | // FOURCC fourcc;
|
---|
[2] | 55 | PSZ label;
|
---|
| 56 | PSZ extension;
|
---|
| 57 | PSZ eaType;
|
---|
| 58 | };
|
---|
| 59 |
|
---|
| 60 | // ** classdef ************************************************************ /*FOLD00*/
|
---|
| 61 |
|
---|
| 62 | class Settings : public ththSettings
|
---|
| 63 | {
|
---|
| 64 | public:
|
---|
| 65 | Settings (VOID);
|
---|
| 66 |
|
---|
| 67 | BOOL Dialog (BOOL f = FALSE);
|
---|
| 68 |
|
---|
| 69 | PSZ QuerySaveFile (VOID) { return QueryString (SEI_SAVEFILE); }
|
---|
| 70 | VOID SetSaveFile (PSZ psz) { SetString (SEI_SAVEFILE, psz); }
|
---|
| 71 |
|
---|
| 72 | VOID SetWindowData (SWP *pswp, BOOL f = TRUE);
|
---|
| 73 | VOID QueryWindowData (SWP *pswp, USHORT us[7], BOOL f = TRUE);
|
---|
| 74 |
|
---|
| 75 | BOOL HideWindow (VOID) { return QueryFlag (SEI_HIDEWINDOW); }
|
---|
| 76 | VOID HideWindow (BOOL f) { SetFlag (SEI_HIDEWINDOW, f); }
|
---|
| 77 |
|
---|
| 78 | BOOL DelayedCapture (VOID) { return QueryFlag (SEI_DELAYEDCAPTURE); }
|
---|
| 79 | VOID DelayedCapture (BOOL f) { SetFlag (SEI_DELAYEDCAPTURE, f); }
|
---|
| 80 |
|
---|
| 81 | BYTE QuerySaveStyle (VOID) { return QueryLong (SEI_SAVESTYLE); }
|
---|
| 82 | VOID SetSaveStyle (BYTE b) { SetLong (SEI_SAVESTYLE, b); }
|
---|
| 83 |
|
---|
| 84 | BOOL AutoaddExtension (VOID) { return QueryFlag (SEI_AUTOADDEXTENSION); }
|
---|
| 85 | VOID AutoaddExtension (BOOL f) { SetFlag (SEI_AUTOADDEXTENSION, f); }
|
---|
| 86 |
|
---|
| 87 | BOOL ConfirmOverwrite (VOID) { return QueryFlag (SEI_CONFIRMOVERWRITE); }
|
---|
| 88 | VOID ConfirmOverwrite (BOOL f) { SetFlag (SEI_CONFIRMOVERWRITE, f); }
|
---|
| 89 |
|
---|
| 90 | PSZ QueryForceSaveFile (VOID) { return QueryString (SEI_FORCESAVEFILE); }
|
---|
| 91 | VOID SetForceSaveFile (PSZ psz) { SetString (SEI_FORCESAVEFILE, psz); }
|
---|
| 92 |
|
---|
| 93 | BOOL DelayCountdown (VOID) { return QueryFlag (SEI_DELAYCOUNTDOWN); }
|
---|
| 94 | VOID DelayCountdown (BOOL f) { SetFlag (SEI_DELAYCOUNTDOWN, f); }
|
---|
| 95 |
|
---|
| 96 | USHORT QueryDelayTime (VOID) { return QueryLong (SEI_DELAYTIME); }
|
---|
| 97 | VOID SetDelayTime (USHORT us) { SetLong (SEI_DELAYTIME, us); }
|
---|
[92] | 98 | #ifndef _QUIET_
|
---|
[2] | 99 | BOOL SnapshotWindow (VOID) { return QueryFlag (SEI_SNAPSHOTWINDOW); }
|
---|
| 100 | VOID SnapshotWindow (BOOL f) { SetFlag (SEI_SNAPSHOTWINDOW, f); }
|
---|
| 101 |
|
---|
| 102 | BOOL SSWHide (VOID) { return QueryFlag (SEI_SSWHIDE); }
|
---|
| 103 | VOID SSWHide (BOOL f) { SetFlag (SEI_SSWHIDE, f); }
|
---|
| 104 |
|
---|
| 105 | BOOL SSWAlwaysOnTop (VOID) { return QueryFlag (SEI_SSWALWAYSONTOP); }
|
---|
| 106 | VOID SSWAlwaysOnTop (BOOL f) { SetFlag (SEI_SSWALWAYSONTOP, f); }
|
---|
[92] | 107 | #endif
|
---|
[2] | 108 | BYTE QuerySSWCaptureType (VOID) { return QueryLong (SEI_SSWCAPTURETYPE); }
|
---|
| 109 | VOID SetSSWCaptureType (BYTE b) { SetLong (SEI_SSWCAPTURETYPE, b); }
|
---|
| 110 |
|
---|
| 111 | BOOL SerialCapture (VOID) { return QueryFlag (SEI_SERIALCAPTURE); }
|
---|
| 112 | VOID SerialCapture (BOOL f) { SetFlag (SEI_SERIALCAPTURE, f); }
|
---|
| 113 |
|
---|
| 114 | USHORT QuerySerialTime (VOID) { return QueryLong (SEI_SERIALTIME); }
|
---|
| 115 | VOID SetSerialTime (USHORT us) { SetLong (SEI_SERIALTIME, us); }
|
---|
| 116 |
|
---|
| 117 | BOOL DoSound (VOID) { return QueryFlag (SEI_DOSOUND); }
|
---|
| 118 | VOID DoSound (BOOL f) { SetFlag (SEI_DOSOUND, f); }
|
---|
| 119 |
|
---|
| 120 | BYTE QueryFileFormat (VOID) { return QueryLong (SEI_FILEFORMAT); }
|
---|
| 121 | VOID SetFileFormat (BYTE b) { SetLong (SEI_FILEFORMAT, b); }
|
---|
| 122 |
|
---|
| 123 | BYTE QueryFileSaveStyle (VOID) { return QueryLong (SEI_FILESAVESTYLE); }
|
---|
| 124 | VOID SetFileSaveStyle (BYTE b) { SetLong (SEI_FILESAVESTYLE, b); }
|
---|
| 125 |
|
---|
| 126 | PSZ QueryNumSaveDir (VOID);
|
---|
| 127 | VOID SetNumSaveDir (PSZ psz)
|
---|
| 128 | {
|
---|
[100] | 129 | if (strlen(psz) > 3 && (psz[strlen (psz)-1] == '\\') || (psz[strlen (psz)-1] == '/'))
|
---|
[2] | 130 | psz[strlen (psz)-1] = '\0';
|
---|
| 131 | SetString (SEI_NUMSAVEDIR, psz);
|
---|
| 132 | }
|
---|
| 133 |
|
---|
[94] | 134 | VOID SetLangID(INT Language) {LangID = Language;}
|
---|
| 135 | INT GetLangID(VOID) {return LangID;}
|
---|
| 136 |
|
---|
[2] | 137 | VOID SelectLanguage (VOID);
|
---|
| 138 |
|
---|
| 139 | PSZ GetFileExtension( SHORT type = BMF_INVALID );
|
---|
[27] | 140 | // FOURCC GetFOURCC( SHORT type = BMF_INVALID );
|
---|
[2] | 141 | PSZ GetFileEAType( SHORT type = BMF_INVALID );
|
---|
| 142 |
|
---|
[27] | 143 | bool idleSetInIni;
|
---|
| 144 | int saveStyle;
|
---|
| 145 | PSZ pNumSaveDir;
|
---|
| 146 | PSZ pForceSaveFile;
|
---|
| 147 | bool bSerialCapture;
|
---|
| 148 | // BOOL IsMMIOAvailable( VOID );
|
---|
| 149 | // class thth_MMIO *GetMMIO( VOID );
|
---|
[2] | 150 |
|
---|
| 151 | protected:
|
---|
| 152 | USHORT FileNotOpenError (VOID);
|
---|
| 153 | USHORT VersionError (VOID);
|
---|
| 154 |
|
---|
| 155 | BOOL ReloadResources (PSZ psz);
|
---|
| 156 |
|
---|
| 157 | USHORT GetLanguages (HWND hwnd);
|
---|
| 158 |
|
---|
| 159 | private:
|
---|
| 160 | static MRESULT EXPENTRY
|
---|
| 161 | DialogProcedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
| 162 | static MRESULT EXPENTRY
|
---|
| 163 | Page1Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
| 164 | static MRESULT EXPENTRY
|
---|
| 165 | Page2Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
| 166 | static MRESULT EXPENTRY
|
---|
| 167 | Page3Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
| 168 | static MRESULT EXPENTRY
|
---|
| 169 | Page4Procedure (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
| 170 |
|
---|
| 171 | VOID AdjustButton (HWND hwnd, USHORT id, BOOL f)
|
---|
| 172 | {
|
---|
| 173 | WinSendDlgItemMsg (hwnd, id, BM_SETCHECK,
|
---|
| 174 | MPFROMLONG (f), MPFROMLONG (0));
|
---|
| 175 | }
|
---|
| 176 |
|
---|
| 177 | VOID AdjustFlag (HWND hwnd, USHORT id, BOOL &f)
|
---|
| 178 | {
|
---|
| 179 | f = BOOL (WinSendDlgItemMsg (hwnd, id, BM_QUERYCHECK, 0, 0));
|
---|
| 180 | }
|
---|
| 181 |
|
---|
| 182 | HWND hwndPage[COUNT_PAGES];
|
---|
| 183 | static PSZ pszPageTab[COUNT_PAGES];
|
---|
| 184 | BOOL fAutoLanguage;
|
---|
| 185 | HWND hwndDlg;
|
---|
[94] | 186 | INT LangID;
|
---|
[2] | 187 |
|
---|
| 188 | static ImageFormatInfo ifi[];
|
---|
| 189 | };
|
---|
| 190 |
|
---|
| 191 | // ** inline funcs ******************************************************** /*FOLD00*/
|
---|
| 192 |
|
---|
[11] | 193 | inline VOID Settings :: SetWindowData (SWP *pswp, BOOL f)
|
---|
[2] | 194 | {
|
---|
| 195 | // FIXME puke, yukk, choke! get this flag thing away! do it better!
|
---|
| 196 | // FIXME what is with US?
|
---|
| 197 | if (f)
|
---|
| 198 | SetBinary(SEI_SWPSSW, PVOID(pswp), sizeof(SWP));
|
---|
| 199 | else
|
---|
| 200 | SetBinary(SEI_SWP, PVOID(pswp), sizeof(SWP));
|
---|
| 201 | }
|
---|
| 202 |
|
---|
| 203 | // ************************************************************************
|
---|
| 204 | #endif
|
---|