added missing _T()s; deTABified

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@17340 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2002-09-22 14:53:45 +00:00
parent 556469d8ba
commit 4bfedab037
2 changed files with 188 additions and 162 deletions

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: glcanvas.cpp // Name: gtk/glcanvas.cpp
// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK // Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK
// Author: Robert Roebling // Author: Robert Roebling
// Modified by: // Modified by:
@@ -24,7 +24,8 @@
#include "wx/module.h" #include "wx/module.h"
#include "wx/app.h" #include "wx/app.h"
extern "C" { extern "C"
{
#include "gtk/gtk.h" #include "gtk/gtk.h"
#include "gdk/gdk.h" #include "gdk/gdk.h"
#include "gdk/gdkx.h" #include "gdk/gdkx.h"
@@ -59,11 +60,11 @@ wxGLContext::wxGLContext( bool WXUNUSED(isRGB), wxWindow *win, const wxPalette&
wxGLCanvas *gc = (wxGLCanvas*) win; wxGLCanvas *gc = (wxGLCanvas*) win;
XVisualInfo *vi = (XVisualInfo *) gc->m_vi; XVisualInfo *vi = (XVisualInfo *) gc->m_vi;
wxCHECK_RET( vi, "invalid visual for OpenGl" ); wxCHECK_RET( vi, _T("invalid visual for OpenGl") );
m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE ); m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE );
wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); wxCHECK_RET( m_glContext, _T("Couldn't create OpenGl context") );
} }
wxGLContext::wxGLContext( wxGLContext::wxGLContext(
@@ -78,14 +79,16 @@ wxGLContext::wxGLContext(
wxGLCanvas *gc = (wxGLCanvas*) win; wxGLCanvas *gc = (wxGLCanvas*) win;
XVisualInfo *vi = (XVisualInfo *) gc->m_vi; XVisualInfo *vi = (XVisualInfo *) gc->m_vi;
wxCHECK_RET( vi, "invalid visual for OpenGl" ); wxCHECK_RET( vi, _T("invalid visual for OpenGl") );
if( other != 0 ) m_glContext = glXCreateContext( GDK_DISPLAY(), vi,
m_glContext = glXCreateContext( GDK_DISPLAY(), vi, other->m_glContext, GL_TRUE ); other ? other->m_glContext : None,
else GL_TRUE );
m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE );
wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); if ( !m_glContext )
{
wxFAIL_MSG( _T("Couldn't create OpenGl context") );
}
} }
wxGLContext::~wxGLContext() wxGLContext::~wxGLContext()
@@ -292,16 +295,19 @@ bool wxGLCanvas::Create( wxWindow *parent,
m_nativeSizeEvent = TRUE; m_nativeSizeEvent = TRUE;
XVisualInfo *vi = NULL; XVisualInfo *vi = NULL;
if (wxTheApp->m_glVisualInfo != NULL) { if (wxTheApp->m_glVisualInfo != NULL)
{
vi = (XVisualInfo *) wxTheApp->m_glVisualInfo; vi = (XVisualInfo *) wxTheApp->m_glVisualInfo;
m_canFreeVi = FALSE; // owned by wxTheApp - don't free upon destruction m_canFreeVi = FALSE; // owned by wxTheApp - don't free upon destruction
} else { }
else
{
vi = (XVisualInfo *) ChooseGLVisual(attribList); vi = (XVisualInfo *) ChooseGLVisual(attribList);
m_canFreeVi = TRUE; m_canFreeVi = TRUE;
} }
m_vi = vi; // save for later use m_vi = vi; // save for later use
wxCHECK_MSG( m_vi, FALSE, "required visual couldn't be found" ); wxCHECK_MSG( m_vi, FALSE, _T("required visual couldn't be found") );
GdkVisual *visual = gdkx_visual_get( vi->visualid ); GdkVisual *visual = gdkx_visual_get( vi->visualid );
GdkColormap *colormap = gdk_colormap_new( gdkx_visual_get(vi->visualid), TRUE ); GdkColormap *colormap = gdk_colormap_new( gdkx_visual_get(vi->visualid), TRUE );
@@ -421,7 +427,8 @@ void* wxGLCanvas::ChooseGLVisual(int *attribList)
void wxGLCanvas::SwapBuffers() void wxGLCanvas::SwapBuffers()
{ {
if (m_glContext) m_glContext->SwapBuffers(); if (m_glContext)
m_glContext->SwapBuffers();
} }
void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event)) void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event))
@@ -430,12 +437,14 @@ void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event))
void wxGLCanvas::SetCurrent() void wxGLCanvas::SetCurrent()
{ {
if (m_glContext) m_glContext->SetCurrent(); if (m_glContext)
m_glContext->SetCurrent();
} }
void wxGLCanvas::SetColour( const char *colour ) void wxGLCanvas::SetColour( const char *colour )
{ {
if (m_glContext) m_glContext->SetColour( colour ); if (m_glContext)
m_glContext->SetColour( colour );
} }
void wxGLCanvas::OnInternalIdle() void wxGLCanvas::OnInternalIdle()
@@ -463,14 +472,18 @@ IMPLEMENT_CLASS(wxGLApp, wxApp)
wxGLApp::~wxGLApp() wxGLApp::~wxGLApp()
{ {
if (m_glVisualInfo) XFree(m_glVisualInfo); if (m_glVisualInfo)
XFree(m_glVisualInfo);
} }
bool wxGLApp::InitGLVisual(int *attribList) bool wxGLApp::InitGLVisual(int *attribList)
{ {
if (m_glVisualInfo) XFree(m_glVisualInfo); if (m_glVisualInfo)
XFree(m_glVisualInfo);
m_glVisualInfo = wxGLCanvas::ChooseGLVisual(attribList); m_glVisualInfo = wxGLCanvas::ChooseGLVisual(attribList);
return (m_glVisualInfo != NULL);
return m_glVisualInfo != NULL;
} }
#endif #endif

View File

@@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: glcanvas.cpp // Name: gtk/glcanvas.cpp
// Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK // Purpose: wxGLCanvas, for using OpenGL/Mesa with wxWindows and GTK
// Author: Robert Roebling // Author: Robert Roebling
// Modified by: // Modified by:
@@ -24,7 +24,8 @@
#include "wx/module.h" #include "wx/module.h"
#include "wx/app.h" #include "wx/app.h"
extern "C" { extern "C"
{
#include "gtk/gtk.h" #include "gtk/gtk.h"
#include "gdk/gdk.h" #include "gdk/gdk.h"
#include "gdk/gdkx.h" #include "gdk/gdkx.h"
@@ -59,11 +60,11 @@ wxGLContext::wxGLContext( bool WXUNUSED(isRGB), wxWindow *win, const wxPalette&
wxGLCanvas *gc = (wxGLCanvas*) win; wxGLCanvas *gc = (wxGLCanvas*) win;
XVisualInfo *vi = (XVisualInfo *) gc->m_vi; XVisualInfo *vi = (XVisualInfo *) gc->m_vi;
wxCHECK_RET( vi, "invalid visual for OpenGl" ); wxCHECK_RET( vi, _T("invalid visual for OpenGl") );
m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE ); m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE );
wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); wxCHECK_RET( m_glContext, _T("Couldn't create OpenGl context") );
} }
wxGLContext::wxGLContext( wxGLContext::wxGLContext(
@@ -78,14 +79,16 @@ wxGLContext::wxGLContext(
wxGLCanvas *gc = (wxGLCanvas*) win; wxGLCanvas *gc = (wxGLCanvas*) win;
XVisualInfo *vi = (XVisualInfo *) gc->m_vi; XVisualInfo *vi = (XVisualInfo *) gc->m_vi;
wxCHECK_RET( vi, "invalid visual for OpenGl" ); wxCHECK_RET( vi, _T("invalid visual for OpenGl") );
if( other != 0 ) m_glContext = glXCreateContext( GDK_DISPLAY(), vi,
m_glContext = glXCreateContext( GDK_DISPLAY(), vi, other->m_glContext, GL_TRUE ); other ? other->m_glContext : None,
else GL_TRUE );
m_glContext = glXCreateContext( GDK_DISPLAY(), vi, None, GL_TRUE );
wxCHECK_RET( m_glContext, "Couldn't create OpenGl context" ); if ( !m_glContext )
{
wxFAIL_MSG( _T("Couldn't create OpenGl context") );
}
} }
wxGLContext::~wxGLContext() wxGLContext::~wxGLContext()
@@ -292,16 +295,19 @@ bool wxGLCanvas::Create( wxWindow *parent,
m_nativeSizeEvent = TRUE; m_nativeSizeEvent = TRUE;
XVisualInfo *vi = NULL; XVisualInfo *vi = NULL;
if (wxTheApp->m_glVisualInfo != NULL) { if (wxTheApp->m_glVisualInfo != NULL)
{
vi = (XVisualInfo *) wxTheApp->m_glVisualInfo; vi = (XVisualInfo *) wxTheApp->m_glVisualInfo;
m_canFreeVi = FALSE; // owned by wxTheApp - don't free upon destruction m_canFreeVi = FALSE; // owned by wxTheApp - don't free upon destruction
} else { }
else
{
vi = (XVisualInfo *) ChooseGLVisual(attribList); vi = (XVisualInfo *) ChooseGLVisual(attribList);
m_canFreeVi = TRUE; m_canFreeVi = TRUE;
} }
m_vi = vi; // save for later use m_vi = vi; // save for later use
wxCHECK_MSG( m_vi, FALSE, "required visual couldn't be found" ); wxCHECK_MSG( m_vi, FALSE, _T("required visual couldn't be found") );
GdkVisual *visual = gdkx_visual_get( vi->visualid ); GdkVisual *visual = gdkx_visual_get( vi->visualid );
GdkColormap *colormap = gdk_colormap_new( gdkx_visual_get(vi->visualid), TRUE ); GdkColormap *colormap = gdk_colormap_new( gdkx_visual_get(vi->visualid), TRUE );
@@ -421,7 +427,8 @@ void* wxGLCanvas::ChooseGLVisual(int *attribList)
void wxGLCanvas::SwapBuffers() void wxGLCanvas::SwapBuffers()
{ {
if (m_glContext) m_glContext->SwapBuffers(); if (m_glContext)
m_glContext->SwapBuffers();
} }
void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event)) void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event))
@@ -430,12 +437,14 @@ void wxGLCanvas::OnSize(wxSizeEvent& WXUNUSED(event))
void wxGLCanvas::SetCurrent() void wxGLCanvas::SetCurrent()
{ {
if (m_glContext) m_glContext->SetCurrent(); if (m_glContext)
m_glContext->SetCurrent();
} }
void wxGLCanvas::SetColour( const char *colour ) void wxGLCanvas::SetColour( const char *colour )
{ {
if (m_glContext) m_glContext->SetColour( colour ); if (m_glContext)
m_glContext->SetColour( colour );
} }
void wxGLCanvas::OnInternalIdle() void wxGLCanvas::OnInternalIdle()
@@ -463,14 +472,18 @@ IMPLEMENT_CLASS(wxGLApp, wxApp)
wxGLApp::~wxGLApp() wxGLApp::~wxGLApp()
{ {
if (m_glVisualInfo) XFree(m_glVisualInfo); if (m_glVisualInfo)
XFree(m_glVisualInfo);
} }
bool wxGLApp::InitGLVisual(int *attribList) bool wxGLApp::InitGLVisual(int *attribList)
{ {
if (m_glVisualInfo) XFree(m_glVisualInfo); if (m_glVisualInfo)
XFree(m_glVisualInfo);
m_glVisualInfo = wxGLCanvas::ChooseGLVisual(attribList); m_glVisualInfo = wxGLCanvas::ChooseGLVisual(attribList);
return (m_glVisualInfo != NULL);
return m_glVisualInfo != NULL;
} }
#endif #endif