]> Creatis software - crea.git/commitdiff
Teste code
authoreduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Sat, 18 Jan 2025 12:45:17 +0000 (13:45 +0100)
committereduardo.davila@creatis.insa-lyon.fr <eduardo.davila@creatis.insa-lyon.fr>
Sat, 18 Jan 2025 12:45:17 +0000 (13:45 +0100)
src/creawxVTKRenderWindowInteractor.mm

index 4aa72102268b2705202013a6a7e493965474c965..83ca46f73f0fe14920c6806ac3c9607fd3b4e11e 100644 (file)
@@ -270,7 +270,8 @@ wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor()
       , RenderWhenDisabled(1)
       , UseCaptureMouse(0)
 {
-    
+    firstTimeOnPaint=false;
+
 #ifdef VTK_DEBUG_LEAKS
   vtkDebugLeaks::ConstructClass("wxVTKRenderWindowInteractor");
 #endif
@@ -285,7 +286,6 @@ wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor()
     this->Device=vtkTDxMacDevice::New();
 #endif
 
-    firstTimeOnPaint=false;
 }
 //---------------------------------------------------------------------------
 wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor(wxWindow *parent,
@@ -312,7 +312,7 @@ wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor(wxWindow *parent,
       , RenderWhenDisabled(1)
       , UseCaptureMouse(0)
 {
-        
+    firstTimeOnPaint=false;
 #ifdef VTK_DEBUG_LEAKS
   vtkDebugLeaks::ConstructClass("wxVTKRenderWindowInteractor");
 #endif
@@ -328,13 +328,10 @@ wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor(wxWindow *parent,
   this->UpdateSize(size.x, size.y);
 #endif
     
-
 #ifdef VTK_USE_TDX
     this->Device=vtkTDxMacDevice::New();
 #endif
 
-    firstTimeOnPaint=false;
-
 }
 
 //---------------------------------------------------------------------------
@@ -574,6 +571,7 @@ long wxVTKRenderWindowInteractor::GetHandleHack()
 void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event))
 {
     printf("EED wxVTKRenderWindowInteractor::OnPaint \n");
+    firstTimeOnPaint=true;
 
   //must always be here
 //EED2021-08-26  
@@ -639,7 +637,6 @@ void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event))
   }
 #endif
 #endif
-    firstTimeOnPaint=true;
 }
 
 //---------------------------------------------------------------------------
@@ -978,48 +975,53 @@ void wxVTKRenderWindowInteractor::OnMouseCaptureLost(wxMouseCaptureLostEvent& ev
 //---------------------------------------------------------------------------
 void wxVTKRenderWindowInteractor::Render()
 {
-    printf("EED wxVTKRenderWindowInteractor::Render \n");
+    printf("EED wxVTKRenderWindowInteractor::Render UPS \n");
+    
+    if (firstTimeOnPaint==true){
+        
 #if wxCHECK_VERSION(2, 8, 0)
-  int renderAllowed = !IsFrozen();
+        int renderAllowed = !IsFrozen();
 #else
-  int renderAllowed = 1;
+        int renderAllowed = 1;
 #endif
-  if (renderAllowed && !RenderWhenDisabled)
-    {
-    //the user doesn't want us to render when the toplevel frame
-    //is disabled - first find the top level parent
-    wxWindow *topParent = wxGetTopLevelParent(this);
-    if (topParent)
-      {
-      //if it exists, check whether it's enabled
-      //if it's not enabeld, renderAllowed will be false
-      renderAllowed = topParent->IsEnabled();
-      }
-    } // if renderAllowed && !RenderWhenDisabled
-
-  if (renderAllowed)
-    {
+        if (renderAllowed && !RenderWhenDisabled)
+        {
+            //the user doesn't want us to render when the toplevel frame
+            //is disabled - first find the top level parent
+            wxWindow *topParent = wxGetTopLevelParent(this);
+            if (topParent)
+            {
+                //if it exists, check whether it's enabled
+                //if it's not enabeld, renderAllowed will be false
+                renderAllowed = topParent->IsEnabled();
+            }
+        } // if renderAllowed && !RenderWhenDisabled
+        
+        if (renderAllowed)
+        {
 #if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
-    wxGLCanvas::SetCurrent(*(this->context));
+            wxGLCanvas::SetCurrent(*(this->context));
 #endif
-    if(Handle && (Handle == GetHandleHack()) )
-      {
-      RenderWindow->Render();
-      }
+            if(Handle && (Handle == GetHandleHack()) )
+            {
+                RenderWindow->Render();
+            }
 #if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 2)
-    else if(GetHandleHack())
-      {
-      //this means the user has reparented us; let's adapt to the
-      //new situation by doing the WindowRemap dance
-      //store the new situation
-      Handle = GetHandleHack();
-      RenderWindow->SetNextWindowId(reinterpret_cast<void *>(Handle));
-      RenderWindow->WindowRemap();
-      RenderWindow->Render();
-      }
+            else if(GetHandleHack())
+            {
+                //this means the user has reparented us; let's adapt to the
+                //new situation by doing the WindowRemap dance
+                //store the new situation
+                Handle = GetHandleHack();
+                RenderWindow->SetNextWindowId(reinterpret_cast<void *>(Handle));
+                RenderWindow->WindowRemap();
+                RenderWindow->Render();
+            }
 #endif
-    } // if renderAllowed
+        } // if renderAllowed
+    } // if firstTimeOnPaint
 }
+
 //---------------------------------------------------------------------------
 void wxVTKRenderWindowInteractor::SetRenderWhenDisabled(int newValue)
 {