]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
The first implementation of the "Removing 3D Cache System from Gauss Viewer"
authorapo <apo@opencascade.com>
Thu, 8 May 2008 08:32:21 +0000 (08:32 +0000)
committerapo <apo@opencascade.com>
Thu, 8 May 2008 08:32:21 +0000 (08:32 +0000)
idl/VISU_Gen.idl
src/VISUGUI/VISU_msg_en.ts
src/VISUGUI/VisuGUI.cxx
src/VISUGUI/VisuGUI.h
src/VISUGUI/VisuGUI_Module.cxx
src/VISUGUI/VisuGUI_Slider.cxx
src/VISUGUI/VisuGUI_Slider.h
src/VISU_I/VISU_View_i.hh

index 9e1958f81ca9824a65e117903946e1505c60f096..2497187f04489f5585245a87fc098ca3a1224905 100644 (file)
@@ -2093,8 +2093,8 @@ module VISU {
    * the following types: 3d, Table, XY plot.
    * %View interface is a base for all types of %view interfaces.
    */
-  interface View: Base {
-
+  interface View: Base, SALOME::GenericObj 
+  {
     /*! \brief %ViewRepresentation enumeration
      *
      * displaying part ("ALL" isn't setable)
index 9218e1f61601fdd20eacf32f80e0263036a9f319..dcb15c658e47c26b870074fbd349e9c2cfd2e6d6 100644 (file)
@@ -1327,37 +1327,6 @@ Please, refer to the documentation.</translation>
             <translation>Elapsed time : </translation>
         </message>
     </context>
-    <context>
-        <name>VisuGUI_CacheDlg</name>
-        <message>
-            <source>CACHE_TITLE</source>
-            <translation>Cache properties</translation>
-        </message>
-        <message>
-            <source>FREE</source>
-            <translation>Free</translation>
-        </message>
-        <message>
-            <source>LIMITED_MEMORY</source>
-            <translation>Limited memory</translation>
-        </message>
-        <message>
-            <source>MEMORY STATE</source>
-            <translation>Memory state</translation>
-        </message>
-        <message>
-            <source>MEMORY_MODE</source>
-            <translation>Memory mode</translation>
-        </message>
-        <message>
-            <source>MINIMAL_MEMORY</source>
-            <translation>Minimal memory</translation>
-        </message>
-        <message>
-            <source>USED_BY_CACHE</source>
-            <translation>Used by cache</translation>
-        </message>
-    </context>
     <context>
         <name>VisuGUI_ClippingDlg</name>
         <message>
@@ -2768,30 +2737,57 @@ Please, provide non-empty resulting presentation.</translation>
     </context>
     <context>
         <name>VisuGUI_Slider</name>
+
+        <message>
+            <source>TITLE</source>
+            <translation>Slider</translation>
+        </message>
+
         <message>
-            <source>AVI</source>
-            <translation>AVI</translation>
+            <source>NAVIGATION</source>
+            <translation>Navigation</translation>
         </message>
         <message>
-            <source>CACHE_MEMORY</source>
-            <translation>Cache:</translation>
+            <source>IS_CYCLED</source>
+            <translation>Is Cycled</translation>
         </message>
+
         <message>
-            <source>FREE_MEMORY</source>
-            <translation>Free:</translation>
+            <source>SPEED</source>
+            <translation>Speed</translation>
         </message>
+
         <message>
-            <source>MORE</source>
-            <translation>More...</translation>
+            <source>MEMORY_MODE</source>
+            <translation>Mode</translation>
         </message>
         <message>
-            <source>SPEED</source>
-            <translation>Speed:</translation>
+            <source>MINIMAL_MEMORY</source>
+            <translation>Minimal</translation>
         </message>
         <message>
-            <source>TOOLBAR_TITLE</source>
-            <translation>Slider</translation>
+            <source>LIMITED_MEMORY</source>
+            <translation>Limited</translation>
+        </message>
+        <message>
+            <source>MEMORY_UNITS</source>
+            <translation>Mb</translation>
+        </message>
+
+
+        <message>
+            <source>MEMORY_STATE</source>
+            <translation>State</translation>
+        </message>
+        <message>
+            <source>USED_BY_CACHE</source>
+            <translation>Used:</translation>
+        </message>
+        <message>
+            <source>AVAILABLE_MEMORY</source>
+            <translation>Free:</translation>
         </message>
+
     </context>
     <context>
         <name>VisuGUI_StreamLinesDlg</name>
index a802ab00a4024fb040d6a231f487f824412eb68c..131ccec85273c7461d6db9ec7f3a304c48cfde03 100644 (file)
 
 #include "VVTK_ViewModel.h"
 
+#include "VisuGUI_Slider.h"
+
 using namespace VISU;
 
 #ifdef _DEBUG_
@@ -169,9 +171,9 @@ static int MYDEBUG = 0;
 VisuGUI
 ::VisuGUI():
   SalomeApp_Module( "VISU" ),
+  mySlider( NULL ),
   myDisplayer( 0 )
-{
-}
+{}
 
 
 VisuGUI
@@ -184,6 +186,7 @@ VisuGUI
 ::OnImportFromFile()
 {
   if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()");
+
   if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) )
     return;
 
@@ -2936,7 +2939,14 @@ bool
 VisuGUI
 ::activateModule( SUIT_Study* theStudy )
 {
-  SalomeApp_Module::activateModule( theStudy );
+  bool aResult = SalomeApp_Module::activateModule( theStudy );
+
+  if ( !mySlider ) {
+    SALOMEDS::Study_var aStudy = GetDSStudy( GetCStudy( GetAppStudy( this ) ) );
+    VISU::ColoredPrs3dCache_var aCache = GetVisuGen( this )->GetColoredPrs3dCache( aStudy );
+    mySlider = new VisuGUI_Slider( this, getApp()->desktop(), getApp()->selectionMgr() );
+  }
+
   studyActivated();
   setMenuShown( true );
   setToolShown( true );
@@ -2946,7 +2956,9 @@ VisuGUI
   shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
   action(VISU_IMPORT_FROM_FILE)->setShortcuts(shortcuts);
 
-  return true;
+  emit moduleActivated();
+
+  return aResult;
 }
 
 
@@ -2960,8 +2972,11 @@ VisuGUI
   // Unset actions accelerator keys
   action(VISU_IMPORT_FROM_FILE)->setShortcuts(QKeySequence::UnknownKey);
 
-  SalomeApp_Module::deactivateModule( theStudy );
-  return true;
+  bool aResult = SalomeApp_Module::deactivateModule( theStudy );
+  
+  emit moduleDeactivated();
+
+  return aResult;
 }
 
 LightApp_Selection*
index 536a45a3ea4629e16d71bf972e36bb85f6eff5e4..2f612517be0fe446a8ed1070b59ed4bef48b80fb 100644 (file)
 #include "SVTK_ViewWindow.h"
 
 
-
 class SUIT_ViewManager;
 class SVTK_ViewWindow;
-class Prs3d_i;
+class VisuGUI_Slider;
 
 namespace VISU
 {
+  class Prs3d_i;
   typedef std::pair<Prs3d_i*,int> TPrs3dToInd; // prs pointer and default index of scalar bar placement
   typedef std::set<TPrs3dToInd> TSetPrs3d;
   typedef std::map<SVTK_ViewWindow*,TSetPrs3d> TViewToPrs3d;
@@ -82,6 +82,10 @@ public:
   VISU::TViewToPrs3d&
   getScalarBarsMap();
   
+signals:
+  void moduleDeactivated();
+  void moduleActivated();
+
 public slots:
   virtual bool deactivateModule( SUIT_Study* );
   virtual bool activateModule( SUIT_Study* );
@@ -188,6 +192,7 @@ private:
   void createPopupMenus();
 
 private:
+  VisuGUI_Slider* mySlider;
   LightApp_Displayer* myDisplayer;
   VISU::TViewToPrs3d myScalarBarsMap;
 };
index d2a59a73417f18c1e161b8e73e20e51b7ca6bf78..21ffa19def49f1026e985849692e55da720fef21 100644 (file)
@@ -65,8 +65,6 @@
 #include "VISU_GaussPtsAct.h"
 #include "VisuGUI_GaussPointsDlg.h"
 
-#include "VisuGUI_Slider.h"
-
 #include "VISU_Gen_i.hh"
 #include "VISU_Result_i.hh"
 #include "VISU_CutLines_i.hh"
@@ -414,14 +412,10 @@ onCreateViewManager()
   aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) );
   aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ),
                             aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) );
+
   new LightApp_VTKSelector( aViewer, anApp->selectionMgr() );
+
   anApp->addViewManager( aViewManager );
-     
-  VVTK_ViewWindow* aViewWindow = ( VVTK_ViewWindow* )aViewManager->createViewWindow();
-  if( aViewWindow )
-  {
-    new VisuGUI_Slider( this, aViewWindow, anApp->selectionMgr() );
-  }
 
   return aViewer->getViewManager();
 }
index 64379d60b13ed6b4b51d360e32eef9e76f4364e1..23b380398aa4de395ac7bda36c18213d113dbc90 100644 (file)
 
 #include "VISU_Actor.h"
 
-#include "VVTK_MainWindow.h"
-#include "VVTK_ViewWindow.h"
-
 #include "VISU_Gen_i.hh"
-#include "VisuGUI_Module.h"
+#include "VisuGUI.h"
 #include "VisuGUI_Tools.h"
 #include "VisuGUI_Prs3dTools.h"
 
 #include "VTKViewer_Algorithm.h"
 #include "SVTK_Functor.h"
 
+#include "QtxDockWidget.h"
+#include "QtxDoubleSpinBox.h"
+
 #include <vtkActorCollection.h>
 #include <vtkRenderer.h>
 
+#include <QMainWindow>
 #include <QComboBox>
 #include <QFont>
 #include <QLabel>
 #include <QToolTip>
 #include <QSlider>
 #include <QSpinBox>
+#include <QGroupBox>
+#include <QCheckBox>
+#include <QRadioButton>
 #include <QTimer>
 
 /*!
   Constructor
 */
-VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule, 
-                               VVTK_ViewWindow* theViewWindow,
+VisuGUI_Slider::VisuGUI_Slider( VisuGUI* theModule, 
+                               QMainWindow* theParent,
                                LightApp_SelectionMgr* theSelectionMgr )
-  : QtxToolBar( tr("TOOLBAR_TITLE"), theViewWindow->getMainWindow1() ),
-    myModule( theModule ),
-    myMainWindow( theViewWindow->getMainWindow1() ),
+  : QWidget( theParent ),
+    myViewManager( VISU::GetVisuGen( theModule )->GetViewManager() ),
     mySelectionMgr( theSelectionMgr )
 {
-  //setLabel();
-  //setCloseMode(QDockWindow::Undocked);
-  setMovable( true );
-
-  VISU::ViewManager_var aViewManager = VISU::GetVisuGen( myModule )->GetViewManager();
-  VISU::View_var aView = aViewManager->GetCurrentView();
-  if(!CORBA::is_nil(aView.in()))
-    myView3D = VISU::View3D::_narrow(aView);
+  setWindowTitle( tr("TITLE") );
 
   SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr();
 
-  //setHorizontallyStretchable( true );
+  QGridLayout *aWidgetGridLayout = new QGridLayout( this );
 
-  QWidget* aWidget = new QWidget( this );
-  aWidget->setFocusPolicy(Qt::StrongFocus);
-  myWidgetAction = addWidget( aWidget );
+  //----------------------------------------------------------------------------
+  // Definition of the navigation group box
+  QGroupBox *aNavigationGroupBox = new QGroupBox( tr( "NAVIGATION" ), this );
 
-  QGridLayout* aLayout = new QGridLayout( aWidget );
-  aLayout->setMargin( 11 );
-  aLayout->setSpacing( 6 );
+  QGridLayout *aNavigationGridLayout = new QGridLayout( aNavigationGroupBox );
+  aNavigationGridLayout->setHorizontalSpacing( 6 );
+  aNavigationGridLayout->setVerticalSpacing( 6 );
+  aNavigationGridLayout->setContentsMargins( 9, 9, 9, 9 );
 
-  // Slider and time stamps
-  myFirstTimeStamp = new QLabel( aWidget );
-  myFirstTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  aLayout->addWidget( myFirstTimeStamp, 0, 0, Qt::AlignHCenter );
+  myFirstTimeStamp = new QLabel( aNavigationGroupBox );
+  myFirstTimeStamp->setAlignment( Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter );
+  myFirstTimeStamp->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+  aNavigationGridLayout->addWidget( myFirstTimeStamp, 0, 0, 1, 1 );
 
-  mySlider = new QSlider( aWidget );
-  mySlider->setMinimum( 0 );
-  mySlider->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
+  mySlider = new QSlider( aNavigationGroupBox );
+  mySlider->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+  mySlider->setFocusPolicy( Qt::StrongFocus );
   mySlider->setOrientation( Qt::Horizontal );
   mySlider->setTracking( false );
-  mySlider->setFocusPolicy(Qt::StrongFocus);
-  aLayout->addWidget( mySlider, 0, 1, 1, 8 );
-
-  myLastTimeStamp = new QLabel( aWidget );
-  myLastTimeStamp->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  aLayout->addWidget( myLastTimeStamp, 0, 9, Qt::AlignHCenter );
-
-  myTimeStampsNumber = new QLabel( aWidget );
-  myTimeStampsNumber->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  aLayout->addWidget( myTimeStampsNumber, 0, 10, Qt::AlignHCenter );
-
-  QLabel* aCacheMemoryLabel = new QLabel( tr( "CACHE_MEMORY" ), aWidget );
-  aCacheMemoryLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  aLayout->addWidget( aCacheMemoryLabel, 0, 11 );
-
-  myCacheMemory = new QLabel( aWidget );
-  myCacheMemory->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  QFontMetrics fm( myCacheMemory->font() );
-  myCacheMemory->setFixedWidth( fm.width( "9.99E+99 Mb" ) );
-
-  aLayout->addWidget( myCacheMemory, 0, 12 );
-
-  // Buttons
-#ifdef ENABLE_AVI_AND_MORE_BUTTONS
-  myMoreButton = new QToolButton( aWidget );
-  myMoreButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
-  myMoreButton->setEnabled( false );
-  myMoreButton->setCheckble( true );
-  myMoreButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_MORE" ) ) );
-  QToolTip::add( myMoreButton, tr( "MORE" ) );
-  aLayout->addWidget( myMoreButton, 1, 0 );
-
-  myAVIButton = new QToolButton( aWidget );
-  myAVIButton->setEnabled( false );
-  myAVIButton->setCheckble( true );
-  myAVIButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_AVI" ) ) );
-  QToolTip::add( myAVIButton, tr( "AVI" ) );
-  aLayout->addWidget( myAVIButton, 1, 1 );
-#endif
-
-  aLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 2 );
-
-  myFirstButton = new QToolButton( aWidget );
+  mySlider->setMinimum( 0 );
+
+  aNavigationGridLayout->addWidget( mySlider, 0, 1, 1, 5 );
+
+  myLastTimeStamp = new QLabel( aNavigationGroupBox );
+  aNavigationGridLayout->addWidget( myLastTimeStamp, 0, 6, 1, 1 );
+
+  myTimeStampsNumber = new QLabel( aNavigationGroupBox );
+  aNavigationGridLayout->addWidget( myTimeStampsNumber, 0, 7, 1, 1 );
+
+  myIsCycled = new QCheckBox( tr( "IS_CYCLED" ), aNavigationGroupBox );
+  myIsCycled->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+  myIsCycled->setLayoutDirection( Qt::LeftToRight );
+  myIsCycled->setEnabled( false );
+
+  aNavigationGridLayout->addWidget( myIsCycled, 1, 0, 1, 1 );
+
+  myFirstButton = new QToolButton( aNavigationGroupBox );
   myFirstButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_FIRST" ) ) );
-  aLayout->addWidget( myFirstButton, 1, 3 );
+  myFirstButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+  aNavigationGridLayout->addWidget( myFirstButton, 1, 1, 1, 1 );
 
-  myPreviousButton = new QToolButton( aWidget );
+  myPreviousButton = new QToolButton( aNavigationGroupBox );
   myPreviousButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PREVIOUS" ) ) );
-  aLayout->addWidget( myPreviousButton, 1, 4 );
+  myPreviousButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+  aNavigationGridLayout->addWidget( myPreviousButton, 1, 2, 1, 1 );
 
-  myPlayButton = new QToolButton( aWidget );
+  myPlayButton = new QToolButton( aNavigationGroupBox );
   myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PLAY" ) ) );
+  myPlayButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
   myPlayButton->setCheckable( true );
-  aLayout->addWidget( myPlayButton, 1, 5 );
+  aNavigationGridLayout->addWidget( myPlayButton, 1, 3, 1, 1 );
 
-  myNextButton = new QToolButton( aWidget );
+  myNextButton = new QToolButton( aNavigationGroupBox );
   myNextButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_NEXT" ) ) );
-  aLayout->addWidget( myNextButton, 1, 6 );
+  myNextButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+  aNavigationGridLayout->addWidget( myNextButton, 1, 4, 1, 1 );
 
-  myLastButton = new QToolButton( aWidget );
+  myLastButton = new QToolButton(aNavigationGroupBox);
   myLastButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_LAST" ) ) );
-  aLayout->addWidget( myLastButton, 1, 7 );
-
-  aLayout->addItem( new QSpacerItem( 24, 24, QSizePolicy::Expanding, QSizePolicy::Minimum ), 1, 8 );
-
-  myTimeStampStrings = new QComboBox( aWidget );
-  myTimeStampStrings->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  myTimeStampStrings->setFocusPolicy(Qt::StrongFocus);
-  aLayout->addWidget( myTimeStampStrings, 1, 9 );
-
-  myTimeStampIndices = new QComboBox( aWidget );
-  myTimeStampIndices->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  myTimeStampIndices->setFocusPolicy(Qt::StrongFocus);
-  aLayout->addWidget( myTimeStampIndices, 1, 10 );
-
-  // Speed
-  QLabel* aSpeedLabel = new QLabel( tr( "SPEED" ), aWidget );
-  aSpeedLabel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  aLayout->addWidget( aSpeedLabel, 1, 11 );
-
-  mySpeedBox = new QSpinBox( aWidget );
-  mySpeedBox->setMinimum( 1 );
-  mySpeedBox->setMaximum( 100 );
-  mySpeedBox->setSingleStep( 1 );
-  mySpeedBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
-  mySpeedBox->setFocusPolicy(Qt::StrongFocus);
-  mySpeedBox->setValue( 50 );
-  aLayout->addWidget( mySpeedBox, 1, 12 );
+  myLastButton->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
+  aNavigationGridLayout->addWidget( myLastButton, 1, 5, 1, 1 );
+
+  myTimeStampStrings = new QComboBox( aNavigationGroupBox );
+  myTimeStampStrings->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+  myTimeStampStrings->setFocusPolicy( Qt::StrongFocus );
+  aNavigationGridLayout->addWidget( myTimeStampStrings, 1, 6, 1, 1 );
+
+  myTimeStampIndexes = new QComboBox( aNavigationGroupBox );
+  myTimeStampIndexes->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+  myTimeStampIndexes->setFocusPolicy( Qt::StrongFocus );
+  aNavigationGridLayout->addWidget( myTimeStampIndexes, 1, 7, 1, 1 );
+
+  aWidgetGridLayout->addWidget( aNavigationGroupBox, 0, 0, 1, 1 );
+
+  //----------------------------------------------------------------------------
+  // Definition of the speed group box
+  QGroupBox* aSpeedGroupBox = new QGroupBox( tr( "SPEED" ), this );
+  {
+    QHBoxLayout* aSpeedBoxLayout = new QHBoxLayout( aSpeedGroupBox );
+    aSpeedBoxLayout->setSpacing( 6 );
+    aSpeedBoxLayout->setContentsMargins( 9, 9, 9, 9 );
+    
+    mySpeedSlider = new QSlider( aSpeedGroupBox );
+    mySpeedSlider->setLayoutDirection( Qt::RightToLeft );
+    mySpeedSlider->setMaximum( 100 );
+    mySpeedSlider->setValue( 55 );
+    mySpeedSlider->setOrientation( Qt::Vertical );
+    mySpeedSlider->setTickPosition( QSlider::TicksBothSides );
+    mySpeedSlider->setTickInterval( 20 );
+    
+    aSpeedBoxLayout->addWidget( mySpeedSlider );   
+  }
+  aWidgetGridLayout->addWidget( aSpeedGroupBox, 0, 1, 2, 1 );
+
+
+  //----------------------------------------------------------------------------
+  QHBoxLayout* aMemoryBoxLayout = new QHBoxLayout();
+  aMemoryBoxLayout->setSpacing( 6 );
+  aMemoryBoxLayout->setContentsMargins( 0, 0, 0, 0 );
+
+  //----------------------------------------------------------------------------
+  // Definition of the memory mode group box
+  QGroupBox* aModeGroupBox = new QGroupBox( tr( "MEMORY_MODE" ), this );
+  {
+    QHBoxLayout* aMemoryModeBoxLayout = new QHBoxLayout( aModeGroupBox );
+    aMemoryModeBoxLayout->setSpacing( 6 );
+    aMemoryModeBoxLayout->setContentsMargins( 9, 9, 9, 9 );
+    
+    myMinimalMemoryButton = new QRadioButton( tr( "MINIMAL_MEMORY" ), aModeGroupBox );
+    aMemoryModeBoxLayout->addWidget( myMinimalMemoryButton );
+    
+    QSpacerItem* aSpacer = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+    aMemoryModeBoxLayout->addItem( aSpacer );
+    
+    myLimitedMemoryButton = new QRadioButton( tr( "LIMITED_MEMORY" ), aModeGroupBox );
+    myLimitedMemoryButton->setChecked( true );
+    aMemoryModeBoxLayout->addWidget( myLimitedMemoryButton );
+    
+    myLimitedMemory = new QtxDoubleSpinBox( aModeGroupBox );
+    myLimitedMemory->setMaximum( 10000 );
+    myLimitedMemory->setValue( 512 );
+    aMemoryModeBoxLayout->addWidget( myLimitedMemory );
+    
+    QLabel* aMemoryDimensionLabel = new QLabel( aModeGroupBox );
+    aMemoryDimensionLabel->setText( tr( "MEMORY_UNITS" ) );
+    aMemoryModeBoxLayout->addWidget( aMemoryDimensionLabel );
+  }
+
+  aMemoryBoxLayout->addWidget( aModeGroupBox );
 
+  //----------------------------------------------------------------------------
+  // Definition of the memory state group box
+  QGroupBox* aStateGroupBox = new QGroupBox( tr( "MEMORY_STATE" ), this );
+  {
+    QHBoxLayout* aMemoryStateBoxLayout = new QHBoxLayout( aStateGroupBox );
+    aMemoryStateBoxLayout->setSpacing( 6 );
+    aMemoryStateBoxLayout->setContentsMargins( 9, 9, 9, 9 );
+    
+    QLabel* aUsedMemoryLabel = new QLabel( tr( "USED_BY_CACHE" ), aStateGroupBox );
+    aMemoryStateBoxLayout->addWidget( aUsedMemoryLabel );
+    
+    myUsedMemory = new QLineEdit( aStateGroupBox );
+    myUsedMemory->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+    myUsedMemory->setEnabled( false );
+    aMemoryStateBoxLayout->addWidget( myUsedMemory );
+    
+    QSpacerItem* aSpacer = new QSpacerItem( 40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
+    aMemoryStateBoxLayout->addItem( aSpacer );
+    
+    QLabel* aFreeMemoryLabel = new QLabel( tr( "AVAILABLE_MEMORY" ), aStateGroupBox );
+    aMemoryStateBoxLayout->addWidget( aFreeMemoryLabel );
+    
+    myFreeMemory = new QLineEdit( aStateGroupBox );
+    myFreeMemory->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed );
+    myFreeMemory->setEnabled( false );
+    aMemoryStateBoxLayout->addWidget( myFreeMemory );
+  }
+
+  aMemoryBoxLayout->addWidget( aStateGroupBox );
+
+  aWidgetGridLayout->addLayout( aMemoryBoxLayout, 1, 0, 1, 1 );
+
+  //----------------------------------------------------------------------------
+  QSpacerItem* spacerItem1 = new QSpacerItem( 20, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
+  aWidgetGridLayout->addItem( spacerItem1, 2, 0, 1, 1 );
+
+  //----------------------------------------------------------------------------
   myTimer = new QTimer( this );
 
   // Common
+  connect( theModule, SIGNAL( moduleDeactivated() ), SLOT( onModuleDeactivated() ) );
+
+  connect( theModule, SIGNAL( moduleActivated() ), SLOT( onModuleActivated() ) );
+
   connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), SLOT( onSelectionChanged() ) );
 
   connect( myTimeStampStrings, SIGNAL( activated( int ) ),    SLOT( onTimeStampActivated( int ) ) );
-  connect( myTimeStampIndices, SIGNAL( activated( int ) ),    SLOT( onTimeStampActivated( int ) ) );
+  connect( myTimeStampIndexes, SIGNAL( activated( int ) ),    SLOT( onTimeStampActivated( int ) ) );
 
   connect( myFirstButton,      SIGNAL( clicked() ),           SLOT( onFirst() ) );
   connect( myPreviousButton,   SIGNAL( clicked() ),           SLOT( onPrevious() ) );
@@ -213,13 +273,20 @@ VisuGUI_Slider::VisuGUI_Slider( VisuGUI_Module* theModule,
 
   connect( mySlider,           SIGNAL( valueChanged( int ) ), SLOT( onValueChanged( int ) ) );
 
-  connect( mySpeedBox,         SIGNAL( valueChanged( int ) ), SLOT( onSpeedChanged( int ) ) );
+  connect( mySpeedSlider,      SIGNAL( valueChanged( int ) ), SLOT( onSpeedChanged( int ) ) );
 
   connect( myTimer,            SIGNAL( timeout() ),           SLOT( onTimeout() ) );
 
+  //----------------------------------------------------------------------------
+  connect( myLimitedMemoryButton, SIGNAL( toggled( bool ) ), myLimitedMemory, SLOT( setEnabled( bool ) ) );
+
+  //----------------------------------------------------------------------------
   enableControls( false );
 
-  myMainWindow->addToolBar( Qt::BottomToolBarArea, this );
+  QtxDockWidget* aQtxDockWidget = new QtxDockWidget( true, theParent );
+  theParent->addDockWidget( Qt::BottomDockWidgetArea , aQtxDockWidget );
+  aQtxDockWidget->setWidget( this );
+  aQtxDockWidget->show();
 }
 
 /*!
@@ -229,6 +296,16 @@ VisuGUI_Slider::~VisuGUI_Slider()
 {
 }
 
+void VisuGUI_Slider::onModuleDeactivated()
+{
+  setHidden( true );
+}
+
+void VisuGUI_Slider::onModuleActivated()
+{
+  setHidden( false );
+}
+
 bool VisuGUI_Slider::checkHolderList()
 {
   THolderList aHolderList;
@@ -245,14 +322,15 @@ bool VisuGUI_Slider::checkHolderList()
 
 void VisuGUI_Slider::enableControls( bool on )
 {
-  widgetForAction( myWidgetAction  )->setEnabled( on );
+  setEnabled( on );
+
   if( on )
   {
     if( checkHolderList() )
       return;
 
     myTimeStampStrings->clear();
-    myTimeStampIndices->clear();
+    myTimeStampIndexes->clear();
 
     VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front();
 
@@ -278,7 +356,7 @@ void VisuGUI_Slider::enableControls( bool on )
       QString aTime = anInfo.myTime.in();
 
       myTimeStampStrings->addItem( aTime );
-      myTimeStampIndices->addItem( QString::number( aNumber ) );
+      myTimeStampIndexes->addItem( QString::number( aNumber ) );
 
       if( aNumber == aTimeStampNumber )
        a_current_index = an_index;
@@ -287,14 +365,14 @@ void VisuGUI_Slider::enableControls( bool on )
     myTimeStampStrings->setFont(myTimeStampStrings->font());
     myTimeStampStrings->updateGeometry();
     
-    myTimeStampIndices->setFont(myTimeStampStrings->font());
-    myTimeStampIndices->updateGeometry();
+    myTimeStampIndexes->setFont(myTimeStampStrings->font());
+    myTimeStampIndexes->updateGeometry();
 
     if( a_current_index > mySlider->maximum() )
       mySlider->setMaximum( aLength-1 );
 
     myTimeStampStrings->setCurrentIndex( a_current_index );
-    myTimeStampIndices->setCurrentIndex( a_current_index );
+    myTimeStampIndexes->setCurrentIndex( a_current_index );
     mySlider->setValue( a_current_index );
 
     if( a_current_index <= mySlider->maximum() )
@@ -313,10 +391,19 @@ void VisuGUI_Slider::updateMemoryState()
     return;
 
   VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front();
-
   VISU::ColoredPrs3dCache_var aCache = aHolder->GetCache();
+
   CORBA::Float aCacheMemory = aCache->GetMemorySize();
-  myCacheMemory->setText( QString::number( double( aCacheMemory ), 'E', 2 ) + " Mb" );
+  myUsedMemory->setText( QString::number( double( aCacheMemory ), 'E', 2 ) + " Mb" );
+  myUsedMemory->setFont( myUsedMemory->font() );
+  myUsedMemory->updateGeometry();
+    
+
+  long aMb = 1024 * 1024;
+  double aFreeMemory = (double)VISU_PipeLine::GetAvailableMemory( 2048 * aMb ) / (double)aMb;
+  myFreeMemory->setText( QString::number( double( aFreeMemory ), 'E', 2 ) + " Mb" );
+  myFreeMemory->setFont( myFreeMemory->font() );
+  myFreeMemory->updateGeometry();
 }
 
 void VisuGUI_Slider::onSelectionChanged()
@@ -384,7 +471,7 @@ void VisuGUI_Slider::onPlay( bool on )
   {
     myPlayButton->setIcon( aResourceMgr->loadPixmap( "VISU", tr( "ICON_SLIDER_PAUSE" ) ) );
 
-    int delay = int(5000.0 / double(mySpeedBox->value()));
+    int delay = int(5000.0 / double(mySpeedSlider->value()));
     myTimer->start( delay );
   }
   else
@@ -415,7 +502,7 @@ void VisuGUI_Slider::onValueChanged( int value )
   }
 
   myTimeStampStrings->setCurrentIndex( value );
-  myTimeStampIndices->setCurrentIndex( value );
+  myTimeStampIndexes->setCurrentIndex( value );
 
   VISU::ColoredPrs3dHolder_var aHolder = myHolderList.front();
 
@@ -430,6 +517,12 @@ void VisuGUI_Slider::onValueChanged( int value )
   if(aNumber == aTimeStampNumber)
     return;
 
+  VISU::View_var aView = myViewManager->GetCurrentView();
+  if ( CORBA::is_nil( aView.in() ) )
+    return;
+
+  VISU::View3D_var aView3D = VISU::View3D::_narrow( aView );
+
   THolderList::const_iterator anIter = myHolderList.begin();
   THolderList::const_iterator anIterEnd = myHolderList.end();
   for( ; anIter != anIterEnd; anIter++ )
@@ -444,18 +537,20 @@ void VisuGUI_Slider::onValueChanged( int value )
 
     QApplication::setOverrideCursor(Qt::WaitCursor);
     
-    aHolder->Apply( aPrs3d, anInput, myView3D );
+    aHolder->Apply( aPrs3d, anInput, aView3D );
     
     QApplication::restoreOverrideCursor();
   }
 
+  aView3D->Destroy();
+
   updateMemoryState();
 }
 
 void VisuGUI_Slider::onSpeedChanged( int value )
 {
   if(myPlayButton->isChecked()){
-    int delay = int(5000.0 / double(mySpeedBox->value()));
+    int delay = int(5000.0 / double(mySpeedSlider->value()));
     myTimer->start( delay );
   }
 }
index 1347b6503022db9dac9eb4fb27c19cede443c7d1..ab8b5f5b5a85f59081e4b2837fd339c368d020f4 100644 (file)
@@ -28,7 +28,8 @@
 #ifndef VisuGUI_Slider_HeaderFile
 #define VisuGUI_Slider_HeaderFile
 
-#include "QtxToolBar.h"
+#include <QWidget>
+
 #include <vector>
 
 #include "SALOMEconfig.h"
@@ -45,23 +46,24 @@ class QLineEdit;
 class QToolButton;
 class QSlider;
 class QSpinBox;
+class QCheckBox;
+class QRadioButton;
+class QMainWindow;
 class QTimer;
-class QAction;
 
-class VVTK_ViewWindow;
-class VVTK_MainWindow;
+class QtxDoubleSpinBox;
 class LightApp_SelectionMgr;
+class VisuGUI;
 
-class VisuGUI_Module;
-
-class VisuGUI_Slider : public QtxToolBar
+class VisuGUI_Slider : public QWidget
 {
-  Q_OBJECT
+  Q_OBJECT;
 
 public:
-  VisuGUI_Slider( VisuGUI_Module* theModule, 
-                 VVTK_ViewWindow* theViewWindow,
+  VisuGUI_Slider( VisuGUI* theModule, 
+                 QMainWindow* theParent,
                  LightApp_SelectionMgr* theSelectionMgr );
+
   virtual ~VisuGUI_Slider();
 
 public slots:
@@ -81,29 +83,25 @@ public slots:
 
   virtual void     onTimeout();
 
+protected slots:
+  void onModuleDeactivated();
+  void onModuleActivated();
+
 protected:
   virtual void     enableControls( bool );
   virtual void     updateMemoryState();
   virtual bool     checkHolderList();
 
 private:
-  VisuGUI_Module*  myModule;
-  VVTK_MainWindow* myMainWindow;
   LightApp_SelectionMgr* mySelectionMgr;
-  VISU::View3D_var myView3D;
+  VISU::ViewManager_var myViewManager;
 
   QSlider*         mySlider;
   QLabel*          myFirstTimeStamp;
   QLabel*          myLastTimeStamp;
   QLabel*          myTimeStampsNumber;
 
-  QLabel*          myCacheMemory;
-
-#ifdef ENABLE_AVI_AND_MORE_BUTTONS
-  QToolButton*     myMoreButton;
-  QToolButton*     myAVIButton;
-#endif
-
+  QCheckBox*       myIsCycled;
   QToolButton*     myFirstButton;
   QToolButton*     myPreviousButton;
   QToolButton*     myPlayButton;
@@ -111,16 +109,21 @@ private:
   QToolButton*     myLastButton;
 
   QComboBox*       myTimeStampStrings;
-  QComboBox*       myTimeStampIndices;
+  QComboBox*       myTimeStampIndexes;
+
+  QSlider*         mySpeedSlider;
 
-  QSpinBox*        mySpeedBox;
+  QRadioButton*     myMinimalMemoryButton;
+  QRadioButton*     myLimitedMemoryButton;
+  QtxDoubleSpinBox* myLimitedMemory;
 
-  QTimer*          myTimer;
+  QLineEdit*      myUsedMemory;
+  QLineEdit*      myFreeMemory;
 
   typedef std::vector<VISU::ColoredPrs3dHolder_var> THolderList;
-  THolderList      myHolderList;
+  THolderList     myHolderList;
   
-  QAction*         myWidgetAction;
+  QTimer*         myTimer;
 };
 
 #endif
index c388740b97160ecc9c86c5b3aea591e1bb323d5c..8ebf690fab08b0234f9abb6090a4ac7b981f1382 100644 (file)
@@ -28,6 +28,7 @@
 #define VISU_View_i_HeaderFile
 
 #include "VISUConfig.hh"
+#include "SALOME_GenericObj_i.hh"
 
 class QWidget;
 
@@ -46,7 +47,8 @@ namespace VISU
   class Curve_i;
 
   class VISU_I_EXPORT View_i : public virtual POA_VISU::View,
-                 public virtual Storable
+                              public virtual SALOME::GenericObj_i,
+                              public virtual Storable
   {
   public:
     View_i (SalomeApp_Application *theApplication,
@@ -125,7 +127,7 @@ namespace VISU
 
   //===========================================================================
   class VISU_I_EXPORT XYPlot_i : public virtual POA_VISU::XYPlot,
-                   public virtual View_i
+                                public virtual View_i
   {
   public:
     typedef VISU::XYPlot TInterface;
@@ -216,7 +218,7 @@ namespace VISU
 
   //===========================================================================
   class VISU_I_EXPORT View3D_i : public virtual POA_VISU::View3D,
-                   public virtual View_i
+                                public virtual View_i
   {
   public:
     typedef VISU::View3D TInterface;