XYWnd.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /*
  2. ===========================================================================
  3. Doom 3 GPL Source Code
  4. Copyright (C) 1999-2011 id Software LLC, a ZeniMax Media company.
  5. This file is part of the Doom 3 GPL Source Code (?Doom 3 Source Code?).
  6. Doom 3 Source Code is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation, either version 3 of the License, or
  9. (at your option) any later version.
  10. Doom 3 Source Code 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. You should have received a copy of the GNU General Public License
  15. along with Doom 3 Source Code. If not, see <http://www.gnu.org/licenses/>.
  16. 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.
  17. 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.
  18. ===========================================================================
  19. */
  20. #if !defined(AFX_XYWND_H__44B4BA04_781B_11D1_B53C_00AA00A410FC__INCLUDED_)
  21. #define AFX_XYWND_H__44B4BA04_781B_11D1_B53C_00AA00A410FC__INCLUDED_
  22. #if _MSC_VER >= 1000
  23. #pragma once
  24. #endif // _MSC_VER >= 1000
  25. // XYWnd.h : header file
  26. //
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CXYWnd window
  29. #include "qe3.h"
  30. #include "CamWnd.h"
  31. const int SCALE_X = 0x01;
  32. const int SCALE_Y = 0x02;
  33. const int SCALE_Z = 0x04;
  34. bool FilterBrush(brush_t *pb);
  35. typedef void (PFNPathCallback)(bool, int);
  36. // as i didn't really encapsulate anything this
  37. // should really be a struct..
  38. class CClipPoint
  39. {
  40. public:
  41. CClipPoint(){ Reset(); };
  42. void Reset(){ m_ptClip[0] = m_ptClip[1] = m_ptClip[2] = 0.0; m_bSet = false; m_pVec3 = NULL;};
  43. bool Set(){ return m_bSet; };
  44. void Set(bool b) { m_bSet = b; };
  45. void UpdatePointPtr() { if (m_pVec3) VectorCopy(m_ptClip, *m_pVec3); };
  46. void SetPointPtr(idVec3* p) { m_pVec3 = p; };
  47. idVec3 m_ptClip; // the 3d point
  48. idVec3* m_pVec3; // optional ptr for 3rd party updates
  49. CPoint m_ptScreen; // the onscreen xy point (for mousability)
  50. bool m_bSet;
  51. operator idVec3&() {return m_ptClip;};
  52. operator idVec3*() {return &m_ptClip;};
  53. operator float*() {return m_ptClip.ToFloatPtr();};
  54. };
  55. class CXYWnd : public CWnd
  56. {
  57. DECLARE_DYNCREATE(CXYWnd);
  58. // Construction
  59. public:
  60. CXYWnd();
  61. // Attributes
  62. public:
  63. // Operations
  64. public:
  65. // Overrides
  66. // ClassWizard generated virtual function overrides
  67. //{{AFX_VIRTUAL(CXYWnd)
  68. protected:
  69. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  70. //}}AFX_VIRTUAL
  71. // Implementation
  72. public:
  73. bool AreaSelectOK();
  74. idVec3& RotateOrigin();
  75. idVec3& Rotation();
  76. void UndoClear();
  77. bool UndoAvailable();
  78. void KillPathMode();
  79. void Undo();
  80. void UndoCopy();
  81. void Copy();
  82. void Paste();
  83. void Redraw(unsigned int nBits);
  84. void VectorCopyXY( const idVec3 &in, idVec3 &out );
  85. void PositionView();
  86. void FlipClip();
  87. void SplitClip();
  88. void Clip();
  89. idVec3& GetOrigin();
  90. void SetOrigin(idVec3 org); // PGM
  91. void XY_Init();
  92. void XY_Draw();
  93. void DrawZIcon();
  94. void DrawRotateIcon();
  95. void DrawCameraIcon();
  96. void XY_DrawBlockGrid();
  97. void XY_DrawGrid();
  98. bool XY_MouseMoved (int x, int y, int buttons);
  99. void NewBrushDrag (int x, int y);
  100. bool DragDelta (int x, int y, idVec3 &move);
  101. void XY_MouseUp(int x, int y, int buttons);
  102. void XY_MouseDown (int x, int y, int buttons);
  103. void XY_ToGridPoint (int x, int y, idVec3 &point);
  104. void XY_ToPoint (int x, int y, idVec3 &point);
  105. void SnapToPoint (int x, int y, idVec3 &point);
  106. void SetActive(bool b) {m_bActive = b;};
  107. bool Active() {return m_bActive;};
  108. void DropClipPoint(UINT nFlags, CPoint point);
  109. int GetAxisHoriz() { return m_axisHoriz; };
  110. int GetAxisVert() { return m_axisVert; };
  111. void AnalogMouseZoom( int mouseDeltaY );
  112. bool RogueClipMode();
  113. bool ClipMode();
  114. void SetClipMode(bool bMode);
  115. void RetainClipMode(bool bMode);
  116. bool RotateMode();
  117. bool SetRotateMode(bool bMode);
  118. bool ScaleMode();
  119. void SetScaleMode(bool bMode);
  120. bool PathMode();
  121. void DropPathPoint(UINT nFlags, CPoint point);
  122. bool PointMode();
  123. void AddPointPoint(UINT nFlags, idVec3* pVec);
  124. void SetPointMode(bool b);
  125. virtual ~CXYWnd();
  126. void SetViewType(int n);
  127. int GetViewType() {return m_nViewType; };
  128. void SetScale(float f) {m_fScale = f;};
  129. float Scale() {return m_fScale;};
  130. int Width() {return m_nWidth;}
  131. int Height() {return m_nHeight;}
  132. bool m_bActive;
  133. void UpdateViewDependencies( void );
  134. void DrawPrecisionCrosshair();
  135. void CyclePrecisionCrosshairMode();
  136. enum
  137. {
  138. PRECISION_CROSSHAIR_NONE = 0,
  139. PRECISION_CROSSHAIR_SNAP = 1,
  140. PRECISION_CROSSHAIR_FREE = 2,
  141. PRECISION_CROSSHAIR_MAX,
  142. };
  143. int m_precisionCrosshairMode;
  144. int m_mouseX;
  145. int m_mouseY;
  146. // Generated message map functions
  147. protected:
  148. int m_nUpdateBits;
  149. int m_nWidth;
  150. int m_nHeight;
  151. float m_fScale;
  152. float m_TopClip;
  153. float m_BottomClip;
  154. bool m_bDirty;
  155. idVec3 m_vOrigin;
  156. CPoint m_ptCursor;
  157. bool m_bRButtonDown;
  158. int m_nButtonstate;
  159. int m_nPressx;
  160. int m_nPressy;
  161. idVec3 m_vPressdelta;
  162. bool m_bPress_selection;
  163. int m_axisHoriz; // <axisHoriz> and <axisVert> are one of AXIS_X, AXIS_Y, AXIS_Z and
  164. int m_axisVert; // reflect which axes are represented horizontally and vertically in the 2d view (XY, XZ, etc)
  165. /// Each of the following _mc fields are stored in map-coordinates, NOT screen-pixels
  166. float m_mcWidth;
  167. float m_mcHeight;
  168. float m_mcLeft;
  169. float m_mcRight;
  170. float m_mcTop;
  171. float m_mcBottom;
  172. friend CCamWnd;
  173. //friend C3DFXCamWnd;
  174. CMenu m_mnuDrop;
  175. int m_nViewType;
  176. unsigned int m_nTimerID;
  177. int m_nScrollFlags;
  178. CPoint m_ptDrag;
  179. CPoint m_ptDragAdj;
  180. CPoint m_ptDragTotal;
  181. void OriginalButtonUp(UINT nFlags, CPoint point);
  182. void OriginalButtonDown(UINT nFlags, CPoint point);
  183. void ProduceSplits(brush_t** pFront, brush_t** pBack);
  184. void ProduceSplitLists();
  185. void HandleDrop();
  186. void PaintSizeInfo(int nDim1, int nDim2, idVec3 vMinBounds, idVec3 vMaxBounds);
  187. void DrawSelectedCentroid( int nDim1, int nDim2, idVec3 vMinBounds, idVec3 vMaxBounds );
  188. void OnEntityCreate(unsigned int nID);
  189. CPoint m_ptDown;
  190. //{{AFX_MSG(CXYWnd)
  191. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  192. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  193. afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
  194. afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  195. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  196. afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
  197. afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
  198. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  199. afx_msg void OnPaint();
  200. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  201. afx_msg void OnSize(UINT nType, int cx, int cy);
  202. afx_msg void OnDestroy();
  203. afx_msg void OnSelectMouserotate();
  204. afx_msg void OnTimer(UINT nIDEvent);
  205. afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  206. afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
  207. afx_msg void OnKillFocus(CWnd* pNewWnd);
  208. afx_msg void OnSetFocus(CWnd* pOldWnd);
  209. afx_msg void OnClose();
  210. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  211. afx_msg void OnDropNewmodel();
  212. afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);
  213. afx_msg BOOL OnCmdMsg( UINT nID, int nCode, void *pExtra, AFX_CMDHANDLERINFO *pHandlerInfo );
  214. //}}AFX_MSG
  215. DECLARE_MESSAGE_MAP()
  216. };
  217. /////////////////////////////////////////////////////////////////////////////
  218. //{{AFX_INSERT_LOCATION}}
  219. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  220. #endif // !defined(AFX_XYWND_H__44B4BA04_781B_11D1_B53C_00AA00A410FC__INCLUDED_)