X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=src%2FcreawxVTKRenderWindowInteractor.mm;h=3047c9397e9c54ec980e4edfa0b30ad39ef665b9;hb=ad89139d4d59c2ea606d45bcce1784ef5c7b187f;hp=6efc47c4c9f94e5b745522a9f7c5ac279d0b3a50;hpb=13746b9e3318f71af2cf48a8da8bbe487d84355e;p=crea.git diff --git a/src/creawxVTKRenderWindowInteractor.mm b/src/creawxVTKRenderWindowInteractor.mm index 6efc47c..3047c93 100644 --- a/src/creawxVTKRenderWindowInteractor.mm +++ b/src/creawxVTKRenderWindowInteractor.mm @@ -43,12 +43,15 @@ =========================================================================*/ -#import +//#import #include #include "creawxVTKRenderWindowInteractor.h" +#include + + //This is needed for vtk 3.1 : #ifndef VTK_MAJOR_VERSION # include "vtkVersion.h" @@ -102,7 +105,7 @@ wxWindow* wxGetTopLevelParent(wxWindow *win) // To access objc calls on cocoa #ifdef __WXCOCOA__ #ifdef VTK_USE_COCOA -//EED #import +#import // This trick is no longer need in VTK CVS, should get rid of that: #define id Id #else @@ -395,12 +398,20 @@ void wxVTKRenderWindowInteractor::UpdateSize(int x, int y) 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)) @@ -467,7 +478,6 @@ 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; @@ -493,8 +503,6 @@ printf("EED wxVTKRenderWindowInteractor::GetHandleHack start \n"); // 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 @@ -502,14 +510,14 @@ printf("EED wxVTKRenderWindowInteractor::GetHandleHack End AAA handle_tmp %ld \ // 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)) { + //must always be here - wxPaintDC pDC(this); +//EED2021-08-26 wxPaintDC pDC(this); //do it here rather than in the cstor: this is safer. if(!Handle) @@ -518,6 +526,9 @@ void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event)) #ifdef __WXCOCOA__ vtkCocoaRenderWindow *rwin = vtkCocoaRenderWindow::SafeDownCast(RenderWindow); +//2021-08-30 +// rwin->SetWantsBestResolution(true); + NSView *nvsview = (NSView* )Handle; NSWindow *nswindow = nvsview.window; rwin->SetRootWindow( nswindow ); @@ -525,8 +536,6 @@ void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event)) #else RenderWindow->SetWindowId(reinterpret_cast(Handle)); #endif - - // Cocoa // this->GetNSView() <-> DisplayId @@ -546,7 +555,8 @@ void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event)) #endif } // get vtk to render to the wxWindows - Render(); + +Render(); #ifdef __WXMAC__ // This solves a problem with repainting after a window resize // See also: http://sourceforge.net/mailarchive/forum.php?thread_id=31690967&forum_id=41789 @@ -560,6 +570,7 @@ void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event)) } #endif #else + vtkCarbonRenderWindow* rwin = vtkCarbonRenderWindow::SafeDownCast(RenderWindow); if( rwin ) { @@ -571,6 +582,7 @@ void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event)) #endif #endif } + //--------------------------------------------------------------------------- void wxVTKRenderWindowInteractor::OnEraseBackground(wxEraseEvent &event) { @@ -594,7 +606,9 @@ void wxVTKRenderWindowInteractor::OnSize(wxSizeEvent& WXUNUSED(event)) #endif //this will check for Handle //Render(); + } + //--------------------------------------------------------------------------- void wxVTKRenderWindowInteractor::OnMotion(wxMouseEvent &event) { @@ -603,6 +617,7 @@ void wxVTKRenderWindowInteractor::OnMotion(wxMouseEvent &event) return; } #if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0) + SetEventInformationFlipY(event.GetX(), event.GetY(), event.ControlDown(), event.ShiftDown(), '\0', 0, NULL); @@ -907,7 +922,6 @@ void wxVTKRenderWindowInteractor::OnMouseCaptureLost(wxMouseCaptureLostEvent& ev //--------------------------------------------------------------------------- void wxVTKRenderWindowInteractor::Render() { -printf("EED wxVTKRenderWindowInteractor::Render Start \n"); #if wxCHECK_VERSION(2, 8, 0) int renderAllowed = !IsFrozen(); #else @@ -933,9 +947,7 @@ printf("EED wxVTKRenderWindowInteractor::Render Start \n"); #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()) @@ -950,8 +962,6 @@ printf("EED wxVTKRenderWindowInteractor::Render 2 \n"); } #endif -printf("EED wxVTKRenderWindowInteractor::Render End \n"); - } } //---------------------------------------------------------------------------