// PARAVIS : ParaView wrapper SALOME module
//
-// Copyright (C) 2010-2014 CEA/DEN, EDF R&D
+// Copyright (C) 2010-2022 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
#include <QtxActionToolMgr.h>
#include <LightApp_Application.h>
-#include <SalomeApp_Application.h> // // should ultimately be a LightApp only
#include <SUIT_Desktop.h>
#include <QApplication>
#include <pqComparativeVisPanel.h>
#include <pqPipelineBrowserWidget.h>
#include <pqProxyInformationWidget.h>
-#include <pqSettings.h>
#include <pqDataInformationWidget.h>
#include <pqPVAnimationWidget.h>
#include <pqFindDataSelectionDisplayFrame.h>
-#include <pqMultiBlockInspectorPanel.h>
+#include <pqMultiBlockInspectorWidget.h>
#include <pqProgressWidget.h>
#include <pqProgressManager.h>
-//#include <pqDisplayProxyEditorWidget.h>
#include <pqPropertiesPanel.h>
+#include <pqPVApplicationCore.h>
+#include <pqAnimationManager.h>
#include <pqApplicationCore.h>
#include <pqPluginManager.h>
#include <pqColorMapEditor.h>
#include <pqDeleteReaction.h>
-//class ResizeHelper : public pqPVAnimationWidget
-//{
-// // TEMPORARILY WORKAROUND AROUND PARAVIEW 3.14 BUG:
-// // WHEN ANIMATION VIEW IS RESIZED, ITS CONTENTS IS NOT PREPERLY RE-ARRANGED
-// // CAUSING SOME CONTROLS TO STAY NON-VISIBLE
-// // THIS BUG IS NATURALLY FIXED BY ADDING
-// // this->updateGeometries();
-// // TO THE
-// // void pqAnimationWidget::resizeEvent(QResizeEvent* e);
-// // BUT THIS CANNOT BE DONE DIRECTLY, SINCE CORRESPONDING API IS NOT PUBLIC
-// // THE ONLY WAY TO DO THIS BY SENDING SHOW EVENT TO THE WIDGET
-//
-//public:
-// ResizeHelper( QWidget* parent ) : pqPVAnimationWidget( parent ) {}
-//protected:
-// void resizeEvent(QResizeEvent* e)
-// {
-// pqAnimationWidget* w = findChild<pqAnimationWidget*>( "pqAnimationWidget" );
-// if ( w ) {
-// QShowEvent e;
-// QApplication::sendEvent( w, &e );
-// }
-// pqPVAnimationWidget::resizeEvent( e );
-// }
-//};
+#include <vtkPVGeneralSettings.h>
+#include <vtkSMSettings.h>
+#include <vtkPVConfig.h>
+
+class ResizeHelper : public pqPVAnimationWidget
+{
+ // TEMPORARY WORKAROUND AROUND PARAVIEW 3.14 BUG:
+ // WHEN ANIMATION VIEW IS RESIZED, ITS CONTENTS IS NOT PREPERLY RE-ARRANGED
+ // CAUSING SOME CONTROLS TO STAY NON-VISIBLE
+ // THIS BUG IS NATURALLY FIXED BY ADDING
+ // this->updateGeometries();
+ // TO THE
+ // void pqAnimationWidget::resizeEvent(QResizeEvent* e);
+ // BUT THIS CANNOT BE DONE DIRECTLY, SINCE CORRESPONDING API IS NOT PUBLIC
+ // THE ONLY WAY TO DO THIS BY SENDING SHOW EVENT TO THE WIDGET
+
+public:
+ ResizeHelper( QWidget* parent ) : pqPVAnimationWidget( parent ) {}
+protected:
+ void resizeEvent(QResizeEvent* e)
+ {
+ pqAnimationWidget* w = findChild<pqAnimationWidget*>( "pqAnimationWidget" );
+ if ( w ) {
+ QShowEvent e;
+ QApplication::sendEvent( w, &e );
+ }
+ pqPVAnimationWidget::resizeEvent( e );
+ }
+};
/*!
\brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc.
pqPipelineBrowserWidget* browser = guiElements->getPipelineBrowserWidget();
pipelineBrowserDock->setWidget(browser);
myDockWidgets[pipelineBrowserDock] = true;
+ pipelineBrowserDock->hide();
+
+ // PROPERTIES, DISPLAY and VIEW:
+ // See ParaViewMainWindow.cxx - those three panels can be separated or grouped.
+ vtkSMSettings* settings = vtkSMSettings::GetInstance();
- // Properties dock (previously called OBJECT_INSPECTOR)
+ // Properties dock (previously called OBJECT_INSPECTOR)
QDockWidget* propertiesDock = new QDockWidget( tr( "TTL_OBJECT_INSPECTOR" ), desk );
propertiesDock->setObjectName("propertiesDock");
propertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
// hook delete to pqDeleteReaction.
QAction* tempDeleteAction = new QAction(this);
pqDeleteReaction* handler = new pqDeleteReaction(tempDeleteAction);
+#if PARAVIEW_VERSION_MAJOR==5 && PARAVIEW_VERSION_MINOR<9
handler->connect(propertiesPanel, SIGNAL(deleteRequested(pqPipelineSource*)), SLOT(deleteSource(pqPipelineSource*)));
-
+#else
+ handler->connect(propertiesPanel, SIGNAL(deleteRequested(pqProxy*)), SLOT(deleteSource(pqProxy*)));
+#endif
myDockWidgets[propertiesDock] = true;
+ propertiesDock->hide();
+
+ int propertiesPanelMode = settings->GetSettingAsInt(
+ ".settings.GeneralSettings.PropertiesPanelMode", vtkPVGeneralSettings::ALL_IN_ONE);
+
+ // Display dock
+ QDockWidget* displayPropertiesDock = 0;
+ if (propertiesPanelMode == vtkPVGeneralSettings::SEPARATE_DISPLAY_PROPERTIES ||
+ propertiesPanelMode == vtkPVGeneralSettings::ALL_SEPARATE )
+ {
+ displayPropertiesDock = new QDockWidget( tr( "TTL_DISPLAY" ), desk );
+ displayPropertiesDock->setObjectName("displayPropertiesDock");
+ displayPropertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
+ desk->addDockWidget( Qt::LeftDockWidgetArea, displayPropertiesDock );
+
+ pqPropertiesPanel* displayPropertiesPanel = new pqPropertiesPanel();
+ displayPropertiesPanel->setObjectName("displayPropertiesPanel");
+ displayPropertiesPanel->setProperty("panelMode", QVariant(2)); // probably to have only the Display part
+ displayPropertiesDock->setWidget(displayPropertiesPanel);
+ myDockWidgets[displayPropertiesDock] = false;
+ displayPropertiesDock->hide();
+ }
+
+ // View dock
+ QDockWidget* viewPropertiesDock = 0;
+ if (propertiesPanelMode == vtkPVGeneralSettings::SEPARATE_VIEW_PROPERTIES ||
+ propertiesPanelMode == vtkPVGeneralSettings::ALL_SEPARATE )
+ {
+ viewPropertiesDock = new QDockWidget( tr( "TTL_VIEW_PANEL" ), desk );
+ viewPropertiesDock->setObjectName("viewPropertiesDock");
+ viewPropertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea );
+ desk->addDockWidget( Qt::LeftDockWidgetArea, viewPropertiesDock );
+
+ pqPropertiesPanel* viewPropertiesPanel = new pqPropertiesPanel();
+ viewPropertiesPanel->setObjectName("viewPropertiesPanel");
+ viewPropertiesPanel->setProperty("panelMode", QVariant(4)); // probably to have only the View part
+ viewPropertiesDock->setWidget(viewPropertiesPanel);
+ myDockWidgets[viewPropertiesDock] = false;
+ viewPropertiesDock->hide();
+ }
+
+ switch (propertiesPanelMode)
+ {
+ case vtkPVGeneralSettings::SEPARATE_DISPLAY_PROPERTIES:
+ propertiesPanel->setPanelMode(
+ pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::VIEW_PROPERTIES);
+ break;
+
+ case vtkPVGeneralSettings::SEPARATE_VIEW_PROPERTIES:
+ propertiesPanel->setPanelMode(
+ pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::DISPLAY_PROPERTIES);
+ break;
+
+ case vtkPVGeneralSettings::ALL_SEPARATE:
+ propertiesPanel->setPanelMode(pqPropertiesPanel::SOURCE_PROPERTIES);
+ break;
+
+ case vtkPVGeneralSettings::ALL_IN_ONE:
+ default:
+ propertiesPanel->setPanelMode(
+ pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::VIEW_PROPERTIES|pqPropertiesPanel::DISPLAY_PROPERTIES);
+ break;
+ }
// Information dock
QDockWidget* informationDock = new QDockWidget(tr( "TTL_INFORMATION" ), desk);
myDockWidgets[informationDock] = true;
-
- desk->tabifyDockWidget(informationDock, propertiesDock);
- desk->tabifyDockWidget(propertiesDock, pipelineBrowserDock);
- //propertiesDock->raise();
+ if ( viewPropertiesDock )
+ desk->tabifyDockWidget(propertiesDock, viewPropertiesDock);
+ if ( displayPropertiesDock )
+ desk->tabifyDockWidget(propertiesDock, displayPropertiesDock);
+ desk->tabifyDockWidget(propertiesDock, informationDock);
+ propertiesDock->raise();
// Statistic View
QDockWidget* statisticsViewDock = new QDockWidget( tr( "TTL_STATISTICS_VIEW" ), desk );
QDockWidget* animationViewDock = new QDockWidget( tr( "TTL_ANIMATION_VIEW" ), desk );
animationViewDock->setObjectName("animationViewDock");
desk->addDockWidget( Qt::BottomDockWidgetArea, animationViewDock );
- pqPVAnimationWidget* animation_panel = new pqPVAnimationWidget(animationViewDock); // [ABN] was resizeHelper
+ pqPVAnimationWidget* animation_panel = new ResizeHelper(animationViewDock); // [ABN] was resizeHelper
+
+ // RNV: Emit signal in order to make sure that animation scene is set
+ QMetaObject::invokeMethod( pqPVApplicationCore::instance()->animationManager(),
+ "activeSceneChanged",
+ Q_ARG( pqAnimationScene*, pqPVApplicationCore::instance()->animationManager()->getActiveScene() ) );
+
animationViewDock->setWidget(animation_panel);
myDockWidgets[animationViewDock] = false; // hidden by default
QDockWidget* multiBlockInspectorPanelDock = new QDockWidget( tr( "TTL_MUTLI_BLOCK_INSPECTOR" ), desk );
multiBlockInspectorPanelDock->setObjectName("multiBlockInspectorPanelDock");
desk->addDockWidget( Qt::LeftDockWidgetArea, multiBlockInspectorPanelDock );
- pqMultiBlockInspectorPanel* mbi_panel = new pqMultiBlockInspectorPanel( multiBlockInspectorPanelDock );
+ pqMultiBlockInspectorWidget* mbi_panel = new pqMultiBlockInspectorWidget( multiBlockInspectorPanelDock );
multiBlockInspectorPanelDock->setWidget(mbi_panel);
myDockWidgets[multiBlockInspectorPanelDock] = false; // hidden by default
/*!
\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 );
+ }
}
}
dw->toggleViewAction()->setVisible( true );
}
- // restore toolbar breaks state
- QMapIterator<QWidget*, bool> it2( myToolbarBreaks );
- while( it2.hasNext() ) {
- it2.next();
- QToolBar* tb = qobject_cast<QToolBar*>( it2.key() );
- if ( myToolbarBreaks[tb] )
- desk->insertToolBarBreak( tb );
- }
-
+ // restore toolbar breaks state
+ QMapIterator<QWidget*, bool> it2( myToolbarBreaks );
+ while( it2.hasNext() ) {
+ it2.next();
+ QToolBar* tb = qobject_cast<QToolBar*>( it2.key() );
+ if ( myToolbarBreaks[tb] )
+ desk->insertToolBarBreak( tb );
+ }
+
// restore toolbar visibility state
QMapIterator<QWidget*, bool> it3( myToolbars );
while( it3.hasNext() ) {
// restoreCommonWindowsState() method, and at the moment of the ParaVis activation we call
// this method.
- //LightApp_Application* anApp = getApp();
- SalomeApp_Application* anApp = getApp();
+ LightApp_Application* anApp = getApp();
if(!anApp)
return;
-// int begin = SalomeApp_Application::WT_ObjectBrowser;
-// int end = SalomeApp_Application::WT_NoteBook;
int begin = LightApp_Application::WT_ObjectBrowser;
int end = LightApp_Application::WT_User;
for( int i = begin; i <= end; i++ ) {
QDockWidget* dock = 0;
QWidget* w = wg->parentWidget();
while ( w && !dock ) {
- dock = ::qobject_cast<QDockWidget*>( w );
- w = w->parentWidget();
+ dock = ::qobject_cast<QDockWidget*>( w );
+ w = w->parentWidget();
}
if(dock){
- if(!myCommonMap.contains(i)){
- myCommonMap.insert(i,dock->isVisible());
- } else {
- myCommonMap[i] = dock->isVisible();
- }
+ if(!myCommonMap.contains(i)){
+ myCommonMap.insert(i,dock->isVisible());
+ } else {
+ myCommonMap[i] = dock->isVisible();
+ }
}
}
}
\brief Restore visibility of the common dockable windows (OB, PyConsole, ... etc.)
*/
void PVGUI_Module::restoreCommonWindowsState() {
- SalomeApp_Application* anApp = getApp();
-// LightApp_Application* anApp = getApp();
+ LightApp_Application* anApp = getApp();
if(!anApp)
return;
DockWindowMap::const_iterator it = myCommonMap.begin();
QDockWidget* dock = 0;
QWidget* w = wg->parentWidget();
while ( w && !dock ) {
- dock = ::qobject_cast<QDockWidget*>( w );
- w = w->parentWidget();
+ dock = ::qobject_cast<QDockWidget*>( w );
+ w = w->parentWidget();
}
if(dock) {
- dock->setVisible(it.value());
+ dock->setVisible(it.value());
}
}
}