]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
Additional fix of INTPAL 52639: Creation of ParaView viewer makes Paraview toolbars... V7_6_0a1
authorakl <alexander.kovalev@opencascade.com>
Tue, 31 Mar 2015 13:05:43 +0000 (17:05 +0400)
committerakl <alexander.kovalev@opencascade.com>
Tue, 31 Mar 2015 13:05:43 +0000 (17:05 +0400)
src/PVGUI/PVGUI_Module.cxx
src/PVGUI/PVGUI_Module.h
src/PVGUI/PVGUI_Module_widgets.cxx

index 39c8b2435203ecb39495b2a29dbb1fb952a2f9d7..0010354d5dbbf2657cc770fba0ac57cabcce12bb 100644 (file)
@@ -1305,7 +1305,7 @@ void PVGUI_Module::onPushTraceTimer()
 QString PVGUI_Module::getHelpFileName() {
   QString aPVHome(getenv("PVHOME"));
   if (aPVHome.isNull()) {
-    qWarning("Wariable PVHOME is not defined");
+    qWarning("Variable PVHOME is not defined");
     return QString();
   }
   QChar aSep = QDir::separator();
@@ -1373,6 +1373,36 @@ void PVGUI_Module::loadSelectedState(bool toClear)
   }
 }
 
+void PVGUI_Module::onViewManagerAdded( SUIT_ViewManager* vm )
+{
+  if (PVViewer_ViewManager* pvvm = dynamic_cast<PVViewer_ViewManager*>(vm)) {
+    connect(pvvm, SIGNAL(viewCreated(SUIT_ViewWindow*)), this, SLOT(onPVViewCreated(SUIT_ViewWindow*)));
+    connect(pvvm, SIGNAL(deleteView(SUIT_ViewWindow*)), this, SLOT(onPVViewDelete(SUIT_ViewWindow*)));
+    }
+}
+
+void PVGUI_Module::onViewManagerRemoved( SUIT_ViewManager* vm )
+{
+  if (PVViewer_ViewManager* pvvm = dynamic_cast<PVViewer_ViewManager*>(vm))
+    disconnect(pvvm, SIGNAL(viewCreated(SUIT_ViewWindow*)), this, SLOT(onPVViewCreated(SUIT_ViewWindow*)));
+}
+
+/*!Show toolbars at \a vw PV view window creating when PARAVIS is active.
+*/
+void PVGUI_Module::onPVViewCreated( SUIT_ViewWindow* vw )
+{
+  myGuiElements->setToolBarVisible(true);
+  restoreDockWidgetsState();
+}
+
+/*!Save toolbars state at \a view view closing.
+*/
+void PVGUI_Module::onPVViewDelete(SUIT_ViewWindow* view)
+{
+  if (dynamic_cast<PVViewer_ViewWindow*>(view))
+    saveDockWidgetsState( false );
+}
+
 /*!
   \fn CAM_Module* createModule();
   \brief Export module instance (factory function).
index f955a6e1093d9e31123498853d3833d181f5ce51..64340d5fa254e98d2e175b591848c24764a9f0f9 100644 (file)
@@ -50,6 +50,7 @@ class pqDataRepresentation;
 class pqRepresentation;
 class PVViewer_GUIElements;
 class PVViewer_EngineWrapper;
+class SUIT_ViewWindow;
 
 class PVGUI_Module : public SalomeApp_Module
 {
@@ -190,7 +191,7 @@ private:
   void                   setupDockWidgets();
 
   //! Save states of dockable ParaView widgets
-  void                   saveDockWidgetsState();
+  void                   saveDockWidgetsState( bool hideWidgets = true );
 
   //! Restore states of dockable ParaView widgets
   void                   restoreDockWidgetsState();
@@ -264,6 +265,10 @@ protected slots:
   virtual void           onModelOpened();
   virtual void           onPushTraceTimer();
   virtual void           onInitTimer();
+  virtual void           onViewManagerAdded( SUIT_ViewManager* );
+  virtual void           onViewManagerRemoved( SUIT_ViewManager* );
+  virtual void           onPVViewCreated( SUIT_ViewWindow* );
+  virtual void           onPVViewDelete( SUIT_ViewWindow* );
 
 private:
   int                    mySelectionControlsTb;
index f441e1d5d7fb5443112fa7e242e67ad2274b722f..a20a3af46b19fca2fc7a9c807e78068f775bdbd3 100644 (file)
@@ -343,7 +343,7 @@ void PVGUI_Module::setupDockWidgets()
 /*!
   \brief Save states of dockable ParaView widgets.
 */
-void PVGUI_Module::saveDockWidgetsState()
+void PVGUI_Module::saveDockWidgetsState(bool hideWidgets)
 {
   SUIT_Desktop* desk = application()->desktop();
 
@@ -362,8 +362,10 @@ void PVGUI_Module::saveDockWidgetsState()
     it1.next();
     QDockWidget* dw = qobject_cast<QDockWidget*>( it1.key() );
     myDockWidgets[dw] = dw->isVisible();
-    dw->setVisible( false );
-    dw->toggleViewAction()->setVisible( false );
+    if ( hideWidgets ) {
+      dw->setVisible( false );
+      dw->toggleViewAction()->setVisible( false );
+    }
   }
   // store toolbar breaks state and remove all tollbar breaks 
   QMapIterator<QWidget*, bool> it2( myToolbarBreaks );
@@ -371,7 +373,7 @@ void PVGUI_Module::saveDockWidgetsState()
     it2.next();
     QToolBar* tb = qobject_cast<QToolBar*>( it2.key() );
     myToolbarBreaks[tb] = desk->toolBarBreak( tb );
-    if ( myToolbarBreaks[tb] )
+    if ( myToolbarBreaks[tb] && hideWidgets )
       desk->removeToolBarBreak( tb );
   }
   // store toolbars visibility state and hide'em all
@@ -380,8 +382,10 @@ void PVGUI_Module::saveDockWidgetsState()
     it3.next();
     QToolBar* tb = qobject_cast<QToolBar*>( it3.key() );
     myToolbars[tb] = tb->isVisible();
-    tb->setVisible( false );
-    tb->toggleViewAction()->setVisible( false );
+    if ( hideWidgets ) {
+      tb->setVisible( false );
+      tb->toggleViewAction()->setVisible( false );
+    }
   }
 }