XYWnd.h 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*
  2. ===========================================================================
  3. Copyright (C) 1999-2005 Id Software, Inc.
  4. This file is part of Quake III Arena source code.
  5. Quake III Arena source code is free software; you can redistribute it
  6. and/or modify it under the terms of the GNU General Public License as
  7. published by the Free Software Foundation; either version 2 of the License,
  8. or (at your option) any later version.
  9. Quake III Arena source code is distributed in the hope that it will be
  10. useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with Foobar; if not, write to the Free Software
  15. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
  16. ===========================================================================
  17. */
  18. #if !defined(AFX_XYWND_H__44B4BA04_781B_11D1_B53C_00AA00A410FC__INCLUDED_)
  19. #define AFX_XYWND_H__44B4BA04_781B_11D1_B53C_00AA00A410FC__INCLUDED_
  20. #if _MSC_VER >= 1000
  21. #pragma once
  22. #endif // _MSC_VER >= 1000
  23. // XYWnd.h : header file
  24. //
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CXYWnd window
  27. #include "qe3.h"
  28. #include "CamWnd.h"
  29. const int SCALE_X = 0x01;
  30. const int SCALE_Y = 0x02;
  31. const int SCALE_Z = 0x04;
  32. typedef void (PFNPathCallback)(bool, int);
  33. // as i didn't really encapsulate anything this
  34. // should really be a struct..
  35. class CClipPoint
  36. {
  37. public:
  38. CClipPoint(){ Reset(); };
  39. void Reset(){ m_ptClip[0] = m_ptClip[1] = m_ptClip[2] = 0.0; m_bSet = false; m_pVec3 = NULL;};
  40. bool Set(){ return m_bSet; };
  41. void Set(bool b) { m_bSet = b; };
  42. void UpdatePointPtr() { if (m_pVec3) VectorCopy(m_ptClip, *m_pVec3); };
  43. void SetPointPtr(vec3_t* p) { m_pVec3 = p; };
  44. vec3_t m_ptClip; // the 3d point
  45. vec3_t* m_pVec3; // optional ptr for 3rd party updates
  46. CPoint m_ptScreen; // the onscreen xy point (for mousability)
  47. bool m_bSet;
  48. operator vec3_t&() {return m_ptClip;};
  49. operator vec3_t*() {return &m_ptClip;};
  50. };
  51. class CXYWnd : public CWnd
  52. {
  53. DECLARE_DYNCREATE(CXYWnd);
  54. // Construction
  55. public:
  56. CXYWnd();
  57. // Attributes
  58. public:
  59. // Operations
  60. public:
  61. // Overrides
  62. // ClassWizard generated virtual function overrides
  63. //{{AFX_VIRTUAL(CXYWnd)
  64. protected:
  65. virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
  66. //}}AFX_VIRTUAL
  67. // Implementation
  68. public:
  69. bool AreaSelectOK();
  70. vec3_t& RotateOrigin();
  71. vec3_t& Rotation();
  72. void UndoClear();
  73. bool UndoAvailable();
  74. void KillPathMode();
  75. void Undo();
  76. void UndoCopy();
  77. void Copy();
  78. void Paste();
  79. void Redraw(unsigned int nBits);
  80. void VectorCopyXY(vec3_t in, vec3_t out);
  81. void PositionView();
  82. void FlipClip();
  83. void SplitClip();
  84. void Clip();
  85. vec3_t& GetOrigin();
  86. void SetOrigin(vec3_t org); // PGM
  87. void XY_Init();
  88. void XY_Overlay();
  89. void XY_Draw();
  90. void DrawZIcon();
  91. void DrawRotateIcon();
  92. void DrawCameraIcon();
  93. void XY_DrawBlockGrid();
  94. void XY_DrawGrid();
  95. void XY_MouseMoved (int x, int y, int buttons);
  96. void NewBrushDrag (int x, int y);
  97. qboolean DragDelta (int x, int y, vec3_t move);
  98. void XY_MouseUp(int x, int y, int buttons);
  99. void XY_MouseDown (int x, int y, int buttons);
  100. void XY_ToGridPoint (int x, int y, vec3_t point);
  101. void XY_ToPoint (int x, int y, vec3_t point);
  102. void SnapToPoint (int x, int y, vec3_t point);
  103. void SetActive(bool b) {m_bActive = b;};
  104. bool Active() {return m_bActive;};
  105. void DropClipPoint(UINT nFlags, CPoint point);
  106. bool RogueClipMode();
  107. bool ClipMode();
  108. void SetClipMode(bool bMode);
  109. void RetainClipMode(bool bMode);
  110. bool RotateMode();
  111. bool SetRotateMode(bool bMode);
  112. bool ScaleMode();
  113. void SetScaleMode(bool bMode);
  114. bool PathMode();
  115. void DropPathPoint(UINT nFlags, CPoint point);
  116. bool PointMode();
  117. void AddPointPoint(UINT nFlags, vec3_t* pVec);
  118. void SetPointMode(bool b);
  119. virtual ~CXYWnd();
  120. void SetViewType(int n);
  121. int GetViewType() {return m_nViewType; };
  122. void SetScale(float f) {m_fScale = f;};
  123. float Scale() {return m_fScale;};
  124. int Width() {return m_nWidth;}
  125. int Height() {return m_nHeight;}
  126. bool m_bActive;
  127. // Generated message map functions
  128. protected:
  129. int m_nUpdateBits;
  130. int m_nWidth;
  131. int m_nHeight;
  132. bool m_bTiming;
  133. float m_fScale;
  134. float m_TopClip;
  135. float m_BottomClip;
  136. bool m_bDirty;
  137. vec3_t m_vOrigin;
  138. CPoint m_ptCursor;
  139. bool m_bRButtonDown;
  140. int m_nButtonstate;
  141. int m_nPressx;
  142. int m_nPressy;
  143. vec3_t m_vPressdelta;
  144. bool m_bPress_selection;
  145. friend CCamWnd;
  146. //friend C3DFXCamWnd;
  147. CMenu m_mnuDrop;
  148. int m_nViewType;
  149. unsigned int m_nTimerID;
  150. int m_nScrollFlags;
  151. CPoint m_ptDrag;
  152. CPoint m_ptDragAdj;
  153. CPoint m_ptDragTotal;
  154. void OriginalButtonUp(UINT nFlags, CPoint point);
  155. void OriginalButtonDown(UINT nFlags, CPoint point);
  156. void ProduceSplits(brush_t** pFront, brush_t** pBack);
  157. void ProduceSplitLists();
  158. void HandleDrop();
  159. void PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBounds);
  160. void OnEntityCreate(unsigned int nID);
  161. CPoint m_ptDown;
  162. //{{AFX_MSG(CXYWnd)
  163. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  164. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  165. afx_msg void OnMButtonDown(UINT nFlags, CPoint point);
  166. afx_msg void OnRButtonDown(UINT nFlags, CPoint point);
  167. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  168. afx_msg void OnMButtonUp(UINT nFlags, CPoint point);
  169. afx_msg void OnRButtonUp(UINT nFlags, CPoint point);
  170. afx_msg void OnMouseMove(UINT nFlags, CPoint point);
  171. afx_msg void OnPaint();
  172. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  173. afx_msg void OnSize(UINT nType, int cx, int cy);
  174. afx_msg void OnDestroy();
  175. afx_msg void OnSelectMouserotate();
  176. afx_msg void OnTimer(UINT nIDEvent);
  177. afx_msg void OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags);
  178. afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
  179. afx_msg void OnKillFocus(CWnd* pNewWnd);
  180. afx_msg void OnSetFocus(CWnd* pOldWnd);
  181. afx_msg void OnClose();
  182. //}}AFX_MSG
  183. DECLARE_MESSAGE_MAP()
  184. };
  185. /////////////////////////////////////////////////////////////////////////////
  186. //{{AFX_INSERT_LOCATION}}
  187. // Microsoft Developer Studio will insert additional declarations immediately before the previous line.
  188. #endif // !defined(AFX_XYWND_H__44B4BA04_781B_11D1_B53C_00AA00A410FC__INCLUDED_)