2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
\r
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
5 This file is part of GtkRadiant.
\r
7 GtkRadiant is free software; you can redistribute it and/or modify
\r
8 it under the terms of the GNU General Public License as published by
\r
9 the Free Software Foundation; either version 2 of the License, or
\r
10 (at your option) any later version.
\r
12 GtkRadiant is distributed in the hope that it will be useful,
\r
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
15 GNU General Public License for more details.
\r
17 You should have received a copy of the GNU General Public License
\r
18 along with GtkRadiant; if not, write to the Free Software
\r
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
22 #ifndef _XYWINDOW_H_
\r
23 #define _XYWINDOW_H_
\r
26 #include "camwindow.h"
\r
27 #include "glwindow.h"
\r
29 const int SCALE_X = 0x01;
\r
30 const int SCALE_Y = 0x02;
\r
31 const int SCALE_Z = 0x04;
\r
33 typedef void (PFNPathCallback)(bool, int);
\r
34 // as i didn't really encapsulate anything this
\r
35 // should really be a struct..
\r
39 ClipPoint(){ Reset(); };
\r
40 void Reset(){ m_ptClip[0] = m_ptClip[1] = m_ptClip[2] = 0.0; m_bSet = false; m_pVec3 = NULL;};
\r
41 bool Set(){ return m_bSet; };
\r
42 void Set(bool b) { m_bSet = b; };
\r
43 void UpdatePointPtr() { if (m_pVec3) VectorCopy(m_ptClip, *m_pVec3); };
\r
44 void SetPointPtr(vec3_t* p) { m_pVec3 = p; };
\r
45 vec3_t m_ptClip; // the 3d point
\r
46 vec3_t* m_pVec3; // optional ptr for 3rd party updates
\r
47 int m_ptScreenX, m_ptScreenY; // the onscreen xy point (for mousability)
\r
49 operator vec3_t&() {return m_ptClip;};
\r
50 operator vec3_t*() {return &m_ptClip;};
\r
52 /*! Draw clip/path point with rasterized number label */
\r
53 void Draw(float fScale, int num);
\r
54 /*! Draw clip/path point with rasterized string label */
\r
55 void Draw(float fScale, const char *label);
\r
58 class XYWnd : public GLWindow
\r
62 virtual ~XYWnd() { }
\r
65 bool AreaSelectOK();
\r
66 vec3_t& RotateOrigin();
\r
69 bool UndoAvailable();
\r
70 void KillPathMode();
\r
75 void Redraw(unsigned int nBits);
\r
76 void VectorCopyXY(vec3_t in, vec3_t out);
\r
77 void PositionView();
\r
81 vec3_t& GetOrigin();
\r
82 void SetOrigin(vec3_t org); // PGM
\r
87 void DrawRotateIcon();
\r
88 void DrawCameraIcon();
\r
89 void XY_DrawBlockGrid();
\r
91 void XY_MouseMoved (int x, int y, int buttons);
\r
92 // TTimo: FIXME: was experimental stuff to track possible endless loop issues
\r
93 // void XY_MouseMovedRec (int x, int y, int buttons);
\r
94 void NewBrushDrag (int x, int y);
\r
95 qboolean DragDelta (int x, int y, vec3_t move);
\r
96 void XY_MouseUp(int x, int y, int buttons);
\r
97 void XY_MouseDown (int x, int y, int buttons);
\r
98 void XY_ToGridPoint (int x, int y, vec3_t point);
\r
99 void XY_ToPoint (int x, int y, vec3_t point);
\r
100 void SnapToPoint (int x, int y, vec3_t point);
\r
101 void SetActive(bool b) {m_bActive = b;};
\r
102 bool Active() {return m_bActive;};
\r
104 void DropClipPoint(guint32 nFlags, int pointx, int pointy);
\r
105 bool RogueClipMode();
\r
107 void SetClipMode(bool bMode);
\r
108 void RetainClipMode(bool bMode);
\r
111 bool SetRotateMode(bool bMode);
\r
113 void SetScaleMode(bool bMode);
\r
116 void DropPathPoint(guint32 nFlags, int pointx, int pointy);
\r
118 // void AddPointPoint(guint32 nFlags, vec3_t* pVec);
\r
119 void SetPointMode(bool b);
\r
121 void SetViewType(int n);
\r
131 float m_BottomClip;
\r
135 int m_ptCursorX, m_ptCursorY;
\r
136 bool m_bRButtonDown;
\r
138 int m_nButtonstate;
\r
141 vec3_t m_vPressdelta;
\r
142 bool m_bPress_selection;
\r
144 friend class CamWnd;
\r
147 // this is unique for all views
\r
148 static GtkWidget* m_mnuDrop;
\r
152 int m_nScrollFlags;
\r
153 int m_ptDragX, m_ptDragY;
\r
154 int m_ptDragAdjX, m_ptDragAdjY;
\r
155 int m_ptDragTotalX, m_ptDragTotalY;
\r
157 void OriginalButtonUp(guint32 nFlags, int point, int pointy);
\r
158 void OriginalButtonDown(guint32 nFlags, int point, int pointy);
\r
159 // void ProduceSplits(brush_t** pFront, brush_t** pBack);
\r
160 void PlanePointsFromClipPoints(vec3_t planepts[3], brush_t *pBrush);
\r
161 void ProduceSplitLists();
\r
163 void PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBounds);
\r
165 int m_ptDownX, m_ptDownY;
\r
168 void OnEntityCreate(const char* item);
\r
169 int GetViewType() {return m_nViewType; }
\r
170 void SetScale(float f) {m_fScale = f;}
\r
171 float Scale() {return m_fScale;}
\r
172 int Width() {return m_nWidth;}
\r
173 int Height() {return m_nHeight;}
\r
179 void OnLButtonDown(guint32 flags, int pointx, int pointy);
\r
180 void OnRButtonDown(guint32 flags, int pointx, int pointy);
\r
181 void OnMButtonDown(guint32 flags, int pointx, int pointy);
\r
182 void OnLButtonUp(guint32 flags, int pointx, int pointy);
\r
183 void OnRButtonUp(guint32 flags, int pointx, int pointy);
\r
184 void OnMButtonUp(guint32 flags, int pointx, int pointy);
\r
185 void OnMouseMove(guint32 nFlags, int pointx, int pointy);
\r
186 void OnMouseWheel(bool bUp);
\r
187 void OnSize (int cx, int cy);
\r
191 XORRectangle m_XORRectangle;
\r
194 #endif // _XYWINDOW_H_
\r