X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPVGUI%2FPVGUI_Module_widgets.cxx;h=7ddee81bfcf2221be03b8e2d633d47c44ab9734d;hb=fe837bd5f2aae9a93c8986af24a84520551b2995;hp=965b30b7751dfd11760d3f4e8ba3f3a10f0b48b8;hpb=71e226017e82285fdb81ab04ed32703cff1ba7f3;p=modules%2Fparavis.git diff --git a/src/PVGUI/PVGUI_Module_widgets.cxx b/src/PVGUI/PVGUI_Module_widgets.cxx index 965b30b7..7ddee81b 100644 --- a/src/PVGUI/PVGUI_Module_widgets.cxx +++ b/src/PVGUI/PVGUI_Module_widgets.cxx @@ -23,10 +23,12 @@ // #include "PVGUI_Module.h" +#include "PVViewer_ViewManager.h" +#include "PVViewer_GUIElements.h" #include #include -#include +#include // // should ultimately be a LightApp only #include #include @@ -63,13 +65,16 @@ #include #include #include +#include + +#include 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 BUG IS NATURALLY FIXED BY ADDING // this->updateGeometries(); // TO THE // void pqAnimationWidget::resizeEvent(QResizeEvent* e); @@ -82,7 +87,7 @@ protected: void resizeEvent(QResizeEvent* e) { pqAnimationWidget* w = findChild( "pqAnimationWidget" ); - if ( w ) { + if ( w ) { QShowEvent e; QApplication::sendEvent( w, &e ); } @@ -90,6 +95,8 @@ protected: } }; + + /*! \brief Create dock widgets for ParaView widgets such as object inspector, pipeline browser, etc. ParaView pqMainWindowCore class is fully responsible for these dock widgets' contents. @@ -98,61 +105,105 @@ protected: void PVGUI_Module::setupDockWidgets() { SUIT_Desktop* desk = application()->desktop(); + PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance(desk); desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); + desk->setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North); // Pipeline QDockWidget* pipelineBrowserDock = new QDockWidget( tr( "TTL_PIPELINE_BROWSER" ), desk ); pipelineBrowserDock->setObjectName("pipelineBrowserDock"); pipelineBrowserDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea ); desk->addDockWidget( Qt::LeftDockWidgetArea, pipelineBrowserDock ); - pqPipelineBrowserWidget* browser = new pqPipelineBrowserWidget(pipelineBrowserDock); - pqParaViewMenuBuilders::buildPipelineBrowserContextMenu(*browser); + pqPipelineBrowserWidget* browser = guiElements->getPipelineBrowserWidget(); pipelineBrowserDock->setWidget(browser); myDockWidgets[pipelineBrowserDock] = true; + pipelineBrowserDock->hide(); - // Properties dock (previously called OBJECT_INSPECTOR) + // PROPERTIES, DISPLAY and VIEW: + // See ParaViewMainWindow.cxx - those three panels can be separated or grouped. + pqSettings *settings = pqApplicationCore::instance()->settings(); + + // Properties dock (previously called OBJECT_INSPECTOR) QDockWidget* propertiesDock = new QDockWidget( tr( "TTL_OBJECT_INSPECTOR" ), desk ); propertiesDock->setObjectName("propertiesDock"); - propertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::NoDockWidgetArea|Qt::RightDockWidgetArea ); + propertiesDock->setAllowedAreas( Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea ); desk->addDockWidget( Qt::LeftDockWidgetArea, propertiesDock ); - pqPropertiesPanel* propertiesPanel = new pqPropertiesPanel(propertiesDock); - propertiesDock->setObjectName("propertiesPanel"); + pqPropertiesPanel* propertiesPanel = guiElements->getPropertiesPanel(); propertiesDock->setWidget(propertiesPanel); connect( propertiesPanel, SIGNAL( helpRequested(const QString&, const QString&) ), this, SLOT( showHelpForProxy(const QString&, const QString&) ) ); + // hook delete to pqDeleteReaction. + QAction* tempDeleteAction = new QAction(this); + pqDeleteReaction* handler = new pqDeleteReaction(tempDeleteAction); + handler->connect(propertiesPanel, SIGNAL(deleteRequested(pqPipelineSource*)), SLOT(deleteSource(pqPipelineSource*))); myDockWidgets[propertiesDock] = true; + propertiesDock->hide(); + + // Display dock + QDockWidget* 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 = 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(); + + // Taken from ParaViewMainWindow.cxx: + int propertiesPanelMode = settings->value( + "GeneralSettings.PropertiesPanelMode", vtkPVGeneralSettings::ALL_IN_ONE).toInt(); + switch (propertiesPanelMode) + { + case vtkPVGeneralSettings::SEPARATE_DISPLAY_PROPERTIES: + viewPropertiesDock->hide(); + propertiesPanel->setPanelMode( + pqPropertiesPanel::SOURCE_PROPERTIES|pqPropertiesPanel::VIEW_PROPERTIES); + break; + + case vtkPVGeneralSettings::SEPARATE_VIEW_PROPERTIES: + displayPropertiesDock->hide(); + 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); + viewPropertiesDock->hide(); + displayPropertiesDock->hide(); + break; + } - //Display Dock -// QDockWidget* displayDock = new QDockWidget( tr( "TTL_DISPLAY" ), desk ); -// displayDock->setObjectName("displayDock"); -// QWidget* displayWidgetFrame = new QWidget(displayDock); -// displayWidgetFrame->setObjectName("displayWidgetFrame"); -// displayDock->setWidget(displayWidgetFrame); -// -// QScrollArea* displayScrollArea = new QScrollArea(displayWidgetFrame); -// displayScrollArea->setObjectName("displayScrollArea"); -// displayScrollArea->setWidgetResizable(true); -// -// QVBoxLayout* verticalLayout = new QVBoxLayout(displayWidgetFrame); -// verticalLayout->setSpacing(0); -// verticalLayout->setContentsMargins(0, 0, 0, 0); -// -// pqDisplayProxyEditorWidget* displayWidget = new pqDisplayProxyEditorWidget(displayDock); -// displayWidget->setObjectName("displayWidget"); -// displayScrollArea->setWidget(displayWidget); -// verticalLayout->addWidget(displayScrollArea); -// -// myDockWidgets[displayDock] = true; - - // information dock + // Information dock QDockWidget* informationDock = new QDockWidget(tr( "TTL_INFORMATION" ), desk); informationDock->setObjectName("informationDock"); QWidget* informationWidgetFrame = new QWidget(informationDock); informationWidgetFrame->setObjectName("informationWidgetFrame"); - + QVBoxLayout* verticalLayout_2 = new QVBoxLayout(informationWidgetFrame); verticalLayout_2->setSpacing(0); verticalLayout_2->setContentsMargins(0, 0, 0, 0); @@ -171,7 +222,8 @@ void PVGUI_Module::setupDockWidgets() myDockWidgets[informationDock] = true; - desk->setTabPosition(Qt::LeftDockWidgetArea, QTabWidget::North); + desk->tabifyDockWidget(propertiesDock, viewPropertiesDock); + desk->tabifyDockWidget(propertiesDock, displayPropertiesDock); desk->tabifyDockWidget(propertiesDock, informationDock); propertiesDock->raise(); @@ -189,7 +241,7 @@ void PVGUI_Module::setupDockWidgets() QDockWidget* animationViewDock = new QDockWidget( tr( "TTL_ANIMATION_VIEW" ), desk ); animationViewDock->setObjectName("animationViewDock"); desk->addDockWidget( Qt::BottomDockWidgetArea, animationViewDock ); - pqPVAnimationWidget* animation_panel = new ResizeHelper(animationViewDock); //pqPVAnimationWidget + pqPVAnimationWidget* animation_panel = new ResizeHelper(animationViewDock); // [ABN] was resizeHelper animationViewDock->setWidget(animation_panel); myDockWidgets[animationViewDock] = false; // hidden by default @@ -277,9 +329,9 @@ void PVGUI_Module::setupDockWidgets() aProgress->setEnabled(true); // Set up the dock window corners to give the vertical docks more room. - desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); - desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); - +// desk->setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea); +// desk->setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea); + // Setup the default dock configuration ... statisticsViewDock->hide(); comparativePanelDock->hide(); @@ -360,14 +412,16 @@ void PVGUI_Module::restoreDockWidgetsState() dw->setVisible( it1.value() ); dw->toggleViewAction()->setVisible( true ); } - // restore toolbar breaks state - QMapIterator it2( myToolbarBreaks ); - while( it2.hasNext() ) { - it2.next(); - QToolBar* tb = qobject_cast( it2.key() ); - if ( myToolbarBreaks[tb] ) - desk->insertToolBarBreak( tb ); - } + + // restore toolbar breaks state + QMapIterator it2( myToolbarBreaks ); + while( it2.hasNext() ) { + it2.next(); + QToolBar* tb = qobject_cast( it2.key() ); + if ( myToolbarBreaks[tb] ) + desk->insertToolBarBreak( tb ); + } + // restore toolbar visibility state QMapIterator it3( myToolbars ); while( it3.hasNext() ) { @@ -396,27 +450,30 @@ void PVGUI_Module::storeCommonWindowsState() { // restoreCommonWindowsState() method, and at the moment of the ParaVis activation we call // this method. + //LightApp_Application* anApp = getApp(); SalomeApp_Application* anApp = getApp(); if(!anApp) return; - int begin = SalomeApp_Application::WT_ObjectBrowser; - int end = SalomeApp_Application::WT_NoteBook; +// 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++ ) { QWidget* wg = anApp->getWindow(i); if(wg) { QDockWidget* dock = 0; QWidget* w = wg->parentWidget(); while ( w && !dock ) { - dock = ::qobject_cast( w ); - w = w->parentWidget(); + dock = ::qobject_cast( 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(); + } } } } @@ -427,6 +484,7 @@ void PVGUI_Module::storeCommonWindowsState() { */ void PVGUI_Module::restoreCommonWindowsState() { SalomeApp_Application* anApp = getApp(); +// LightApp_Application* anApp = getApp(); if(!anApp) return; DockWindowMap::const_iterator it = myCommonMap.begin(); @@ -436,11 +494,11 @@ void PVGUI_Module::restoreCommonWindowsState() { QDockWidget* dock = 0; QWidget* w = wg->parentWidget(); while ( w && !dock ) { - dock = ::qobject_cast( w ); - w = w->parentWidget(); + dock = ::qobject_cast( w ); + w = w->parentWidget(); } if(dock) { - dock->setVisible(it.value()); + dock->setVisible(it.value()); } } }