-/*\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
-//\r
-// Z Window\r
-//\r
-// Leonardo Zide (leo@lokigames.com)\r
-//\r
-\r
-#include "stdafx.h"\r
-#include "zwindow.h"\r
-\r
-// =============================================================================\r
-// ZWnd class\r
-\r
-ZWnd::ZWnd ()\r
- : GLWindow (FALSE)\r
-{\r
-}\r
-\r
-ZWnd::~ZWnd()\r
-{\r
-}\r
-\r
-void ZWnd::OnCreate () \r
-{\r
- g_qeglobals_gui.d_z = m_pWidget;\r
-\r
- if (!MakeCurrent())\r
- Error ("wglMakeCurrent in CZWnd::OnCreate failed");\r
-}\r
-\r
-void ZWnd::OnLButtonDown(guint32 nFlags, int pointx, int pointy) \r
-{\r
- SetFocus();\r
- SetCapture();\r
- Z_MouseDown (pointx, m_pWidget->allocation.height - 1 - pointy , nFlags);\r
-}\r
-\r
-void ZWnd::OnMButtonDown(guint32 nFlags, int pointx, int pointy) \r
-{\r
- SetFocus();\r
- SetCapture();\r
- Z_MouseDown (pointx, m_pWidget->allocation.height - 1 - pointy , nFlags);\r
-}\r
-\r
-void ZWnd::OnRButtonDown(guint32 nFlags, int pointx, int pointy) \r
-{\r
- SetFocus();\r
- SetCapture();\r
- Z_MouseDown (pointx, m_pWidget->allocation.height - 1 - pointy , nFlags);\r
-}\r
-\r
-void ZWnd::OnLButtonUp(guint32 nFlags, int pointx, int pointy) \r
-{\r
- Z_MouseUp (pointx, m_pWidget->allocation.height - 1 - pointy, nFlags);\r
- ReleaseCapture ();\r
-}\r
-\r
-void ZWnd::OnMButtonUp(guint32 nFlags, int pointx, int pointy) \r
-{\r
- Z_MouseUp (pointx, m_pWidget->allocation.height - 1 - pointy, nFlags);\r
- ReleaseCapture ();\r
-}\r
-\r
-void ZWnd::OnRButtonUp(guint32 nFlags, int pointx, int pointy) \r
-{\r
- Z_MouseUp (pointx, m_pWidget->allocation.height - 1 - pointy, nFlags);\r
- ReleaseCapture ();\r
-}\r
-\r
-void ZWnd::OnMouseMove(guint32 nFlags, int pointx, int pointy) \r
-{\r
- float fz = z.origin[2] + ((m_pWidget->allocation.height - 1 - pointy) - (z.height/2)) / z.scale;\r
- fz = floor(fz / g_qeglobals.d_gridsize + 0.5) * g_qeglobals.d_gridsize;\r
- CString strStatus;\r
- strStatus.Format("Z:: %.1f", fz);\r
- g_pParentWnd->SetStatusText(1, strStatus);\r
- Z_MouseMoved (pointx, m_pWidget->allocation.height - 1 - pointy, nFlags);\r
-}\r
-\r
-void ZWnd::OnExpose() \r
-{\r
- if (!MakeCurrent ())\r
- {\r
- Sys_Printf("ERROR: wglMakeCurrent failed..\n ");\r
- Sys_Printf("Please restart Radiant if the Z view is not working\n");\r
- }\r
- else\r
- {\r
- QE_CheckOpenGLForErrors();\r
- Z_Draw ();\r
- QE_CheckOpenGLForErrors();\r
- SwapBuffers();\r
- }\r
-}\r
-\r
-void ZWnd::OnSize(int cx, int cy) \r
-{\r
- z.width = cx;\r
- z.height = cy;\r
- if (z.width < 10)\r
- z.width = 10;\r
- if (z.height < 10)\r
- z.height = 10;\r
- RedrawWindow ();\r
-}\r
+/*
+Copyright (C) 1999-2007 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
+*/
+
+//
+// Z Window
+//
+// Leonardo Zide (leo@lokigames.com)
+//
+
+#include "stdafx.h"
+#include "zwindow.h"
+
+// =============================================================================
+// ZWnd class
+
+ZWnd::ZWnd ()
+ : GLWindow (FALSE)
+{
+}
+
+ZWnd::~ZWnd()
+{
+}
+
+void ZWnd::OnCreate ()
+{
+ g_qeglobals_gui.d_z = m_pWidget;
+
+ if (!MakeCurrent())
+ Error ("wglMakeCurrent in CZWnd::OnCreate failed");
+}
+
+void ZWnd::OnLButtonDown(guint32 nFlags, int pointx, int pointy)
+{
+ SetFocus();
+ SetCapture();
+ Z_MouseDown (pointx, m_pWidget->allocation.height - 1 - pointy , nFlags);
+}
+
+void ZWnd::OnMButtonDown(guint32 nFlags, int pointx, int pointy)
+{
+ SetFocus();
+ SetCapture();
+ Z_MouseDown (pointx, m_pWidget->allocation.height - 1 - pointy , nFlags);
+}
+
+void ZWnd::OnRButtonDown(guint32 nFlags, int pointx, int pointy)
+{
+ SetFocus();
+ SetCapture();
+ Z_MouseDown (pointx, m_pWidget->allocation.height - 1 - pointy , nFlags);
+}
+
+void ZWnd::OnLButtonUp(guint32 nFlags, int pointx, int pointy)
+{
+ Z_MouseUp (pointx, m_pWidget->allocation.height - 1 - pointy, nFlags);
+ ReleaseCapture ();
+}
+
+void ZWnd::OnMButtonUp(guint32 nFlags, int pointx, int pointy)
+{
+ Z_MouseUp (pointx, m_pWidget->allocation.height - 1 - pointy, nFlags);
+ ReleaseCapture ();
+}
+
+void ZWnd::OnRButtonUp(guint32 nFlags, int pointx, int pointy)
+{
+ Z_MouseUp (pointx, m_pWidget->allocation.height - 1 - pointy, nFlags);
+ ReleaseCapture ();
+}
+
+void ZWnd::OnMouseMove(guint32 nFlags, int pointx, int pointy)
+{
+ float fz = z.origin[2] + ((m_pWidget->allocation.height - 1 - pointy) - (z.height/2)) / z.scale;
+ fz = floor(fz / g_qeglobals.d_gridsize + 0.5) * g_qeglobals.d_gridsize;
+ CString strStatus;
+ strStatus.Format("Z:: %.1f", fz);
+ g_pParentWnd->SetStatusText(1, strStatus);
+ Z_MouseMoved (pointx, m_pWidget->allocation.height - 1 - pointy, nFlags);
+}
+
+void ZWnd::OnExpose()
+{
+ if (!MakeCurrent ())
+ {
+ Sys_Printf("ERROR: wglMakeCurrent failed..\n ");
+ Sys_Printf("Please restart Radiant if the Z view is not working\n");
+ }
+ else
+ {
+ QE_CheckOpenGLForErrors();
+ Z_Draw ();
+ QE_CheckOpenGLForErrors();
+ SwapBuffers();
+ }
+}
+
+void ZWnd::OnSize(int cx, int cy)
+{
+ z.width = cx;
+ z.height = cy;
+ if (z.width < 10)
+ z.width = 10;
+ if (z.height < 10)
+ z.height = 10;
+ RedrawWindow ();
+}