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 _CAMWINDOW_H_
\r
23 #define _CAMWINDOW_H_
\r
27 #include "glwindow.h"
\r
33 : x(0), y(0), w(0), h(0)
\r
35 rectangle_t(float _x, float _y, float _w, float _h)
\r
36 : x(_x), y(_y), w(_w), h(_h)
\r
47 XORRectangle(GtkWidget* widget)
\r
48 : m_widget(widget), m_gc(NULL)
\r
55 void set(rectangle_t rectangle)
\r
59 m_rectangle = rectangle;
\r
63 bool initialised() const
\r
65 return m_gc != NULL;
\r
71 m_gc = gdk_gc_new(m_widget->window);
\r
73 GdkColor color = { 0, 0xffff, 0xffff, 0xffff, };
\r
74 GdkColormap* colormap = gdk_window_get_colormap(m_widget->window);
\r
75 gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE);
\r
76 gdk_gc_copy(m_gc, m_widget->style->white_gc);
\r
77 gdk_gc_set_foreground(m_gc, &color);
\r
78 gdk_gc_set_background(m_gc, &color);
\r
80 gdk_gc_set_function(m_gc, GDK_XOR);
\r
85 const int x = (int)m_rectangle.x;
\r
86 const int y = (int)m_rectangle.y;
\r
87 const int w = (int)m_rectangle.w;
\r
88 const int h = (int)m_rectangle.h;
\r
89 gdk_draw_rectangle(m_widget->window, m_gc, TRUE, x, -(h) - (y - m_widget->allocation.height), w, h);
\r
92 rectangle_t m_rectangle;
\r
95 GtkWidget* m_widget;
\r
98 class CamWnd : public GLWindow
\r
101 void MatchViewAxes(const vec3_t P, const vec3_t vec, int &axis, float &sgn);
\r
106 camera_t *Camera(){return &m_Camera;};
\r
107 void Cam_MouseControl(float dtime);
\r
108 void Cam_ChangeFloor(qboolean up);
\r
109 void ToggleFreeMove();
\r
114 void Cam_BuildMatrix();
\r
115 void Cam_PositionDrag();
\r
116 void Cam_KeyControl(float dtime);
\r
117 void Cam_MouseDown(int x, int y, int buttons);
\r
118 void Cam_MouseUp (int x, int y, int buttons);
\r
119 void Cam_MouseMoved (int x, int y, int buttons);
\r
121 qboolean CullBrush (brush_t *b);
\r
123 void Cam_DrawStuff();
\r
124 void Cam_DrawBrushes(int mode);
\r
125 void Cam_DrawBrush(brush_t *b, int mode);
\r
127 brush_t* m_TransBrushes[MAX_MAP_BRUSHES];
\r
128 int m_nNumTransBrushes;
\r
130 int m_nCambuttonstate;
\r
133 int m_ptLastCursorX;
\r
134 int m_ptLastCamCursorX;
\r
137 int m_ptLastCursorY;
\r
138 int m_ptLastCamCursorY;
\r
139 face_t* m_pSide_select;
\r
145 guint m_FocusOutHandler_id;
\r
149 void OnLButtonDown (guint32 flags, int x, int y);
\r
150 void OnRButtonDown (guint32 flags, int x, int y);
\r
151 void OnMButtonDown (guint32 flags, int x, int y);
\r
152 void OnLButtonUp (guint32 flags, int pointx, int pointy);
\r
153 void OnRButtonUp (guint32 flags, int pointx, int pointy);
\r
154 void OnMButtonUp (guint32 flags, int pointx, int pointy);
\r
155 void OnMouseMove (guint32 flags, int pointx, int pointy);
\r
156 void OnMouseWheel(bool bUp);
\r
157 void OnSize(int cx, int cy);
\r
160 void OriginalMouseDown (guint32 nFlags, int pointX, int pointY);
\r
161 void OriginalMouseUp (guint32 nFlags, int pointX, int pointY);
\r
164 XORRectangle m_XORRectangle;
\r
166 // project a point in geometric space into camera space
\r
167 void ProjectCamera(const vec3_t A, vec_t B[2]);
\r
171 #endif // _CAMWINDOW_H_
\r