doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GEOptions.h
Go to the documentation of this file.
1 /*
2 ===========================================================================
3 
4 Doom 3 GPL Source Code
5 Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
6 
7 This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
8 
9 Doom 3 Source Code is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
13 
14 Doom 3 Source Code is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
21 
22 In addition, the Doom 3 Source Code is also subject to certain additional terms. You should have received a copy of these additional terms immediately following the terms and conditions of the GNU General Public License which accompanied the Doom 3 Source Code. If not, please request a copy in writing from id Software at the address below.
23 
24 If you have questions concerning this license or the applicable additional terms, you may contact in writing id Software LLC, c/o ZeniMax Media Inc., Suite 120, Rockville, Maryland 20850 USA.
25 
26 ===========================================================================
27 */
28 
29 #ifndef GEOPTIONS_H_
30 #define GEOPTIONS_H_
31 
32 #ifndef REGISTRYOPTIONS_H_
33 #include "../common/registryoptions.h"
34 #endif
35 
36 class idRectangle;
37 
39 {
40 public:
41 
43 
44  rvGEOptions();
45 
46  void Init( void );
47 
48  // Write the options to the registery
49  bool Save ( void );
50 
51  // Read the options from the registry
52  bool Load ( void );
53 
54  void SetSelectionColor ( idVec4& color );
55  void SetSelectionColor ( COLORREF color );
56  void SetGridColor ( idVec4& color );
57  void SetGridColor ( COLORREF color );
58  void SetGridWidth ( int width );
59  void SetGridHeight ( int height );
60  void SetGridVisible ( bool vis );
61  void SetGridSnap ( bool snap );
62  void SetLastOptionsPage ( int page );
63  void SetNavigatorVisible ( bool vis );
64  void SetPropertiesVisible ( bool vis );
65  void SetTransformerVisible ( bool vis );
66  void SetIgnoreDesktopSelect ( bool ignore );
67  void SetStatusBarVisible ( bool vis );
68 
69  void AddRecentFile ( const char* filename );
70  int GetRecentFileCount ( void );
71  const char* GetRecentFile ( int index );
72 
73  idVec4& GetGridColor ( void );
74  int GetGridWidth ( void );
75  int GetGridHeight ( void );
76  bool GetGridVisible ( void );
77  bool GetGridSnap ( void );
78  int GetLastOptionsPage ( void );
79  idVec4& GetWorkspaceColor ( void );
80  bool GetNavigatorVisible ( void );
81  bool GetTransformerVisible ( void );
82  bool GetPropertiesVisible ( void );
83  idVec4& GetSelectionColor ( void );
84  COLORREF* GetCustomColors ( void );
85  bool GetIgnoreDesktopSelect ( void );
86  bool GetStatusBarVisible ( void );
87 
88  void SetWindowPlacement ( const char* name, HWND hwnd );
89  bool GetWindowPlacement ( const char* name, HWND hwnd );
90 
91  void SnapRectToGrid ( idRectangle& rect, bool snapLeft = true, bool snapTop = true, bool snapWidth = true, bool snapHeight = true );
92 
93 protected:
94 
95  void ConvertColor ( COLORREF src, idVec4& dest );
96  void SetModified ( bool mod );
97 
98  bool mModified;
100 
104  bool mGridSnap;
106 
109 
115 
117 
118  COLORREF mCustomColors[16];
119 
121 };
122 
123 ID_INLINE void rvGEOptions::SetModified ( bool mod )
124 {
125  mModified = mod;
126 }
127 
128 ID_INLINE void rvGEOptions::ConvertColor ( COLORREF src, idVec4& dest )
129 {
130  dest[0] = (float)GetRValue ( src ) / 255.0f;
131  dest[1] = (float)GetGValue ( src ) / 255.0f;
132  dest[2] = (float)GetBValue ( src ) / 255.0f;
133  dest[3] = 1.0f;
134 }
135 
136 ID_INLINE void rvGEOptions::SetGridWidth ( int width )
137 {
138  mGridWidth = width;
139  SetModified ( true );
140 }
141 
142 ID_INLINE void rvGEOptions::SetGridHeight ( int height )
143 {
145  SetModified ( true );
146 }
147 
148 ID_INLINE void rvGEOptions::SetGridSnap ( bool snap )
149 {
150  mGridSnap = snap;
151  SetModified ( true );
152 }
153 
154 ID_INLINE void rvGEOptions::SetGridVisible ( bool vis )
155 {
156  mGridVisible = vis;
157  SetModified ( true );
158 }
159 
160 ID_INLINE void rvGEOptions::SetStatusBarVisible ( bool vis )
161 {
162  mStatusBarVisible = vis;
163  SetModified ( true );
164 }
165 
166 ID_INLINE void rvGEOptions::SetGridColor ( COLORREF color )
167 {
168  ConvertColor ( color, mGridColor );
169  SetModified ( true );
170 }
171 
173 {
174  VectorCopy ( color, mSelectionColor );
175  SetModified ( true );
176 }
177 
178 ID_INLINE void rvGEOptions::SetSelectionColor ( COLORREF color )
179 {
180  ConvertColor ( color, mSelectionColor );
181  SetModified ( true );
182 }
183 
185 {
186  VectorCopy ( color, mGridColor );
187  SetModified ( true );
188 }
189 
190 ID_INLINE void rvGEOptions::SetNavigatorVisible ( bool vis )
191 {
192  mNavigatorVisible = vis;
193  SetModified ( true );
194 }
195 
196 ID_INLINE void rvGEOptions::SetPropertiesVisible ( bool vis )
197 {
198  mPropertiesVisible = vis;
199  SetModified ( true );
200 }
201 
202 ID_INLINE void rvGEOptions::SetTransformerVisible ( bool vis )
203 {
204  mTransformerVisible = vis;
205  SetModified ( true );
206 }
207 
209 {
210  return mGridColor;
211 }
212 
213 ID_INLINE int rvGEOptions::GetGridWidth ( void )
214 {
215  return mGridWidth;
216 }
217 
218 ID_INLINE int rvGEOptions::GetGridHeight ( void )
219 {
220  return mGridHeight;
221 }
222 
223 ID_INLINE bool rvGEOptions::GetGridVisible ( void )
224 {
225  return mGridVisible;
226 }
227 
228 ID_INLINE bool rvGEOptions::GetGridSnap ( void )
229 {
230  return mGridSnap;
231 }
232 
234 {
235  return mWorkspaceColor;
236 }
237 
238 ID_INLINE int rvGEOptions::GetLastOptionsPage ( void )
239 {
240  return mLastOptionsPage;
241 }
242 
243 ID_INLINE void rvGEOptions::SetLastOptionsPage ( int page )
244 {
245  mLastOptionsPage = page;
246 }
247 
248 ID_INLINE bool rvGEOptions::GetNavigatorVisible ( void )
249 {
250  return mNavigatorVisible;
251 }
252 
253 ID_INLINE bool rvGEOptions::GetPropertiesVisible ( void )
254 {
255  return mPropertiesVisible;
256 }
257 
258 ID_INLINE bool rvGEOptions::GetTransformerVisible ( void )
259 {
260  return mTransformerVisible;
261 }
262 
263 ID_INLINE bool rvGEOptions::GetStatusBarVisible ( void )
264 {
265  return mStatusBarVisible;
266 }
267 
269 {
270  return mSelectionColor;
271 }
272 
273 ID_INLINE COLORREF* rvGEOptions::GetCustomColors ( void )
274 {
275  return mCustomColors;
276 }
277 
278 ID_INLINE void rvGEOptions::SetIgnoreDesktopSelect ( bool ignore )
279 {
280  mIgnoreDesktopSelect = ignore;
281 }
282 
283 ID_INLINE bool rvGEOptions::GetIgnoreDesktopSelect ( void )
284 {
285  return mIgnoreDesktopSelect;
286 }
287 
288 ID_INLINE void rvGEOptions::SetWindowPlacement ( const char* name, HWND hwnd )
289 {
290  mRegistry.SetWindowPlacement ( name, hwnd );
291 }
292 
293 ID_INLINE bool rvGEOptions::GetWindowPlacement ( const char* name, HWND hwnd )
294 {
295  return mRegistry.GetWindowPlacement ( name, hwnd );
296 }
297 
298 ID_INLINE void rvGEOptions::AddRecentFile ( const char* filename )
299 {
300  mRegistry.AddRecentFile ( filename );
301 }
302 
303 ID_INLINE int rvGEOptions::GetRecentFileCount ( void )
304 {
305  return mRegistry.GetRecentFileCount ( );
306 }
307 
308 ID_INLINE const char* rvGEOptions::GetRecentFile ( int index )
309 {
310  return mRegistry.GetRecentFile ( index );
311 }
312 
313 #endif // _GEOPTIONS_H_
314 
bool mPropertiesVisible
Definition: GEOptions.h:111
byte color[4]
Definition: MegaTexture.cpp:54
idVec4 mGridColor
Definition: GEOptions.h:101
void SetModified(bool mod)
Definition: GEOptions.h:123
bool GetNavigatorVisible(void)
Definition: GEOptions.h:248
bool GetWindowPlacement(const char *name, HWND hwnd)
int GetGridHeight(void)
Definition: GEOptions.h:218
void SetTransformerVisible(bool vis)
Definition: GEOptions.h:202
void SetSelectionColor(idVec4 &color)
Definition: GEOptions.h:172
bool GetPropertiesVisible(void)
Definition: GEOptions.h:253
bool GetGridSnap(void)
Definition: GEOptions.h:228
bool mGridVisible
Definition: GEOptions.h:105
idVec4 mWorkspaceColor
Definition: GEOptions.h:107
void SnapRectToGrid(idRectangle &rect, bool snapLeft=true, bool snapTop=true, bool snapWidth=true, bool snapHeight=true)
Definition: GEOptions.cpp:155
void SetWindowPlacement(const char *name, HWND hwnd)
Definition: GEOptions.h:288
#define VectorCopy(a, b)
Definition: Vector.h:1999
bool mGridSnap
Definition: GEOptions.h:104
idList< idStr > mRecentFiles
Definition: GEOptions.h:116
idVec4 & GetSelectionColor(void)
Definition: GEOptions.h:268
bool Save(void)
Definition: GEOptions.cpp:72
case const float
Definition: Callbacks.cpp:62
bool GetTransformerVisible(void)
Definition: GEOptions.h:258
bool mNavigatorVisible
Definition: GEOptions.h:110
bool GetWindowPlacement(const char *name, HWND hwnd)
Definition: GEOptions.h:293
GLuint src
Definition: glext.h:5390
rvRegistryOptions mRegistry
Definition: GEOptions.h:120
bool mIgnoreDesktopSelect
Definition: GEOptions.h:114
void SetPropertiesVisible(bool vis)
Definition: GEOptions.h:196
idVec4 & GetWorkspaceColor(void)
Definition: GEOptions.h:233
void SetIgnoreDesktopSelect(bool ignore)
Definition: GEOptions.h:278
GLuint index
Definition: glext.h:3476
void SetLastOptionsPage(int page)
Definition: GEOptions.h:243
Definition: Vector.h:808
bool mModified
Definition: GEOptions.h:98
void Init(void)
Definition: GEOptions.cpp:61
bool mStatusBarVisible
Definition: GEOptions.h:113
void SetGridSnap(bool snap)
Definition: GEOptions.h:148
void AddRecentFile(const char *filename)
Definition: GEOptions.h:298
bool Load(void)
Definition: GEOptions.cpp:111
bool GetGridVisible(void)
Definition: GEOptions.h:223
void SetGridVisible(bool vis)
Definition: GEOptions.h:154
bool GetIgnoreDesktopSelect(void)
Definition: GEOptions.h:283
void SetStatusBarVisible(bool vis)
Definition: GEOptions.h:160
GLenum GLsizei width
Definition: glext.h:2846
const char * GetRecentFile(int index)
Definition: GEOptions.h:308
void SetWindowPlacement(const char *name, HWND hwnd)
COLORREF mCustomColors[16]
Definition: GEOptions.h:118
void ConvertColor(COLORREF src, idVec4 &dest)
Definition: GEOptions.h:128
COLORREF * GetCustomColors(void)
Definition: GEOptions.h:273
GLenum GLsizei GLsizei height
Definition: glext.h:2856
static const int MAX_MRU_SIZE
int GetGridWidth(void)
Definition: GEOptions.h:213
idVec4 & GetGridColor(void)
Definition: GEOptions.h:208
void SetGridWidth(int width)
Definition: GEOptions.h:136
int GetLastOptionsPage(void)
Definition: GEOptions.h:238
void AddRecentFile(const char *filename)
bool GetStatusBarVisible(void)
Definition: GEOptions.h:263
const GLcharARB * name
Definition: glext.h:3629
int mGridHeight
Definition: GEOptions.h:103
int mGridWidth
Definition: GEOptions.h:102
int mLastOptionsPage
Definition: GEOptions.h:99
int GetRecentFileCount(void)
const char * GetRecentFile(int index)
void SetGridHeight(int height)
Definition: GEOptions.h:142
void SetGridColor(idVec4 &color)
Definition: GEOptions.h:184
idVec4 mSelectionColor
Definition: GEOptions.h:108
void SetNavigatorVisible(bool vis)
Definition: GEOptions.h:190
bool mTransformerVisible
Definition: GEOptions.h:112
int GetRecentFileCount(void)
Definition: GEOptions.h:303
static const int MAX_MRU_SIZE
Definition: GEOptions.h:42