Commit 98e7223e authored by Julien Jomier's avatar Julien Jomier
Browse files

ENH: Added back support for TDx

Change-Id: Iaa2fade0b48a89e6841d2cf78007b2100d84a713
ENH: Added missing files to support TDx implementation
ENH: Removed warning message when no focus on the interaction
COMP: Qt5 does not define Q_WS_WIN and should use Q_OS_WIN instead.
parent b318abe4
......@@ -35,15 +35,15 @@
#include "QVTKInteractor.h"
#include "QVTKInteractorInternal.h"
#if defined(VTK_USE_TDX) && defined(Q_WS_WIN)
#if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
# include "vtkTDxWinDevice.h"
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_MAC)
#if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
# include "vtkTDxMacDevice.h"
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
#if defined(VTK_USE_TDX) && defined(Q_OS_X11)
# include "vtkTDxUnixDevice.h"
#endif
......@@ -82,20 +82,20 @@ QVTKInteractor::QVTKInteractor()
{
this->Internal = new QVTKInteractorInternal(this);
#if defined(VTK_USE_TDX) && defined(Q_WS_WIN)
#if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
this->Device=vtkTDxWinDevice::New();
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_MAC)
#if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
this->Device=vtkTDxMacDevice::New();
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
#if defined(VTK_USE_TDX) && defined(Q_OS_X11)
this->Device=0;
#endif
}
void QVTKInteractor::Initialize()
{
#if defined(VTK_USE_TDX) && defined(Q_WS_WIN)
#if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
if(this->UseTDx)
{
// this is QWidget::winId();
......@@ -108,7 +108,7 @@ void QVTKInteractor::Initialize()
}
}
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_MAC)
#if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
if(this->UseTDx)
{
if(!this->Device->GetInitialized())
......@@ -122,7 +122,7 @@ void QVTKInteractor::Initialize()
this->Enable();
}
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
#if defined(VTK_USE_TDX) && defined(Q_OS_X11)
// ----------------------------------------------------------------------------
vtkTDxUnixDevice *QVTKInteractor::GetDevice()
{
......@@ -158,19 +158,19 @@ void QVTKInteractor::TerminateApp()
// ----------------------------------------------------------------------------
void QVTKInteractor::StartListening()
{
#if defined(VTK_USE_TDX) && defined(Q_WS_WIN)
#if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
if(this->Device->GetInitialized() && !this->Device->GetIsListening())
{
this->Device->StartListening();
}
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_MAC)
#if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
if(this->UseTDx && !this->Device->GetInitialized())
{
this->Device->Initialize();
}
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
#if defined(VTK_USE_TDX) && defined(Q_OS_X11)
if(this->UseTDx && this->Device!=0)
{
this->Device->SetInteractor(this);
......@@ -181,19 +181,19 @@ void QVTKInteractor::StartListening()
// ----------------------------------------------------------------------------
void QVTKInteractor::StopListening()
{
#if defined(VTK_USE_TDX) && defined(Q_WS_WIN)
#if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
if(this->Device->GetInitialized() && this->Device->GetIsListening())
{
this->Device->StopListening();
}
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_MAC)
#if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
if(this->UseTDx && this->Device->GetInitialized())
{
this->Device->Close();
}
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
#if defined(VTK_USE_TDX) && defined(Q_OS_X11)
if(this->UseTDx && this->Device!=0)
{
// this assumes that a outfocus event is emitted prior
......@@ -225,13 +225,13 @@ void QVTKInteractor::TimerEvent(int timerId)
QVTKInteractor::~QVTKInteractor()
{
delete this->Internal;
#if defined(VTK_USE_TDX) && defined(Q_WS_WIN)
#if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
this->Device->Delete();
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_MAC)
#if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
this->Device->Delete();
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
#if defined(VTK_USE_TDX) && defined(Q_OS_X11)
this->Device=0;
#endif
}
......
......@@ -43,13 +43,13 @@
#include <QtCore/QObject>
#include "vtkTDxConfigure.h" // defines VTK_USE_TDX
#if defined(VTK_USE_TDX) && defined(Q_WS_WIN)
#if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
class vtkTDxWinDevice;
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_MAC)
#if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
class vtkTDxMacDevice;
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
#if defined(VTK_USE_TDX) && defined(Q_OS_X11)
class vtkTDxDevice;
class vtkTDxUnixDevice;
#endif
......@@ -102,7 +102,7 @@ public:
// timer event slot
virtual void TimerEvent(int timerId);
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
#if defined(VTK_USE_TDX) && defined(Q_OS_X11)
virtual vtkTDxUnixDevice *GetDevice();
virtual void SetDevice(vtkTDxDevice *device);
#endif
......@@ -117,13 +117,13 @@ protected:
virtual int InternalCreateTimer(int timerId, int timerType, unsigned long duration);
// destroy a Qt Timer
virtual int InternalDestroyTimer(int platformTimerId);
#if defined(VTK_USE_TDX) && defined(Q_WS_WIN)
#if defined(VTK_USE_TDX) && defined(Q_OS_WIN)
vtkTDxWinDevice *Device;
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_MAC)
#if defined(VTK_USE_TDX) && defined(Q_OS_MAC)
vtkTDxMacDevice *Device;
#endif
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
#if defined(VTK_USE_TDX) && defined(Q_OS_X11)
vtkTDxUnixDevice *Device;
#endif
......
......@@ -44,11 +44,11 @@
#include "qsignalmapper.h"
#include "qtimer.h"
#include "vtkRenderingOpenGLConfigure.h"
#if defined(Q_WS_X11)
#if defined(Q_OS_X11)
#include "qx11info_x11.h"
#endif
#if defined(Q_WS_WIN)
#if defined(Q_OS_WIN)
# include <windows.h>
# include <QSysInfo>
#endif
......@@ -134,6 +134,7 @@ void QVTKWidget::SetUseTDx(bool useTDx)
if(useTDx!=this->UseTDx)
{
this->UseTDx=useTDx;
if(this->UseTDx)
{
#if defined(VTK_USE_TDX) && defined(Q_WS_X11)
......@@ -812,7 +813,7 @@ void QVTKWidget::x11_setup_window()
#endif
}
#if defined(Q_WS_WIN)
#if defined(Q_OS_WIN)
bool QVTKWidget::winEvent(MSG* msg, long*)
{
// Starting with Windows Vista, Microsoft introduced WDDM.
......@@ -821,7 +822,7 @@ bool QVTKWidget::winEvent(MSG* msg, long*)
if(msg->message == WM_PAINT &&
QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
{
InvalidateRect(this->winId(), NULL, FALSE);
InvalidateRect((HWND)this->winId(), NULL, FALSE);
}
return false;
}
......
......@@ -248,7 +248,7 @@ protected:
// that VTK chooses
void x11_setup_window();
#if defined(Q_WS_WIN)
#if defined(Q_OS_WIN)
bool winEvent(MSG* msg, long* result);
#endif
......
......@@ -114,6 +114,23 @@ if (NOT VTK_LEGACY_REMOVE)
vtkOpenGLPolyDataMapper.cxx)
endif()
if(VTK_USE_TDX)
list(APPEND Module_SRCS
vtkTDxDevice.cxx
vtkTDxInteractorStyleGeo.cxx)
if(WIN32)
list(APPEND Module_SRCS vtkTDxWinDevice.cxx)
endif()
if(UNIX)
list(APPEND Module_SRCS vtkTDxUnixDevice.cxx)
endif()
if(APPLE)
list(APPEND Module_SRCS vtkTDxMacDevice.cxx)
endif()
endif()
set(${vtk-module}_HDRS
vtkgluPickMatrix.h
vtkOpenGL.h
......
......@@ -507,11 +507,9 @@ VOID CALLBACK vtkTDxWinDeviceTimerProc(HWND hwnd,
{
std::map<HWND,vtkTDxWinDevice *,vtkLessThanWindowHandle>::iterator it=vtkWindowHandleToDeviceObject.find(hwnd);
// cout << "proc for hwnd=" << hwnd << endl;
if(it==vtkWindowHandleToDeviceObject.end())
{
vtkGenericWarningMacro(<< "No matching vtkTDxWinDevice object for window hwnd=" << hwnd);
//vtkGenericWarningMacro(<< "No matching vtkTDxWinDevice object for window hwnd=" << hwnd);
return;
}
vtkTDxWinDevice *device=(*it).second;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment