=========================================================================*/
-#import <Cocoa/Cocoa.h>
#include <assert.h>
# include "vtkVersion.h"
#endif
+
#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
# include "vtkCommand.h"
#else
// AKT: wxOSX 2.9.x defines __WXOSX_COCOA__ rather than __WXCOCOA__
#ifdef __WXOSX_COCOA__
-#define __WXCOCOA__
+ #import <Cocoa/Cocoa.h>
+ #define __WXCOCOA__
#endif
#if defined(__WXMAC__) && wxCHECK_VERSION(2,9,0)
#endif
+#ifdef VTK_USE_TDX
+#import "vtkTDxMacDevice.h"
+#endif
+
+
//=======================================================================
// LG : NAMESPACE IS NECESSARY TO AVOID CONFLICTING SYMBOLS IN DYN LIBS
namespace crea
// To access objc calls on cocoa
#ifdef __WXCOCOA__
-#ifdef VTK_USE_COCOA
-//EED #import <Cocoa/Cocoa.h>
-// This trick is no longer need in VTK CVS, should get rid of that:
+
#define id Id
-#else
-#error Build mismatch you need both wxWidgets and VTK to be configure against Cocoa to work
-#endif //VTK_USE_COCOA
+
+// #ifdef VTK_USE_COCOA
+// // This trick is no longer need in VTK CVS, should get rid of that:
+// #define id Id
+// #else
+// #error Build mismatch you need both wxWidgets and VTK to be configure against Cocoa to work
+// #endif //VTK_USE_COCOA
+
#endif //__WXCOCOA__
#if wxMAJOR_VERSION <= 2
-
#ifdef __WXGTK__
#include <gdk/gdkx.h> // GDK_WINDOW_XWINDOW is found here in wxWidgets 2.8.0
#include "gdk/gdkprivate.h"
, RenderWhenDisabled(1)
, UseCaptureMouse(0)
{
+
#ifdef VTK_DEBUG_LEAKS
vtkDebugLeaks::ConstructClass("wxVTKRenderWindowInteractor");
#endif
this->RenderWindow = NULL;
this->SetRenderWindow(vtkRenderWindow::New());
this->RenderWindow->Delete();
+
+#ifdef VTK_USE_TDX
+ this->Device=vtkTDxMacDevice::New();
+#endif
+
}
//---------------------------------------------------------------------------
wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor(wxWindow *parent,
, RenderWhenDisabled(1)
, UseCaptureMouse(0)
{
+
#ifdef VTK_DEBUG_LEAKS
vtkDebugLeaks::ConstructClass("wxVTKRenderWindowInteractor");
#endif
// so we update the size information of the interactor/renderwindow here
this->UpdateSize(size.x, size.y);
#endif
+
+
+#ifdef VTK_USE_TDX
+ this->Device=vtkTDxMacDevice::New();
+#endif
+
}
+
//---------------------------------------------------------------------------
wxVTKRenderWindowInteractor::~wxVTKRenderWindowInteractor()
{
#if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
delete this->context;
#endif
+
+#ifdef VTK_USE_TDX
+ this->Device->Delete();
+#endif
}
+
//---------------------------------------------------------------------------
wxVTKRenderWindowInteractor * wxVTKRenderWindowInteractor::New()
{
// we don't make use of the objectfactory, because we're not registered
return new wxVTKRenderWindowInteractor;
}
+
//---------------------------------------------------------------------------
void wxVTKRenderWindowInteractor::Initialize()
{
// enable everything and start rendering
Enable();
//RenderWindow->Start();
-
// set the size in the render window interactor
Size[0] = size[0];
Size[1] = size[1];
-
// this is initialized
- Initialized = 1;
+ Initialized = 1;
}
//---------------------------------------------------------------------------
void wxVTKRenderWindowInteractor::Enable()
#if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
wxGLCanvas::SetCurrent(*this->context);
#endif
+
+//EED 2010-10-14
+#ifdef VTK_USE_TDX
+ if(this->UseTDx)
+ {
+ this->Device->SetInteractor(this);
+ this->Device->Initialize();
+ }
+#endif
+
Modified();
+
}
//---------------------------------------------------------------------------
bool wxVTKRenderWindowInteractor::Enable(bool enable)
{
+#ifdef VTK_USE_TDX
+ if(this->UseTDx)
+ {
+ this->Device->SetInteractor(this);
+ this->Device->Initialize();
+ }
+#endif
+
#if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
return wxGLCanvas::Enable(enable);
#else
{
// if already disabled then done
if (!Enabled)
+ {
return;
-
+ }
+#ifdef VTK_USE_TDX
+ if(this->Device->GetInitialized())
+ {
+ this->Device->Close();
+ }
+#endif
+
+
// that's it (we can't remove the event handler like it should be...)
Enabled = 0;
Modified();
Size[0] = x;
Size[1] = y;
// and our RenderWindow's size
+
+#ifdef __WXCOCOA__
+// #ifdef VTK_USE_COCOA
+// #else
+// #endif //VTK_USE_COCOA
+#else
RenderWindow->SetSize(x, y);
+#endif //__WXCOCOA__
+
#if defined(__WXMSW__)
this->Refresh();
#endif //__WXMSW__
- }
- }
+ } // if x y
+ } // if RenderWindow
}
//---------------------------------------------------------------------------
int wxVTKRenderWindowInteractor::CreateTimer(int WXUNUSED(timertype))
{
// it's a one shot timer
if (!timer.Start(10, TRUE))
+ {
return 0;
-
+ }
return 1;
-
}
+
#if VTK_MAJOR_VERSION > 5 || (VTK_MAJOR_VERSION == 5 && VTK_MINOR_VERSION >= 2)
//------------------------------------------------------------------
int wxVTKRenderWindowInteractor::InternalCreateTimer(int timerId, int timerType,
unsigned long duration)
{
if (!timer.Start(duration, timerType == OneShotTimer))
+ {
return 0;
-
+ }
return ID_wxVTKRenderWindowInteractor_TIMER;
}
//------------------------------------------------------------------
return 1;
}
#endif
+
//---------------------------------------------------------------------------
int wxVTKRenderWindowInteractor::DestroyTimer()
{
// do nothing
return 1;
}
+
//---------------------------------------------------------------------------
void wxVTKRenderWindowInteractor::OnTimer(wxTimerEvent& WXUNUSED(event))
{
// in wxPython/src/helpers.cpp
long wxVTKRenderWindowInteractor::GetHandleHack()
{
-printf("EED wxVTKRenderWindowInteractor::GetHandleHack start \n");
//helper function to hide the MSW vs GTK stuff
long handle_tmp = 0;
// Find and return the actual X-Window.
#if defined(__WXGTK__) || defined(__WXX11__)
-printf("EED wxVTKRenderWindowInteractor::GetHandleHack End AAA handle_tmp %ld \n", handle_tmp);
-printf("EED wxVTKRenderWindowInteractor::GetHandleHack End AAA handle_tmp %ld \n", (long)GetXWindow(this));
return (long)GetXWindow(this);
#endif
// handle_tmp = (long)this->GetXWindow();
//#endif
-printf("EED wxVTKRenderWindowInteractor::GetHandleHack End BBB handle_tmp %ld \n", handle_tmp);
return handle_tmp;
}
//---------------------------------------------------------------------------
void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event))
{
-
-printf("EED wxVTKRenderWindowInteractor::OnPaint Start \n");
//must always be here
-//EED2021-08-26 wxPaintDC pDC(this);
-
-printf("EED wxVTKRenderWindowInteractor::OnPaint 1 \n");
+//EED2021-08-26
+#ifdef __WXCOCOA__
+#else
+ wxPaintDC pDC(this);
+#endif
//do it here rather than in the cstor: this is safer.
if(!Handle)
{
-printf("EED wxVTKRenderWindowInteractor::OnPaint 2 \n");
Handle = GetHandleHack();
#ifdef __WXCOCOA__
-printf("EED wxVTKRenderWindowInteractor::OnPaint 3 \n");
vtkCocoaRenderWindow *rwin = vtkCocoaRenderWindow::SafeDownCast(RenderWindow);
NSView *nvsview = (NSView* )Handle;
NSWindow *nswindow = nvsview.window;
rwin->SetRootWindow( nswindow );
rwin->SetWindowId( reinterpret_cast<void *>(nvsview) );
#else
-printf("EED wxVTKRenderWindowInteractor::OnPaint 4 \n");
RenderWindow->SetWindowId(reinterpret_cast<void *>(Handle));
#endif
-
-
-printf("EED wxVTKRenderWindowInteractor::OnPaint 5 \n");
// Cocoa
// this->GetNSView() <-> DisplayId
// this->GetTopLevel()->GetNSWindow() <-> WindowId
#ifdef __WXMSW__
-printf("EED wxVTKRenderWindowInteractor::OnPaint 6 \n");
RenderWindow->SetParentId(reinterpret_cast<void *>(this->GetParent()->GetHWND()));
#endif //__WXMSW__
#endif
}
// get vtk to render to the wxWindows
-
-printf("EED wxVTKRenderWindowInteractor::OnPaint 7 \n");
-
Render();
#ifdef __WXMAC__
-printf("EED wxVTKRenderWindowInteractor::OnPaint 8 \n");
// This solves a problem with repainting after a window resize
// See also: http://sourceforge.net/mailarchive/forum.php?thread_id=31690967&forum_id=41789
#ifdef __WXCOCOA__
-printf("EED wxVTKRenderWindowInteractor::OnPaint 9 \n");
#if !wxCHECK_VERSION(2, 9, 0)
// this doesn't seem necessary with wxOSX 2.9.x
-printf("EED wxVTKRenderWindowInteractor::OnPaint 10 \n");
vtkCocoaRenderWindow * rwin = vtkCocoaRenderWindow::SafeDownCast(RenderWindow);
if( rwin )
{
-printf("EED wxVTKRenderWindowInteractor::OnPaint 11 \n");
rwin->UpdateContext();
}
#endif
#else
-printf("EED wxVTKRenderWindowInteractor::OnPaint 12 \n");
vtkCarbonRenderWindow* rwin = vtkCarbonRenderWindow::SafeDownCast(RenderWindow);
if( rwin )
{
-printf("EED wxVTKRenderWindowInteractor::OnPaint 13 \n");
#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 4)
// Must be somewhere after VTK 4.4
-printf("EED wxVTKRenderWindowInteractor::OnPaint 14 \n");
rwin->UpdateGLRegion();
#endif
}
#endif
#endif
-
-printf("EED wxVTKRenderWindowInteractor::OnPaint 15 \n");
-
-printf("EED wxVTKRenderWindowInteractor::OnPaint End \n");
-
+
}
//---------------------------------------------------------------------------
void wxVTKRenderWindowInteractor::OnEraseBackground(wxEraseEvent &event)
//---------------------------------------------------------------------------
void wxVTKRenderWindowInteractor::OnKeyDown(wxKeyEvent &event)
{
- if (!Enabled)
+ if (!Enabled)
{
return;
}
//---------------------------------------------------------------------------
void wxVTKRenderWindowInteractor::OnKeyUp(wxKeyEvent &event)
{
- if (!Enabled)
+ if (!Enabled)
{
return;
}
//---------------------------------------------------------------------------
void wxVTKRenderWindowInteractor::OnChar(wxKeyEvent &event)
{
- if (!Enabled)
+ if (!Enabled)
{
return;
}
InvokeEvent(vtkCommand::MouseWheelBackwardEvent, NULL);
}
#endif
-
+
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void wxVTKRenderWindowInteractor::Render()
{
-printf("EED wxVTKRenderWindowInteractor::Render Start \n");
#if wxCHECK_VERSION(2, 8, 0)
int renderAllowed = !IsFrozen();
#else
//if it's not enabeld, renderAllowed will be false
renderAllowed = topParent->IsEnabled();
}
- }
+ } // if renderAllowed && !RenderWhenDisabled
if (renderAllowed)
{
#endif
if(Handle && (Handle == GetHandleHack()) )
{
-printf("EED wxVTKRenderWindowInteractor::Render 1 \n");
RenderWindow->Render();
-printf("EED wxVTKRenderWindowInteractor::Render 2 \n");
}
#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 2)
else if(GetHandleHack())
RenderWindow->Render();
}
#endif
-
-printf("EED wxVTKRenderWindowInteractor::Render End \n");
-
- }
+ } // if renderAllowed
}
//---------------------------------------------------------------------------
void wxVTKRenderWindowInteractor::SetRenderWhenDisabled(int newValue)