From d156160daff1a3d52cddbc0d99f503607a6ae789 Mon Sep 17 00:00:00 2001 From: jonjenssen <69144954+jonjenssen@users.noreply.github.com> Date: Thu, 7 Apr 2022 16:24:27 +0200 Subject: [PATCH] Summary Multiplot: sync plot selection in tree with view (#8788) * Make sure the subplot selected in the tree is shown in the multiplot viewer. * Clean up multiplot toolbar handling a bit * Remove old summary plot toolbar. --- .../Commands/RicCloseSummaryCaseFeature.cpp | 2 +- ...RicCloseSummaryCaseInCollectionFeature.cpp | 2 +- .../Commands/RicImportSummaryCasesFeature.cpp | 4 +- .../Commands/RicImportSummaryGroupFeature.cpp | 3 +- .../CMakeLists_files.cmake | 2 - ...RicActivateCurveFilterInToolbarFeature.cpp | 59 ------------- .../RicActivateCurveFilterInToolbarFeature.h | 34 -------- .../RicNewSummaryCrossPlotCurveFeature.cpp | 2 +- .../RicNewSummaryCurveFeature.cpp | 2 +- .../RicNewSummaryEnsembleCurveSetFeature.cpp | 4 +- .../RicSummaryPlotEditorUi.cpp | 4 +- .../ProjectDataModel/RimMultiPlot.cpp | 32 ++----- .../ProjectDataModel/RimMultiPlot.h | 10 +-- .../RimObservedDataCollection.cpp | 2 +- .../Summary/RimEnsembleCurveSet.cpp | 2 +- .../Summary/RimSummaryCurve.cpp | 4 +- .../Summary/RimSummaryMultiPlot.cpp | 11 +++ .../Summary/RimSummaryMultiPlot.h | 4 +- .../Summary/RimSummaryPlotCollection.cpp | 2 +- ...RimSummaryPlotFilterTextCurveSetEditor.cpp | 2 +- .../Summary/RimSummaryPlotSourceStepping.cpp | 7 +- .../ProjectDataModelCommands/RimcProject.cpp | 2 +- .../UserInterface/RiuMultiPlotBook.cpp | 18 ++++ .../UserInterface/RiuMultiPlotBook.h | 2 + .../UserInterface/RiuPlotMainWindow.cpp | 86 +++---------------- .../UserInterface/RiuPlotMainWindow.h | 3 - .../UserInterface/RiuPlotMainWindowTools.cpp | 1 - 27 files changed, 78 insertions(+), 228 deletions(-) delete mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.cpp delete mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.h diff --git a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp index e36249b35e..f55126f8cb 100644 --- a/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseSummaryCaseFeature.cpp @@ -75,7 +75,7 @@ void RicCloseSummaryCaseFeature::deleteSummaryCases( std::vectorupdateAllRequiredEditors(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); caf::AsyncPdmObjectVectorDeleter summaryCaseDeleter( cases ); CAF_ASSERT( cases.empty() ); // vector should be empty immediately. diff --git a/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp b/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp index c8b32cccb4..06fa3973d6 100644 --- a/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp +++ b/ApplicationLibCode/Commands/RicCloseSummaryCaseInCollectionFeature.cpp @@ -96,5 +96,5 @@ void RicCloseSummaryCaseInCollectionFeature::onActionTriggered( bool isChecked ) } RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } diff --git a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp index 301dccc655..ac34166353 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryCasesFeature.cpp @@ -98,7 +98,7 @@ void RicImportSummaryCasesFeature::onActionTriggered( bool isChecked ) RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow(); if ( mainPlotWindow && !cases.empty() ) { - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } std::vector allCases; @@ -147,7 +147,7 @@ bool RicImportSummaryCasesFeature::createAndAddSummaryCasesFromFiles( const QStr RiuPlotMainWindow* mainPlotWindow = app->getOrCreateAndShowMainPlotWindow(); if ( mainPlotWindow && !cases->empty() ) { - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); // Close main window if there are no eclipse cases imported std::vector allCases; diff --git a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp index 98b2a4bc66..6a7bdd22b8 100644 --- a/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp +++ b/ApplicationLibCode/Commands/RicImportSummaryGroupFeature.cpp @@ -71,8 +71,7 @@ void RicImportSummaryGroupFeature::onActionTriggered( bool isChecked ) if ( mainPlotWindow && !cases.empty() ) { mainPlotWindow->selectAsCurrentItem( cases.back() ); - - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } std::vector allCases; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index ae7cbc1ec2..e2fb7c775f 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -41,7 +41,6 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingSummaryCurveFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicClearSourceSteppingEnsembleCurveSetFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.h - ${CMAKE_CURRENT_LIST_DIR}/RicActivateCurveFilterInToolbarFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicNewPlotAxisPropertiesFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.h @@ -90,7 +89,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingSummaryCurveFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicClearSourceSteppingEnsembleCurveSetFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSetSourceSteppingEnsembleCurveSetFeature.cpp - ${CMAKE_CURRENT_LIST_DIR}/RicActivateCurveFilterInToolbarFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewDerivedSummaryFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewPlotAxisPropertiesFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicShowSummaryPlotManagerFeature.cpp diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.cpp deleted file mode 100644 index 8e4ff89a6d..0000000000 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.cpp +++ /dev/null @@ -1,59 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2019- Equinor ASA -// -// ResInsight is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#include "RicActivateCurveFilterInToolbarFeature.h" - -#include "RiaGuiApplication.h" -#include "RiuPlotMainWindow.h" - -#include - -CAF_CMD_SOURCE_INIT( RicActivateCurveFilterInToolbarFeature, "RicActivateCurveFilterInToolbarFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicActivateCurveFilterInToolbarFeature::isCommandEnabled() -{ - return true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicActivateCurveFilterInToolbarFeature::onActionTriggered( bool isChecked ) -{ - if ( RiaGuiApplication::isRunning() ) - { - auto plotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - if ( plotWindow ) - { - plotWindow->setFocusToLineEditInSummaryToolBar(); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicActivateCurveFilterInToolbarFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Activate Summary Curve Filter Editor" ); - - applyShortcutWithHintToAction( actionToSetup, QKeySequence( tr( "Ctrl+F" ) ) ); -} diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.h deleted file mode 100644 index 8352953ce0..0000000000 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicActivateCurveFilterInToolbarFeature.h +++ /dev/null @@ -1,34 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2019- Equinor ASA -// -// ResInsight is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY -// WARRANTY; without even the implied warranty of MERCHANTABILITY or -// FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at -// for more details. -// -///////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "cafCmdFeature.h" - -//================================================================================================== -/// -//================================================================================================== -class RicActivateCurveFilterInToolbarFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - bool isCommandEnabled() override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; -}; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp index 70e3385ea6..995fd126c7 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCrossPlotCurveFeature.cpp @@ -77,7 +77,7 @@ void RicNewSummaryCrossPlotCurveFeature::onActionTriggered( bool isChecked ) RiaGuiApplication::instance()->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem( newCurve ); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp index c03c8c1786..73a27ea346 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryCurveFeature.cpp @@ -107,7 +107,7 @@ void RicNewSummaryCurveFeature::onActionTriggered( bool isChecked ) app->getOrCreateAndShowMainPlotWindow()->selectAsCurrentItem( newCurve ); RiuPlotMainWindow* mainPlotWindow = app->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp index cc1ac22e64..1e96749245 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicNewSummaryEnsembleCurveSetFeature.cpp @@ -130,7 +130,7 @@ RimSummaryPlot* if ( mainPlotWindow ) { mainPlotWindow->selectAsCurrentItem( firstCurveSetCreated ); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } return plot; } @@ -183,7 +183,7 @@ void RicNewSummaryEnsembleCurveSetFeature::onActionTriggered( bool isChecked ) if ( mainPlotWindow && firstCurveSet ) { mainPlotWindow->selectAsCurrentItem( firstCurveSet ); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index eba17f33f3..99a13559fd 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -236,7 +236,7 @@ void RicSummaryPlotEditorUi::fieldChangedByUi( const caf::PdmFieldHandle* change field->setValueWithFieldChanged( true ); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } else if ( changedField == &m_useAutoAppearanceAssignment && m_useAutoAppearanceAssignment ) { @@ -861,7 +861,7 @@ void RicSummaryPlotEditorUi::createNewPlot() m_targetPlot = newSummaryPlot; RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 7045f81689..121e1d804a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -492,30 +492,6 @@ int RimMultiPlot::rowsPerPage() const return rowCount; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimMultiPlot::columnCountField() -{ - return &m_columnCount; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimMultiPlot::rowsPerPageField() -{ - return &m_rowsPerPage; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -caf::PdmFieldHandle* RimMultiPlot::pagePreviewField() -{ - return &m_pagePreviewMode; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -913,3 +889,11 @@ bool RimMultiPlot::isMouseCursorInsidePlot() if ( !m_viewer ) return false; return m_viewer->underMouse(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RimMultiPlot::fieldsToShowInToolbar() +{ + return { &m_pagePreviewMode, &m_columnCount, &m_rowsPerPage }; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 4333a6f306..a0af751746 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -89,11 +89,8 @@ public: void setRowCount( RiaDefines::RowCount rowCount ); void setTickmarkCount( RimPlotAxisPropertiesInterface::LegendTickmarkCountEnum tickmarkCount ); - int columnCount() const override; - int rowsPerPage() const; - caf::PdmFieldHandle* columnCountField(); - caf::PdmFieldHandle* rowsPerPageField(); - caf::PdmFieldHandle* pagePreviewField(); + int columnCount() const override; + int rowsPerPage() const; void setShowPlotTitles( bool enable ); bool showPlotTitles() const; @@ -108,6 +105,8 @@ public: int axisTitleFontSize() const; int axisValueFontSize() const; + virtual std::vector fieldsToShowInToolbar(); + protected: QImage snapshotWindowContent() override; @@ -129,7 +128,6 @@ protected: void onLoadDataAndUpdate() override; void initAfterRead() override; - void applyPlotWindowTitleToWidgets(); void updatePlots(); void updateZoom(); diff --git a/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp index c68f220683..4d0a3322ce 100644 --- a/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimObservedDataCollection.cpp @@ -128,7 +128,7 @@ void updateNewObservedDataCreated( caf::PdmObject* object ) caf::PdmUiObjectEditorHandle::updateUiAllObjectEditors(); RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); - if ( mpw ) mpw->updateSummaryPlotToolBar(); + if ( mpw ) mpw->updateMultiPlotToolBar(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp index ba20062352..80ecaaadeb 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimEnsembleCurveSet.cpp @@ -795,7 +795,7 @@ void RimEnsembleCurveSet::fieldChangedByUi( const caf::PdmFieldHandle* changedFi plot->updateConnectedEditors(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index 7a0920359e..481f39cbf3 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -1076,7 +1076,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, plot->updatePlotTitle(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); // If no plot collection is found, we assume that we are inside a curve creator // Update the summary curve collection to make sure the curve names are updated in curve creator UI @@ -1236,7 +1236,7 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, plot->updateConnectedEditors(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); dataChanged.send(); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp index 0ab5bcaaf9..93ade2680b 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.cpp @@ -449,6 +449,9 @@ std::vector RimSummaryMultiPlot::fieldsToShowInToolbar() toolBarFields.insert( std::end( toolBarFields ), std::begin( fields ), std::end( fields ) ); } + auto multiFields = RimMultiPlot::fieldsToShowInToolbar(); + toolBarFields.insert( std::end( toolBarFields ), std::begin( multiFields ), std::end( multiFields ) ); + return toolBarFields; } @@ -580,6 +583,14 @@ void RimSummaryMultiPlot::duplicate() duplicatePlot.send( this ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimSummaryMultiPlot::makeSureIsVisible( RimSummaryPlot* summaryPlot ) +{ + if ( summaryPlot->plotWidget() && !m_viewer.isNull() ) m_viewer->scrollToPlot( summaryPlot->plotWidget() ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h index ce9e708ff5..c728fa3af5 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlot.h @@ -68,7 +68,7 @@ public: void removePlotNoUpdate( RimPlot* plot ) override; void updateAfterPlotRemove() override; - std::vector fieldsToShowInToolbar(); + std::vector fieldsToShowInToolbar() override; void syncAxisRanges(); @@ -79,6 +79,8 @@ public: std::vector summaryPlots() const; std::vector visibleSummaryPlots() const; + void makeSureIsVisible( RimSummaryPlot* plot ); + protected: bool handleGlobalKeyEvent( QKeyEvent* keyEvent ) override; bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp index b83ada7e01..849f07dc67 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp @@ -112,7 +112,7 @@ void RimSummaryPlotCollection::onChildDeleted( caf::PdmChildArrayFieldHandle* { updateSummaryNameHasChanged(); RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp index e6b1769d16..62e75f7f39 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotFilterTextCurveSetEditor.cpp @@ -236,7 +236,7 @@ void RimSummaryPlotFilterTextCurveSetEditor::fieldChangedByUi( const caf::PdmFie RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); if ( mainPlotWindow ) { - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp index d43c81781a..6931ce7daa 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotSourceStepping.cpp @@ -397,9 +397,8 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* ensembleCurveColl->updateConnectedEditors(); } - RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); - bool forceUpdateOfFieldsInToolbar = true; - mainPlotWindow->updateSummaryPlotToolBar( forceUpdateOfFieldsInToolbar ); + RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); + mainPlotWindow->updateMultiPlotToolBar(); return; } @@ -597,7 +596,7 @@ void RimSummaryPlotSourceStepping::fieldChangedByUi( const caf::PdmFieldHandle* } RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp index 761b62e297..7a2c2be9e6 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcProject.cpp @@ -76,7 +76,7 @@ caf::PdmObjectHandle* RimProject_importSummaryCase::execute() RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); if ( mainPlotWindow && !newCases.empty() ) { - mainPlotWindow->updateSummaryPlotToolBar(); + mainPlotWindow->updateMultiPlotToolBar(); } } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 4176c29162..46501fe82e 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -663,6 +663,24 @@ void RiuMultiPlotBook::changeCurrentPage( int pageNumber ) if ( !m_pages.isEmpty() ) m_scrollArea->ensureWidgetVisible( m_pages[m_currentPageIndex] ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMultiPlotBook::scrollToPlot( RiuPlotWidget* plotWidget ) +{ + int pageNum = 0; + + for ( auto& page : m_pages ) + { + if ( page->indexOfPlotWidget( plotWidget ) >= 0 ) + { + changeCurrentPage( pageNum ); + return; + } + pageNum++; + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h index 92e81807e9..ff25420e97 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h @@ -84,6 +84,8 @@ public: void renderTo( QPaintDevice* painter ); + void scrollToPlot( RiuPlotWidget* plotWidget ); + void goToNextPage(); void goToPrevPage(); void goToLastPage(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 222f81de60..2eed1333db 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -196,7 +196,6 @@ void RiuPlotMainWindow::cleanupGuiBeforeProjectClose() cleanUpTemporaryWidgets(); m_wellLogPlotToolBarEditor->clear(); - m_summaryPlotToolBarEditor->clear(); m_multiPlotToolBarEditor->clear(); setWindowTitle( "Plots - ResInsight" ); @@ -429,9 +428,6 @@ void RiuPlotMainWindow::createToolBars() m_wellLogPlotToolBarEditor = std::make_unique( "Well Log Plot", this ); m_wellLogPlotToolBarEditor->hide(); - m_summaryPlotToolBarEditor = std::make_unique( "Summary Plot", this ); - m_summaryPlotToolBarEditor->hide(); - m_multiPlotToolBarEditor = std::make_unique( "Multi Plot", this ); m_multiPlotToolBarEditor->hide(); @@ -691,9 +687,8 @@ void RiuPlotMainWindow::updateMultiPlotToolBar() RimMultiPlot* plotWindow = dynamic_cast( m_activePlotViewWindow.p() ); if ( plotWindow ) { - std::vector toolBarFields = { plotWindow->pagePreviewField(), - plotWindow->columnCountField(), - plotWindow->rowsPerPageField() }; + std::vector toolBarFields = plotWindow->fieldsToShowInToolbar(); + m_multiPlotToolBarEditor->setFields( toolBarFields ); m_multiPlotToolBarEditor->updateUi(); m_multiPlotToolBarEditor->show(); @@ -706,61 +701,6 @@ void RiuPlotMainWindow::updateMultiPlotToolBar() refreshToolbars(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindow::updateSummaryPlotToolBar( bool forceUpdateUi ) -{ - RimSummaryPlot* summaryPlot = dynamic_cast( m_activePlotViewWindow.p() ); - RimSummaryMultiPlot* summaryMultiPlot = dynamic_cast( m_activePlotViewWindow.p() ); - - std::vector toolBarFields; - - if ( summaryMultiPlot ) - { - toolBarFields = summaryMultiPlot->fieldsToShowInToolbar(); - } - else if ( summaryPlot ) - { - toolBarFields = summaryPlot->fieldsToShowInToolbar(); - } - - if ( toolBarFields.size() > 0 ) - { - QString keyword; - - if ( !m_summaryPlotToolBarEditor->isEditorDataValid( toolBarFields ) ) - { - keyword = m_summaryPlotToolBarEditor->keywordForFocusWidget(); - - m_summaryPlotToolBarEditor->setFields( toolBarFields ); - } - - m_summaryPlotToolBarEditor->updateUi( caf::PdmUiToolBarEditor::uiEditorConfigName() ); - m_summaryPlotToolBarEditor->show(); - m_summaryPlotToolBarEditor->setFocusWidgetFromKeyword( keyword ); - } - else - { - m_summaryPlotToolBarEditor->clear(); - m_summaryPlotToolBarEditor->hide(); - } - - refreshToolbars(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindow::setFocusToLineEditInSummaryToolBar() -{ - if ( m_summaryPlotToolBarEditor ) - { - m_summaryPlotToolBarEditor->setFocusWidgetFromKeyword( - RimSummaryPlotFilterTextCurveSetEditor::curveFilterFieldKeyword() ); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -901,7 +841,6 @@ void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow ) } updateWellLogPlotToolBar(); - updateSummaryPlotToolBar(); updateMultiPlotToolBar(); } @@ -1005,20 +944,17 @@ void RiuPlotMainWindow::selectedObjectsChanged() if ( firstSelectedObject ) { - RimSummaryPlot* summaryPlot = nullptr; - firstSelectedObject->firstAncestorOrThisOfType( summaryPlot ); - if ( summaryPlot ) + RimSummaryMultiPlot* multiSummaryPlot = nullptr; + firstSelectedObject->firstAncestorOrThisOfType( multiSummaryPlot ); + if ( multiSummaryPlot ) { - updateSummaryPlotToolBar(); - } - else - { - RimSummaryMultiPlot* multiSummaryPlot = nullptr; - firstSelectedObject->firstAncestorOrThisOfType( multiSummaryPlot ); - if ( multiSummaryPlot ) + updateMultiPlotToolBar(); + + RimSummaryPlot* summaryPlot = nullptr; + firstSelectedObject->firstAncestorOrThisOfType( summaryPlot ); + if ( summaryPlot ) { - updateSummaryPlotToolBar(); - updateMultiPlotToolBar(); + multiSummaryPlot->makeSureIsVisible( summaryPlot ); } } } diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 3c16eafebe..ce3663a78d 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -85,8 +85,6 @@ public: void updateWellLogPlotToolBar(); void updateMultiPlotToolBar(); - void updateSummaryPlotToolBar( bool forceUpdateUi = false ); - void setFocusToLineEditInSummaryToolBar(); RicSummaryPlotEditorDialog* summaryCurveCreatorDialog( bool createIfNotPresent ); RicSummaryCurveCalculatorDialog* summaryCurveCalculatorDialog( bool createIfNotPresent ); @@ -136,7 +134,6 @@ private: std::unique_ptr m_wellLogPlotToolBarEditor; std::unique_ptr m_multiPlotToolBarEditor; - std::unique_ptr m_summaryPlotToolBarEditor; std::unique_ptr m_pdmUiPropertyView; std::unique_ptr m_summaryPlotManagerView; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp index 60390a91e2..c6b4069b40 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp @@ -94,7 +94,6 @@ void RiuPlotMainWindowTools::refreshToolbars() if ( mpw ) { - mpw->updateSummaryPlotToolBar(); mpw->updateWellLogPlotToolBar(); mpw->updateMultiPlotToolBar(); }