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
25 // Leonardo Zide (leo@lokigames.com)
31 // =============================================================================
41 void ZWnd::OnCreate(){
42 g_qeglobals_gui.d_z = m_pWidget;
44 if ( !MakeCurrent() ) {
45 Error( "wglMakeCurrent in CZWnd::OnCreate failed" );
49 void ZWnd::OnLButtonDown( guint32 nFlags, int pointx, int pointy ){
52 Z_MouseDown( pointx, m_pWidget->allocation.height - 1 - pointy, nFlags );
55 void ZWnd::OnMButtonDown( guint32 nFlags, int pointx, int pointy ){
58 Z_MouseDown( pointx, m_pWidget->allocation.height - 1 - pointy, nFlags );
61 void ZWnd::OnRButtonDown( guint32 nFlags, int pointx, int pointy ){
64 Z_MouseDown( pointx, m_pWidget->allocation.height - 1 - pointy, nFlags );
67 void ZWnd::OnLButtonUp( guint32 nFlags, int pointx, int pointy ){
68 Z_MouseUp( pointx, m_pWidget->allocation.height - 1 - pointy, nFlags );
72 void ZWnd::OnMButtonUp( guint32 nFlags, int pointx, int pointy ){
73 Z_MouseUp( pointx, m_pWidget->allocation.height - 1 - pointy, nFlags );
77 void ZWnd::OnRButtonUp( guint32 nFlags, int pointx, int pointy ){
78 Z_MouseUp( pointx, m_pWidget->allocation.height - 1 - pointy, nFlags );
82 void ZWnd::OnMouseMove( guint32 nFlags, int pointx, int pointy ){
83 float fz = z.origin[2] + ( ( m_pWidget->allocation.height - 1 - pointy ) - ( z.height / 2 ) ) / z.scale;
84 fz = floor( fz / g_qeglobals.d_gridsize + 0.5 ) * g_qeglobals.d_gridsize;
86 strStatus.Format( "Z:: %.1f", fz );
87 g_pParentWnd->SetStatusText( 1, strStatus );
88 Z_MouseMoved( pointx, m_pWidget->allocation.height - 1 - pointy, nFlags );
91 void ZWnd::OnExpose(){
92 if ( !MakeCurrent() ) {
93 Sys_Printf( "ERROR: wglMakeCurrent failed..\n " );
94 Sys_Printf( "Please restart Radiant if the Z view is not working\n" );
98 QE_CheckOpenGLForErrors();
100 QE_CheckOpenGLForErrors();
105 void ZWnd::OnSize( int cx, int cy ){
108 if ( z.width < 10 ) {
111 if ( z.height < 10 ) {