File: XYWnd.h

package info (click to toggle)
dhewm3 1.5.1~pre%2Bgit20200905%2Bdfsg-1
  • links: PTS, VCS
  • area: contrib
  • in suites: bullseye
  • size: 21,664 kB
  • sloc: cpp: 408,868; ansic: 1,188; objc: 1,034; python: 330; sh: 94; makefile: 11
file content (264 lines) | stat: -rw-r--r-- 8,160 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
/*
===========================================================================

Doom 3 GPL Source Code
Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.

This file is part of the Doom 3 GPL Source Code ("Doom 3 Source Code").

Doom 3 Source Code is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Doom 3 Source Code is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Doom 3 Source Code.  If not, see <http://www.gnu.org/licenses/>.

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.

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.

===========================================================================
*/
#if !defined(AFX_XYWND_H__44B4BA04_781B_11D1_B53C_00AA00A410FC__INCLUDED_)
#define AFX_XYWND_H__44B4BA04_781B_11D1_B53C_00AA00A410FC__INCLUDED_

#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
// XYWnd.h : header file
//

/////////////////////////////////////////////////////////////////////////////
// CXYWnd window

#include "qe3.h"
#include "CamWnd.h"

const int SCALE_X = 0x01;
const int SCALE_Y = 0x02;
const int SCALE_Z = 0x04;

bool FilterBrush(brush_t *pb);

typedef void (PFNPathCallback)(bool, int);
// as i didn't really encapsulate anything this
// should really be a struct..
class CClipPoint
{
public:
  CClipPoint(){ Reset(); };
  void Reset(){ m_ptClip[0] = m_ptClip[1] = m_ptClip[2] = 0.0; m_bSet = false; m_pVec3 = NULL;};
  bool Set(){ return m_bSet; };
  void Set(bool b) { m_bSet = b; };
  void UpdatePointPtr() { if (m_pVec3) VectorCopy(m_ptClip, *m_pVec3); };
  void SetPointPtr(idVec3* p) { m_pVec3 = p; };
  idVec3 m_ptClip;      // the 3d point
  idVec3* m_pVec3;      // optional ptr for 3rd party updates
  CPoint m_ptScreen;    // the onscreen xy point (for mousability)
  bool m_bSet;
  operator idVec3&() {return m_ptClip;};
  operator idVec3*() {return &m_ptClip;};
  operator float*() {return m_ptClip.ToFloatPtr();};
};

class CXYWnd : public CWnd
{
  DECLARE_DYNCREATE(CXYWnd);
// Construction
public:
	CXYWnd();

// Attributes
public:

// Operations
public:

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CXYWnd)
	protected:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	//}}AFX_VIRTUAL

// Implementation
public:
  bool AreaSelectOK();
  idVec3& RotateOrigin();
  idVec3& Rotation();
  void UndoClear();
  bool UndoAvailable();
  void KillPathMode();
  void Undo();
  void UndoCopy();
  void Copy();
  void Paste();
  void Redraw(unsigned int nBits);
  void VectorCopyXY( const idVec3 &in, idVec3 &out );
	void PositionView();
	void FlipClip();
	void SplitClip();
	void Clip();
	idVec3& GetOrigin();
	void SetOrigin(idVec3 org);		// PGM
	void XY_Init();
  void XY_Draw();
  void DrawZIcon();
  void DrawRotateIcon();
  void DrawCameraIcon();
  void XY_DrawBlockGrid();
  void XY_DrawGrid();
  bool XY_MouseMoved (int x, int y, int buttons);
  void NewBrushDrag (int x, int y);
  bool DragDelta (int x, int y, idVec3 &move);
  void XY_MouseUp(int x, int y, int buttons);
  void XY_MouseDown (int x, int y, int buttons);
  void XY_ToGridPoint (int x, int y, idVec3 &point);
  void XY_ToPoint (int x, int y, idVec3 &point);
  void SnapToPoint (int x, int y, idVec3 &point);
  void SetActive(bool b) {m_bActive = b;};
  bool Active() {return m_bActive;};
  void DropClipPoint(UINT nFlags, CPoint point);

	int GetAxisHoriz() { return m_axisHoriz; };
	int GetAxisVert() { return m_axisVert; };
	void AnalogMouseZoom( int mouseDeltaY );


  bool RogueClipMode();
	bool ClipMode();
	void SetClipMode(bool bMode);
	void RetainClipMode(bool bMode);

  bool RotateMode();
  bool SetRotateMode(bool bMode);
  bool ScaleMode();
  void SetScaleMode(bool bMode);

  bool PathMode();
  void DropPathPoint(UINT nFlags, CPoint point);

  bool PointMode();
  void AddPointPoint(UINT nFlags, idVec3* pVec);
  void SetPointMode(bool b);


	virtual ~CXYWnd();
  void SetViewType(int n);
  int GetViewType() {return  m_nViewType; };
  void SetScale(float f) {m_fScale = f;};
  float Scale() {return m_fScale;};
  int Width() {return m_nWidth;}
  int Height() {return m_nHeight;}
  bool m_bActive;

	void UpdateViewDependencies( void );

	void DrawPrecisionCrosshair();
	void CyclePrecisionCrosshairMode();
	enum
	{
		PRECISION_CROSSHAIR_NONE = 0,
		PRECISION_CROSSHAIR_SNAP = 1,
		PRECISION_CROSSHAIR_FREE = 2,
		PRECISION_CROSSHAIR_MAX,
	};

	int m_precisionCrosshairMode;
	int m_mouseX;
	int m_mouseY;


	// Generated message map functions
protected:
	int m_nUpdateBits;
	int m_nWidth;
  int m_nHeight;
	float	m_fScale;
	float	m_TopClip;
  float m_BottomClip;
  bool m_bDirty;
	idVec3 m_vOrigin;
	CPoint m_ptCursor;
  bool m_bRButtonDown;

  int	m_nButtonstate;
  int m_nPressx;
  int m_nPressy;
  idVec3 m_vPressdelta;
  bool m_bPress_selection;

	int m_axisHoriz; //  <axisHoriz> and <axisVert> are one of AXIS_X, AXIS_Y, AXIS_Z and
	int m_axisVert;	 //  reflect which axes are represented horizontally and vertically in the 2d view (XY, XZ, etc)

	/// Each of the following _mc fields are stored in map-coordinates, NOT screen-pixels
	float m_mcWidth;
	float m_mcHeight;
	float m_mcLeft;
	float m_mcRight;
	float m_mcTop;
	float m_mcBottom;


  friend CCamWnd;
  //friend C3DFXCamWnd;

  CMenu m_mnuDrop;
  int m_nViewType;

  unsigned int m_nTimerID;
  int m_nScrollFlags;
  CPoint m_ptDrag;
  CPoint m_ptDragAdj;
  CPoint m_ptDragTotal;

	void OriginalButtonUp(UINT nFlags, CPoint point);
	void OriginalButtonDown(UINT nFlags, CPoint point);
  void ProduceSplits(brush_t** pFront, brush_t** pBack);
  void ProduceSplitLists();
  void HandleDrop();
  void PaintSizeInfo(int nDim1, int nDim2, idVec3 vMinBounds, idVec3 vMaxBounds);
	void DrawSelectedCentroid( int nDim1, int nDim2, idVec3 vMinBounds, idVec3 vMaxBounds );

  void OnEntityCreate(unsigned int nID);
  CPoint m_ptDown;
	//{{AFX_MSG(CXYWnd)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	afx_msg void OnPaint();
	afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnDestroy();
	afx_msg void OnSelectMouserotate();
	afx_msg void OnTimer(UINT nIDEvent);
	afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
	afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
	afx_msg void OnKillFocus(CWnd* pNewWnd);
	afx_msg void OnSetFocus(CWnd* pOldWnd);
	afx_msg void OnClose();
	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	afx_msg void OnDropNewmodel();
	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
	afx_msg BOOL OnCmdMsg( UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo );
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

/////////////////////////////////////////////////////////////////////////////

//{{AFX_INSERT_LOCATION}}
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_XYWND_H__44B4BA04_781B_11D1_B53C_00AA00A410FC__INCLUDED_)