]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/xywindow.h
fix unzip code
[xonotic/netradiant.git] / radiant / xywindow.h
1 /*
2    Copyright (C) 1999-2007 id Software, Inc. and contributors.
3    For a list of contributors, see the accompanying CONTRIBUTORS file.
4
5    This file is part of GtkRadiant.
6
7    GtkRadiant is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    GtkRadiant is distributed in the hope that it will be useful,
13    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 GtkRadiant; if not, write to the Free Software
19    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
20  */
21
22 #ifndef _XYWINDOW_H_
23 #define _XYWINDOW_H_
24
25 #include "qe3.h"
26 #include "camwindow.h"
27 #include "glwindow.h"
28
29 const int SCALE_X = 0x01;
30 const int SCALE_Y = 0x02;
31 const int SCALE_Z = 0x04;
32
33 typedef void ( PFNPathCallback )( bool, int );
34 // as i didn't really encapsulate anything this
35 // should really be a struct..
36 class ClipPoint
37 {
38 public:
39 ClipPoint(){ Reset(); };
40 void Reset(){ m_ptClip[0] = m_ptClip[1] = m_ptClip[2] = 0.0; m_bSet = false; m_pVec3 = NULL; };
41 bool Set(){ return m_bSet; };
42 void Set( bool b ) { m_bSet = b; };
43 void UpdatePointPtr() {
44         if ( m_pVec3 ) {
45                 VectorCopy( m_ptClip, *m_pVec3 );
46         }
47 };
48 void SetPointPtr( vec3_t* p ) { m_pVec3 = p; };
49 vec3_t m_ptClip;        // the 3d point
50 vec3_t* m_pVec3;        // optional ptr for 3rd party updates
51 int m_ptScreenX, m_ptScreenY;      // the onscreen xy point (for mousability)
52 bool m_bSet;
53 operator vec3_t&() {
54         return m_ptClip;
55 };
56 operator vec3_t*() {
57         return &m_ptClip;
58 };
59
60 /*! Draw clip/path point with rasterized number label */
61 void Draw( float fScale, int num );
62 /*! Draw clip/path point with rasterized string label */
63 void Draw( float fScale, const char *label );
64 };
65
66 class XYWnd : public GLWindow
67 {
68 public:
69 XYWnd();
70 virtual ~XYWnd() { }
71
72 public:
73 bool AreaSelectOK();
74 vec3_t& RotateOrigin();
75 vec3_t& 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( vec3_t in, vec3_t out );
85 void PositionView();
86 void FlipClip();
87 void SplitClip();
88 void Clip();
89 vec3_t& GetOrigin();
90 void SetOrigin( vec3_t org );       // PGM
91 void XY_Init();
92 void XY_Overlay();
93 void XY_Draw();
94 void DrawZIcon();
95 void DrawRotateIcon();
96 void DrawCameraIcon();
97 void XY_DrawBlockGrid();
98 void XY_DrawGrid();
99 void XY_MouseMoved( int x, int y, int buttons );
100 // TTimo: FIXME: was experimental stuff to track possible endless loop issues
101 //  void XY_MouseMovedRec (int x, int y, int buttons);
102 void NewBrushDrag( int x, int y );
103 qboolean DragDelta( int x, int y, vec3_t move );
104 void XY_MouseUp( int x, int y, int buttons );
105 void XY_MouseDown( int x, int y, int buttons );
106 void XY_ToGridPoint( int x, int y, vec3_t point );
107 void XY_ToPoint( int x, int y, vec3_t point );
108 void SnapToPoint( int x, int y, vec3_t point );
109 void SetActive( bool b ) {m_bActive = b; };
110 bool Active() {return m_bActive; };
111
112 void DropClipPoint( guint32 nFlags, int pointx, int pointy );
113 bool RogueClipMode();
114 bool ClipMode();
115 void SetClipMode( bool bMode );
116 void RetainClipMode( bool bMode );
117
118 bool RotateMode();
119 bool SetRotateMode( bool bMode );
120 bool ScaleMode();
121 void SetScaleMode( bool bMode );
122
123 bool PathMode();
124 void DropPathPoint( guint32 nFlags, int pointx, int pointy );
125 bool PointMode();
126 //  void AddPointPoint(guint32 nFlags, vec3_t* pVec);
127 void SetPointMode( bool b );
128
129 void SetViewType( int n );
130 bool m_bActive;
131
132 protected:
133 int m_nUpdateBits;
134 int m_nWidth;
135 int m_nHeight;
136 bool m_bTiming;
137 float m_fScale;
138 float m_TopClip;
139 float m_BottomClip;
140 bool m_bDirty;
141 vec3_t m_vOrigin;
142
143 int m_ptCursorX, m_ptCursorY;
144 bool m_bRButtonDown;
145
146 int m_nButtonstate;
147 int m_nPressx;
148 int m_nPressy;
149 vec3_t m_vPressdelta;
150 bool m_bPress_selection;
151
152 friend class CamWnd;
153
154 private:
155 // this is unique for all views
156 static GtkWidget* m_mnuDrop;
157
158 int m_nViewType;
159
160 int m_nScrollFlags;
161 int m_ptDragX, m_ptDragY;
162 int m_ptDragAdjX, m_ptDragAdjY;
163 int m_ptDragTotalX, m_ptDragTotalY;
164
165 void OriginalButtonUp( guint32 nFlags, int point, int pointy );
166 void OriginalButtonDown( guint32 nFlags, int point, int pointy );
167 //  void ProduceSplits(brush_t** pFront, brush_t** pBack);
168 void PlanePointsFromClipPoints( vec3_t planepts[3], brush_t * pBrush );
169 void ProduceSplitLists();
170 void HandleDrop();
171 void PaintSizeInfo( int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBounds );
172
173 int m_ptDownX, m_ptDownY;
174
175 public:
176 void OnEntityCreate( const char* item );
177 int GetViewType() {return m_nViewType; }
178 void SetScale( float f ) {m_fScale = f; }
179 float Scale() {return m_fScale; }
180 int Width() {return m_nWidth; }
181 int Height() {return m_nHeight; }
182
183 protected:
184
185 void OnCreate();
186 void OnExpose();
187 void OnLButtonDown( guint32 flags, int pointx, int pointy );
188 void OnRButtonDown( guint32 flags, int pointx, int pointy );
189 void OnMButtonDown( guint32 flags, int pointx, int pointy );
190 void OnLButtonUp( guint32 flags, int pointx, int pointy );
191 void OnRButtonUp( guint32 flags, int pointx, int pointy );
192 void OnMButtonUp( guint32 flags, int pointx, int pointy );
193 void OnMouseMove( guint32 nFlags, int pointx, int pointy );
194 void OnMouseWheel( bool bUp );
195 void OnSize( int cx, int cy );
196 void OnTimer();
197
198 private:
199 XORRectangle m_XORRectangle;
200 };
201
202 #endif // _XYWINDOW_H_