From: apo Date: Tue, 13 Sep 2005 04:08:49 +0000 (+0000) Subject: 1. Port from QValueStack to std::stack. X-Git-Tag: BR-D5-38-2003_D2005-12-10~45 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=02c6b21ccb91777b0acfa821e757dbaef451d623;p=modules%2Fgui.git 1. Port from QValueStack to std::stack. 2. To provide correct memory menagement --- diff --git a/src/SVTK/SVTK_RenderWindowInteractor.cxx b/src/SVTK/SVTK_RenderWindowInteractor.cxx index 709505d89..f371c025d 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.cxx +++ b/src/SVTK/SVTK_RenderWindowInteractor.cxx @@ -21,8 +21,8 @@ // // // -// File : VTKViewer_RenderWindowInteractor.cxx -// Author : Nicolas REJNERI +// File : +// Author : // Module : SALOME // $Header$ @@ -405,6 +405,19 @@ SVTK_RenderWindowInteractor ::~SVTK_RenderWindowInteractor() { if(MYDEBUG) INFOS("~SVTK_RenderWindowInteractor() - "<SetInteractorStyle(NULL); + while(!myInteractorStyles.empty()){ + const PInteractorStyle& aStyle = myInteractorStyles.top(); + aStyle->SetInteractor(NULL); + myInteractorStyles.pop(); + } + + SetRenderer(NULL); + + GetDevice()->SetRenderWindow(NULL); } vtkRenderWindow* @@ -439,7 +452,7 @@ SVTK_RenderWindowInteractor if(GetRenderer()){ myRenderWindow->RemoveRenderer(getRenderer()); - theRenderer->SetInteractor(NULL); + myRenderer->SetInteractor(NULL); } myRenderer = theRenderer; @@ -488,7 +501,7 @@ vtkInteractorStyle* SVTK_RenderWindowInteractor ::GetInteractorStyle() { - return myInteractorStyles.isEmpty() ? 0 : myInteractorStyles.top().GetPointer(); + return myInteractorStyles.empty() ? 0 : myInteractorStyles.top().GetPointer(); } @@ -616,6 +629,10 @@ SVTK_RenderWindowInteractor ::wheelEvent( QWheelEvent* event ) { QVTK_RenderWindowInteractor::wheelEvent(event); + if(event->delta() > 0) + GetDevice()->InvokeEvent(SVTK::ZoomInEvent,NULL); + else + GetDevice()->InvokeEvent(SVTK::ZoomOutEvent,NULL); #ifdef GENERATE_SUIT_EVENTS emit WheelMoved( event ); #endif diff --git a/src/SVTK/SVTK_RenderWindowInteractor.h b/src/SVTK/SVTK_RenderWindowInteractor.h index 146be1081..e36bfd23d 100644 --- a/src/SVTK/SVTK_RenderWindowInteractor.h +++ b/src/SVTK/SVTK_RenderWindowInteractor.h @@ -32,10 +32,9 @@ #include "SVTK.h" #include "SVTK_Selection.h" -#include -#include - #include +#include +#include class vtkGenericRenderWindowInteractor; class vtkInteractorStyle; @@ -202,7 +201,8 @@ class SVTK_EXPORT SVTK_RenderWindowInteractor: public QVTK_RenderWindowInteracto vtkSmartPointer myRenderWindow; typedef vtkSmartPointer PInteractorStyle; - QValueStack myInteractorStyles; + typedef std::stack TInteractorStyles; + TInteractorStyles myInteractorStyles; };