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