doom3-gpl
Doom 3 GPL source release
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
XYWnd.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 #if !defined(AFX_XYWND_H__44B4BA04_781B_11D1_B53C_00AA00A410FC__INCLUDED_)
29 #define AFX_XYWND_H__44B4BA04_781B_11D1_B53C_00AA00A410FC__INCLUDED_
30 
31 #if _MSC_VER >= 1000
32 #pragma once
33 #endif // _MSC_VER >= 1000
34 // XYWnd.h : header file
35 //
36 
38 // CXYWnd window
39 
40 #include "qe3.h"
41 #include "CamWnd.h"
42 
43 const int SCALE_X = 0x01;
44 const int SCALE_Y = 0x02;
45 const int SCALE_Z = 0x04;
46 
47 bool FilterBrush(brush_t *pb);
48 
50 // as i didn't really encapsulate anything this
51 // should really be a struct..
53 {
54 public:
55  CClipPoint(){ Reset(); };
56  void Reset(){ m_ptClip[0] = m_ptClip[1] = m_ptClip[2] = 0.0; m_bSet = false; m_pVec3 = NULL;};
57  bool Set(){ return m_bSet; };
58  void Set(bool b) { m_bSet = b; };
60  void SetPointPtr(idVec3* p) { m_pVec3 = p; };
61  idVec3 m_ptClip; // the 3d point
62  idVec3* m_pVec3; // optional ptr for 3rd party updates
63  CPoint m_ptScreen; // the onscreen xy point (for mousability)
64  bool m_bSet;
65  operator idVec3&() {return m_ptClip;};
66  operator idVec3*() {return &m_ptClip;};
67  operator float*() {return m_ptClip.ToFloatPtr();};
68 };
69 
70 class CXYWnd : public CWnd
71 {
73 // Construction
74 public:
75  CXYWnd();
76 
77 // Attributes
78 public:
79 
80 // Operations
81 public:
82 
83 // Overrides
84  // ClassWizard generated virtual function overrides
85  //{{AFX_VIRTUAL(CXYWnd)
86  protected:
87  virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
88  //}}AFX_VIRTUAL
89 
90 // Implementation
91 public:
92  bool AreaSelectOK();
94  idVec3& Rotation();
95  void UndoClear();
96  bool UndoAvailable();
97  void KillPathMode();
98  void Undo();
99  void UndoCopy();
100  void Copy();
101  void Paste();
102  void Redraw(unsigned int nBits);
103  void VectorCopyXY( const idVec3 &in, idVec3 &out );
104  void PositionView();
105  void FlipClip();
106  void SplitClip();
107  void Clip();
108  idVec3& GetOrigin();
109  void SetOrigin(idVec3 org); // PGM
110  void XY_Init();
111  void XY_Draw();
112  void DrawZIcon();
113  void DrawRotateIcon();
114  void DrawCameraIcon();
115  void XY_DrawBlockGrid();
116  void XY_DrawGrid();
117  bool XY_MouseMoved (int x, int y, int buttons);
118  void NewBrushDrag (int x, int y);
119  bool DragDelta (int x, int y, idVec3 &move);
120  void XY_MouseUp(int x, int y, int buttons);
121  void XY_MouseDown (int x, int y, int buttons);
122  void XY_ToGridPoint (int x, int y, idVec3 &point);
123  void XY_ToPoint (int x, int y, idVec3 &point);
124  void SnapToPoint (int x, int y, idVec3 &point);
125  void SetActive(bool b) {m_bActive = b;};
126  bool Active() {return m_bActive;};
127  void DropClipPoint(UINT nFlags, CPoint point);
128 
129  int GetAxisHoriz() { return m_axisHoriz; };
130  int GetAxisVert() { return m_axisVert; };
131  void AnalogMouseZoom( int mouseDeltaY );
132 
133 
134  bool RogueClipMode();
135  bool ClipMode();
136  void SetClipMode(bool bMode);
137  void RetainClipMode(bool bMode);
138 
139  bool RotateMode();
140  bool SetRotateMode(bool bMode);
141  bool ScaleMode();
142  void SetScaleMode(bool bMode);
143 
144  bool PathMode();
145  void DropPathPoint(UINT nFlags, CPoint point);
146 
147  bool PointMode();
148  void AddPointPoint(UINT nFlags, idVec3* pVec);
149  void SetPointMode(bool b);
150 
151 
152  virtual ~CXYWnd();
153  void SetViewType(int n);
154  int GetViewType() {return m_nViewType; };
155  void SetScale(float f) {m_fScale = f;};
156  float Scale() {return m_fScale;};
157  int Width() {return m_nWidth;}
158  int Height() {return m_nHeight;}
159  bool m_bActive;
160 
161  void UpdateViewDependencies( void );
162 
163  void DrawPrecisionCrosshair();
165  enum
166  {
171  };
172 
174  int m_mouseX;
175  int m_mouseY;
176 
177 
178  // Generated message map functions
179 protected:
181  int m_nWidth;
183  float m_fScale;
184  float m_TopClip;
186  bool m_bDirty;
188  CPoint m_ptCursor;
190 
196 
197  int m_axisHoriz; // <axisHoriz> and <axisVert> are one of AXIS_X, AXIS_Y, AXIS_Z and
198  int m_axisVert; // reflect which axes are represented horizontally and vertically in the 2d view (XY, XZ, etc)
199 
201  float m_mcWidth;
202  float m_mcHeight;
203  float m_mcLeft;
204  float m_mcRight;
205  float m_mcTop;
206  float m_mcBottom;
207 
208 
209  friend CCamWnd;
210  //friend C3DFXCamWnd;
211 
212  CMenu m_mnuDrop;
214 
215  unsigned int m_nTimerID;
217  CPoint m_ptDrag;
218  CPoint m_ptDragAdj;
220 
221  void OriginalButtonUp(UINT nFlags, CPoint point);
222  void OriginalButtonDown(UINT nFlags, CPoint point);
223  void ProduceSplits(brush_t** pFront, brush_t** pBack);
224  void ProduceSplitLists();
225  void HandleDrop();
226  void PaintSizeInfo(int nDim1, int nDim2, idVec3 vMinBounds, idVec3 vMaxBounds);
227  void DrawSelectedCentroid( int nDim1, int nDim2, idVec3 vMinBounds, idVec3 vMaxBounds );
228 
229  void OnEntityCreate(unsigned int nID);
230  CPoint m_ptDown;
231  //{{AFX_MSG(CXYWnd)
232  afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
233  afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
234  afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
235  afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
236  afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
237  afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
238  afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
239  afx_msg void OnMouseMove(UINT nFlags, CPoint point);
240  afx_msg void OnPaint();
241  afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
242  afx_msg void OnSize(UINT nType, int cx, int cy);
243  afx_msg void OnDestroy();
244  afx_msg void OnSelectMouserotate();
245  afx_msg void OnTimer(UINT nIDEvent);
246  afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
247  afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
248  afx_msg void OnKillFocus(CWnd* pNewWnd);
249  afx_msg void OnSetFocus(CWnd* pOldWnd);
250  afx_msg void OnClose();
251  afx_msg BOOL OnEraseBkgnd(CDC* pDC);
252  afx_msg void OnDropNewmodel();
253  afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
254  afx_msg BOOL OnCmdMsg( UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo );
255  //}}AFX_MSG
256  DECLARE_MESSAGE_MAP()
257 };
258 
260 
261 //{{AFX_INSERT_LOCATION}}
262 // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
263 
264 #endif // !defined(AFX_XYWND_H__44B4BA04_781B_11D1_B53C_00AA00A410FC__INCLUDED_)
virtual ~CXYWnd()
Definition: XYWnd.cpp:529
int Height()
Definition: XYWnd.h:158
void Undo()
Definition: XYWnd.cpp:4215
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct)
Definition: XYWnd.cpp:749
void CyclePrecisionCrosshairMode()
Definition: XYWnd.cpp:4484
bool m_bDirty
Definition: XYWnd.h:186
virtual BOOL PreCreateWindow(CREATESTRUCT &cs)
Definition: XYWnd.cpp:577
idVec3 m_ptClip
Definition: XYWnd.h:60
void UpdatePointPtr()
Definition: XYWnd.h:59
CPoint m_ptScreen
Definition: XYWnd.h:63
int m_nPressy
Definition: XYWnd.h:193
afx_msg BOOL OnEraseBkgnd(CDC *pDC)
Definition: XYWnd.cpp:4446
void DropPathPoint(UINT nFlags, CPoint point)
Definition: XYWnd.cpp:843
void ProduceSplits(brush_t **pFront, brush_t **pBack)
Definition: XYWnd.cpp:944
afx_msg void OnSize(UINT nType, int cx, int cy)
Definition: XYWnd.cpp:3858
void Set(bool b)
Definition: XYWnd.h:58
void Paste()
Definition: XYWnd.cpp:4260
afx_msg void OnMButtonDown(UINT nFlags, CPoint point)
Definition: XYWnd.cpp:923
float m_mcBottom
Definition: XYWnd.h:206
DECLARE_DYNCREATE(CXYWnd)
afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
Definition: XYWnd.cpp:4393
CONST PIXELFORMATDESCRIPTOR UINT
Definition: win_qgl.cpp:47
afx_msg void OnSetFocus(CWnd *pOldWnd)
Definition: XYWnd.cpp:4420
int m_mouseX
Definition: XYWnd.h:174
const float * ToFloatPtr(void) const
Definition: Vector.h:719
afx_msg BOOL OnCmdMsg(UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo)
Definition: XYWnd.cpp:1972
void PaintSizeInfo(int nDim1, int nDim2, idVec3 vMinBounds, idVec3 vMaxBounds)
Definition: XYWnd.cpp:3412
friend CCamWnd
Definition: XYWnd.h:209
const int SCALE_Z
Definition: XYWnd.h:45
GLenum GLint GLint y
Definition: glext.h:2849
GLenum GLsizei n
Definition: glext.h:3705
bool m_bSet
Definition: XYWnd.h:64
void HandleDrop()
Definition: XYWnd.cpp:2126
case const int
Definition: Callbacks.cpp:52
#define VectorCopy(a, b)
Definition: Vector.h:1999
int m_mouseY
Definition: XYWnd.h:175
Definition: Vector.h:316
afx_msg void OnMouseMove(UINT nFlags, CPoint point)
Definition: XYWnd.cpp:1198
void XY_Init()
Definition: XYWnd.cpp:2222
void XY_MouseDown(int x, int y, int buttons)
Definition: XYWnd.cpp:2324
afx_msg void OnMButtonUp(UINT nFlags, CPoint point)
Definition: XYWnd.cpp:1129
bool m_bRButtonDown
Definition: XYWnd.h:189
afx_msg void OnSelectMouserotate()
Definition: XYWnd.cpp:4078
float m_mcRight
Definition: XYWnd.h:204
void NewBrushDrag(int x, int y)
Definition: XYWnd.cpp:2523
void XY_DrawBlockGrid()
Definition: XYWnd.cpp:2922
const int SCALE_Y
Definition: XYWnd.h:44
void SetViewType(int n)
Definition: XYWnd.cpp:3998
void DropClipPoint(UINT nFlags, CPoint point)
Definition: XYWnd.cpp:774
GLenum GLint x
Definition: glext.h:2849
bool Set()
Definition: XYWnd.h:57
#define BOOL
Definition: mprintf.c:71
bool SetRotateMode(bool bMode)
Definition: XYWnd.cpp:4040
CPoint m_ptDrag
Definition: XYWnd.h:217
void XY_ToGridPoint(int x, int y, idVec3 &point)
Definition: XYWnd.cpp:2284
void AnalogMouseZoom(int mouseDeltaY)
int m_axisVert
Definition: XYWnd.h:198
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR *lpncsp)
Definition: XYWnd.cpp:4403
float m_mcWidth
Each of the following _mc fields are stored in map-coordinates, NOT screen-pixels.
Definition: XYWnd.h:201
void( PFNPathCallback)(bool, int)
Definition: XYWnd.h:49
void SetScale(float f)
Definition: XYWnd.h:155
idVec3 m_vOrigin
Definition: XYWnd.h:187
int m_nViewType
Definition: XYWnd.h:213
void SetActive(bool b)
Definition: XYWnd.h:125
unsigned int m_nTimerID
Definition: XYWnd.h:215
CXYWnd()
Definition: XYWnd.cpp:501
void PositionView()
Definition: XYWnd.cpp:3951
afx_msg void OnKillFocus(CWnd *pNewWnd)
Definition: XYWnd.cpp:4411
bool RogueClipMode()
Definition: XYWnd.cpp:1436
afx_msg void OnClose()
Definition: XYWnd.cpp:4429
int m_nButtonstate
Definition: XYWnd.h:191
CPoint m_ptDown
Definition: XYWnd.h:230
idVec3 & Rotation()
Definition: XYWnd.cpp:4353
afx_msg void OnLButtonUp(UINT nFlags, CPoint point)
Definition: XYWnd.cpp:1113
int m_nWidth
Definition: XYWnd.h:181
void XY_DrawGrid()
Definition: XYWnd.cpp:2741
bool PathMode()
Definition: XYWnd.cpp:1444
void Copy()
Definition: XYWnd.cpp:4142
idVec3 & RotateOrigin()
Definition: XYWnd.cpp:4361
#define NULL
Definition: Lib.h:88
bool m_bPress_selection
Definition: XYWnd.h:195
afx_msg void OnLButtonDown(UINT nFlags, CPoint point)
Definition: XYWnd.cpp:887
void OriginalButtonUp(UINT nFlags, CPoint point)
Definition: XYWnd.cpp:1183
void SetScaleMode(bool bMode)
Definition: XYWnd.cpp:4068
void DrawRotateIcon()
Definition: XYWnd.cpp:3015
CPoint m_ptDragAdj
Definition: XYWnd.h:218
int m_nPressx
Definition: XYWnd.h:192
#define FAR
Definition: jmorecfg.h:205
void UndoCopy()
Definition: XYWnd.cpp:4239
int m_nUpdateBits
Definition: XYWnd.h:180
void Redraw(unsigned int nBits)
Definition: XYWnd.cpp:4013
void OnEntityCreate(unsigned int nID)
Definition: XYWnd.cpp:1928
int m_nScrollFlags
Definition: XYWnd.h:216
int GetViewType()
Definition: XYWnd.h:154
bool XY_MouseMoved(int x, int y, int buttons)
Definition: XYWnd.cpp:2590
void UpdateViewDependencies(void)
bool AreaSelectOK()
Definition: XYWnd.cpp:4438
void RetainClipMode(bool bMode)
Definition: XYWnd.cpp:1383
void DrawSelectedCentroid(int nDim1, int nDim2, idVec3 vMinBounds, idVec3 vMaxBounds)
void DrawZIcon()
Definition: XYWnd.cpp:3126
void UndoClear()
Definition: XYWnd.cpp:4231
afx_msg void OnPaint()
Definition: XYWnd.cpp:1471
GLubyte GLubyte b
Definition: glext.h:4662
afx_msg void OnDropNewmodel()
Definition: XYWnd.cpp:4453
bool UndoAvailable()
Definition: XYWnd.cpp:4252
void VectorCopyXY(const idVec3 &in, idVec3 &out)
Definition: XYWnd.cpp:3969
afx_msg void OnDestroy()
Definition: XYWnd.cpp:3988
void XY_Draw()
Definition: XYWnd.cpp:3539
void DrawPrecisionCrosshair()
Definition: XYWnd.cpp:4505
float m_mcLeft
Definition: XYWnd.h:203
tuple f
Definition: idal.py:89
int GetAxisHoriz()
Definition: XYWnd.h:129
bool m_bActive
Definition: XYWnd.h:159
GLuint in
Definition: glext.h:5388
bool DragDelta(int x, int y, idVec3 &move)
Definition: XYWnd.cpp:2491
int m_nHeight
Definition: XYWnd.h:182
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
Definition: XYWnd.cpp:1630
bool RotateMode()
Definition: XYWnd.cpp:4023
float m_TopClip
Definition: XYWnd.h:184
Definition: XYWnd.h:70
void SnapToPoint(int x, int y, idVec3 &point)
Definition: XYWnd.cpp:2234
void DrawCameraIcon()
Definition: XYWnd.cpp:3076
void AddPointPoint(UINT nFlags, idVec3 *pVec)
Definition: XYWnd.cpp:873
float m_fScale
Definition: XYWnd.h:183
CPoint m_ptCursor
Definition: XYWnd.h:188
float m_mcHeight
Definition: XYWnd.h:202
afx_msg void OnRButtonDown(UINT nFlags, CPoint point)
Definition: XYWnd.cpp:1086
const int SCALE_X
Definition: XYWnd.h:43
void SplitClip()
Definition: XYWnd.cpp:3920
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
void Reset()
Definition: XYWnd.h:56
afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt)
Definition: XYWnd.cpp:4462
void SetOrigin(idVec3 org)
Definition: XYWnd.cpp:3848
bool PointMode()
Definition: XYWnd.cpp:1452
CClipPoint()
Definition: XYWnd.h:55
unsigned char bool
Definition: setup.h:74
void XY_MouseUp(int x, int y, int buttons)
Definition: XYWnd.cpp:2475
void XY_ToPoint(int x, int y, idVec3 &point)
Definition: XYWnd.cpp:2249
void KillPathMode()
Definition: XYWnd.cpp:1911
CMenu m_mnuDrop
Definition: XYWnd.h:212
idVec3 m_vPressdelta
Definition: XYWnd.h:194
float m_mcTop
Definition: XYWnd.h:205
GLfloat GLfloat p
Definition: glext.h:4674
int m_axisHoriz
Definition: XYWnd.h:197
void FlipClip()
Definition: XYWnd.cpp:3941
float Scale()
Definition: XYWnd.h:156
afx_msg void OnTimer(UINT nIDEvent)
Definition: XYWnd.cpp:4369
int Width()
Definition: XYWnd.h:157
int m_precisionCrosshairMode
Definition: XYWnd.h:173
void ProduceSplitLists()
Definition: XYWnd.cpp:1001
bool ScaleMode()
Definition: XYWnd.cpp:4031
bool Active()
Definition: XYWnd.h:126
void SetPointMode(bool b)
Definition: XYWnd.cpp:1460
void Clip()
Definition: XYWnd.cpp:3874
void SetPointPtr(idVec3 *p)
Definition: XYWnd.h:60
idVec3 & GetOrigin()
Definition: XYWnd.cpp:3840
CPoint m_ptDragTotal
Definition: XYWnd.h:219
void OriginalButtonDown(UINT nFlags, CPoint point)
Definition: XYWnd.cpp:1165
void SetClipMode(bool bMode)
Definition: XYWnd.cpp:1398
int GetAxisVert()
Definition: XYWnd.h:130
idVec3 * m_pVec3
Definition: XYWnd.h:62
bool FilterBrush(brush_t *pb)
Definition: XYWnd.cpp:3167
bool ClipMode()
Definition: XYWnd.cpp:1428
afx_msg void OnRButtonUp(UINT nFlags, CPoint point)
Definition: XYWnd.cpp:1137
float m_BottomClip
Definition: XYWnd.h:185