2 Copyright (C) 1999-2007 id Software, Inc. and contributors.
3 For a list of contributors, see the accompanying CONTRIBUTORS file.
5 This file is part of GtkRadiant.
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.
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.
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
33 : x( 0 ), y( 0 ), w( 0 ), h( 0 )
35 rectangle_t( float _x, float _y, float _w, float _h )
36 : x( _x ), y( _y ), w( _w ), h( _h )
47 XORRectangle( GtkWidget* widget )
48 : m_widget( widget ), m_gc( NULL )
51 if ( initialised() ) {
55 void set( rectangle_t rectangle ){
58 m_rectangle = rectangle;
62 bool initialised() const {
66 if ( !initialised() ) {
67 m_gc = gdk_gc_new( m_widget->window );
69 GdkColor color = { 0, 0xffff, 0xffff, 0xffff, };
70 GdkColormap* colormap = gdk_window_get_colormap( m_widget->window );
71 gdk_colormap_alloc_color( colormap, &color, FALSE, TRUE );
72 gdk_gc_copy( m_gc, m_widget->style->white_gc );
73 gdk_gc_set_foreground( m_gc, &color );
74 gdk_gc_set_background( m_gc, &color );
76 gdk_gc_set_function( m_gc, GDK_XOR );
80 const int x = (int)m_rectangle.x;
81 const int y = (int)m_rectangle.y;
82 const int w = (int)m_rectangle.w;
83 const int h = (int)m_rectangle.h;
84 gdk_draw_rectangle( m_widget->window, m_gc, TRUE, x, -( h ) - ( y - m_widget->allocation.height ), w, h );
87 rectangle_t m_rectangle;
93 class CamWnd : public GLWindow
96 void MatchViewAxes( const vec3_t P, const vec3_t vec, int &axis, float &sgn );
101 camera_t *Camera(){return &m_Camera; };
102 void Cam_MouseControl( float dtime );
103 void Cam_ChangeFloor( qboolean up );
104 void ToggleFreeMove();
109 void Cam_BuildMatrix();
110 void Cam_PositionDrag();
111 void Cam_KeyControl( float dtime );
112 void Cam_MouseDown( int x, int y, int buttons );
113 void Cam_MouseUp( int x, int y, int buttons );
114 void Cam_MouseMoved( int x, int y, int buttons );
116 qboolean CullBrush( brush_t *b );
118 void Cam_DrawStuff();
119 void Cam_DrawBrushes( int mode );
120 void Cam_DrawBrush( brush_t *b, int mode );
122 brush_t* m_TransBrushes[MAX_MAP_BRUSHES];
123 int m_nNumTransBrushes;
125 int m_nCambuttonstate;
129 int m_ptLastCamCursorX;
133 int m_ptLastCamCursorY;
134 face_t* m_pSide_select;
140 guint m_FocusOutHandler_id;
144 void OnLButtonDown( guint32 flags, int x, int y );
145 void OnRButtonDown( guint32 flags, int x, int y );
146 void OnMButtonDown( guint32 flags, int x, int y );
147 void OnLButtonUp( guint32 flags, int pointx, int pointy );
148 void OnRButtonUp( guint32 flags, int pointx, int pointy );
149 void OnMButtonUp( guint32 flags, int pointx, int pointy );
150 void OnMouseMove( guint32 flags, int pointx, int pointy );
151 void OnMouseWheel( bool bUp );
152 void OnSize( int cx, int cy );
155 void OriginalMouseDown( guint32 nFlags, int pointX, int pointY );
156 void OriginalMouseUp( guint32 nFlags, int pointX, int pointY );
159 XORRectangle m_XORRectangle;
161 // project a point in geometric space into camera space
162 void ProjectCamera( const vec3_t A, vec_t B[2] );
166 #endif // _CAMWINDOW_H_