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