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
25 // Leonardo Zide (leo@lokigames.com)
\r
29 #include "zwindow.h"
\r
31 // =============================================================================
\r
43 void ZWnd::OnCreate ()
\r
45 g_qeglobals_gui.d_z = m_pWidget;
\r
48 Error ("wglMakeCurrent in CZWnd::OnCreate failed");
\r
51 void ZWnd::OnLButtonDown(guint32 nFlags, int pointx, int pointy)
\r
55 Z_MouseDown (pointx, m_pWidget->allocation.height - 1 - pointy , nFlags);
\r
58 void ZWnd::OnMButtonDown(guint32 nFlags, int pointx, int pointy)
\r
62 Z_MouseDown (pointx, m_pWidget->allocation.height - 1 - pointy , nFlags);
\r
65 void ZWnd::OnRButtonDown(guint32 nFlags, int pointx, int pointy)
\r
69 Z_MouseDown (pointx, m_pWidget->allocation.height - 1 - pointy , nFlags);
\r
72 void ZWnd::OnLButtonUp(guint32 nFlags, int pointx, int pointy)
\r
74 Z_MouseUp (pointx, m_pWidget->allocation.height - 1 - pointy, nFlags);
\r
78 void ZWnd::OnMButtonUp(guint32 nFlags, int pointx, int pointy)
\r
80 Z_MouseUp (pointx, m_pWidget->allocation.height - 1 - pointy, nFlags);
\r
84 void ZWnd::OnRButtonUp(guint32 nFlags, int pointx, int pointy)
\r
86 Z_MouseUp (pointx, m_pWidget->allocation.height - 1 - pointy, nFlags);
\r
90 void ZWnd::OnMouseMove(guint32 nFlags, int pointx, int pointy)
\r
92 float fz = z.origin[2] + ((m_pWidget->allocation.height - 1 - pointy) - (z.height/2)) / z.scale;
\r
93 fz = floor(fz / g_qeglobals.d_gridsize + 0.5) * g_qeglobals.d_gridsize;
\r
95 strStatus.Format("Z:: %.1f", fz);
\r
96 g_pParentWnd->SetStatusText(1, strStatus);
\r
97 Z_MouseMoved (pointx, m_pWidget->allocation.height - 1 - pointy, nFlags);
\r
100 void ZWnd::OnExpose()
\r
102 if (!MakeCurrent ())
\r
104 Sys_Printf("ERROR: wglMakeCurrent failed..\n ");
\r
105 Sys_Printf("Please restart Radiant if the Z view is not working\n");
\r
109 QE_CheckOpenGLForErrors();
\r
111 QE_CheckOpenGLForErrors();
\r
116 void ZWnd::OnSize(int cx, int cy)
\r