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();
}
}
+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).
class pqRepresentation;
class PVViewer_GUIElements;
class PVViewer_EngineWrapper;
+class SUIT_ViewWindow;
class PVGUI_Module : public SalomeApp_Module
{
void setupDockWidgets();
//! Save states of dockable ParaView widgets
- void saveDockWidgetsState();
+ void saveDockWidgetsState( bool hideWidgets = true );
//! Restore states of dockable ParaView widgets
void restoreDockWidgetsState();
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;
/*!
\brief Save states of dockable ParaView widgets.
*/
-void PVGUI_Module::saveDockWidgetsState()
+void PVGUI_Module::saveDockWidgetsState(bool hideWidgets)
{
SUIT_Desktop* desk = application()->desktop();
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 );
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
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 );
+ }
}
}