-/*\r
-Copyright (C) 1999-2007 id Software, Inc. and contributors.\r
-For a list of contributors, see the accompanying CONTRIBUTORS file.\r
-\r
-This file is part of GtkRadiant.\r
-\r
-GtkRadiant is free software; you can redistribute it and/or modify\r
-it under the terms of the GNU General Public License as published by\r
-the Free Software Foundation; either version 2 of the License, or\r
-(at your option) any later version.\r
-\r
-GtkRadiant is distributed in the hope that it will be useful,\r
-but WITHOUT ANY WARRANTY; without even the implied warranty of\r
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
-GNU General Public License for more details.\r
-\r
-You should have received a copy of the GNU General Public License\r
-along with GtkRadiant; if not, write to the Free Software\r
-Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\r
-*/\r
-\r
-#ifndef _CAMWINDOW_H_\r
-#define _CAMWINDOW_H_\r
-\r
-class XYWnd;\r
-\r
-#include "glwindow.h"\r
-\r
-class rectangle_t\r
-{\r
-public:\r
- rectangle_t()\r
- : x(0), y(0), w(0), h(0)\r
- {}\r
- rectangle_t(float _x, float _y, float _w, float _h)\r
- : x(_x), y(_y), w(_w), h(_h)\r
- {}\r
- float x;\r
- float y;\r
- float w;\r
- float h;\r
-};\r
-\r
-class XORRectangle\r
-{\r
-public:\r
- XORRectangle(GtkWidget* widget)\r
- : m_widget(widget), m_gc(NULL)\r
- {}\r
- ~XORRectangle()\r
- {\r
- if(initialised())\r
- gdk_gc_unref(m_gc);\r
- }\r
- void set(rectangle_t rectangle)\r
- {\r
- lazy_init();\r
- draw();\r
- m_rectangle = rectangle;\r
- draw();\r
- }\r
-private:\r
- bool initialised() const\r
- {\r
- return m_gc != NULL;\r
- }\r
- void lazy_init()\r
- {\r
- if(!initialised())\r
- {\r
- m_gc = gdk_gc_new(m_widget->window);\r
-\r
- GdkColor color = { 0, 0xffff, 0xffff, 0xffff, };\r
- GdkColormap* colormap = gdk_window_get_colormap(m_widget->window);\r
- gdk_colormap_alloc_color (colormap, &color, FALSE, TRUE);\r
- gdk_gc_copy(m_gc, m_widget->style->white_gc);\r
- gdk_gc_set_foreground(m_gc, &color);\r
- gdk_gc_set_background(m_gc, &color);\r
-\r
- gdk_gc_set_function(m_gc, GDK_XOR);\r
- }\r
- }\r
- void draw() const\r
- {\r
- const int x = (int)m_rectangle.x;\r
- const int y = (int)m_rectangle.y;\r
- const int w = (int)m_rectangle.w;\r
- const int h = (int)m_rectangle.h;\r
- gdk_draw_rectangle(m_widget->window, m_gc, TRUE, x, -(h) - (y - m_widget->allocation.height), w, h);\r
- }\r
-\r
- rectangle_t m_rectangle;\r
-\r
- GdkGC* m_gc;\r
- GtkWidget* m_widget;\r
-};\r
-\r
-class CamWnd : public GLWindow\r
-{\r
-public:\r
- void MatchViewAxes(const vec3_t P, const vec3_t vec, int &axis, float &sgn);\r
- void ReInitGL();\r
- void BenchMark();\r
- CamWnd();\r
- virtual ~CamWnd();\r
- camera_t *Camera(){return &m_Camera;};\r
- void Cam_MouseControl(float dtime);\r
- void Cam_ChangeFloor(qboolean up);\r
- void ToggleFreeMove();\r
- bool m_bFreeMove;\r
-\r
-protected:\r
- void Cam_Init();\r
- void Cam_BuildMatrix();\r
- void Cam_PositionDrag();\r
- void Cam_KeyControl(float dtime);\r
- void Cam_MouseDown(int x, int y, int buttons);\r
- void Cam_MouseUp (int x, int y, int buttons);\r
- void Cam_MouseMoved (int x, int y, int buttons);\r
- void InitCull();\r
- qboolean CullBrush (brush_t *b);\r
- void Cam_Draw();\r
- void Cam_DrawStuff();\r
- void Cam_DrawBrushes(int mode);\r
- void Cam_DrawBrush(brush_t *b, int mode);\r
-\r
- brush_t* m_TransBrushes[MAX_MAP_BRUSHES];\r
- int m_nNumTransBrushes;\r
- camera_t m_Camera;\r
- int m_nCambuttonstate;\r
- int m_ptButtonX;\r
- int m_ptCursorX;\r
- int m_ptLastCursorX;\r
- int m_ptLastCamCursorX;\r
- int m_ptButtonY;\r
- int m_ptCursorY;\r
- int m_ptLastCursorY;\r
- int m_ptLastCamCursorY;\r
- face_t* m_pSide_select;\r
- vec3_t m_vCull1;\r
- vec3_t m_vCull2;\r
- int m_nCullv1[3];\r
- int m_nCullv2[3];\r
- bool m_bClipMode;\r
- guint m_FocusOutHandler_id;\r
-\r
- void OnCreate ();\r
- void OnExpose ();\r
- void OnLButtonDown (guint32 flags, int x, int y);\r
- void OnRButtonDown (guint32 flags, int x, int y);\r
- void OnMButtonDown (guint32 flags, int x, int y);\r
- void OnLButtonUp (guint32 flags, int pointx, int pointy);\r
- void OnRButtonUp (guint32 flags, int pointx, int pointy);\r
- void OnMButtonUp (guint32 flags, int pointx, int pointy);\r
- void OnMouseMove (guint32 flags, int pointx, int pointy);\r
- void OnMouseWheel(bool bUp);\r
- void OnSize(int cx, int cy);\r
-\r
-protected:\r
- void OriginalMouseDown (guint32 nFlags, int pointX, int pointY);\r
- void OriginalMouseUp (guint32 nFlags, int pointX, int pointY);\r
-\r
-private:\r
- XORRectangle m_XORRectangle;\r
-\r
- // project a point in geometric space into camera space\r
- void ProjectCamera(const vec3_t A, vec_t B[2]);\r
-};\r
-\r
-\r
-#endif // _CAMWINDOW_H_\r
+/*
+ Copyright (C) 1999-2006 Id Software, Inc. and contributors.
+ For a list of contributors, see the accompanying CONTRIBUTORS file.
+
+ This file is part of GtkRadiant.
+
+ GtkRadiant is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GtkRadiant is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GtkRadiant; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#if !defined( INCLUDED_CAMWINDOW_H )
+#define INCLUDED_CAMWINDOW_H
+
+#include <uilib/uilib.h>
+#include "math/vector.h"
+#include "signal/signalfwd.h"
+
+class CamWnd;
+CamWnd* NewCamWnd();
+void DeleteCamWnd( CamWnd* camwnd );
+
+void AddCameraMovedCallback( const SignalHandler& handler );
+
+void CamWnd_Update( CamWnd& camwnd );
+
+ui::GLArea CamWnd_getWidget( CamWnd& camwnd );
+void CamWnd_setParent( CamWnd& camwnd, ui::Window parent );
+
+void GlobalCamera_setCamWnd( CamWnd& camwnd );
+
+void fill_view_camera_menu( ui::Menu menu );
+void CamWnd_constructToolbar( ui::Toolbar toolbar );
+void CamWnd_registerShortcuts();
+
+void GlobalCamera_Benchmark();
+
+const Vector3& Camera_getOrigin( CamWnd& camwnd );
+void Camera_setOrigin( CamWnd& camwnd, const Vector3& origin );
+
+enum
+{
+ CAMERA_PITCH = 0, // up / down
+ CAMERA_YAW = 1, // left / right
+ CAMERA_ROLL = 2, // fall over
+};
+
+const Vector3& Camera_getAngles( CamWnd& camwnd );
+void Camera_setAngles( CamWnd& camwnd, const Vector3& angles );
+
+
+struct camwindow_globals_t
+{
+ Vector3 color_cameraback;
+ Vector3 color_selbrushes3d;
+
+ int m_nCubicScale;
+
+ camwindow_globals_t() :
+ color_cameraback( 0.25f, 0.25f, 0.25f ),
+ color_selbrushes3d( 1.0f, 0.f, 0.f ),
+ m_nCubicScale( 26 ){
+ }
+
+};
+
+extern camwindow_globals_t g_camwindow_globals;
+
+void CamWnd_Construct();
+void CamWnd_Destroy();
+
+#endif