]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - radiant/xywindow.h
rebuilt gtk binary dependencies file
[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() { if (m_pVec3) VectorCopy(m_ptClip, *m_pVec3); };
44   void SetPointPtr(vec3_t* p) { m_pVec3 = p; };
45   vec3_t m_ptClip;      // the 3d point
46   vec3_t* m_pVec3;      // optional ptr for 3rd party updates
47   int m_ptScreenX, m_ptScreenY;    // the onscreen xy point (for mousability)
48   bool m_bSet;
49   operator vec3_t&() {return m_ptClip;};
50   operator vec3_t*() {return &m_ptClip;};
51   
52   /*! Draw clip/path point with rasterized number label */
53   void Draw(float fScale, int num);
54   /*! Draw clip/path point with rasterized string label */
55   void Draw(float fScale, const char *label);
56 };
57
58 class XYWnd : public GLWindow
59 {
60 public:
61   XYWnd();
62   virtual ~XYWnd() { }
63
64 public:
65   bool AreaSelectOK();
66   vec3_t& RotateOrigin();
67   vec3_t& Rotation();
68   void UndoClear();
69   bool UndoAvailable();
70   void KillPathMode();
71   void Undo();
72   void UndoCopy();
73   void Copy();
74   void Paste();
75   void Redraw(unsigned int nBits);
76   void VectorCopyXY(vec3_t in, vec3_t out);
77   void PositionView();
78   void FlipClip();
79   void SplitClip();
80   void Clip();
81   vec3_t& GetOrigin();
82   void SetOrigin(vec3_t org);           // PGM
83   void XY_Init();
84   void XY_Overlay();
85   void XY_Draw();
86   void DrawZIcon();
87   void DrawRotateIcon();
88   void DrawCameraIcon();
89   void XY_DrawBlockGrid();
90   void XY_DrawGrid();
91   void XY_MouseMoved (int x, int y, int buttons);
92 // TTimo: FIXME: was experimental stuff to track possible endless loop issues
93 //  void XY_MouseMovedRec (int x, int y, int buttons);
94   void NewBrushDrag (int x, int y);
95   qboolean DragDelta (int x, int y, vec3_t move);
96   void XY_MouseUp(int x, int y, int buttons);
97   void XY_MouseDown (int x, int y, int buttons);
98   void XY_ToGridPoint (int x, int y, vec3_t point);
99   void XY_ToPoint (int x, int y, vec3_t point);
100   void SnapToPoint (int x, int y, vec3_t point);
101   void SetActive(bool b) {m_bActive = b;};
102   bool Active() {return m_bActive;};
103
104   void DropClipPoint(guint32 nFlags, int pointx, int pointy);
105   bool RogueClipMode();
106   bool ClipMode();
107   void SetClipMode(bool bMode);
108   void RetainClipMode(bool bMode);
109
110   bool RotateMode();
111   bool SetRotateMode(bool bMode);
112   bool ScaleMode();
113   void SetScaleMode(bool bMode);
114
115   bool PathMode();
116   void DropPathPoint(guint32 nFlags, int pointx, int pointy);
117   bool PointMode();
118 //  void AddPointPoint(guint32 nFlags, vec3_t* pVec);
119   void SetPointMode(bool b);
120
121   void SetViewType(int n);
122   bool m_bActive;
123
124 protected:
125   int m_nUpdateBits;
126   int m_nWidth;
127   int m_nHeight;
128   bool m_bTiming;
129   float m_fScale;
130   float m_TopClip;
131   float m_BottomClip;
132   bool m_bDirty;
133   vec3_t m_vOrigin;
134
135   int m_ptCursorX, m_ptCursorY;
136   bool m_bRButtonDown;
137
138   int m_nButtonstate;
139   int m_nPressx;
140   int m_nPressy;
141   vec3_t m_vPressdelta;
142   bool m_bPress_selection;
143
144   friend class CamWnd;
145
146 private:
147   // this is unique for all views
148   static GtkWidget* m_mnuDrop;
149
150   int m_nViewType;
151
152   int m_nScrollFlags;
153   int m_ptDragX, m_ptDragY;
154   int m_ptDragAdjX, m_ptDragAdjY;
155   int m_ptDragTotalX, m_ptDragTotalY;
156
157   void OriginalButtonUp(guint32 nFlags, int point, int pointy);
158   void OriginalButtonDown(guint32 nFlags, int point, int pointy);
159 //  void ProduceSplits(brush_t** pFront, brush_t** pBack);
160   void PlanePointsFromClipPoints(vec3_t planepts[3], brush_t *pBrush);
161   void ProduceSplitLists();
162   void HandleDrop();
163   void PaintSizeInfo(int nDim1, int nDim2, vec3_t vMinBounds, vec3_t vMaxBounds);
164
165   int m_ptDownX, m_ptDownY;
166
167 public:
168   void OnEntityCreate(const char* item);
169   int GetViewType() {return m_nViewType; }
170   void SetScale(float f) {m_fScale = f;}
171   float Scale() {return m_fScale;}
172   int Width() {return m_nWidth;}
173   int Height() {return m_nHeight;}
174
175 protected:
176
177   void OnCreate ();
178   void OnExpose ();
179   void OnLButtonDown(guint32 flags, int pointx, int pointy);
180   void OnRButtonDown(guint32 flags, int pointx, int pointy);
181   void OnMButtonDown(guint32 flags, int pointx, int pointy);
182   void OnLButtonUp(guint32 flags, int pointx, int pointy);
183   void OnRButtonUp(guint32 flags, int pointx, int pointy);
184   void OnMButtonUp(guint32 flags, int pointx, int pointy);
185   void OnMouseMove(guint32 nFlags, int pointx, int pointy);
186   void OnMouseWheel(bool bUp);
187   void OnSize (int cx, int cy);
188   void OnTimer();
189
190 private:
191   XORRectangle m_XORRectangle;
192 };
193
194 #endif // _XYWINDOW_H_