doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GEWorkspace.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 _GEWORKSPACE_H_
30 #define _GEWORKSPACE_H_
31 
32 #ifndef GESELECTIONMGR_H_
33 #include "GESelectionMgr.h"
34 #endif // GESELECTIONMGR_H_
35 
36 #ifndef GEMODIFIERSTACK_H_
37 #include "GEModifierStack.h"
38 #endif // GEMODIFIERSTACK_H_
39 
40 class rvGEApp;
41 
43 {
44 public:
45 
49 };
50 
52 {
53 public:
54 
56  {
60  };
61 
63  {
74  };
75 
77  {
84  };
85 
86  rvGEWorkspace ( rvGEApp* app );
87  ~rvGEWorkspace ( );
88 
89  // Attach the workspace to a win32 window
90  bool Attach ( HWND wnd );
91 
92  // Detach the workspace from the current win32 window
93  void Detach ( void );
94 
95  bool NewFile ( void );
96  bool LoadFile ( const char* filename, idStr* error = NULL );
97  bool SaveFile ( const char* filename );
98  const char* GetFilename ( void );
99 
100  // Source control methods
101  bool CheckOut ( void );
102  bool CheckIn ( void );
103  bool UndoCheckout ( void );
105 
106  void Render ( HDC hDC );
107 
108  rvGEApp* GetApplication ( void );
109 
110  void HideSelected ( void );
111  void UnhideSelected ( void );
112  void DeleteSelected ( void );
113  bool EditSelectedProperties ( void );
114  bool EditSelectedScripts ( void );
115  void BringSelectedForward ( void );
116  void BringSelectedToFront ( void );
117  void SendSelectedBackward ( void );
118  void SendSelectedToBack ( void );
119  void AlignSelected ( EItemAlign align );
120  void MakeSelectedSameSize ( bool width, bool height );
121  void MakeSelectedAChild ( void );
122 
123  bool CanHide ( void );
124  void ShowHidden ( void );
125  void HideWindow ( idWindow* window );
126  void UnhideWindow ( idWindow* window );
127 
128  EZoomLevel ZoomIn ( void );
129  EZoomLevel ZoomOut ( void );
130  EZoomLevel GetZoom ( void );
131  float GetZoomScale ( void );
132 
133  static rvGEWorkspace* GetWorkspace ( HWND wnd );
138  HWND GetWindow ( void );
139 
140  void HandleMessage ( UINT msg, WPARAM wParam, LPARAM lParam );
141 
142  idVec2& WindowToWorkspace ( idVec2& point );
143  idVec2& WorkspaceToWindow ( idVec2& point );
146 
147  bool IsModified ( void );
148  bool IsNew ( void );
149 
151 
152 // void Cut ( void );
153  void Copy ( void );
154  void Paste ( void );
155 
156  void AddModifierMove ( const char* modName, float x, float y, bool snap );
157  void AddModifierSize ( const char* modName, float l, float t, float r, float b, bool snap );
158 
159  void SetModified ( bool mod );
160 
161 protected:
162 
164  {
174  };
175 
176  bool SetupPixelFormat ( void );
177  void UpdateSelections ( void );
178 
179  // Additional rendering routines
180  void RenderGrid ( void );
181 
182  // File related methods
183  void WriteTabs ( idFile* file, int depth );
184  bool WriteWindow ( idFile* file, int depth, idWindow* window );
185 
186  // Message handlers
187  int HandleRButtonDown ( WPARAM wParam, LPARAM lParam );
188  int HandleLButtonDown ( WPARAM wParam, LPARAM lParam );
189  int HandleLButtonUp ( WPARAM wParam, LPARAM lParam );
190  int HandleLButtonDblClk ( WPARAM wParam, LPARAM lParam );
191  int HandleMButtonDown ( WPARAM wParam, LPARAM lParam );
192  int HandleMButtonUp ( WPARAM wParam, LPARAM lParam );
193  int HandleMouseMove ( WPARAM wParam, LPARAM lParam );
194  int HandleKeyDown ( WPARAM wParam, LPARAM lParam );
195  int HandleScroll ( int scrollbar, WPARAM wParam, LPARAM lParam );
196  int HandleCommand ( WPARAM wParam, LPARAM lParam );
197 
198  // General protected functions
199  void UpdateScrollbars ( void );
200  void UpdateRectangle ( bool useScroll = true );
201  void UpdateCursor ( void );
202  void UpdateCursor ( float x, float y );
204  void UpdateTitle ( void );
206  void Scroll ( int scrollbar, int offset );
207 
208  // Modifier methods
209  void AddModifierMoveNudge( float x, float y, bool snap );
210  void AddModifierSizeNudge( float w, float h, bool snap );
211  void AddModifierShowAll ( void );
212 
213  void AddModifiers ( EModifierType type, ... );
216 
218  HWND mWnd;
219 
220  int mZoom;
222 
225 
228 
230 
233 
237  bool mDragX;
238  bool mDragY;
240 
242 
246 
247 private:
248 
249  static bool CleanupEnumProc ( rvGEWindowWrapper* wrapper, void* data );
250  static bool ShowAllEnumProc ( rvGEWindowWrapper* wrapper, void* data );
251  static bool BuildSelectMenuEnumProc ( rvGEWindowWrapper* wrapper, void* data );
252 
253  // States
254  bool mModified;
255  bool mNew;
256  bool mDontAdd;
258 
259  // Resources
260  HCURSOR mHandCursor;
261 };
262 
264 {
265  return (EZoomLevel)mZoom;
266 }
267 
269 {
270  return (rvGEWorkspace*) GetWindowLong ( wnd, GWL_USERDATA );
271 }
272 
273 ID_INLINE const char* rvGEWorkspace::GetFilename ( void )
274 {
275  return mFilename;
276 }
277 
278 ID_INLINE bool rvGEWorkspace::IsModified ( void )
279 {
280  return mModified;
281 }
282 
283 ID_INLINE bool rvGEWorkspace::IsNew ( void )
284 {
285  return mNew;
286 }
287 
289 {
290  return mModifiers;
291 }
292 
294 {
295  return mSelections;
296 }
297 
298 ID_INLINE void rvGEWorkspace::ShowHidden ( void )
299 {
300  AddModifierShowAll ( );
301 }
302 
303 ID_INLINE void rvGEWorkspace::AddModifierMoveNudge ( float x, float y, bool snap )
304 {
305  AddModifierMove ( "Nudge Move", x, y, snap );
306 }
307 
308 ID_INLINE void rvGEWorkspace::AddModifierSizeNudge ( float w, float h, bool snap )
309 {
310  AddModifierSize ( "Nudge Size", 0, 0, w, h, snap );
311 }
312 
314 {
315  return mInterface;
316 }
317 
319 {
320  return mApplication;
321 }
322 
323 ID_INLINE HWND rvGEWorkspace::GetWindow ( void )
324 {
325  return mWnd;
326 }
327 
329 {
330  return mClipboard;
331 }
332 
334 {
335  return mSourceControlState;
336 }
337 
338 #endif // _GEWORKSPACE_H_
void RenderGrid(void)
idList< rvGEClipboardItem * > GetClipboard(void)
Definition: GEWorkspace.h:328
idUserInterfaceLocal * GetInterface(void)
Definition: GEWorkspace.h:313
int HandleCommand(WPARAM wParam, LPARAM lParam)
void Paste(void)
Definition: GEApp.h:73
void Scroll(int scrollbar, int offset)
rvGESelectionMgr::EHitTest mDragType
Definition: GEWorkspace.h:234
void UpdateScrollbars(void)
EZoomLevel ZoomIn(void)
bool EditSelectedScripts(void)
void AddModifierShowAll(void)
static bool CleanupEnumProc(rvGEWindowWrapper *wrapper, void *data)
Definition: GEWorkspace.cpp:99
bool SaveFile(const char *filename)
bool Attach(HWND wnd)
CONST PIXELFORMATDESCRIPTOR UINT
Definition: win_qgl.cpp:47
int HandleLButtonDblClk(WPARAM wParam, LPARAM lParam)
bool LoadFile(const char *filename, idStr *error=NULL)
void HandleMessage(UINT msg, WPARAM wParam, LPARAM lParam)
void WriteTabs(idFile *file, int depth)
ESourceControlState GetSourceControlState(void)
Definition: GEWorkspace.h:333
GLenum GLint GLint y
Definition: glext.h:2849
int HandleLButtonDown(WPARAM wParam, LPARAM lParam)
void SendSelectedToBack(void)
void AddModifierSizeNudge(float w, float h, bool snap)
Definition: GEWorkspace.h:308
rvGEWorkspace(rvGEApp *app)
Definition: GEWorkspace.cpp:63
void SetModified(bool mod)
void AddModifiers(EModifierType type,...)
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glext.h:2878
void SendSelectedBackward(void)
static bool ShowAllEnumProc(rvGEWindowWrapper *wrapper, void *data)
const char * GetFilename(void)
Definition: GEWorkspace.h:273
GLuint GLuint GLsizei GLenum type
Definition: glext.h:2845
GLenum GLint x
Definition: glext.h:2849
void UpdateTitle(void)
bool NewFile(void)
GLintptr offset
Definition: glext.h:3113
list l
Definition: prepare.py:17
int HandleScroll(int scrollbar, WPARAM wParam, LPARAM lParam)
void BringSelectedForward(void)
Definition: File.h:50
rvGEModifier * CreateModifier(EModifierType type, idWindow *window, va_list args)
rvGEModifierStack mModifiers
Definition: GEWorkspace.h:231
ESourceControlState mSourceControlState
Definition: GEWorkspace.h:257
rvGEModifierStack & GetModifierStack(void)
Definition: GEWorkspace.h:288
Definition: Vector.h:52
idRectangle mRect
Definition: GEWorkspace.h:221
float GetZoomScale(void)
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:3454
rvGEApp * GetApplication(void)
Definition: GEWorkspace.h:318
int HandleMouseMove(WPARAM wParam, LPARAM lParam)
HWND GetWindow(void)
Definition: GEWorkspace.h:323
Definition: Dict.h:65
#define NULL
Definition: Lib.h:88
bool IsModified(void)
Definition: GEWorkspace.h:278
HDC hDC
Definition: wglext.h:383
bool IsNew(void)
Definition: GEWorkspace.h:283
void Render(HDC hDC)
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: glext.h:2853
void DeleteSelected(void)
void HideWindow(idWindow *window)
void UpdateSelections(void)
bool CheckIn(void)
void UpdateRectangle(bool useScroll=true)
void ShowHidden(void)
Definition: GEWorkspace.h:298
HCURSOR mHandCursor
Definition: GEWorkspace.h:260
rvGESelectionMgr & GetSelectionMgr(void)
Definition: GEWorkspace.h:293
GLenum GLsizei width
Definition: glext.h:2846
bool WriteWindow(idFile *file, int depth, idWindow *window)
typedef HDC(WINAPI *PFNWGLGETCURRENTREADDCARBPROC)(void)
idList< idWindow * > mSelectMenu
Definition: GEWorkspace.h:244
idVec2 mSelectMenuPos
Definition: GEWorkspace.h:245
idWindow * NewWindow(idDict *state, rvGEWindowWrapper::EWindowType type)
static rvGEWorkspace * GetWorkspace(HWND wnd)
Definition: GEWorkspace.h:268
GLenum GLsizei GLsizei height
Definition: glext.h:2856
GLubyte GLubyte b
Definition: glext.h:4662
bool SetupPixelFormat(void)
prefInfo window
void UnhideWindow(idWindow *window)
void MakeSelectedAChild(void)
void BringSelectedToFront(void)
GLdouble GLdouble GLdouble r
Definition: glext.h:2951
bool CheckOut(void)
rvGESelectionMgr mSelections
Definition: GEWorkspace.h:232
void AddModifierSize(const char *modName, float l, float t, float r, float b, bool snap)
idVec2 & WorkspaceToWindow(idVec2 &point)
void AddModifierMoveNudge(float x, float y, bool snap)
Definition: GEWorkspace.h:303
void Copy(void)
EZoomLevel ZoomOut(void)
void AlignSelected(EItemAlign align)
idVec2 & WindowToWorkspace(idVec2 &point)
void Detach(void)
void UnhideSelected(void)
bool CanHide(void)
void HideSelected(void)
Definition: Str.h:116
idVec2 mDragPoint
Definition: GEWorkspace.h:235
int HandleMButtonUp(WPARAM wParam, LPARAM lParam)
void MakeSelectedSameSize(bool width, bool height)
void UpdateCursor(void)
bool UndoCheckout(void)
void AddModifierMove(const char *modName, float x, float y, bool snap)
static bool BuildSelectMenuEnumProc(rvGEWindowWrapper *wrapper, void *data)
static idList< rvGEClipboardItem * > mClipboard
Definition: GEWorkspace.h:243
EZoomLevel GetZoom(void)
Definition: GEWorkspace.h:263
bool EditSelectedProperties(void)
int HandleMButtonDown(WPARAM wParam, LPARAM lParam)
int HandleLButtonUp(WPARAM wParam, LPARAM lParam)
int HandleRButtonDown(WPARAM wParam, LPARAM lParam)
idWindow * AddWindow(rvGEWindowWrapper::EWindowType type)
rvGEApp * mApplication
Definition: GEWorkspace.h:241
idUserInterfaceLocal * mInterface
Definition: GEWorkspace.h:217
int HandleKeyDown(WPARAM wParam, LPARAM lParam)
GLdouble GLdouble t
Definition: glext.h:2943