From b7e1d006bdb5331d20f107974b6d75942c2d2e8f Mon Sep 17 00:00:00 2001 From: ana Date: Mon, 15 Feb 2016 11:35:42 +0300 Subject: [PATCH] Windows compatibility --- src/GLViewer/GLViewer_BaseObjects.cxx | 2 +- src/GLViewer/GLViewer_Drawer.cxx | 2 ++ src/GLViewer/GLViewer_Viewer2d.cxx | 2 +- src/OCCViewer/OCCViewer_ViewWindow.cxx | 6 +++--- src/SVTK/SVTK_RenderWindowInteractor.cxx | 11 +++++++++-- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/GLViewer/GLViewer_BaseObjects.cxx b/src/GLViewer/GLViewer_BaseObjects.cxx index bec5bf103..6127c02df 100644 --- a/src/GLViewer/GLViewer_BaseObjects.cxx +++ b/src/GLViewer/GLViewer_BaseObjects.cxx @@ -1438,7 +1438,7 @@ bool GLViewer_TextObject::translateToEMF( HDC dc, GLViewer_CoordSystem* aViewerC y = double( yPos ); aViewerCS->transform( *aEMFCS, x, y ); - const char* str = aText.toAscii(); + const char* str = aText.toLatin1().data(); int nHeight = 35*14; // height of font int nWidth = 35*12; // average character width diff --git a/src/GLViewer/GLViewer_Drawer.cxx b/src/GLViewer/GLViewer_Drawer.cxx index d8bd48cd3..43cad77e1 100644 --- a/src/GLViewer/GLViewer_Drawer.cxx +++ b/src/GLViewer/GLViewer_Drawer.cxx @@ -398,7 +398,9 @@ static GLuint displayListBase( QFont* theFont ) listBase += 256; HDC glHdc = ::wglGetCurrentDC(); + #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) ::SelectObject( glHdc, theFont->handle() ); + #endif if ( !::wglUseFontBitmaps( glHdc, 0, 256, listBase ) ) listBase = 0; aList = listBase; diff --git a/src/GLViewer/GLViewer_Viewer2d.cxx b/src/GLViewer/GLViewer_Viewer2d.cxx index 8fadd22e0..908a565f6 100644 --- a/src/GLViewer/GLViewer_Viewer2d.cxx +++ b/src/GLViewer/GLViewer_Viewer2d.cxx @@ -793,7 +793,7 @@ bool GLViewer_Viewer2d::translateTo( VectorFileType aType, QString FileName, Pap HDC screen_dc = GetDC( 0 ); //The screen device context HDC bitDC = CreateCompatibleDC ( screen_dc ); //The context compatible with screen - hMetaFileDC = CreateEnhMetaFile( bitDC, FileName.toAscii(), &r, "" ); + hMetaFileDC = CreateEnhMetaFile( bitDC, FileName.toLatin1().data(), &r, "" ); SetMapMode( hMetaFileDC, MM_HIMETRIC ); SetWindowOrgEx( hMetaFileDC, 0, r.bottom, NULL ); HRGN ClipRgn = CreateRectRgn( 0, 0, AW, AH ); diff --git a/src/OCCViewer/OCCViewer_ViewWindow.cxx b/src/OCCViewer/OCCViewer_ViewWindow.cxx index 8ad6be95c..b059f7d80 100755 --- a/src/OCCViewer/OCCViewer_ViewWindow.cxx +++ b/src/OCCViewer/OCCViewer_ViewWindow.cxx @@ -108,9 +108,9 @@ static QEvent* l_mbPressEvent = 0; -#ifdef WIN32 -# include -#endif +//#ifdef WIN32 +//# include +//#endif #include diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx index 55e3b3cb9..e11751537 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -513,14 +513,20 @@ QVTK_RenderWindowInteractor } #endif -#else + +#else // QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + bool QVTK_RenderWindowInteractor ::nativeEvent(const QByteArray& eventType, void* message, long* result) { +#ifdef WIN32 + // TODO: WIN32-related implementation +#else if ( eventType == "xcb_generic_event_t" ) { xcb_generic_event_t* ev = static_cast(message); #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + // TODO: this code is never called if ( SVTK_SpaceMouseX* aSpaceMouse = SVTK_SpaceMouseX::getInstance() ) #else if ( SVTK_SpaceMouseXCB* aSpaceMouse = SVTK_SpaceMouseXCB::getInstance() ) @@ -530,6 +536,7 @@ bool QVTK_RenderWindowInteractor { SVTK_SpaceMouse::MoveEvent anEvent; #if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) + // TODO: this code is never called int type = aSpaceMouse->translateEvent( QX11Info::display(), xEvent, &anEvent, 1.0, 1.0 ); #else int type = aSpaceMouse->translateEvent( QX11Info::connection(), (xcb_client_message_event_t*)ev, &anEvent, 1.0, 1.0 ); @@ -549,7 +556,7 @@ bool QVTK_RenderWindowInteractor } } } - +#endif return QWidget::nativeEvent( eventType, message, result ); } #endif -- 2.39.2