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