From 915f059fd9bdf618ab1ecdd9c54a65ef21d56301 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Tue, 7 Apr 2026 10:26:10 +0200 Subject: [PATCH 01/47] Testing --- .../Commands/3dView/CMakeLists_files.cmake | 2 + .../3dView/RicPopOutTo3dViewFeature.cpp | 64 +++++++++++++++++++ .../3dView/RicPopOutTo3dViewFeature.h | 34 ++++++++++ .../3dView/RicPopOutToPlotViewFeature.cpp | 61 ++++++++++++++++++ .../3dView/RicPopOutToPlotViewFeature.h | 34 ++++++++++ .../ProjectDataModel/Rim3dView.cpp | 34 ++++++++++ .../ProjectDataModel/Rim3dView.h | 11 +++- .../UserInterface/RiuMainWindow.cpp | 12 ++++ .../UserInterface/RiuMainWindow.h | 2 + .../UserInterface/RiuMainWindowBase.h | 2 + .../UserInterface/RiuPlotMainWindow.cpp | 10 +++ .../UserInterface/RiuPlotMainWindow.h | 1 + 12 files changed, 266 insertions(+), 1 deletion(-) create mode 100644 ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.cpp create mode 100644 ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.h create mode 100644 ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.cpp create mode 100644 ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.h diff --git a/ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake b/ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake index 372fa0843a6..4779084ce24 100644 --- a/ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake @@ -1,6 +1,8 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicApplyUserDefinedCameraFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicStoreUserDefinedCameraFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicPopOutTo3dViewFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicPopOutToPlotViewFeature.cpp ) list(APPEND COMMAND_CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES}) diff --git a/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.cpp b/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.cpp new file mode 100644 index 00000000000..276e25fcbe0 --- /dev/null +++ b/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.cpp @@ -0,0 +1,64 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2026 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 "RicPopOutTo3dViewFeature.h" + +#include "RiaGuiApplication.h" + +#include "RimGridView.h" +#include "RiuMainWindow.h" + +#include "RiuViewer.h" + +#include "cafSelectionManager.h" + +#include +#include + +CAF_CMD_SOURCE_INIT( RicPopOutTo3dViewFeature, "RicPopOutTo3dViewFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicPopOutTo3dViewFeature::isCommandEnabled() const +{ + if ( auto view = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ) ) + { + return !view->isDockingViewer(); + } + return false; + + //-------------------------------------------------------------------------------------------------- + /// + //-------------------------------------------------------------------------------------------------- + void RicPopOutTo3dViewFeature::onActionTriggered( bool isChecked ) + { + if ( auto view = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ) ) + { + view->convertToDocking( RiaGuiApplication::instance()->mainWindow() ); + } + } + + //-------------------------------------------------------------------------------------------------- + /// + //-------------------------------------------------------------------------------------------------- + void RicPopOutTo3dViewFeature::setupActionLook( QAction * actionToSetup ) + { + actionToSetup->setText( "Pop Out (in 3D View)" ); + actionToSetup->setIcon( QIcon( ":/3DWindow.svg" ) ); + } diff --git a/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.h b/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.h new file mode 100644 index 00000000000..7c62afa512f --- /dev/null +++ b/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2026 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 RicPopOutTo3dViewFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() const override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.cpp b/ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.cpp new file mode 100644 index 00000000000..6218552a361 --- /dev/null +++ b/ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.cpp @@ -0,0 +1,61 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2026 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 "RicPopOutToPlotViewFeature.h" + +#include "RiaGuiApplication.h" + +#include "RimGridView.h" +#include "RiuMainWindow.h" + +#include "RiuViewer.h" + +#include "cafSelectionManager.h" + +#include +#include + +CAF_CMD_SOURCE_INIT( RicPopOutToPlotViewFeature, "RicPopOutToPlotViewFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicPopOutToPlotViewFeature::isCommandEnabled() const +{ + return true; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicPopOutToPlotViewFeature::onActionTriggered( bool isChecked ) +{ + if ( auto view = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ) ) + { + view->convertToDocking( RiaGuiApplication::instance()->mainPlotWindow() ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicPopOutToPlotViewFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Pop Out (in Plot View)" ); + actionToSetup->setIcon( QIcon( ":/PlotWindow.svg" ) ); +} diff --git a/ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.h b/ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.h new file mode 100644 index 00000000000..a7ac6d0a30c --- /dev/null +++ b/ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2026 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 RicPopOutToPlotViewFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() const override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 242ca265d56..45b12e3def2 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -21,6 +21,7 @@ #include "RiaApplication.h" #include "RiaFieldHandleTools.h" +#include "RiaGuiApplication.h" #include "RiaOptionItemFactory.h" #include "RiaPreferences.h" #include "RiaPreferencesSystem.h" @@ -52,12 +53,14 @@ #include "RiuTimeStepChangedHandler.h" #include "RiuViewer.h" +#include "cafCmdFeatureMenuBuilder.h" #include "cafDisplayCoordTransform.h" #include "cafFrameAnimationControl.h" #include "cafPdmFieldScriptingCapability.h" #include "cafPdmFieldScriptingCapabilityCvfColor3.h" #include "cafPdmFieldScriptingCapabilityCvfVec3d.h" #include "cafPdmUiComboBoxEditor.h" + #include "cvfCamera.h" #include "cvfModelBasicList.h" #include "cvfPart.h" @@ -1897,3 +1900,34 @@ void Rim3dView::synchronizeLocalAnnotationsFromGlobal() } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dView::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const +{ + if ( isDockingViewer() ) + { + } + else + { + menuBuilder << "RicPopOutTo3dViewFeature"; + menuBuilder << "RicPopOutToPlotViewFeature"; + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dView::convertToDocking( RiuMainWindowBase* mainWindow ) +{ + if ( isDockingViewer() ) return; + + removeMdiWindowFromMdiArea(); + + QWidget* viewWidget = createViewWidget( nullptr ); + + mainWindow->initializeDockingViewer( viewWidget ); + updateViewWidgetAfterCreation(); + scheduleCreateDisplayModelAndRedraw(); +} \ No newline at end of file diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.h b/ApplicationLibCode/ProjectDataModel/Rim3dView.h index 658393f66c4..91617d64b19 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.h +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.h @@ -53,6 +53,7 @@ class RiuViewer; class RivAnnotationsPartMgr; class RivMeasurementPartMgr; class RivWellPathsPartMgr; +class RiuMainWindowBase; class RimViewNameConfig; namespace cvf @@ -95,6 +96,8 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public int id() const final; + bool isDockingViewer() const { return m_isDockingViewer; } + // Public fields: caf::PdmField isPerspectiveView; @@ -203,6 +206,8 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public RimAnnotationInViewCollection* annotationCollection() const; void synchronizeLocalAnnotationsFromGlobal(); + void convertToDocking( RiuMainWindowBase* mainWindow ); + protected: static void removeModelByName( cvf::Scene* scene, const cvf::String& modelName ); @@ -256,6 +261,8 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public void onViewNavigationChanged() override; + void appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const override; + protected: caf::PdmFieldHandle* userDescriptionField() override; caf::PdmFieldHandle* backgroundColorField(); @@ -326,7 +333,7 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public QPointer m_viewer; QPointer m_overrideViewer; bool m_isCallingUpdateDisplayModelForCurrentTimestepAndRedraw; // To avoid infinite recursion if comparison views - // are pointing to each other. + // are pointing to each other. // Fields caf::PdmField m_id; @@ -359,4 +366,6 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public std::unique_ptr m_animationTimer; const int m_animationIntervalMillisec; int m_animationTimerUsers; + + bool m_isDockingViewer; }; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index e17e949922d..0a206e0312f 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -1274,6 +1274,18 @@ void RiuMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, slotRefreshViewActions(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindow::initializeDockingViewer( QWidget* viewer ) +{ + auto dockViewer = RiuDockWidgetTools::createDockWidget( "3D Viewer", "3D view", dockManager() ); + dockViewer->setWidget( viewer ); + dockManager()->addDockWidgetFloating( dockViewer ); + + slotRefreshViewActions(); +} + //-------------------------------------------------------------------------------------------------- /// This method needs to handle memory deallocation !!! //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index 1f7bc10012a..b3910c02f4e 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -101,6 +101,8 @@ class RiuMainWindow : public RiuMainWindowBase void initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override; void setActiveViewer( QWidget* subWindow ) override; + void initializeDockingViewer( QWidget* viewer ) override; + void setResultInfo( const QString& info ) const; void refreshViewActions(); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 6b94a3bb7ac..2821782b318 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -72,6 +72,8 @@ class RiuMainWindowBase : public QMainWindow virtual void initializeViewer( QMdiSubWindow* viewWindow, QWidget* viewWidget, const RimMdiWindowGeometry& windowsGeometry ) = 0; virtual void setActiveViewer( QWidget* subWindow ) = 0; + virtual void initializeDockingViewer( QWidget* viewer ) = 0; + virtual QMdiSubWindow* findMdiSubWindow( QWidget* viewer ) = 0; RimMdiWindowGeometry windowGeometryForViewer( QWidget* viewer ); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 4b6eb837fdf..de7490e1f91 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -865,6 +865,16 @@ void RiuPlotMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* vie refreshToolbars(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotMainWindow::initializeDockingViewer( QWidget* viewer ) +{ + auto dockViewer = RiuDockWidgetTools::createDockWidget( "3D Viewer", "3D view", dockManager() ); + dockViewer->setWidget( viewer ); + dockManager()->addDockWidgetFloating( dockViewer ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 89d4d4d3879..65112e2af9c 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -71,6 +71,7 @@ class RiuPlotMainWindow : public RiuMainWindowBase void removeViewer( QWidget* viewer ) override; void initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override; void setActiveViewer( QWidget* subWindow ) override; + void initializeDockingViewer( QWidget* viewer ) override; void setDefaultWindowSize(); void enable3DSelectionLink( bool enable ); From 2d98ed3e5d7a82ba2da90c475e0a230397374deb Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 7 Apr 2026 18:29:02 +0200 Subject: [PATCH 02/47] Work in progress --- .../Commands/3dView/CMakeLists_files.cmake | 1 + .../3dView/RicConvert3dToMdiFeature.cpp | 65 ++++++++++++++++ .../3dView/RicConvert3dToMdiFeature.h | 34 +++++++++ .../3dView/RicPopOutTo3dViewFeature.cpp | 33 +++++---- .../ProjectDataModel/Rim3dView.cpp | 26 ++++++- .../ProjectDataModel/Rim3dView.h | 10 ++- .../ProjectDataModel/RimViewWindow.h | 5 +- .../UserInterface/RiuMainWindow.cpp | 74 ++++++++++--------- .../UserInterface/RiuMainWindow.h | 2 +- .../UserInterface/RiuMainWindowBase.cpp | 19 ++--- .../UserInterface/RiuMainWindowBase.h | 6 +- .../UserInterface/RiuPlotMainWindow.cpp | 64 ++++++++-------- .../UserInterface/RiuPlotMainWindow.h | 8 +- 13 files changed, 243 insertions(+), 104 deletions(-) create mode 100644 ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.cpp create mode 100644 ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.h diff --git a/ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake b/ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake index 4779084ce24..20ad2ccb4a2 100644 --- a/ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake @@ -3,6 +3,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicStoreUserDefinedCameraFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicPopOutTo3dViewFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicPopOutToPlotViewFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicConvert3dToMdiFeature.cpp ) list(APPEND COMMAND_CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES}) diff --git a/ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.cpp b/ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.cpp new file mode 100644 index 00000000000..18b3d0f2f2e --- /dev/null +++ b/ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.cpp @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2026 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 "RicConvert3dToMdiFeature.h" + +#include "RiaGuiApplication.h" + +#include "RimGridView.h" +#include "RiuMainWindow.h" + +#include "RiuViewer.h" + +#include "cafSelectionManager.h" + +#include +#include + +CAF_CMD_SOURCE_INIT( RicConvert3dToMdiFeature, "RicConvert3dToMdiFeature" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RicConvert3dToMdiFeature::isCommandEnabled() const +{ + if ( auto view = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ) ) + { + return view->isDockingViewer(); + } + return false; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicConvert3dToMdiFeature::onActionTriggered( bool isChecked ) +{ + if ( auto view = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ) ) + { + view->convertToMdi( RiaGuiApplication::instance()->mainWindow() ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicConvert3dToMdiFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Convert to MDI view" ); + actionToSetup->setIcon( QIcon( ":/3DWindow.svg" ) ); +} diff --git a/ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.h b/ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.h new file mode 100644 index 00000000000..51aadb201d8 --- /dev/null +++ b/ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.h @@ -0,0 +1,34 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2026 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 RicConvert3dToMdiFeature : public caf::CmdFeature +{ + CAF_CMD_HEADER_INIT; + +protected: + bool isCommandEnabled() const override; + void onActionTriggered( bool isChecked ) override; + void setupActionLook( QAction* actionToSetup ) override; +}; diff --git a/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.cpp b/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.cpp index 276e25fcbe0..98fcaa9d300 100644 --- a/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.cpp +++ b/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.cpp @@ -42,23 +42,24 @@ bool RicPopOutTo3dViewFeature::isCommandEnabled() const return !view->isDockingViewer(); } return false; +} - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - void RicPopOutTo3dViewFeature::onActionTriggered( bool isChecked ) +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicPopOutTo3dViewFeature::onActionTriggered( bool isChecked ) +{ + if ( auto view = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ) ) { - if ( auto view = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ) ) - { - view->convertToDocking( RiaGuiApplication::instance()->mainWindow() ); - } + view->convertToDocking( RiaGuiApplication::instance()->mainWindow() ); } +} - //-------------------------------------------------------------------------------------------------- - /// - //-------------------------------------------------------------------------------------------------- - void RicPopOutTo3dViewFeature::setupActionLook( QAction * actionToSetup ) - { - actionToSetup->setText( "Pop Out (in 3D View)" ); - actionToSetup->setIcon( QIcon( ":/3DWindow.svg" ) ); - } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RicPopOutTo3dViewFeature::setupActionLook( QAction* actionToSetup ) +{ + actionToSetup->setText( "Pop Out (in 3D View)" ); + actionToSetup->setIcon( QIcon( ":/3DWindow.svg" ) ); +} diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 45b12e3def2..8c9ea6ef4f7 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -35,6 +35,7 @@ #include "RimGridView.h" #include "RimLegendConfig.h" #include "RimMainPlotCollection.h" +#include "RimMdiWindowController.h" #include "RimMeasurement.h" #include "RimOilField.h" #include "RimProject.h" @@ -53,6 +54,8 @@ #include "RiuTimeStepChangedHandler.h" #include "RiuViewer.h" +#include "DockManager.h" + #include "cafCmdFeatureMenuBuilder.h" #include "cafDisplayCoordTransform.h" #include "cafFrameAnimationControl.h" @@ -1908,6 +1911,7 @@ void Rim3dView::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const { if ( isDockingViewer() ) { + menuBuilder << "RicConvert3dToMdiFeature"; } else { @@ -1927,7 +1931,27 @@ void Rim3dView::convertToDocking( RiuMainWindowBase* mainWindow ) QWidget* viewWidget = createViewWidget( nullptr ); - mainWindow->initializeDockingViewer( viewWidget ); + m_dockWidget = mainWindow->initializeDockingViewer( viewWidget ); + updateViewWidgetAfterCreation(); + scheduleCreateDisplayModelAndRedraw(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dView::convertToMdi( RiuMainWindowBase* mainWindow ) +{ + if ( !isDockingViewer() ) return; + + mainWindow->dockManager()->removeDockWidget( m_dockWidget ); + + m_dockWidget->takeWidget(); + m_dockWidget = nullptr; + + m_windowController->updateViewerWidget(); + + updateMdiWindowVisibility(); + updateViewWidgetAfterCreation(); scheduleCreateDisplayModelAndRedraw(); } \ No newline at end of file diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.h b/ApplicationLibCode/ProjectDataModel/Rim3dView.h index 91617d64b19..d4ac0bafd7b 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.h +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.h @@ -71,6 +71,11 @@ namespace caf class DisplayCoordTransform; } +namespace ads +{ +class CDockWidget; +} + enum PartRenderMaskEnum { surfaceBit = 1, @@ -96,7 +101,7 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public int id() const final; - bool isDockingViewer() const { return m_isDockingViewer; } + bool isDockingViewer() const { return !m_dockWidget.isNull(); } // Public fields: @@ -207,6 +212,7 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public void synchronizeLocalAnnotationsFromGlobal(); void convertToDocking( RiuMainWindowBase* mainWindow ); + void convertToMdi( RiuMainWindowBase* mainWindow ); protected: static void removeModelByName( cvf::Scene* scene, const cvf::String& modelName ); @@ -367,5 +373,5 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public const int m_animationIntervalMillisec; int m_animationTimerUsers; - bool m_isDockingViewer; + QPointer m_dockWidget; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index ca6b310166f..bb602a7785b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -117,11 +117,10 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface virtual void assignIdIfNecessary() = 0; protected: - caf::PdmField m_showWindow; - -private: + caf::PdmField m_showWindow; caf::PdmChildField m_windowController; +private: // Obsoleted field caf::PdmField> obsoleteField_windowGeometry; }; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 0a206e0312f..bb35c8b4e68 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -141,12 +141,12 @@ RiuMainWindow::RiuMainWindow() { setAttribute( Qt::WA_DeleteOnClose ); - m_mdiArea = new RiuMdiArea( this ); - connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) ); + // m_mdiArea = new RiuMdiArea( this ); + // connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) ); - ads::CDockWidget* cWidget = RiuDockWidgetTools::createDockWidget( "3D Views", RiuDockWidgetTools::main3DWindowName(), this ); - cWidget->setWidget( m_mdiArea ); - dockManager()->setCentralWidget( cWidget ); + // ads::CDockWidget* cWidget = RiuDockWidgetTools::createDockWidget( "3D Views", RiuDockWidgetTools::main3DWindowName(), this ); + // cWidget->setWidget( m_mdiArea ); + // dockManager()->setCentralWidget( cWidget ); createActions(); createMenus(); @@ -241,7 +241,7 @@ void RiuMainWindow::initializeGuiNewProjectLoaded() setPdmRoot( RimProject::current() ); restoreTreeViewState(); - m_mdiArea->applyTiling(); + // m_mdiArea->applyTiling(); slotRefreshFileActions(); slotRefreshUndoRedoActions(); @@ -261,15 +261,15 @@ void RiuMainWindow::initializeGuiNewProjectLoaded() statusBar()->showMessage( "Ready ...", 5000 ); } - QMdiSubWindow* activeSubWindow = m_mdiArea->activeSubWindow(); - if ( activeSubWindow ) - { - auto w = findViewWindowFromSubWindow( activeSubWindow ); - if ( w && w->mdiWindowGeometry().isMaximized ) - { - activeSubWindow->showMaximized(); - } - } + // QMdiSubWindow* activeSubWindow = m_mdiArea->activeSubWindow(); + // if ( activeSubWindow ) + //{ + // auto w = findViewWindowFromSubWindow( activeSubWindow ); + // if ( w && w->mdiWindowGeometry().isMaximized ) + // { + // activeSubWindow->showMaximized(); + // } + // } // Sync selections with property editor. // Go backwards as the most "important" tree view is first in the list @@ -343,7 +343,7 @@ void RiuMainWindow::cleanupGuiCaseClose() //-------------------------------------------------------------------------------------------------- void RiuMainWindow::cleanupGuiBeforeProjectClose() { - m_mdiArea->closeAllSubWindows(); + // m_mdiArea->closeAllSubWindows(); setPdmRoot( nullptr ); @@ -1144,15 +1144,15 @@ void RiuMainWindow::slotInputMockModel() //-------------------------------------------------------------------------------------------------- QMdiSubWindow* RiuMainWindow::findMdiSubWindow( QWidget* viewer ) { - QList subws = m_mdiArea->subWindowList(); - int i; - for ( i = 0; i < subws.size(); ++i ) - { - if ( subws[i]->widget() == viewer ) - { - return subws[i]; - } - } + // QList subws = m_mdiArea->subWindowList(); + // int i; + // for ( i = 0; i < subws.size(); ++i ) + //{ + // if ( subws[i]->widget() == viewer ) + // { + // return subws[i]; + // } + // } return nullptr; } @@ -1182,7 +1182,8 @@ RimViewWindow* RiuMainWindow::findViewWindowFromSubWindow( QMdiSubWindow* subWin //-------------------------------------------------------------------------------------------------- QList RiuMainWindow::subWindowList( QMdiArea::WindowOrder order ) { - return m_mdiArea->subWindowList( order ); + // return m_mdiArea->subWindowList( order ); + return {}; } //-------------------------------------------------------------------------------------------------- @@ -1246,7 +1247,7 @@ RiuMessagePanel* RiuMainWindow::messagePanel() //-------------------------------------------------------------------------------------------------- void RiuMainWindow::removeViewer( QWidget* viewer ) { - removeViewerFromMdiArea( m_mdiArea, viewer ); + // removeViewerFromMdiArea( m_mdiArea, viewer ); slotRefreshViewActions(); } @@ -1268,7 +1269,7 @@ void RiuMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, subWindowSize = QSize( 400, 400 ); } - initializeSubWindow( m_mdiArea, subWindow, subWindowPos, subWindowSize ); + // initializeSubWindow( m_mdiArea, subWindow, subWindowPos, subWindowSize ); subWindow->setWidget( viewer ); slotRefreshViewActions(); @@ -1277,13 +1278,15 @@ void RiuMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMainWindow::initializeDockingViewer( QWidget* viewer ) +ads::CDockWidget* RiuMainWindow::initializeDockingViewer( QWidget* viewer ) { - auto dockViewer = RiuDockWidgetTools::createDockWidget( "3D Viewer", "3D view", dockManager() ); - dockViewer->setWidget( viewer ); - dockManager()->addDockWidgetFloating( dockViewer ); + auto dockWidget = RiuDockWidgetTools::createDockWidget( "3D Viewer", "3D view", dockManager() ); + dockWidget->setWidget( viewer ); + dockManager()->addDockWidgetFloating( dockWidget ); slotRefreshViewActions(); + + return dockWidget; } //-------------------------------------------------------------------------------------------------- @@ -1499,8 +1502,8 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim //-------------------------------------------------------------------------------------------------- void RiuMainWindow::setActiveViewer( QWidget* viewer ) { - QMdiSubWindow* swin = findMdiSubWindow( viewer ); - if ( swin ) m_mdiArea->setActiveSubWindow( swin ); + // QMdiSubWindow* swin = findMdiSubWindow( viewer ); + // if ( swin ) m_mdiArea->setActiveSubWindow( swin ); } //-------------------------------------------------------------------------------------------------- @@ -2110,7 +2113,8 @@ void RiuMainWindow::customMenuRequested( const QPoint& pos ) //-------------------------------------------------------------------------------------------------- bool RiuMainWindow::isAnyMdiSubWindowVisible() { - return !m_mdiArea->subWindowList().empty(); + // return !m_mdiArea->subWindowList().empty(); + return false; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index b3910c02f4e..38212b20b5c 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -101,7 +101,7 @@ class RiuMainWindow : public RiuMainWindowBase void initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override; void setActiveViewer( QWidget* subWindow ) override; - void initializeDockingViewer( QWidget* viewer ) override; + ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) override; void setResultInfo( const QString& info ) const; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 4d00129ad43..b069bbecec4 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -66,7 +66,7 @@ RiuMainWindowBase::RiuMainWindowBase() , m_blockSubWindowProjectTreeSelection( false ) , m_hasBeenVisible( false ) , m_windowMenu( nullptr ) - , m_mdiArea( nullptr ) +// , m_mdiArea( nullptr ) { ads::CDockManager::setAutoHideConfigFlags( ads::CDockManager::DefaultAutoHideConfig ); m_dockManager = new ads::CDockManager( this ); @@ -123,7 +123,8 @@ ads::CDockManager* RiuMainWindowBase::dockManager() const //-------------------------------------------------------------------------------------------------- RiuMdiArea* RiuMainWindowBase::mdiArea() { - return m_mdiArea; + return nullptr; + // return m_mdiArea; } //-------------------------------------------------------------------------------------------------- @@ -774,12 +775,12 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu() connect( exportLayoutAction, SIGNAL( triggered() ), this, SLOT( exportDockLayout() ) ); } - m_windowMenu->addSeparator(); - QAction* cascadeWindowsAction = new QAction( "Cascade Windows", this ); - connect( cascadeWindowsAction, SIGNAL( triggered() ), m_mdiArea, SLOT( cascadeSubWindows() ) ); + // m_windowMenu->addSeparator(); + // QAction* cascadeWindowsAction = new QAction( "Cascade Windows", this ); + // connect( cascadeWindowsAction, SIGNAL( triggered() ), m_mdiArea, SLOT( cascadeSubWindows() ) ); - QAction* closeAllSubWindowsAction = new QAction( "Close All Windows", this ); - connect( closeAllSubWindowsAction, SIGNAL( triggered() ), m_mdiArea, SLOT( closeAllSubWindows() ) ); + // QAction* closeAllSubWindowsAction = new QAction( "Close All Windows", this ); + // connect( closeAllSubWindowsAction, SIGNAL( triggered() ), m_mdiArea, SLOT( closeAllSubWindows() ) ); caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance(); @@ -789,8 +790,8 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu() m_windowMenu->addAction( cmdFeatureMgr->action( name ) ); } - m_windowMenu->addAction( cascadeWindowsAction ); - m_windowMenu->addAction( closeAllSubWindowsAction ); + // m_windowMenu->addAction( cascadeWindowsAction ); + // m_windowMenu->addAction( closeAllSubWindowsAction ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 2821782b318..59a57f0d01a 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -72,7 +72,7 @@ class RiuMainWindowBase : public QMainWindow virtual void initializeViewer( QMdiSubWindow* viewWindow, QWidget* viewWidget, const RimMdiWindowGeometry& windowsGeometry ) = 0; virtual void setActiveViewer( QWidget* subWindow ) = 0; - virtual void initializeDockingViewer( QWidget* viewer ) = 0; + virtual ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) = 0; virtual QMdiSubWindow* findMdiSubWindow( QWidget* viewer ) = 0; @@ -143,8 +143,8 @@ protected slots: QAction* m_redoAction; QUndoView* m_undoView; - RiuMdiArea* m_mdiArea; - QMenu* m_windowMenu; + // RiuMdiArea* m_mdiArea; + QMenu* m_windowMenu; const int DOCKSTATE_VERSION = 3; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index de7490e1f91..885ce10a849 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -98,19 +98,19 @@ RiuPlotMainWindow::RiuPlotMainWindow() , m_autoUpdateEnabled( false ) , m_autoUpdateTimerId( -1 ) { - m_mdiArea = new RiuMdiArea( this ); - connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) ); + // m_mdiArea = new RiuMdiArea( this ); + // connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) ); - caf::CmdFeatureMenuBuilder menuForMdiArea; - menuForMdiArea << "RicNewEmptySummaryMultiPlotFeature"; - menuForMdiArea << "RicOpenSummaryPlotEditorFromMdiAreaFeature"; - new RiuContextMenuLauncher( m_mdiArea, menuForMdiArea ); + // caf::CmdFeatureMenuBuilder menuForMdiArea; + // menuForMdiArea << "RicNewEmptySummaryMultiPlotFeature"; + // menuForMdiArea << "RicOpenSummaryPlotEditorFromMdiAreaFeature"; + // new RiuContextMenuLauncher( m_mdiArea, menuForMdiArea ); - ads::CDockWidget* cWidget = RiuDockWidgetTools::createDockWidget( "Plot Window", RiuDockWidgetTools::mainPlotWindowName(), this ); + // ads::CDockWidget* cWidget = RiuDockWidgetTools::createDockWidget( "Plot Window", RiuDockWidgetTools::mainPlotWindowName(), this ); - cWidget->setWidget( m_mdiArea ); - auto dockArea = dockManager()->setCentralWidget( cWidget ); - dockArea->setVisible( true ); + // cWidget->setWidget( m_mdiArea ); + // auto dockArea = dockManager()->setCentralWidget( cWidget ); + // dockArea->setVisible( true ); m_toggleSelectionLinkAction = new QAction( QIcon( ":/Link3DandPlots.png" ), tr( "Link With Selection in 3D" ), this ); m_toggleSelectionLinkAction->setToolTip( "Update wells used in plots from well selections in 3D view." ); @@ -223,7 +223,7 @@ void RiuPlotMainWindow::initializeGuiNewProjectLoaded() } } - m_mdiArea->applyTiling(); + // m_mdiArea->applyTiling(); if ( m_activePlotViewWindow && m_activePlotViewWindow->viewWidget() && !RiaRegressionTestRunner::instance()->isRunningRegressionTests() ) { @@ -262,7 +262,7 @@ void RiuPlotMainWindow::initializeGuiNewProjectLoaded() //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::cleanupGuiBeforeProjectClose() { - m_mdiArea->closeAllSubWindows(); + // m_mdiArea->closeAllSubWindows(); setPdmRoot( nullptr ); @@ -640,15 +640,15 @@ void RiuPlotMainWindow::createDockPanels() //-------------------------------------------------------------------------------------------------- QMdiSubWindow* RiuPlotMainWindow::findMdiSubWindow( QWidget* viewer ) { - QList subws = m_mdiArea->subWindowList(); - int i; - for ( i = 0; i < subws.size(); ++i ) - { - if ( subws[i]->widget() == viewer ) - { - return subws[i]; - } - } + // QList subws = m_mdiArea->subWindowList(); + // int i; + // for ( i = 0; i < subws.size(); ++i ) + //{ + // if ( subws[i]->widget() == viewer ) + // { + // return subws[i]; + // } + // } return nullptr; } @@ -671,7 +671,8 @@ RimViewWindow* RiuPlotMainWindow::findViewWindowFromSubWindow( QMdiSubWindow* su //-------------------------------------------------------------------------------------------------- QList RiuPlotMainWindow::subWindowList( QMdiArea::WindowOrder order ) { - return m_mdiArea->subWindowList( order ); + // return m_mdiArea->subWindowList( order ); + return {}; } //-------------------------------------------------------------------------------------------------- @@ -837,7 +838,7 @@ void RiuPlotMainWindow::showAndSetKeyboardFocusToSummaryPlotManager() //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::removeViewer( QWidget* viewer ) { - removeViewerFromMdiArea( m_mdiArea, viewer ); + // removeViewerFromMdiArea( m_mdiArea, viewer ); refreshToolbars(); } @@ -859,7 +860,7 @@ void RiuPlotMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* vie subWindowSize = QSize( 400, 400 ); } - initializeSubWindow( m_mdiArea, subWindow, subWindowPos, subWindowSize ); + // initializeSubWindow( m_mdiArea, subWindow, subWindowPos, subWindowSize ); subWindow->setWidget( viewer ); refreshToolbars(); @@ -868,11 +869,13 @@ void RiuPlotMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* vie //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindow::initializeDockingViewer( QWidget* viewer ) +ads::CDockWidget* RiuPlotMainWindow::initializeDockingViewer( QWidget* viewer ) { auto dockViewer = RiuDockWidgetTools::createDockWidget( "3D Viewer", "3D view", dockManager() ); dockViewer->setWidget( viewer ); dockManager()->addDockWidgetFloating( dockViewer ); + + return dockViewer; } //-------------------------------------------------------------------------------------------------- @@ -937,8 +940,8 @@ void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow ) //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::setActiveViewer( QWidget* viewer ) { - QMdiSubWindow* swin = findMdiSubWindow( viewer ); - if ( swin ) m_mdiArea->setActiveSubWindow( swin ); + // QMdiSubWindow* swin = findMdiSubWindow( viewer ); + // if ( swin ) m_mdiArea->setActiveSubWindow( swin ); } //-------------------------------------------------------------------------------------------------- @@ -1085,7 +1088,8 @@ void RiuPlotMainWindow::customMenuRequested( const QPoint& pos ) //-------------------------------------------------------------------------------------------------- bool RiuPlotMainWindow::isAnyMdiSubWindowVisible() { - return !m_mdiArea->subWindowList().empty(); + // return !m_mdiArea->subWindowList().empty(); + return false; } //-------------------------------------------------------------------------------------------------- @@ -1093,9 +1097,9 @@ bool RiuPlotMainWindow::isAnyMdiSubWindowVisible() //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::dragEnterEvent( QDragEnterEvent* event ) { - QPoint curpos = m_mdiArea->mapFromGlobal( QCursor::pos() ); + // QPoint curpos = m_mdiArea->mapFromGlobal( QCursor::pos() ); - if ( m_mdiArea->rect().contains( curpos ) ) event->acceptProposedAction(); + // if ( m_mdiArea->rect().contains( curpos ) ) event->acceptProposedAction(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 65112e2af9c..dbd06b89f3c 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -68,10 +68,10 @@ class RiuPlotMainWindow : public RiuMainWindowBase void cleanupGuiBeforeProjectClose(); void cleanUpTemporaryWidgets(); - void removeViewer( QWidget* viewer ) override; - void initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override; - void setActiveViewer( QWidget* subWindow ) override; - void initializeDockingViewer( QWidget* viewer ) override; + void removeViewer( QWidget* viewer ) override; + void initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override; + void setActiveViewer( QWidget* subWindow ) override; + ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) override; void setDefaultWindowSize(); void enable3DSelectionLink( bool enable ); From 6a7b9a119882eca259af79d999cac01b9fb0ff98 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Thu, 30 Apr 2026 01:19:06 +0200 Subject: [PATCH 03/47] Work in progress --- .../ProjectDataModel/CMakeLists_files.cmake | 1 + .../RimDockWindowController.cpp | 179 ++++++++++++++++++ .../RimDockWindowController.h | 65 +++++++ .../ProjectDataModel/RimViewWindow.h | 1 + .../UserInterface/RiuMainWindow.cpp | 19 ++ .../UserInterface/RiuMainWindow.h | 3 + .../UserInterface/RiuMainWindowBase.cpp | 10 + .../UserInterface/RiuMainWindowBase.h | 6 +- .../UserInterface/RiuPlotMainWindow.cpp | 6 +- 9 files changed, 285 insertions(+), 5 deletions(-) create mode 100644 ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp create mode 100644 ApplicationLibCode/ProjectDataModel/RimDockWindowController.h diff --git a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake index 696a124c966..f0a59deb095 100644 --- a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake @@ -63,6 +63,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimStackablePlotCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RimAdvancedSnapshotExportDefinition.cpp ${CMAKE_CURRENT_LIST_DIR}/RimMdiWindowController.cpp + ${CMAKE_CURRENT_LIST_DIR}/RimDockWindowController.cpp ${CMAKE_CURRENT_LIST_DIR}/RimNamedObject.cpp ${CMAKE_CURRENT_LIST_DIR}/RimCheckableNamedObject.cpp ${CMAKE_CURRENT_LIST_DIR}/RimCheckableObject.cpp diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp new file mode 100644 index 00000000000..dba506f2905 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -0,0 +1,179 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2026 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 "RimDockWindowController.h" + +#include "RiaGuiApplication.h" +#include "RimProject.h" +#include "RimViewWindow.h" +#include "RiuMainWindowBase.h" + +#include "DockManager.h" +#include "DockWidget.h" + +CAF_PDM_XML_SOURCE_INIT( RimDockWindowController, "DockWindowController" ); + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimDockWindowController::RimDockWindowController() +{ + CAF_PDM_InitField( &m_mainWindowID, "MainWindowID", -1, "" ); + CAF_PDM_InitField( &m_x, "xPos", -1, "" ); + CAF_PDM_InitField( &m_y, "yPos", -1, "" ); + CAF_PDM_InitField( &m_width, "Width", -1, "" ); + CAF_PDM_InitField( &m_height, "Height", -1, "" ); + CAF_PDM_InitField( &m_isMaximized, "IsMaximized", false, "" ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimDockWindowController::~RimDockWindowController() +{ +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimDockWindowController::setWindowGeometry( const RimMdiWindowGeometry& windowGeometry ) +{ + m_mainWindowID = windowGeometry.mainWindowID; + m_x = windowGeometry.x; + m_y = windowGeometry.y; + m_width = windowGeometry.width; + m_height = windowGeometry.height; + m_isMaximized = windowGeometry.isMaximized; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimMdiWindowGeometry RimDockWindowController::windowGeometry() +{ + RimMdiWindowGeometry windowGeometry; + + windowGeometry.mainWindowID = m_mainWindowID; + windowGeometry.x = m_x; + windowGeometry.y = m_y; + windowGeometry.width = m_width; + windowGeometry.height = m_height; + windowGeometry.isMaximized = m_isMaximized; + + return windowGeometry; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimDockWindowController::handleViewerDeletion() +{ + viewPdmObject()->m_showWindow = false; + viewPdmObject()->updateConnectedEditors(); + viewPdmObject()->updateUiIconFromToggleField(); + uiCapability()->updateUiIconFromToggleField(); + removeWindowFromDock(); + + updateConnectedEditors(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimDockWindowController::removeWindowFromDock() +{ + RiuMainWindowBase* mainWin = getMainWindow(); + if ( mainWin && viewWidget() ) + { + mainWin->removeViewer( viewWidget() ); + viewPdmObject()->deleteViewWidget(); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimViewWindow* RimDockWindowController::viewPdmObject() +{ + return firstAncestorOrThisOfType(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QWidget* RimDockWindowController::viewWidget() +{ + return viewPdmObject()->viewWidget(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RiuMainWindowBase* RimDockWindowController::getMainWindow() +{ + if ( RiaGuiApplication::isRunning() ) + { + return RiaGuiApplication::instance()->mainWindowByID( m_mainWindowID ); + } + return nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimDockWindowController::setupBeforeSave() +{ + if ( viewWidget() && getMainWindow() ) + { + setWindowGeometry( getMainWindow()->windowGeometryForViewer( viewWidget() ) ); + } +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimDockWindowController::updateViewerWidget() +{ + RiuMainWindowBase* mainWindow = getMainWindow(); + if ( !mainWindow ) return; + + if ( viewPdmObject()->isWindowVisible() ) + { + if ( !viewWidget() ) + { + ads::CDockWidget* viewWindow = mainWindow->createDockViewWindow(); + QWidget* viewWidget = viewPdmObject()->createViewWidget( viewWindow ); + mainWindow->initializeViewer( viewWindow, viewWidget, windowGeometry() ); + + viewPdmObject()->updateViewWidgetAfterCreation(); + } + + viewPdmObject()->updateMdiWindowTitle(); + } + else + { + if ( viewWidget() ) + { + setWindowGeometry( mainWindow->windowGeometryForViewer( viewWidget() ) ); + + mainWindow->removeViewer( viewWidget() ); + + viewPdmObject()->deleteViewWidget(); + } + } +} diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h new file mode 100644 index 00000000000..8d9f96d3236 --- /dev/null +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h @@ -0,0 +1,65 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// Copyright (C) 2026 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 "cafPdmChildField.h" +#include "cafPdmField.h" +#include "cafPdmObject.h" + +class RiuMainWindowBase; +// class RiuMdiSubWindow; +class RimViewWindow; +struct RimMdiWindowGeometry; + +//================================================================================================== +/// +/// +//================================================================================================== +class RimDockWindowController : public caf::PdmObject +{ + CAF_PDM_HEADER_INIT; + +public: + RimDockWindowController(); + ~RimDockWindowController() override; + + void setWindowGeometry( const RimMdiWindowGeometry& windowGeometry ); + RimMdiWindowGeometry windowGeometry(); + + void updateViewerWidget(); + void handleViewerDeletion(); + void removeWindowFromDock(); + +protected: + RimViewWindow* viewPdmObject(); + QWidget* viewWidget(); + RiuMainWindowBase* getMainWindow(); + + // Overridden PDM methods + void setupBeforeSave() override; + +private: + caf::PdmField m_mainWindowID; + + caf::PdmField m_x; + caf::PdmField m_y; + caf::PdmField m_width; + caf::PdmField m_height; + caf::PdmField m_isMaximized; +}; diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index bb602a7785b..23b3953c962 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -91,6 +91,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface ///////// Interface for the Window controller friend class RimMdiWindowController; + friend class RimDockWindowController; QString windowTitle(); virtual QWidget* createViewWidget( QWidget* mainWindowParent = nullptr ) = 0; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index bb35c8b4e68..73f5b9c6c9c 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -107,6 +107,7 @@ #include #include #include +#include #include #include #include @@ -148,6 +149,14 @@ RiuMainWindow::RiuMainWindow() // cWidget->setWidget( m_mdiArea ); // dockManager()->setCentralWidget( cWidget ); + m_centralDockWidget = RiuDockWidgetTools::createDockWidget( "Welcome", "Welcome", this ); + QTextEdit* welcome = new QTextEdit(); + welcome->setReadOnly( true ); + welcome->setPlainText( "Welcome to ResInsight!\n\n" + "To get started, open a project from the File menu or drag and drop a project file into this window." ); + m_centralDockWidget->setWidget( welcome ); + dockManager()->setCentralWidget( m_centralDockWidget ); + createActions(); createMenus(); createToolBars(); @@ -1275,6 +1284,16 @@ void RiuMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, slotRefreshViewActions(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindow::initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) +{ + dockManager()->centralWidget()->dockContainer()->addDockWidget( ads::DockWidgetArea::CenterDockWidgetArea, dockWidget ); + + slotRefreshViewActions(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index 38212b20b5c..e6c8200cc87 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -99,6 +99,7 @@ class RiuMainWindow : public RiuMainWindowBase void removeViewer( QWidget* viewer ) override; void initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override; + void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override; void setActiveViewer( QWidget* subWindow ) override; ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) override; @@ -290,5 +291,7 @@ private slots: QToolBar* m_holoLensToolBar; + QPointer m_centralDockWidget; + std::vector> m_additionalProjectViews; }; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index b069bbecec4..cd02d2d7ae4 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -140,6 +140,16 @@ QMdiSubWindow* RiuMainWindowBase::createViewWindow() return subWin; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +ads::CDockWidget* RiuMainWindowBase::createDockViewWindow() +{ + auto widget = RiuDockWidgetTools::createDockWidget( "3D view", "3dview", this ); + + return widget; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 59a57f0d01a..3da466221f3 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -66,11 +66,13 @@ class RiuMainWindowBase : public QMainWindow virtual QString mainWindowName() = 0; - QMdiSubWindow* createViewWindow(); + QMdiSubWindow* createViewWindow(); + ads::CDockWidget* createDockViewWindow(); virtual void removeViewer( QWidget* viewer ) = 0; virtual void initializeViewer( QMdiSubWindow* viewWindow, QWidget* viewWidget, const RimMdiWindowGeometry& windowsGeometry ) = 0; - virtual void setActiveViewer( QWidget* subWindow ) = 0; + virtual void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) {}; + virtual void setActiveViewer( QWidget* subWindow ) = 0; virtual ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) = 0; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 885ce10a849..7684ef439e7 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -106,11 +106,11 @@ RiuPlotMainWindow::RiuPlotMainWindow() // menuForMdiArea << "RicOpenSummaryPlotEditorFromMdiAreaFeature"; // new RiuContextMenuLauncher( m_mdiArea, menuForMdiArea ); - // ads::CDockWidget* cWidget = RiuDockWidgetTools::createDockWidget( "Plot Window", RiuDockWidgetTools::mainPlotWindowName(), this ); + ads::CDockWidget* cWidget = RiuDockWidgetTools::createDockWidget( "Plot Window", RiuDockWidgetTools::mainPlotWindowName(), this ); // cWidget->setWidget( m_mdiArea ); - // auto dockArea = dockManager()->setCentralWidget( cWidget ); - // dockArea->setVisible( true ); + auto dockArea = dockManager()->setCentralWidget( cWidget ); + dockArea->setVisible( true ); m_toggleSelectionLinkAction = new QAction( QIcon( ":/Link3DandPlots.png" ), tr( "Link With Selection in 3D" ), this ); m_toggleSelectionLinkAction->setToolTip( "Update wells used in plots from well selections in 3D view." ); From 017b855d7fa11d88c707b1019c4fb874dbf6e4ac Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Thu, 30 Apr 2026 17:45:45 +0200 Subject: [PATCH 04/47] Work in progress --- .../ProjectDataModel/CMakeLists_files.cmake | 1 - .../ProjectDataModel/Rim3dView.cpp | 2 +- .../RimMdiWindowController.cpp | 178 ------------------ .../ProjectDataModel/RimMdiWindowController.h | 65 ------- .../ProjectDataModel/RimViewWindow.cpp | 10 +- .../ProjectDataModel/RimViewWindow.h | 7 +- .../UserInterface/RiuMainWindow.cpp | 2 +- .../UserInterface/RiuMainWindowBase.cpp | 11 ++ .../UserInterface/RiuMainWindowBase.h | 1 + 9 files changed, 22 insertions(+), 255 deletions(-) delete mode 100644 ApplicationLibCode/ProjectDataModel/RimMdiWindowController.cpp delete mode 100644 ApplicationLibCode/ProjectDataModel/RimMdiWindowController.h diff --git a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake index f0a59deb095..8e4ccd74936 100644 --- a/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake +++ b/ApplicationLibCode/ProjectDataModel/CMakeLists_files.cmake @@ -62,7 +62,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RimPlotCurveAppearance.cpp ${CMAKE_CURRENT_LIST_DIR}/RimStackablePlotCurve.cpp ${CMAKE_CURRENT_LIST_DIR}/RimAdvancedSnapshotExportDefinition.cpp - ${CMAKE_CURRENT_LIST_DIR}/RimMdiWindowController.cpp ${CMAKE_CURRENT_LIST_DIR}/RimDockWindowController.cpp ${CMAKE_CURRENT_LIST_DIR}/RimNamedObject.cpp ${CMAKE_CURRENT_LIST_DIR}/RimCheckableNamedObject.cpp diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 8c9ea6ef4f7..2e46e5c5b96 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -32,10 +32,10 @@ #include "RimAnnotationCollection.h" #include "RimAnnotationInViewCollection.h" #include "RimCase.h" +#include "RimDockWindowController.h" #include "RimGridView.h" #include "RimLegendConfig.h" #include "RimMainPlotCollection.h" -#include "RimMdiWindowController.h" #include "RimMeasurement.h" #include "RimOilField.h" #include "RimProject.h" diff --git a/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.cpp deleted file mode 100644 index 53b7bbb5d7b..00000000000 --- a/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.cpp +++ /dev/null @@ -1,178 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2017 Statoil 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 "RimMdiWindowController.h" - -#include "RiaGuiApplication.h" -#include "RimProject.h" -#include "RimViewWindow.h" -#include "RiuMainWindowBase.h" - -#include - -CAF_PDM_XML_SOURCE_INIT( RimMdiWindowController, "MdiWindowController" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimMdiWindowController::RimMdiWindowController() -{ - CAF_PDM_InitField( &m_mainWindowID, "MainWindowID", -1, "" ); - CAF_PDM_InitField( &m_x, "xPos", -1, "" ); - CAF_PDM_InitField( &m_y, "yPos", -1, "" ); - CAF_PDM_InitField( &m_width, "Width", -1, "" ); - CAF_PDM_InitField( &m_height, "Height", -1, "" ); - CAF_PDM_InitField( &m_isMaximized, "IsMaximized", false, "" ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimMdiWindowController::~RimMdiWindowController() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimMdiWindowController::setMdiWindowGeometry( const RimMdiWindowGeometry& windowGeometry ) -{ - m_mainWindowID = windowGeometry.mainWindowID; - m_x = windowGeometry.x; - m_y = windowGeometry.y; - m_width = windowGeometry.width; - m_height = windowGeometry.height; - m_isMaximized = windowGeometry.isMaximized; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimMdiWindowGeometry RimMdiWindowController::mdiWindowGeometry() -{ - RimMdiWindowGeometry windowGeometry; - - windowGeometry.mainWindowID = m_mainWindowID; - windowGeometry.x = m_x; - windowGeometry.y = m_y; - windowGeometry.width = m_width; - windowGeometry.height = m_height; - windowGeometry.isMaximized = m_isMaximized; - - return windowGeometry; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimMdiWindowController::handleViewerDeletion() -{ - viewPdmObject()->m_showWindow = false; - viewPdmObject()->updateConnectedEditors(); - viewPdmObject()->updateUiIconFromToggleField(); - uiCapability()->updateUiIconFromToggleField(); - removeWindowFromMDI(); - - updateConnectedEditors(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimMdiWindowController::removeWindowFromMDI() -{ - RiuMainWindowBase* mainWin = getMainWindow(); - if ( mainWin && viewWidget() ) - { - mainWin->removeViewer( viewWidget() ); - viewPdmObject()->deleteViewWidget(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimViewWindow* RimMdiWindowController::viewPdmObject() -{ - return firstAncestorOrThisOfType(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QWidget* RimMdiWindowController::viewWidget() -{ - return viewPdmObject()->viewWidget(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuMainWindowBase* RimMdiWindowController::getMainWindow() -{ - if ( RiaGuiApplication::isRunning() ) - { - return RiaGuiApplication::instance()->mainWindowByID( m_mainWindowID ); - } - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimMdiWindowController::setupBeforeSave() -{ - if ( viewWidget() && getMainWindow() ) - { - setMdiWindowGeometry( getMainWindow()->windowGeometryForViewer( viewWidget() ) ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimMdiWindowController::updateViewerWidget() -{ - RiuMainWindowBase* mainWindow = getMainWindow(); - if ( !mainWindow ) return; - - if ( viewPdmObject()->isWindowVisible() ) - { - if ( !viewWidget() ) - { - QMdiSubWindow* viewWindow = mainWindow->createViewWindow(); - QWidget* viewWidget = viewPdmObject()->createViewWidget( viewWindow ); - mainWindow->initializeViewer( viewWindow, viewWidget, mdiWindowGeometry() ); - - viewPdmObject()->updateViewWidgetAfterCreation(); - } - - viewPdmObject()->updateMdiWindowTitle(); - } - else - { - if ( viewWidget() ) - { - setMdiWindowGeometry( mainWindow->windowGeometryForViewer( viewWidget() ) ); - - mainWindow->removeViewer( viewWidget() ); - - viewPdmObject()->deleteViewWidget(); - } - } -} diff --git a/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.h b/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.h deleted file mode 100644 index dbb22bfa063..00000000000 --- a/ApplicationLibCode/ProjectDataModel/RimMdiWindowController.h +++ /dev/null @@ -1,65 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2017 Statoil 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 "cafPdmChildField.h" -#include "cafPdmField.h" -#include "cafPdmObject.h" - -class RiuMainWindowBase; -class RiuMdiSubWindow; -class RimViewWindow; -struct RimMdiWindowGeometry; - -//================================================================================================== -/// -/// -//================================================================================================== -class RimMdiWindowController : public caf::PdmObject -{ - CAF_PDM_HEADER_INIT; - -public: - RimMdiWindowController(); - ~RimMdiWindowController() override; - - void setMdiWindowGeometry( const RimMdiWindowGeometry& windowGeometry ); - RimMdiWindowGeometry mdiWindowGeometry(); - - void updateViewerWidget(); - void handleViewerDeletion(); - void removeWindowFromMDI(); - -protected: - RimViewWindow* viewPdmObject(); - QWidget* viewWidget(); - RiuMainWindowBase* getMainWindow(); - - // Overridden PDM methods - void setupBeforeSave() override; - -private: - caf::PdmField m_mainWindowID; - - caf::PdmField m_x; - caf::PdmField m_y; - caf::PdmField m_width; - caf::PdmField m_height; - caf::PdmField m_isMaximized; -}; diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index 8990fa386a9..c4cfd6abf31 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -26,7 +26,7 @@ #include "RicfCommandObject.h" -#include "RimMdiWindowController.h" +#include "RimDockWindowController.h" #include "RimProject.h" #include "cafPdmUiTreeAttributes.h" @@ -96,7 +96,7 @@ void RimViewWindow::loadDataAndUpdate() //-------------------------------------------------------------------------------------------------- void RimViewWindow::removeMdiWindowFromMdiArea() { - if ( m_windowController() ) m_windowController->removeWindowFromMDI(); + if ( m_windowController() ) m_windowController->removeWindowFromDock(); } //-------------------------------------------------------------------------------------------------- @@ -194,7 +194,7 @@ bool RimViewWindow::isMdiWindow() const //-------------------------------------------------------------------------------------------------- void RimViewWindow::setMdiWindowGeometry( const RimMdiWindowGeometry& windowGeometry ) { - if ( m_windowController() ) m_windowController()->setMdiWindowGeometry( windowGeometry ); + if ( m_windowController() ) m_windowController()->setWindowGeometry( windowGeometry ); } //-------------------------------------------------------------------------------------------------- @@ -203,7 +203,7 @@ void RimViewWindow::setMdiWindowGeometry( const RimMdiWindowGeometry& windowGeom RimMdiWindowGeometry RimViewWindow::mdiWindowGeometry() { if ( m_windowController() ) - return m_windowController()->mdiWindowGeometry(); + return m_windowController()->windowGeometry(); else return RimMdiWindowGeometry(); } @@ -293,7 +293,7 @@ void RimViewWindow::setAsMdiWindow( int mainWindowID ) { if ( !m_windowController() ) { - m_windowController = new RimMdiWindowController; + m_windowController = new RimDockWindowController; RimMdiWindowGeometry mwg; mwg.mainWindowID = mainWindowID; setMdiWindowGeometry( mwg ); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index 23b3953c962..00281df6d13 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -27,7 +27,7 @@ #include -class RimMdiWindowController; +class RimDockWindowController; struct RimMdiWindowGeometry { @@ -90,7 +90,6 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface void removeMdiWindowFromMdiArea(); ///////// Interface for the Window controller - friend class RimMdiWindowController; friend class RimDockWindowController; QString windowTitle(); @@ -118,8 +117,8 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface virtual void assignIdIfNecessary() = 0; protected: - caf::PdmField m_showWindow; - caf::PdmChildField m_windowController; + caf::PdmField m_showWindow; + caf::PdmChildField m_windowController; private: // Obsoleted field diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 73f5b9c6c9c..3cd24465d7a 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -1256,7 +1256,7 @@ RiuMessagePanel* RiuMainWindow::messagePanel() //-------------------------------------------------------------------------------------------------- void RiuMainWindow::removeViewer( QWidget* viewer ) { - // removeViewerFromMdiArea( m_mdiArea, viewer ); + // m_dockManager->removeDockWidget( viewer ); slotRefreshViewActions(); } diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index cd02d2d7ae4..d5286b1b79b 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -365,6 +365,17 @@ bool RiuMainWindowBase::isBlockingViewSelectionOnSubWindowActivated() const return m_blockSubWindowProjectTreeSelection; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindowBase::removeViewerFromDockArea( QWidget* viewer ) +{ + if ( auto dw = m_dockManager->findDockWidget( viewer->objectName() ) ) + { + dw->close(); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 3da466221f3..873fc3d17e1 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -108,6 +108,7 @@ class RiuMainWindowBase : public QMainWindow void createTreeViews( int numberOfTrees ); void removeViewerFromMdiArea( RiuMdiArea* mdiArea, QWidget* viewer ); void initializeSubWindow( RiuMdiArea* mdiArea, QMdiSubWindow* mdiSubWindow, const QPoint& subWindowPos, const QSize& subWindowSize ); + void removeViewerFromDockArea( QWidget* viewer ); void restoreTreeViewStates( QString treeStateString, QString treeIndexString ); From ceb30350427f260603e1f14c46b307171fad0bc6 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Tue, 5 May 2026 00:10:08 +0200 Subject: [PATCH 05/47] Work in progress --- .../RimDockWindowController.cpp | 7 ++--- .../ProjectDataModel/RimViewWindow.cpp | 26 ++++++++++++++++++- .../ProjectDataModel/RimViewWindow.h | 9 +++++++ .../UserInterface/RiuMainWindow.cpp | 3 ++- 4 files changed, 40 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index dba506f2905..6ca0ceff9d2 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -156,9 +156,10 @@ void RimDockWindowController::updateViewerWidget() { if ( !viewWidget() ) { - ads::CDockWidget* viewWindow = mainWindow->createDockViewWindow(); - QWidget* viewWidget = viewPdmObject()->createViewWidget( viewWindow ); - mainWindow->initializeViewer( viewWindow, viewWidget, windowGeometry() ); + ads::CDockWidget* dockWidget = viewPdmObject()->createDockWidget(); + QWidget* viewWidget = viewPdmObject()->createViewWidget( dockWidget ); + dockWidget->setWidget( viewWidget ); + mainWindow->initializeViewer( dockWidget, viewWidget, windowGeometry() ); viewPdmObject()->updateViewWidgetAfterCreation(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index c4cfd6abf31..a83bbfec77b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -32,6 +32,8 @@ #include "cafPdmUiTreeAttributes.h" #include "cafPdmUiTreeViewEditor.h" +#include "DockWidget.h" + #include #include #include @@ -43,6 +45,7 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimViewWindow, "ViewWindow" ); // Do not use. /// //-------------------------------------------------------------------------------------------------- RimViewWindow::RimViewWindow() + : m_dockWidget( nullptr ) { CAF_PDM_InitScriptableObjectWithNameAndComment( "View window", "", "", "", "ViewWindow", "The Base Class for all Views and Plots in ResInsight" ); @@ -280,9 +283,10 @@ void RimViewWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField, c //-------------------------------------------------------------------------------------------------- void RimViewWindow::updateMdiWindowTitle() { - if ( viewWidget() ) + if ( viewWidget() && dockWidget() ) { viewWidget()->setWindowTitle( windowTitle() ); + dockWidget()->setWindowTitle( windowTitle() ); } } @@ -347,3 +351,23 @@ void RimViewWindow::defineObjectEditorAttribute( QString uiConfigName, caf::PdmU treeItemAttribute->tags.push_back( std::move( tag ) ); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +ads::CDockWidget* RimViewWindow::dockWidget() +{ + return m_dockWidget; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +ads::CDockWidget* RimViewWindow::createDockWidget() +{ + if ( !m_dockWidget ) + { + m_dockWidget = new ads::CDockWidget( windowTitle() ); + } + return m_dockWidget; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index 00281df6d13..eac9fc374cb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -29,6 +29,11 @@ class RimDockWindowController; +namespace ads +{ +class CDockWidget; +} // namespace ads + struct RimMdiWindowGeometry { RimMdiWindowGeometry() @@ -79,6 +84,9 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface virtual QWidget* viewWidget() = 0; + ads::CDockWidget* dockWidget(); + ads::CDockWidget* createDockWidget(); + virtual QImage snapshotWindowContent(); virtual void zoomAll() = 0; @@ -119,6 +127,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface protected: caf::PdmField m_showWindow; caf::PdmChildField m_windowController; + ads::CDockWidget* m_dockWidget; private: // Obsoleted field diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 3cd24465d7a..d3848629a5f 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -155,6 +155,7 @@ RiuMainWindow::RiuMainWindow() welcome->setPlainText( "Welcome to ResInsight!\n\n" "To get started, open a project from the File menu or drag and drop a project file into this window." ); m_centralDockWidget->setWidget( welcome ); + m_centralDockWidget->setFeature( ads::CDockWidget::NoTab, true ); dockManager()->setCentralWidget( m_centralDockWidget ); createActions(); @@ -1289,7 +1290,7 @@ void RiuMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, //-------------------------------------------------------------------------------------------------- void RiuMainWindow::initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) { - dockManager()->centralWidget()->dockContainer()->addDockWidget( ads::DockWidgetArea::CenterDockWidgetArea, dockWidget ); + dockManager()->addDockWidget( ads::DockWidgetArea::CenterDockWidgetArea, dockWidget, dockManager()->centralWidget()->dockAreaWidget() ); slotRefreshViewActions(); } From e195913dcd2bec51fab84e9b316d0b4aab1664ff Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Wed, 6 May 2026 16:54:21 +0200 Subject: [PATCH 06/47] First non-MDI version. Still some missing links and features. --- .../Application/RiaGuiApplication.cpp | 27 +- .../Application/RiaGuiApplication.h | 3 - .../Tools/Summary/RiaSummaryPlotTools.cpp | 14 +- .../CMakeLists_files.cmake | 1 - .../RicTileWindowsFeature.cpp | 357 ------------------ .../RicTileWindowsFeature.h | 117 ------ .../RicNewStimPlanModelPlotFeature.cpp | 2 +- .../RicSnapshotAllPlotsToFileFeature.cpp | 2 +- .../Commands/RicHistogramPlotTools.cpp | 2 +- .../RicSummaryPlotEditorUi.cpp | 2 +- .../RicViewZoomAllFeature.cpp | 20 +- .../RicNewWellLogPlotFeatureImpl.cpp | 4 +- .../AnalysisPlots/RimAnalysisPlot.cpp | 4 +- .../RimAnalysisPlotCollection.cpp | 4 +- .../ContourMap/RimEclipseContourMapView.cpp | 2 +- .../RimCorrelationMatrixPlot.cpp | 6 +- .../CorrelationPlots/RimCorrelationPlot.cpp | 4 +- .../RimCorrelationPlotCollection.cpp | 18 +- .../RimCorrelationReportPlot.cpp | 6 +- .../RimParameterResultCrossPlot.cpp | 4 +- .../RimParameterRftCrossPlot.cpp | 2 +- .../RimRftCorrelationReportPlot.cpp | 8 +- .../CorrelationPlots/RimRftTornadoPlot.cpp | 2 +- .../Flow/RimFlowCharacteristicsPlot.cpp | 6 +- .../RimTofAccumulatedPhaseFractionsPlot.cpp | 8 +- .../Flow/RimTotalWellAllocationPlot.cpp | 8 +- .../Flow/RimWellAllocationOverTimePlot.cpp | 6 +- .../Flow/RimWellAllocationPlot.cpp | 10 +- .../Flow/RimWellConnectivityTable.cpp | 6 +- .../RimWellDistributionPlotCollection.cpp | 6 +- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 6 +- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 6 +- .../GeoMech/RimGeoMechView.cpp | 2 +- .../GridCrossPlots/RimGridCrossPlot.cpp | 8 +- .../RimGridCrossPlotCollection.cpp | 2 +- .../RimSaturationPressurePlotCollection.cpp | 2 +- .../Histogram/RimHistogramPlot.cpp | 10 +- .../Rim2dIntersectionView.cpp | 2 +- .../ProjectDataModel/Rim3dView.cpp | 29 +- .../ProjectDataModel/Rim3dView.h | 3 +- .../ProjectDataModel/RimDepthTrackPlot.cpp | 6 +- .../RimDockWindowController.cpp | 76 ++-- .../RimDockWindowController.h | 14 +- .../ProjectDataModel/RimEclipseView.cpp | 4 +- .../RimMainPlotCollection.cpp | 2 +- .../ProjectDataModel/RimMultiPlot.cpp | 8 +- .../ProjectDataModel/RimPlot.cpp | 8 +- ApplicationLibCode/ProjectDataModel/RimPlot.h | 2 +- .../ProjectDataModel/RimPlotWindow.cpp | 6 +- .../ProjectDataModel/RimTools.cpp | 2 +- .../ProjectDataModel/RimViewController.cpp | 2 +- .../ProjectDataModel/RimViewLinker.cpp | 4 +- .../ProjectDataModel/RimViewWindow.cpp | 123 ++---- .../ProjectDataModel/RimViewWindow.h | 55 +-- .../Seismic/RimSeismicView.cpp | 2 +- .../Summary/RimSummaryCrossPlotCollection.cpp | 2 +- .../Summary/RimSummaryPlot.cpp | 10 +- .../Summary/RimSummaryPlotCollection.cpp | 4 +- .../Summary/RimSummaryTable.cpp | 6 +- .../Summary/RimSummaryTableCollection.cpp | 4 +- .../RimCustomVfpPlot.cpp | 12 +- .../RimVfpPlotCollection.cpp | 2 +- .../RimcWellLogPlotCollection.cpp | 2 +- .../SocketInterface/RiaSocketServer.cpp | 30 +- .../UserInterface/CMakeLists_files.cmake | 3 - .../UserInterface/RiuMainWindow.cpp | 132 +------ .../UserInterface/RiuMainWindow.h | 19 +- .../UserInterface/RiuMainWindowBase.cpp | 213 ++++------- .../UserInterface/RiuMainWindowBase.h | 42 +-- .../UserInterface/RiuMainWindowTools.cpp | 12 +- .../UserInterface/RiuMdiArea.cpp | 202 ---------- ApplicationLibCode/UserInterface/RiuMdiArea.h | 48 --- .../RiuMdiMaximizeWindowGuard.cpp | 49 --- .../UserInterface/RiuMdiMaximizeWindowGuard.h | 30 -- .../UserInterface/RiuMdiSubWindow.cpp | 168 --------- .../UserInterface/RiuMdiSubWindow.h | 46 --- .../UserInterface/RiuPlotMainWindow.cpp | 238 +++--------- .../UserInterface/RiuPlotMainWindow.h | 12 +- .../UserInterface/RiuViewerToViewInterface.h | 3 +- 79 files changed, 420 insertions(+), 1914 deletions(-) delete mode 100644 ApplicationLibCode/Commands/ApplicationCommands/RicTileWindowsFeature.cpp delete mode 100644 ApplicationLibCode/Commands/ApplicationCommands/RicTileWindowsFeature.h delete mode 100644 ApplicationLibCode/UserInterface/RiuMdiArea.cpp delete mode 100644 ApplicationLibCode/UserInterface/RiuMdiArea.h delete mode 100644 ApplicationLibCode/UserInterface/RiuMdiMaximizeWindowGuard.cpp delete mode 100644 ApplicationLibCode/UserInterface/RiuMdiMaximizeWindowGuard.h delete mode 100644 ApplicationLibCode/UserInterface/RiuMdiSubWindow.cpp delete mode 100644 ApplicationLibCode/UserInterface/RiuMdiSubWindow.h diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 5b59bae3924..d2525739dbe 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -103,7 +103,6 @@ #include "RiuGuiTheme.h" #include "RiuMainWindow.h" #include "RiuMainWindowTools.h" -#include "RiuMdiMaximizeWindowGuard.h" #include "RiuMessagePanel.h" #include "RiuPlotMainWindow.h" #include "RiuPlotMainWindowTools.h" @@ -134,7 +133,6 @@ #include #include #include -#include #include #include #include @@ -447,11 +445,11 @@ RimViewWindow* RiaGuiApplication::activePlotWindow() const if ( m_mainPlotWindow ) { - QList subwindows = m_mainPlotWindow->subWindowList( QMdiArea::StackingOrder ); - if ( !subwindows.empty() ) - { - viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() ); - } + // QList subwindows = m_mainPlotWindow->subWindowList( QMdiArea::StackingOrder ); + // if ( !subwindows.empty() ) + //{ + // viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() ); + // } } return viewWindow; @@ -1150,11 +1148,11 @@ RimViewWindow* RiaGuiApplication::activeViewWindow() { RiuPlotMainWindow* mainPlotWindow = dynamic_cast( mainWindowWidget ); - QList subwindows = mainPlotWindow->subWindowList( QMdiArea::StackingOrder ); - if ( !subwindows.empty() ) - { - viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() ); - } + // QList subwindows = mainPlotWindow->subWindowList( QMdiArea::StackingOrder ); + // if ( !subwindows.empty() ) + //{ + // viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() ); + // } } return viewWindow; @@ -1315,9 +1313,6 @@ void RiaGuiApplication::onFileSuccessfullyLoaded( const QString& fileName, RiaDe //-------------------------------------------------------------------------------------------------- void RiaGuiApplication::onProjectBeingOpened() { - // When importing a project, do not maximize the first MDI window to be created - m_maximizeWindowGuard = std::make_unique(); - if ( m_mainWindow ) m_mainWindow->setBlockSubWindowActivatedSignal( true ); if ( mainPlotWindow() ) mainPlotWindow()->setBlockSubWindowActivatedSignal( true ); } @@ -1376,8 +1371,6 @@ void RiaGuiApplication::onProjectOpened() setWindowCaptionFromAppState(); - m_maximizeWindowGuard.reset(); - processEvents(); if ( m_mainWindow ) m_mainWindow->setBlockSubWindowActivatedSignal( false ); diff --git a/ApplicationLibCode/Application/RiaGuiApplication.h b/ApplicationLibCode/Application/RiaGuiApplication.h index 67dfcbfd5e9..18d30eaee7b 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.h +++ b/ApplicationLibCode/Application/RiaGuiApplication.h @@ -55,7 +55,6 @@ class RimWellAllocationPlot; class RiuMainWindow; class RiuMainWindowBase; -class RiuMdiMaximizeWindowGuard; class RiuPlotMainWindow; class RiuRecentFileActionProvider; class RiaArgumentParser; @@ -167,6 +166,4 @@ private slots: std::unique_ptr m_mainPlotWindow; std::unique_ptr m_recentFileActionProvider; - - std::unique_ptr m_maximizeWindowGuard; }; diff --git a/ApplicationLibCode/Application/Tools/Summary/RiaSummaryPlotTools.cpp b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryPlotTools.cpp index 73fa5b359ca..04a02488956 100644 --- a/ApplicationLibCode/Application/Tools/Summary/RiaSummaryPlotTools.cpp +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryPlotTools.cpp @@ -161,7 +161,7 @@ RimMultiPlot* createAndAppendMultiPlot( const std::vector& plots ) auto* plotWindow = new RimMultiPlot; plotWindow->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) ); - plotWindow->setAsPlotMdiWindow(); + plotWindow->dockAsPlotWindow(); plotCollection->addMultiPlot( plotWindow ); appendPlotsToMultiPlot( plotWindow, plots ); @@ -190,7 +190,7 @@ RimSummaryMultiPlot* createAndAppendSummaryMultiPlot( const std::vectorsetMultiPlotTitle( QString( "Multi Plot %1" ).arg( plotCollection->multiPlots().size() + 1 ) ); - plotWindow->setAsPlotMdiWindow(); + plotWindow->dockAsPlotWindow(); plotCollection->addSummaryMultiPlot( plotWindow ); plotWindow->handleDroppedObjects( objects ); @@ -221,7 +221,7 @@ void appendPlotsToMultiPlot( RimMultiPlot* multiPlot, const std::vectorrevokeMdiWindowStatus(); + plot->removeWindowFromDock(); multiPlot->addPlot( plot ); @@ -266,7 +266,7 @@ RimSummaryMultiPlot* createAndAppendDefaultSummaryMultiPlot( const std::vectorsummaryMultiPlotCollection(); auto* summaryMultiPlot = new RimSummaryMultiPlot(); - summaryMultiPlot->setAsPlotMdiWindow(); + summaryMultiPlot->dockAsPlotWindow(); plotCollection->addSummaryMultiPlot( summaryMultiPlot ); RimSummaryPlot* plot = new RimSummaryPlot(); @@ -318,7 +318,7 @@ RimSummaryMultiPlot* createAndAppendSingleSummaryMultiPlotNoAutoSettings( RimSum auto* summaryMultiPlot = new RimSummaryMultiPlot(); summaryMultiPlot->setColumnCount( RiaDefines::ColumnCount::COLUMNS_1 ); summaryMultiPlot->setRowCount( RiaDefines::RowCount::ROWS_1 ); - summaryMultiPlot->setAsPlotMdiWindow(); + summaryMultiPlot->dockAsPlotWindow(); if ( !plot->autoPlotTitle() ) { @@ -353,7 +353,7 @@ RimSummaryMultiPlot* createAndAppendSummaryMultiPlot( const std::vectorsummaryMultiPlotCollection(); auto* summaryMultiPlot = new RimSummaryMultiPlot(); - summaryMultiPlot->setAsPlotMdiWindow(); + summaryMultiPlot->dockAsPlotWindow(); plotCollection->addSummaryMultiPlot( summaryMultiPlot ); appendPlotsToSummaryMultiPlot( summaryMultiPlot, plots ); @@ -407,7 +407,7 @@ void appendPlotsToSummaryMultiPlot( RimSummaryMultiPlot* multiPlot, const std::v multiPlot->startBatchAddOperation(); for ( auto plot : plots ) { - plot->revokeMdiWindowStatus(); + plot->removeWindowFromDock(); multiPlot->addPlot( plot ); diff --git a/ApplicationLibCode/Commands/ApplicationCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/ApplicationCommands/CMakeLists_files.cmake index 1ef296520cc..492c3823c42 100644 --- a/ApplicationLibCode/Commands/ApplicationCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/ApplicationCommands/CMakeLists_files.cmake @@ -1,7 +1,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicShowPlotWindowFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicShowMainWindowFeature.cpp - ${CMAKE_CURRENT_LIST_DIR}/RicTileWindowsFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicOpenProjectFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicOpenLastUsedFileFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicSaveProjectFeature.cpp diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicTileWindowsFeature.cpp b/ApplicationLibCode/Commands/ApplicationCommands/RicTileWindowsFeature.cpp deleted file mode 100644 index 7eeb39b7244..00000000000 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicTileWindowsFeature.cpp +++ /dev/null @@ -1,357 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2015- Statoil ASA -// Copyright (C) 2015- Ceetron Solutions AS -// -// 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 "RicTileWindowsFeature.h" - -#include "RiaGuiApplication.h" - -#include "RimProject.h" - -#include "RiuMainWindow.h" -#include "RiuMdiArea.h" -#include "RiuPlotMainWindow.h" - -#include -#include - -CAF_CMD_SOURCE_INIT( RicTileWindowsFeature, "RicTileWindowsFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTileWindowsFeature::applyTiling( RiuMainWindow* mainWindow, RiaDefines::WindowTileMode requestedTileMode ) -{ - auto mode = requestedTileMode; - - if ( auto proj = RimProject::current() ) - { - // If requested mode is set, reset tiling mode to undefined - if ( proj->subWindowsTileMode3DWindow() == requestedTileMode ) mode = RiaDefines::WindowTileMode::UNDEFINED; - - proj->setSubWindowsTileMode3DWindow( mode ); - } - - if ( mainWindow ) - { - mainWindow->mdiArea()->applyTiling(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicTileWindowsFeature::isCommandEnabled() const -{ - auto* mainWindow = RiuMainWindow::instance(); - if ( mainWindow ) - { - return mainWindow->isAnyMdiSubWindowVisible(); - } - - return false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTileWindowsFeature::onActionTriggered( bool isChecked ) -{ - disableModelChangeContribution(); - - auto* mainWindow = RiuMainWindow::instance(); - applyTiling( mainWindow, RiaDefines::WindowTileMode::DEFAULT ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTileWindowsFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Tile Windows" ); - actionToSetup->setIcon( QIcon( ":/TileWindows.svg" ) ); - actionToSetup->setCheckable( true ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicTileWindowsFeature::isCommandChecked() const -{ - auto proj = RimProject::current(); - - return proj ? ( proj->subWindowsTileMode3DWindow() == RiaDefines::WindowTileMode::DEFAULT ) : false; -} - -CAF_CMD_SOURCE_INIT( RicTilePlotWindowsFeature, "RicTilePlotWindowsFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTilePlotWindowsFeature::applyTiling( RiuPlotMainWindow* mainWindow, RiaDefines::WindowTileMode requestedTileMode ) -{ - auto mode = requestedTileMode; - - if ( auto proj = RimProject::current() ) - { - // If requested mode is set, reset tiling mode to undefined - if ( proj->subWindowsTileModePlotWindow() == requestedTileMode ) mode = RiaDefines::WindowTileMode::UNDEFINED; - - proj->setSubWindowsTileModePlotWindow( mode ); - } - - if ( mainWindow ) - { - mainWindow->mdiArea()->applyTiling(); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicTilePlotWindowsFeature::isCommandEnabled() const -{ - RiuPlotMainWindow* mainPlotWindow = RiaGuiApplication::instance()->mainPlotWindow(); - if ( mainPlotWindow ) - { - return mainPlotWindow->isAnyMdiSubWindowVisible(); - } - - return false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTilePlotWindowsFeature::onActionTriggered( bool isChecked ) -{ - disableModelChangeContribution(); - - auto* mainWindow = RiuPlotMainWindow::instance(); - RicTilePlotWindowsFeature::applyTiling( mainWindow, RiaDefines::WindowTileMode::DEFAULT ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTilePlotWindowsFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Tile Windows" ); - actionToSetup->setIcon( QIcon( ":/TileWindows.svg" ) ); - actionToSetup->setCheckable( true ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicTilePlotWindowsFeature::isCommandChecked() const -{ - auto proj = RimProject::current(); - - return proj ? ( proj->subWindowsTileModePlotWindow() == RiaDefines::WindowTileMode::DEFAULT ) : false; -} - -CAF_CMD_SOURCE_INIT( RicTileWindowsVerticallyFeature, "RicTileWindowsVerticallyFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicTileWindowsVerticallyFeature::isCommandEnabled() const -{ - RiuMainWindow* mainWindow = RiuMainWindow::instance(); - if ( mainWindow ) - { - return mainWindow->isAnyMdiSubWindowVisible(); - } - - return false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTileWindowsVerticallyFeature::onActionTriggered( bool isChecked ) -{ - disableModelChangeContribution(); - - auto* mainWindow = RiuMainWindow::instance(); - RicTileWindowsFeature::applyTiling( mainWindow, RiaDefines::WindowTileMode::VERTICAL ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTileWindowsVerticallyFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Tile Windows Vertically" ); - actionToSetup->setIcon( QIcon( ":/TileWindows.svg" ) ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicTileWindowsVerticallyFeature::isCommandChecked() const -{ - auto proj = RimProject::current(); - - return proj ? ( proj->subWindowsTileMode3DWindow() == RiaDefines::WindowTileMode::VERTICAL ) : false; -} - -CAF_CMD_SOURCE_INIT( RicTileWindowsHorizontallyFeature, "RicTileWindowsHorizontallyFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicTileWindowsHorizontallyFeature::isCommandEnabled() const -{ - RiuMainWindow* mainWindow = RiuMainWindow::instance(); - if ( mainWindow ) - { - return mainWindow->isAnyMdiSubWindowVisible(); - } - - return false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTileWindowsHorizontallyFeature::onActionTriggered( bool isChecked ) -{ - disableModelChangeContribution(); - - auto* mainWindow = RiuMainWindow::instance(); - RicTileWindowsFeature::applyTiling( mainWindow, RiaDefines::WindowTileMode::HORIZONTAL ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTileWindowsHorizontallyFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Tile Windows Horizontally" ); - actionToSetup->setIcon( QIcon( ":/TileWindows.svg" ) ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicTileWindowsHorizontallyFeature::isCommandChecked() const -{ - auto proj = RimProject::current(); - - return proj ? ( proj->subWindowsTileMode3DWindow() == RiaDefines::WindowTileMode::HORIZONTAL ) : false; -} - -//-------------------------------------------------------------------------------------------------- -/// -/// Main Plot window features -/// -//-------------------------------------------------------------------------------------------------- - -CAF_CMD_SOURCE_INIT( RicTilePlotWindowsVerticallyFeature, "RicTilePlotWindowsVerticallyFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicTilePlotWindowsVerticallyFeature::isCommandEnabled() const -{ - auto* mainWindow = RiuPlotMainWindow::instance(); - if ( mainWindow ) - { - return mainWindow->isAnyMdiSubWindowVisible(); - } - - return false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTilePlotWindowsVerticallyFeature::onActionTriggered( bool isChecked ) -{ - disableModelChangeContribution(); - - auto* mainWindow = RiuPlotMainWindow::instance(); - RicTilePlotWindowsFeature::applyTiling( mainWindow, RiaDefines::WindowTileMode::VERTICAL ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTilePlotWindowsVerticallyFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Tile Windows Vertically" ); - actionToSetup->setIcon( QIcon( ":/TileWindows.svg" ) ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicTilePlotWindowsVerticallyFeature::isCommandChecked() const -{ - auto proj = RimProject::current(); - - return proj ? ( proj->subWindowsTileModePlotWindow() == RiaDefines::WindowTileMode::VERTICAL ) : false; -} - -CAF_CMD_SOURCE_INIT( RicTilePlotWindowsHorizontallyFeature, "RicTilePlotWindowsHorizontallyFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicTilePlotWindowsHorizontallyFeature::isCommandEnabled() const -{ - auto* mainWindow = RiuPlotMainWindow::instance(); - if ( mainWindow ) - { - return mainWindow->isAnyMdiSubWindowVisible(); - } - - return false; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTilePlotWindowsHorizontallyFeature::onActionTriggered( bool isChecked ) -{ - disableModelChangeContribution(); - - auto* mainWindow = RiuPlotMainWindow::instance(); - RicTilePlotWindowsFeature::applyTiling( mainWindow, RiaDefines::WindowTileMode::HORIZONTAL ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicTilePlotWindowsHorizontallyFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Tile Windows Horizontally" ); - actionToSetup->setIcon( QIcon( ":/TileWindows.svg" ) ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicTilePlotWindowsHorizontallyFeature::isCommandChecked() const -{ - auto proj = RimProject::current(); - - return proj ? ( proj->subWindowsTileModePlotWindow() == RiaDefines::WindowTileMode::HORIZONTAL ) : false; -} diff --git a/ApplicationLibCode/Commands/ApplicationCommands/RicTileWindowsFeature.h b/ApplicationLibCode/Commands/ApplicationCommands/RicTileWindowsFeature.h deleted file mode 100644 index 57729c238d9..00000000000 --- a/ApplicationLibCode/Commands/ApplicationCommands/RicTileWindowsFeature.h +++ /dev/null @@ -1,117 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2015- Statoil ASA -// Copyright (C) 2015- Ceetron Solutions AS -// -// 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 "RiaPlotDefines.h" - -#include "cafCmdFeature.h" - -class RiuMainWindow; -class RiuPlotMainWindow; - -//================================================================================================== -/// -//================================================================================================== -class RicTileWindowsFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -public: - static void applyTiling( RiuMainWindow* mainWindow, RiaDefines::WindowTileMode requestedTileMode ); - -protected: - bool isCommandEnabled() const override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; - bool isCommandChecked() const override; -}; - -//================================================================================================== -/// -//================================================================================================== -class RicTileWindowsVerticallyFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - bool isCommandEnabled() const override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; - bool isCommandChecked() const override; -}; - -//================================================================================================== -/// -//================================================================================================== -class RicTileWindowsHorizontallyFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - bool isCommandEnabled() const override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; - bool isCommandChecked() const override; -}; - -//================================================================================================== -/// -//================================================================================================== -class RicTilePlotWindowsFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -public: - static void applyTiling( RiuPlotMainWindow* mainWindow, RiaDefines::WindowTileMode requestedTileMode ); - -protected: - bool isCommandEnabled() const override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; - bool isCommandChecked() const override; -}; - -//================================================================================================== -/// -//================================================================================================== -class RicTilePlotWindowsVerticallyFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - bool isCommandEnabled() const override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; - bool isCommandChecked() const override; -}; - -//================================================================================================== -/// -//================================================================================================== -class RicTilePlotWindowsHorizontallyFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - bool isCommandEnabled() const override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; - bool isCommandChecked() const override; -}; diff --git a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp index 585883ca5e9..a8f4cf2cc55 100644 --- a/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp +++ b/ApplicationLibCode/Commands/CompletionCommands/RicNewStimPlanModelPlotFeature.cpp @@ -415,7 +415,7 @@ RimStimPlanModelPlot* RicNewStimPlanModelPlotFeature::createStimPlanModelPlot( b RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); RimStimPlanModelPlot* plot = new RimStimPlanModelPlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); stimPlanModelPlotColl->addStimPlanModelPlot( plot ); diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp index dad235d16b3..2a1999ef503 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp @@ -89,7 +89,7 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QS std::vector viewWindows = RimMainPlotCollection::current()->descendantsIncludingThisOfType(); for ( auto viewWindow : viewWindows ) { - if ( viewWindow->isMdiWindow() && viewWindow->viewWidget() && ( viewId == -1 || viewId == viewWindow->id() ) ) + if ( viewWindow->isMainDockedWindow() && viewWindow->viewWidget() && ( viewId == -1 || viewId == viewWindow->id() ) ) { QString fileName = RicSnapshotFilenameGenerator::generateSnapshotFileName( viewWindow ); if ( !prefix.isEmpty() ) diff --git a/ApplicationLibCode/Commands/RicHistogramPlotTools.cpp b/ApplicationLibCode/Commands/RicHistogramPlotTools.cpp index 8fbadc56be0..bc4f7e61b56 100644 --- a/ApplicationLibCode/Commands/RicHistogramPlotTools.cpp +++ b/ApplicationLibCode/Commands/RicHistogramPlotTools.cpp @@ -124,7 +124,7 @@ RimHistogramMultiPlot* RicHistogramPlotTools::addNewHistogramMultiplot( RimHisto CAF_ASSERT( collection ); RimHistogramMultiPlot* multiplot = collection->appendHistogramMultiPlot(); - multiplot->setAsPlotMdiWindow(); + multiplot->dockAsPlotWindow(); multiplot->setShowWindow( true ); multiplot->loadDataAndUpdate(); collection->updateConnectedEditors(); diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp index 896a09e8b64..622ea627bc1 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicSummaryPlotEditorUi.cpp @@ -644,7 +644,7 @@ void RicSummaryPlotEditorUi::createNewPlot() if ( m_plotContainer ) { newSummaryPlot = new RimSummaryPlot(); - newSummaryPlot->setAsPlotMdiWindow(); + newSummaryPlot->dockAsPlotWindow(); newSummaryPlot->enableAutoPlotTitle( true ); m_plotContainer->addPlot( newSummaryPlot ); } diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.cpp index 8d58f8b97f4..ac8e3a16f9f 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.cpp @@ -51,17 +51,17 @@ void RicViewZoomAllFeature::onActionTriggered( bool isChecked ) } else if ( dynamic_cast( topLevelWidget ) ) { - RiuPlotMainWindow* mainPlotWindow = dynamic_cast( topLevelWidget ); - QList subwindows = mainPlotWindow->subWindowList( QMdiArea::StackingOrder ); - if ( !subwindows.empty() ) - { - RimViewWindow* viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() ); + RiuPlotMainWindow* mainPlotWindow = dynamic_cast( topLevelWidget ); + // QList subwindows = mainPlotWindow->subWindowList( QMdiArea::StackingOrder ); + // if ( !subwindows.empty() ) + //{ + // RimViewWindow* viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() ); - if ( viewWindow ) - { - viewWindow->zoomAll(); - } - } + // if ( viewWindow ) + // { + // viewWindow->zoomAll(); + // } + //} } } diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp index 96a6f1be449..930837e6803 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicNewWellLogPlotFeatureImpl.cpp @@ -62,7 +62,7 @@ RimWellBoreStabilityPlot* RicNewWellLogPlotFeatureImpl::createWellBoreStabilityP plot->copyWbsParameters( params ); } - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); wellLogPlotColl->addWellLogPlot( plot ); @@ -131,7 +131,7 @@ RimWellLogPlot* RicNewWellLogPlotFeatureImpl::createWellLogPlot( bool showAfterC RiaGuiApplication::instance()->getOrCreateMainPlotWindow(); RimWellLogPlot* plot = new RimWellLogPlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); wellLogPlotColl->addWellLogPlot( plot ); diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp index dad8f3dda85..29bec7d032e 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlot.cpp @@ -170,7 +170,7 @@ RimAnalysisPlot::RimAnalysisPlot() //-------------------------------------------------------------------------------------------------- RimAnalysisPlot::~RimAnalysisPlot() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); cleanupBeforeClose(); } @@ -776,7 +776,7 @@ void RimAnalysisPlot::deleteViewWidget() //-------------------------------------------------------------------------------------------------- void RimAnalysisPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); updateAndGetCurveAnalyzer(); diff --git a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp index b891a691466..8dd124b03a7 100644 --- a/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/AnalysisPlots/RimAnalysisPlotCollection.cpp @@ -51,7 +51,7 @@ RimAnalysisPlotCollection::~RimAnalysisPlotCollection() RimAnalysisPlot* RimAnalysisPlotCollection::createAnalysisPlot() { RimAnalysisPlot* plot = new RimAnalysisPlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); if ( firstEnsemble() ) { @@ -86,7 +86,7 @@ RimAnalysisPlot* RimAnalysisPlotCollection::createAnalysisPlot() RimAnalysisPlot* RimAnalysisPlotCollection::createAnalysisPlot( RimSummaryEnsemble* ensemble, const QString& quantityName, std::time_t timeStep ) { RimAnalysisPlot* plot = new RimAnalysisPlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); applySummaryCaseCollectionAndFieldAddressToPlot( plot, ensemble, quantityName.toStdString() ); plot->setTimeSteps( { timeStep } ); diff --git a/ApplicationLibCode/ProjectDataModel/ContourMap/RimEclipseContourMapView.cpp b/ApplicationLibCode/ProjectDataModel/ContourMap/RimEclipseContourMapView.cpp index 6377d4731e7..6411c193ec7 100644 --- a/ApplicationLibCode/ProjectDataModel/ContourMap/RimEclipseContourMapView.cpp +++ b/ApplicationLibCode/ProjectDataModel/ContourMap/RimEclipseContourMapView.cpp @@ -546,7 +546,7 @@ void RimEclipseContourMapView::childFieldChangedByUi( const caf::PdmFieldHandle* { if ( changedChildField == &m_contourMapProjection ) { - updateMdiWindowTitle(); + updateWindowTitle(); } } diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp index 4b68add5837..b99ef230fdf 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationMatrixPlot.cpp @@ -144,7 +144,7 @@ RimCorrelationMatrixPlot::RimCorrelationMatrixPlot() //-------------------------------------------------------------------------------------------------- RimCorrelationMatrixPlot::~RimCorrelationMatrixPlot() { - if ( isMdiWindow() ) removeMdiWindowFromMdiArea(); + if ( isMainDockedWindow() ) removeWindowFromDock(); cleanupBeforeClose(); } @@ -385,7 +385,7 @@ QList RimCorrelationMatrixPlot::calculateValueOptions( c //-------------------------------------------------------------------------------------------------- void RimCorrelationMatrixPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); m_selectedVarsUiField = selectedVectorNamesText(); @@ -735,7 +735,7 @@ void RimCorrelationMatrixPlot::updatePlotTitle() { m_plotWidget->setPlotTitle( m_description ); m_plotWidget->setPlotTitleEnabled( m_showPlotTitle ); - if ( isMdiWindow() ) + if ( isMainDockedWindow() ) { m_plotWidget->setPlotTitleFontSize( titleFontSize() ); } diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp index 6b985549da3..b256ca85cef 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlot.cpp @@ -86,7 +86,7 @@ RimCorrelationPlot::RimCorrelationPlot() //-------------------------------------------------------------------------------------------------- RimCorrelationPlot::~RimCorrelationPlot() { - if ( isMdiWindow() ) removeMdiWindowFromMdiArea(); + if ( isMainDockedWindow() ) removeWindowFromDock(); cleanupBeforeClose(); } @@ -177,7 +177,7 @@ QList RimCorrelationPlot::calculateValueOptions( const c //-------------------------------------------------------------------------------------------------- void RimCorrelationPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); m_selectedVarsUiField = selectedVectorNamesText(); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp index a6e9dd7c753..a01c33d0365 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationPlotCollection.cpp @@ -79,7 +79,7 @@ RimCorrelationPlotCollection::~RimCorrelationPlotCollection() RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( bool defaultToFirstEnsembleFopt ) { RimCorrelationPlot* plot = new RimCorrelationPlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, { "FOPT" } ); plot->selectAllParameters(); @@ -96,7 +96,7 @@ RimCorrelationPlot* RimCorrelationPlotCollection::createCorrelationPlot( RimSummaryEnsemble* ensemble, const QString& quantityName, std::time_t timeStep ) { RimCorrelationPlot* plot = new RimCorrelationPlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, { quantityName }, timeStep ); plot->selectAllParameters(); @@ -112,7 +112,7 @@ RimCorrelationPlot* RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixPlot( bool defaultToFirstEnsembleField ) { RimCorrelationMatrixPlot* plot = new RimCorrelationMatrixPlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); if ( defaultToFirstEnsembleField ) applyFirstEnsembleFieldAddressesToPlot( plot, { "FOPT", "FWPT", "FGPT" } ); plot->selectAllParameters(); @@ -129,7 +129,7 @@ RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixP std::time_t timeStep ) { RimCorrelationMatrixPlot* plot = new RimCorrelationMatrixPlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, quantityNames, timeStep ); plot->selectAllParameters(); @@ -144,7 +144,7 @@ RimCorrelationMatrixPlot* RimCorrelationPlotCollection::createCorrelationMatrixP RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResultCrossPlot( bool defaultToFirstEnsembleFopt ) { RimParameterResultCrossPlot* plot = new RimParameterResultCrossPlot; - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); if ( defaultToFirstEnsembleFopt ) applyFirstEnsembleFieldAddressesToPlot( plot, { "FOPT" } ); addPlot( plot ); @@ -160,7 +160,7 @@ RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResult std::time_t timeStep ) { RimParameterResultCrossPlot* plot = new RimParameterResultCrossPlot; - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); applyEnsembleFieldAndTimeStepToPlot( plot, ensemble, { quantityName }, timeStep ); plot->setEnsembleParameter( paramName ); @@ -174,7 +174,7 @@ RimParameterResultCrossPlot* RimCorrelationPlotCollection::createParameterResult RimCorrelationReportPlot* RimCorrelationPlotCollection::createCorrelationReportPlot( bool defaultToFirstEnsembleField /*= true */ ) { RimCorrelationReportPlot* report = new RimCorrelationReportPlot; - report->setAsPlotMdiWindow(); + report->dockAsPlotWindow(); if ( defaultToFirstEnsembleField ) applyFirstEnsembleFieldAddressesToReport( report, { "FOPT", "FWPT", "FGPT" }, "FOPT" ); report->matrixPlot()->selectAllParameters(); report->correlationPlot()->selectAllParameters(); @@ -191,7 +191,7 @@ RimCorrelationReportPlot* RimCorrelationPlotCollection::createCorrelationReportP std::time_t timeStep ) { RimCorrelationReportPlot* report = new RimCorrelationReportPlot; - report->setAsPlotMdiWindow(); + report->dockAsPlotWindow(); applyEnsembleFieldAndTimeStepToReport( report, ensemble, matrixQuantityNames, tornadoAndCrossPlotQuantityName, timeStep ); report->matrixPlot()->selectAllParameters(); report->correlationPlot()->selectAllParameters(); @@ -205,7 +205,7 @@ RimCorrelationReportPlot* RimCorrelationPlotCollection::createCorrelationReportP RimRftCorrelationReportPlot* RimCorrelationPlotCollection::createRftCorrelationReportPlot( RimWellRftPlot* source ) { auto* report = new RimRftCorrelationReportPlot; - report->setAsPlotMdiWindow(); + report->dockAsPlotWindow(); if ( source ) { diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp index 6bd84af54f0..d4f01114a85 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimCorrelationReportPlot.cpp @@ -217,7 +217,7 @@ RimCorrelationReportPlot::RimCorrelationReportPlot() CAF_PDM_InitField( &m_dockState, "DockState", QString(), "Dock State" ); m_dockState.uiCapability()->setUiHidden( true ); - setAsPlotMdiWindow(); + dockAsPlotWindow(); m_showWindow = true; m_showPlotLegends = false; @@ -255,7 +255,7 @@ RimCorrelationReportPlot::RimCorrelationReportPlot() //-------------------------------------------------------------------------------------------------- RimCorrelationReportPlot::~RimCorrelationReportPlot() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); cleanupBeforeClose(); } @@ -550,7 +550,7 @@ void RimCorrelationReportPlot::deleteViewWidget() //-------------------------------------------------------------------------------------------------- void RimCorrelationReportPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); if ( m_showWindow ) { diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp index 50d8d42084a..92fc189506c 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterResultCrossPlot.cpp @@ -97,7 +97,7 @@ RimParameterResultCrossPlot::RimParameterResultCrossPlot() //-------------------------------------------------------------------------------------------------- RimParameterResultCrossPlot::~RimParameterResultCrossPlot() { - if ( isMdiWindow() ) removeMdiWindowFromMdiArea(); + if ( isMainDockedWindow() ) removeWindowFromDock(); cleanupBeforeClose(); } @@ -255,7 +255,7 @@ void RimParameterResultCrossPlot::defineEditorAttribute( const caf::PdmFieldHand //-------------------------------------------------------------------------------------------------- void RimParameterResultCrossPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); m_selectedVarsUiField = selectedVectorNamesText(); diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterRftCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterRftCrossPlot.cpp index 7c34cc39cd0..8f85eda9a0c 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterRftCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimParameterRftCrossPlot.cpp @@ -514,7 +514,7 @@ RiuPlotWidget* RimParameterRftCrossPlot::doCreatePlotViewWidget( QWidget* parent //-------------------------------------------------------------------------------------------------- void RimParameterRftCrossPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); if ( m_plotWidget ) { diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftCorrelationReportPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftCorrelationReportPlot.cpp index 8f1c5455a0a..1445af9fafb 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftCorrelationReportPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftCorrelationReportPlot.cpp @@ -114,13 +114,13 @@ RimRftCorrelationReportPlot::RimRftCorrelationReportPlot() CAF_PDM_InitField( &m_dockState, "DockState", QString(), "Dock State" ); m_dockState.uiCapability()->setUiHidden( true ); - setAsPlotMdiWindow(); + dockAsPlotWindow(); m_showWindow = true; m_showPlotLegends = false; m_wellRftPlot = new RimWellRftPlot; - m_wellRftPlot->revokeMdiWindowStatus(); + m_wellRftPlot->removeWindowFromDock(); m_wellRftPlot->setShowWindow( true ); m_parameterRftCrossPlot = new RimParameterRftCrossPlot; @@ -134,7 +134,7 @@ RimRftCorrelationReportPlot::RimRftCorrelationReportPlot() //-------------------------------------------------------------------------------------------------- RimRftCorrelationReportPlot::~RimRftCorrelationReportPlot() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); cleanupBeforeClose(); } @@ -374,7 +374,7 @@ void RimRftCorrelationReportPlot::deleteViewWidget() //-------------------------------------------------------------------------------------------------- void RimRftCorrelationReportPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); if ( m_showWindow ) { diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftTornadoPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftTornadoPlot.cpp index ed12253d9a9..3f5311f1a62 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftTornadoPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftTornadoPlot.cpp @@ -279,7 +279,7 @@ RiuPlotWidget* RimRftTornadoPlot::doCreatePlotViewWidget( QWidget* parent ) //-------------------------------------------------------------------------------------------------- void RimRftTornadoPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); if ( m_plotWidget ) { diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp index ba2819da21d..58e0e3ba543 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowCharacteristicsPlot.cpp @@ -98,7 +98,7 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot() CAF_PDM_InitField( &m_maxTof, "MaxTof", 146000, "Max Time of Flight [days]" ); m_showWindow = false; - setAsPlotMdiWindow(); + dockAsPlotWindow(); setDeletable( true ); } @@ -107,7 +107,7 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot() //-------------------------------------------------------------------------------------------------- RimFlowCharacteristicsPlot::~RimFlowCharacteristicsPlot() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); if ( m_flowCharPlotWidget ) { @@ -585,7 +585,7 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch //-------------------------------------------------------------------------------------------------- void RimFlowCharacteristicsPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); if ( m_flowDiagSolution && m_flowCharPlotWidget ) { diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp index 248910fb430..c89b015760d 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimTofAccumulatedPhaseFractionsPlot.cpp @@ -61,7 +61,7 @@ RimTofAccumulatedPhaseFractionsPlot::RimTofAccumulatedPhaseFractionsPlot() //-------------------------------------------------------------------------------------------------- RimTofAccumulatedPhaseFractionsPlot::~RimTofAccumulatedPhaseFractionsPlot() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); if ( m_tofAccumulatedPhaseFractionsPlotWidget ) { @@ -173,7 +173,7 @@ void RimTofAccumulatedPhaseFractionsPlot::fieldChangedByUi( const caf::PdmFieldH if ( changedField == &m_userName || changedField == &m_showPlotTitle ) { - updateMdiWindowTitle(); + updateWindowTitle(); } else if ( changedField == &m_maxTof ) { @@ -199,7 +199,7 @@ QImage RimTofAccumulatedPhaseFractionsPlot::snapshotWindowContent() void RimTofAccumulatedPhaseFractionsPlot::setDescription( const QString& description ) { m_userName = description; - updateMdiWindowTitle(); + updateWindowTitle(); } //-------------------------------------------------------------------------------------------------- @@ -222,7 +222,7 @@ void RimTofAccumulatedPhaseFractionsPlot::assignIdIfNecessary() //-------------------------------------------------------------------------------------------------- void RimTofAccumulatedPhaseFractionsPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); if ( m_tofAccumulatedPhaseFractionsPlotWidget && m_showWindow() ) { diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp index b629fa7c006..fde9deabca1 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimTotalWellAllocationPlot.cpp @@ -55,7 +55,7 @@ RimTotalWellAllocationPlot::RimTotalWellAllocationPlot() //-------------------------------------------------------------------------------------------------- RimTotalWellAllocationPlot::~RimTotalWellAllocationPlot() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); if ( m_wellTotalAllocationPlotWidget ) { @@ -127,7 +127,7 @@ void RimTotalWellAllocationPlot::fieldChangedByUi( const caf::PdmFieldHandle* ch if ( changedField == &m_userName || changedField == &m_showPlotTitle ) { - updateMdiWindowTitle(); + updateWindowTitle(); } } @@ -156,7 +156,7 @@ QImage RimTotalWellAllocationPlot::snapshotWindowContent() void RimTotalWellAllocationPlot::setDescription( const QString& description ) { m_userName = description; - updateMdiWindowTitle(); + updateWindowTitle(); } //-------------------------------------------------------------------------------------------------- @@ -220,7 +220,7 @@ void RimTotalWellAllocationPlot::clearSlices() //-------------------------------------------------------------------------------------------------- void RimTotalWellAllocationPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationOverTimePlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationOverTimePlot.cpp index 99c82f6f4f9..4bc43d4139c 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationOverTimePlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationOverTimePlot.cpp @@ -126,7 +126,7 @@ RimWellAllocationOverTimePlot::RimWellAllocationOverTimePlot() m_axisValueFontSize = caf::FontTools::RelativeSize::Medium; m_legendFontSize = caf::FontTools::RelativeSize::Medium; - setAsPlotMdiWindow(); + dockAsPlotWindow(); setShowWindow( false ); } @@ -135,7 +135,7 @@ RimWellAllocationOverTimePlot::RimWellAllocationOverTimePlot() //-------------------------------------------------------------------------------------------------- RimWellAllocationOverTimePlot::~RimWellAllocationOverTimePlot() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); deleteViewWidget(); } @@ -302,7 +302,7 @@ void RimWellAllocationOverTimePlot::deleteViewWidget() //-------------------------------------------------------------------------------------------------- void RimWellAllocationOverTimePlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); if ( m_plotWidget == nullptr || m_case == nullptr ) { diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index ec71ce0e595..2ffc1108726 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -121,7 +121,7 @@ RimWellAllocationPlot::RimWellAllocationPlot() CAF_PDM_InitFieldNoDefault( &m_tofAccumulatedPhaseFractionsPlot, "TofAccumulatedPhaseFractionsPlot", "TOF Accumulated Phase Fractions" ); m_tofAccumulatedPhaseFractionsPlot = new RimTofAccumulatedPhaseFractionsPlot; - setAsPlotMdiWindow(); + dockAsPlotWindow(); m_accumulatedWellFlowPlot->setAvailableDepthUnits( {} ); m_accumulatedWellFlowPlot->setAvailableDepthTypes( @@ -141,7 +141,7 @@ RimWellAllocationPlot::RimWellAllocationPlot() //-------------------------------------------------------------------------------------------------- RimWellAllocationPlot::~RimWellAllocationPlot() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); delete m_accumulatedWellFlowPlot(); delete m_totalWellAllocationPlot(); @@ -524,7 +524,7 @@ void RimWellAllocationPlot::addStackedCurve( const QString& tracerNa //-------------------------------------------------------------------------------------------------- void RimWellAllocationPlot::updateWidgetTitleWindowTitle() { - updateMdiWindowTitle(); + updateWindowTitle(); if ( m_wellAllocationPlotWidget ) { @@ -739,7 +739,7 @@ QString RimWellAllocationPlot::wellName() const //-------------------------------------------------------------------------------------------------- void RimWellAllocationPlot::removeFromMdiAreaAndDeleteViewWidget() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); deleteViewWidget(); } @@ -862,7 +862,7 @@ QString RimWellAllocationPlot::description() const //-------------------------------------------------------------------------------------------------- void RimWellAllocationPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); if ( !m_case ) { diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellConnectivityTable.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellConnectivityTable.cpp index a400ec25237..1b52596e9d2 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellConnectivityTable.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellConnectivityTable.cpp @@ -194,7 +194,7 @@ RimWellConnectivityTable::RimWellConnectivityTable() CAF_PDM_InitFieldNoDefault( &m_rangeType, "RangeType", "Range Type" ); setLegendsVisible( true ); - setAsPlotMdiWindow(); + dockAsPlotWindow(); setShowWindow( false ); } @@ -203,7 +203,7 @@ RimWellConnectivityTable::RimWellConnectivityTable() //-------------------------------------------------------------------------------------------------- RimWellConnectivityTable::~RimWellConnectivityTable() { - if ( isMdiWindow() ) removeMdiWindowFromMdiArea(); + if ( isMainDockedWindow() ) removeWindowFromDock(); cleanupBeforeClose(); } @@ -531,7 +531,7 @@ void RimWellConnectivityTable::defineEditorAttribute( const caf::PdmFieldHandle* //-------------------------------------------------------------------------------------------------- void RimWellConnectivityTable::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); if ( m_matrixPlotWidget == nullptr || m_case == nullptr ) { diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp index b47fa6fdc42..d57b0f8dd25 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellDistributionPlotCollection.cpp @@ -80,7 +80,7 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection() m_showWindow = false; - setAsPlotMdiWindow(); + dockAsPlotWindow(); addPlot( new RimWellDistributionPlot( RiaDefines::PhaseType::OIL_PHASE ) ); addPlot( new RimWellDistributionPlot( RiaDefines::PhaseType::GAS_PHASE ) ); @@ -92,7 +92,7 @@ RimWellDistributionPlotCollection::RimWellDistributionPlotCollection() //-------------------------------------------------------------------------------------------------- RimWellDistributionPlotCollection::~RimWellDistributionPlotCollection() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); m_plots.deleteChildren(); cleanupBeforeClose(); @@ -188,7 +188,7 @@ caf::PdmFieldHandle* RimWellDistributionPlotCollection::userDescriptionField() void RimWellDistributionPlotCollection::onLoadDataAndUpdate() { // cvf::Trace::show("RimWellDistributionPlotCollection::onLoadDataAndUpdate()"); - updateMdiWindowVisibility(); + updateDockWindowVisibility(); updatePlots(); updateLayout(); } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index addf5f72d08..e616e0b6815 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -137,7 +137,7 @@ RimWellPltPlot::RimWellPltPlot() m_nameConfig->setCustomName( "PLT Plot" ); setNamingMethod( RiaDefines::ObjectNamingMethod::CUSTOM ); - setAsPlotMdiWindow(); + dockAsPlotWindow(); m_doInitAfterLoad = false; m_isOnLoad = true; m_plotLegendsHorizontal = false; @@ -151,7 +151,7 @@ RimWellPltPlot::RimWellPltPlot() //-------------------------------------------------------------------------------------------------- RimWellPltPlot::~RimWellPltPlot() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); deleteViewWidget(); } @@ -1073,7 +1073,7 @@ void RimWellPltPlot::onLoadDataAndUpdate() m_isOnLoad = false; } - updateMdiWindowVisibility(); + updateDockWindowVisibility(); updateFormationsOnPlot(); syncCurvesFromUiSelection(); } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index ebcce2fd4c1..9ff924952b1 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -147,7 +147,7 @@ RimWellRftPlot::RimWellRftPlot() setPlotTitleVisible( true ); - setAsPlotMdiWindow(); + dockAsPlotWindow(); m_isOnLoad = true; } @@ -156,7 +156,7 @@ RimWellRftPlot::RimWellRftPlot() //-------------------------------------------------------------------------------------------------- RimWellRftPlot::~RimWellRftPlot() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); deleteViewWidget(); } @@ -1358,7 +1358,7 @@ void RimWellRftPlot::onLoadDataAndUpdate() m_isOnLoad = false; } - updateMdiWindowVisibility(); + updateDockWindowVisibility(); updateFormationsOnPlot(); if ( depthType() == RiaDefines::DepthType::MEASURED_DEPTH ) diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp index df53e9964aa..6f01c02ef7a 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechView.cpp @@ -193,7 +193,7 @@ void RimGeoMechView::onLoadDataAndUpdate() progress.incrementProgress(); progress.setProgressDescription( "Create Display model" ); - updateMdiWindowVisibility(); + updateDockWindowVisibility(); geoMechPropertyFilterCollection()->loadAndInitializePropertyFilters(); m_wellMeasurementCollection->syncWithChangesInWellMeasurementCollection(); diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index de0f2cc3600..328c5205443 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -72,7 +72,7 @@ RimGridCrossPlot::RimGridCrossPlot() //-------------------------------------------------------------------------------------------------- RimGridCrossPlot::~RimGridCrossPlot() { - removeMdiWindowFromMdiArea(); + if ( isMainDockedWindow() ) removeWindowFromDock(); cleanupBeforeClose(); } @@ -464,7 +464,7 @@ void RimGridCrossPlot::deleteViewWidget() //-------------------------------------------------------------------------------------------------- void RimGridCrossPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); for ( auto dataSet : m_crossPlotDataSets ) { @@ -485,7 +485,7 @@ void RimGridCrossPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin caf::PdmUiGroup* generalGroup = uiOrdering.addNewGroup( "Plot Options" ); generalGroup->add( &m_showInfoBox ); - if ( isMdiWindow() ) + if ( isMainDockedWindow() ) { RimPlotWindow::uiOrderingForLegendsAndFonts( uiConfigName, uiOrdering ); } @@ -595,7 +595,7 @@ void RimGridCrossPlot::updateCurveNamesAndPlotTitle() m_plotWidget->setPlotTitle( plotTitle ); m_plotWidget->setPlotTitleEnabled( m_showPlotTitle && !isSubPlot() ); } - updateMdiWindowTitle(); + updateWindowTitle(); updateInfoBox(); } diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp index e60eca9681f..b746b473d65 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotCollection.cpp @@ -61,7 +61,7 @@ size_t RimGridCrossPlotCollection::plotCount() const RimGridCrossPlot* RimGridCrossPlotCollection::createGridCrossPlot() { RimGridCrossPlot* plot = new RimGridCrossPlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); // plot->setDescription(QString("Summary Cross Plot %1").arg(m_gridCrossPlots.size())); addPlot( plot ); diff --git a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp index 0041ddad7b9..ae550c5115a 100644 --- a/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/GridCrossPlots/RimSaturationPressurePlotCollection.cpp @@ -87,7 +87,7 @@ std::vector if ( eqlnumRegionIdsFound.find( zeroBasedEquilibriumRegion + 1 ) != eqlnumRegionIdsFound.end() ) { RimSaturationPressurePlot* plot = new RimSaturationPressurePlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); // As discussed with Liv Merete, it is not any use for creation of different plots for matrix/fracture. For // now, use hardcoded value for MATRIX diff --git a/ApplicationLibCode/ProjectDataModel/Histogram/RimHistogramPlot.cpp b/ApplicationLibCode/ProjectDataModel/Histogram/RimHistogramPlot.cpp index 971427179e0..05935dccb1e 100644 --- a/ApplicationLibCode/ProjectDataModel/Histogram/RimHistogramPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Histogram/RimHistogramPlot.cpp @@ -131,7 +131,7 @@ RimHistogramPlot::~RimHistogramPlot() { m_isValid = false; - removeMdiWindowFromMdiArea(); + if ( isMainDockedWindow() ) removeWindowFromDock(); deletePlotCurvesAndPlotWidget(); } @@ -261,7 +261,7 @@ void RimHistogramPlot::updatePlotTitle() } updateCurveNames(); - updateMdiWindowTitle(); + updateWindowTitle(); if ( plotWidget() ) { @@ -662,7 +662,7 @@ void RimHistogramPlot::onLoadDataAndUpdate() updatePlotTitle(); auto plotWindow = firstAncestorOrThisOfType(); - if ( plotWindow == nullptr ) updateMdiWindowVisibility(); + if ( plotWindow == nullptr ) updateDockWindowVisibility(); if ( m_histogramCurveCollection ) { @@ -987,7 +987,7 @@ void RimHistogramPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin { caf::PdmUiGroup* mainOptions = uiOrdering.addNewGroup( "General Plot Options" ); - if ( isMdiWindow() ) + if ( isMainDockedWindow() ) { mainOptions->add( &m_showPlotTitle ); if ( m_showPlotTitle ) @@ -1008,7 +1008,7 @@ void RimHistogramPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrderin uiOrdering.add( &m_histogramFrequencyType ); uiOrdering.add( &m_graphType ); - if ( isMdiWindow() ) + if ( isMainDockedWindow() ) { RimPlotWindow::uiOrderingForLegendsAndFonts( uiConfigName, uiOrdering ); } diff --git a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp index a9d5f62c45f..73f302d9a0c 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim2dIntersectionView.cpp @@ -794,7 +794,7 @@ cvf::Transform* Rim2dIntersectionView::scaleTransform() //-------------------------------------------------------------------------------------------------- void Rim2dIntersectionView::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); scheduleCreateDisplayModelAndRedraw(); } diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 2e46e5c5b96..6b98f452263 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -186,7 +186,7 @@ Rim3dView::Rim3dView() m_annotationsPartManager = new RivAnnotationsPartMgr( this ); m_measurementPartManager = new RivMeasurementPartMgr( this ); - this->setAs3DViewMdiWindow(); + this->dockAs3DViewWindow(); // Every timer tick, send a signal for updating animations. // Any animation is supposed to connect to this signal @@ -214,10 +214,13 @@ Rim3dView::~Rim3dView() // Make sure the object is disconnected from other objects before delete prepareForDelete(); - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); - delete m_viewer; - m_viewer = nullptr; + if ( m_viewer ) + { + m_viewer->deleteLater(); + m_viewer = nullptr; + } } //-------------------------------------------------------------------------------------------------- @@ -396,7 +399,7 @@ void Rim3dView::assignIdIfNecessary() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dView::updateMdiWindowTitle() +void Rim3dView::updateWindowTitle() { if ( m_viewer ) { @@ -991,7 +994,7 @@ void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const } else if ( changedField == m_nameConfig->nameField() ) { - updateMdiWindowTitle(); + updateWindowTitle(); if ( viewController() ) { @@ -1437,7 +1440,7 @@ void Rim3dView::updateFonts() //-------------------------------------------------------------------------------------------------- void Rim3dView::performAutoNameUpdate() { - updateMdiWindowTitle(); + updateWindowTitle(); } //-------------------------------------------------------------------------------------------------- @@ -1677,14 +1680,6 @@ void Rim3dView::handleMdiWindowClosed() RimViewWindow::handleMdiWindowClosed(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void Rim3dView::setMdiWindowGeometry( const RimMdiWindowGeometry& windowGeometry ) -{ - RimViewWindow::setMdiWindowGeometry( windowGeometry ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1927,7 +1922,7 @@ void Rim3dView::convertToDocking( RiuMainWindowBase* mainWindow ) { if ( isDockingViewer() ) return; - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); QWidget* viewWidget = createViewWidget( nullptr ); @@ -1950,7 +1945,7 @@ void Rim3dView::convertToMdi( RiuMainWindowBase* mainWindow ) m_windowController->updateViewerWidget(); - updateMdiWindowVisibility(); + updateDockWindowVisibility(); updateViewWidgetAfterCreation(); scheduleCreateDisplayModelAndRedraw(); diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.h b/ApplicationLibCode/ProjectDataModel/Rim3dView.h index d4ac0bafd7b..b1146e62cbf 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.h +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.h @@ -200,7 +200,7 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public Rim3dView* activeComparisonView() const; void setComparisonView( Rim3dView* compView ); std::set viewsUsingThisAsComparisonView(); - void updateMdiWindowTitle() override; + void updateWindowTitle() override; std::vector validComparisonViews() const; RimViewLinker* assosiatedViewLinker() const override; @@ -318,7 +318,6 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public caf::PdmObjectHandle* implementingPdmObject() override; void handleMdiWindowClosed() override; - void setMdiWindowGeometry( const RimMdiWindowGeometry& windowGeometry ) override; // Pure private methods diff --git a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp index 229a608bd10..8a882d799a7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDepthTrackPlot.cpp @@ -185,7 +185,7 @@ RimDepthTrackPlot::~RimDepthTrackPlot() delete m_commonDataSource; delete m_nameConfig; - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); m_plots.deleteChildren(); cleanupBeforeClose(); @@ -791,7 +791,7 @@ void RimDepthTrackPlot::performAutoNameUpdate() m_viewer->setTitleVisible( m_showPlotTitle() ); m_viewer->setPlotTitle( m_plotWindowTitle ); } - updateMdiWindowTitle(); + updateWindowTitle(); } //-------------------------------------------------------------------------------------------------- @@ -1228,7 +1228,7 @@ void RimDepthTrackPlot::initAfterRead() //-------------------------------------------------------------------------------------------------- void RimDepthTrackPlot::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); performAutoNameUpdate(); updatePlots(); updateLayout(); diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index 6ca0ceff9d2..c65cfb97f1d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -33,12 +33,9 @@ CAF_PDM_XML_SOURCE_INIT( RimDockWindowController, "DockWindowController" ); //-------------------------------------------------------------------------------------------------- RimDockWindowController::RimDockWindowController() { - CAF_PDM_InitField( &m_mainWindowID, "MainWindowID", -1, "" ); - CAF_PDM_InitField( &m_x, "xPos", -1, "" ); - CAF_PDM_InitField( &m_y, "yPos", -1, "" ); - CAF_PDM_InitField( &m_width, "Width", -1, "" ); - CAF_PDM_InitField( &m_height, "Height", -1, "" ); - CAF_PDM_InitField( &m_isMaximized, "IsMaximized", false, "" ); + CAF_PDM_InitField( &m_mainWindowID, "MainWindowID", 0, "" ); + CAF_PDM_InitFieldNoDefault( &m_viewToControl, "ViewToControl", "" ); + m_viewToControl = nullptr; } //-------------------------------------------------------------------------------------------------- @@ -48,36 +45,6 @@ RimDockWindowController::~RimDockWindowController() { } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimDockWindowController::setWindowGeometry( const RimMdiWindowGeometry& windowGeometry ) -{ - m_mainWindowID = windowGeometry.mainWindowID; - m_x = windowGeometry.x; - m_y = windowGeometry.y; - m_width = windowGeometry.width; - m_height = windowGeometry.height; - m_isMaximized = windowGeometry.isMaximized; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimMdiWindowGeometry RimDockWindowController::windowGeometry() -{ - RimMdiWindowGeometry windowGeometry; - - windowGeometry.mainWindowID = m_mainWindowID; - windowGeometry.x = m_x; - windowGeometry.y = m_y; - windowGeometry.width = m_width; - windowGeometry.height = m_height; - windowGeometry.isMaximized = m_isMaximized; - - return windowGeometry; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -98,10 +65,12 @@ void RimDockWindowController::handleViewerDeletion() void RimDockWindowController::removeWindowFromDock() { RiuMainWindowBase* mainWin = getMainWindow(); - if ( mainWin && viewWidget() ) + if ( mainWin && viewWidget() && viewPdmObject() ) { - mainWin->removeViewer( viewWidget() ); + viewPdmObject()->deleteDockViewer(); viewPdmObject()->deleteViewWidget(); + + mainWin->removeViewer( viewWidget() ); } } @@ -110,7 +79,7 @@ void RimDockWindowController::removeWindowFromDock() //-------------------------------------------------------------------------------------------------- RimViewWindow* RimDockWindowController::viewPdmObject() { - return firstAncestorOrThisOfType(); + return m_viewToControl; } //-------------------------------------------------------------------------------------------------- @@ -118,6 +87,7 @@ RimViewWindow* RimDockWindowController::viewPdmObject() //-------------------------------------------------------------------------------------------------- QWidget* RimDockWindowController::viewWidget() { + if ( !viewPdmObject() ) return nullptr; return viewPdmObject()->viewWidget(); } @@ -138,10 +108,6 @@ RiuMainWindowBase* RimDockWindowController::getMainWindow() //-------------------------------------------------------------------------------------------------- void RimDockWindowController::setupBeforeSave() { - if ( viewWidget() && getMainWindow() ) - { - setWindowGeometry( getMainWindow()->windowGeometryForViewer( viewWidget() ) ); - } } //-------------------------------------------------------------------------------------------------- @@ -151,6 +117,7 @@ void RimDockWindowController::updateViewerWidget() { RiuMainWindowBase* mainWindow = getMainWindow(); if ( !mainWindow ) return; + if ( !viewPdmObject() ) return; if ( viewPdmObject()->isWindowVisible() ) { @@ -159,22 +126,37 @@ void RimDockWindowController::updateViewerWidget() ads::CDockWidget* dockWidget = viewPdmObject()->createDockWidget(); QWidget* viewWidget = viewPdmObject()->createViewWidget( dockWidget ); dockWidget->setWidget( viewWidget ); - mainWindow->initializeViewer( dockWidget, viewWidget, windowGeometry() ); + mainWindow->initializeViewer( dockWidget, viewWidget ); viewPdmObject()->updateViewWidgetAfterCreation(); } - viewPdmObject()->updateMdiWindowTitle(); + viewPdmObject()->updateWindowTitle(); } else { if ( viewWidget() ) { - setWindowGeometry( mainWindow->windowGeometryForViewer( viewWidget() ) ); - + viewPdmObject()->deleteDockViewer(); mainWindow->removeViewer( viewWidget() ); viewPdmObject()->deleteViewWidget(); } } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimDockWindowController::setMainWindowId( int mainId ) +{ + m_mainWindowID = mainId; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimDockWindowController::setViewToControl( RimViewWindow* view ) +{ + m_viewToControl = view; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h index 8d9f96d3236..74bb69e28c6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h @@ -23,7 +23,6 @@ #include "cafPdmObject.h" class RiuMainWindowBase; -// class RiuMdiSubWindow; class RimViewWindow; struct RimMdiWindowGeometry; @@ -39,8 +38,8 @@ class RimDockWindowController : public caf::PdmObject RimDockWindowController(); ~RimDockWindowController() override; - void setWindowGeometry( const RimMdiWindowGeometry& windowGeometry ); - RimMdiWindowGeometry windowGeometry(); + void setMainWindowId( int mainId ); + void setViewToControl( RimViewWindow* view ); void updateViewerWidget(); void handleViewerDeletion(); @@ -55,11 +54,6 @@ class RimDockWindowController : public caf::PdmObject void setupBeforeSave() override; private: - caf::PdmField m_mainWindowID; - - caf::PdmField m_x; - caf::PdmField m_y; - caf::PdmField m_width; - caf::PdmField m_height; - caf::PdmField m_isMaximized; + caf::PdmField m_mainWindowID; + caf::PdmPtrField m_viewToControl; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp index 402b940622a..7f118f2c290 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseView.cpp @@ -579,7 +579,7 @@ void RimEclipseView::childFieldChangedByUi( const caf::PdmFieldHandle* changedCh { if ( changedChildField == &m_cellResult ) { - updateMdiWindowTitle(); + updateWindowTitle(); m_propertyFilterCollection->updateDefaultResult( m_cellResult() ); } @@ -1268,7 +1268,7 @@ void RimEclipseView::onLoadDataAndUpdate() faultResultSettings()->customFaultResult()->loadResult(); fractureColors()->loadDataAndUpdate(); - updateMdiWindowVisibility(); + updateDockWindowVisibility(); m_propertyFilterCollection()->loadAndInitializePropertyFilters(); diff --git a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp index a20d04f5cb1..5b707dc7fe9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMainPlotCollection.cpp @@ -172,7 +172,7 @@ void RimMainPlotCollection::initAfterRead() auto* summaryMultiPlot = new RimSummaryMultiPlot; summaryMultiPlot->setMultiPlotTitle( QString( "Multi Plot %1" ).arg( m_summaryMultiPlotCollection->multiPlots().size() + 1 ) ); - summaryMultiPlot->setAsPlotMdiWindow(); + summaryMultiPlot->dockAsPlotWindow(); m_summaryMultiPlotCollection->addSummaryMultiPlot( summaryMultiPlot ); // We want to convert RimSummaryCrossPlot into a RimSummaryPlot. The cross plot is derived from RimSummaryPlot, but we need to diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index cc7866185ed..3e03e8bddbd 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -85,7 +85,7 @@ RimMultiPlot::~RimMultiPlot() { m_isValid = false; - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); m_plots.deleteChildren(); cleanupBeforeClose(); @@ -259,7 +259,7 @@ void RimMultiPlot::movePlotsToThis( const std::vector& plotsToMove, in } else { - plotsToMove[tIdx]->removeFromMdiAreaAndCollection(); + plotsToMove[tIdx]->removeFromDockAreaAndCollection(); } } @@ -790,7 +790,7 @@ void RimMultiPlot::onLoadDataAndUpdate() bool originalShowState = m_showPlotLegends(); m_showPlotLegends = false; - updateMdiWindowVisibility(); + updateDockWindowVisibility(); updatePlotTitles(); applyPlotWindowTitleToWidgets(); updatePlots(); @@ -820,7 +820,7 @@ void RimMultiPlot::applyPlotWindowTitleToWidgets() m_viewer->setTitleVisible( m_showPlotWindowTitle() ); m_viewer->setPlotTitle( multiPlotTitle() ); } - updateMdiWindowTitle(); + updateWindowTitle(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp index cab707e832f..8a10cd851cb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp @@ -138,11 +138,11 @@ void RimPlot::setColSpan( RowOrColSpan colSpan ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlot::removeFromMdiAreaAndCollection() +void RimPlot::removeFromDockAreaAndCollection() { - if ( isMdiWindow() ) + if ( isMainDockedWindow() ) { - revokeMdiWindowStatus(); + removeWindowFromDock(); } auto plotCollection = firstAncestorOfType(); @@ -165,7 +165,7 @@ void RimPlot::updateAfterInsertingIntoMultiPlot() //-------------------------------------------------------------------------------------------------- void RimPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - if ( !isMdiWindow() ) + if ( !isMainDockedWindow() ) { uiOrdering.add( &m_rowSpan ); uiOrdering.add( &m_colSpan ); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.h b/ApplicationLibCode/ProjectDataModel/RimPlot.h index 5839de52db6..ba8776705d9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.h @@ -73,7 +73,7 @@ class RimPlot : public QObject, public RimPlotWindow, public RimPlainPlotDataPro RowOrColSpan colSpan() const; void setRowSpan( RowOrColSpan rowSpan ); void setColSpan( RowOrColSpan colSpan ); - void removeFromMdiAreaAndCollection(); + void removeFromDockAreaAndCollection(); void updateAfterInsertingIntoMultiPlot(); // Pure virtual interface methods diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp index 63c486e1c9f..dc6f31ed4c8 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp @@ -389,9 +389,9 @@ bool RimPlotWindow::hasCustomPageLayout( QPageLayout* customPageLayout ) const //-------------------------------------------------------------------------------------------------- void RimPlotWindow::updateWindowVisibility() { - if ( isMdiWindow() ) + if ( isMainDockedWindow() ) { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); } else { @@ -414,7 +414,7 @@ void RimPlotWindow::setId( int id ) //-------------------------------------------------------------------------------------------------- void RimPlotWindow::assignIdIfNecessary() { - if ( m_id == -1 && isMdiWindow() ) + if ( m_id == -1 && isMainDockedWindow() ) { RimProject::current()->assignPlotIdToPlotWindow( this ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimTools.cpp b/ApplicationLibCode/ProjectDataModel/RimTools.cpp index 91d8fcfa130..f5ad272361a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimTools.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimTools.cpp @@ -654,7 +654,7 @@ void RimTools::updateViewWindowContent( std::vector& obje } else { - viewWindow->updateMdiWindowVisibility(); + viewWindow->updateDockWindowVisibility(); } } } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewController.cpp b/ApplicationLibCode/ProjectDataModel/RimViewController.cpp index 0aaed335d98..6232f24e827 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewController.cpp @@ -168,7 +168,7 @@ void RimViewController::fieldChangedByUi( const caf::PdmFieldHandle* changedFiel updateDisplayNameAndIcon(); updateTimeStepLink(); - if ( m_managedView ) m_managedView->updateMdiWindowTitle(); + if ( m_managedView ) m_managedView->updateWindowTitle(); } else if ( changedField == &m_syncCamera ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp b/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp index 2a01c849d54..985315247c7 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewLinker.cpp @@ -233,13 +233,13 @@ void RimViewLinker::updateOverrides() //-------------------------------------------------------------------------------------------------- void RimViewLinker::updateWindowTitles() { - if ( m_masterView ) m_masterView->updateMdiWindowTitle(); + if ( m_masterView ) m_masterView->updateWindowTitle(); for ( RimViewController* viewController : m_viewControllers ) { if ( auto view = viewController->managedView() ) { - view->updateMdiWindowTitle(); + view->updateWindowTitle(); } } } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index a83bbfec77b..db891fd5134 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -26,6 +26,7 @@ #include "RicfCommandObject.h" +#include "Rim3dView.h" #include "RimDockWindowController.h" #include "RimProject.h" @@ -46,18 +47,12 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimViewWindow, "ViewWindow" ); // Do not use. //-------------------------------------------------------------------------------------------------- RimViewWindow::RimViewWindow() : m_dockWidget( nullptr ) + , m_windowController( nullptr ) { CAF_PDM_InitScriptableObjectWithNameAndComment( "View window", "", "", "", "ViewWindow", "The Base Class for all Views and Plots in ResInsight" ); - CAF_PDM_InitFieldNoDefault( &m_windowController, "WindowController", "" ); - m_windowController.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField( &m_showWindow, "ShowWindow", true, "Show Window" ); m_showWindow.uiCapability()->setUiHidden( true ); - - // Obsolete field - CAF_PDM_InitFieldNoDefault( &obsoleteField_windowGeometry, "WindowGeometry", "" ); - RiaFieldHandleTools::disableWriteAndSetFieldHidden( &obsoleteField_windowGeometry ); } //-------------------------------------------------------------------------------------------------- @@ -65,7 +60,6 @@ RimViewWindow::RimViewWindow() //-------------------------------------------------------------------------------------------------- RimViewWindow::~RimViewWindow() { - if ( m_windowController() ) delete m_windowController(); } //-------------------------------------------------------------------------------------------------- @@ -97,9 +91,17 @@ void RimViewWindow::loadDataAndUpdate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewWindow::removeMdiWindowFromMdiArea() +bool RimViewWindow::isMainDockedWindow() const { - if ( m_windowController() ) m_windowController->removeWindowFromDock(); + return m_windowController != nullptr; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimViewWindow::removeWindowFromDock() +{ + if ( m_windowController != nullptr ) m_windowController->removeWindowFromDock(); } //-------------------------------------------------------------------------------------------------- @@ -119,22 +121,31 @@ QString RimViewWindow::windowTitle() return QString( "" ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimViewWindow::deleteDockViewer() +{ + m_dockWidget->deleteDockWidget(); + m_dockWidget = nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RimViewWindow::handleMdiWindowClosed() { - if ( m_windowController() ) m_windowController->handleViewerDeletion(); + if ( m_windowController != nullptr ) m_windowController->handleViewerDeletion(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewWindow::updateMdiWindowVisibility() +void RimViewWindow::updateDockWindowVisibility() { if ( !RiaGuiApplication::isRunning() ) return; - if ( m_windowController() ) + if ( m_windowController != nullptr ) { m_windowController->updateViewerWidget(); } @@ -157,58 +168,17 @@ void RimViewWindow::updateMdiWindowVisibility() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewWindow::setAs3DViewMdiWindow() -{ - setAsMdiWindow( 0 ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimViewWindow::setAsPlotMdiWindow() -{ - setAsMdiWindow( 1 ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimViewWindow::revokeMdiWindowStatus() -{ - if ( m_windowController() ) - { - handleMdiWindowClosed(); - deleteViewWidget(); - delete m_windowController(); - m_windowController = nullptr; - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RimViewWindow::isMdiWindow() const +void RimViewWindow::dockAs3DViewWindow() { - return m_windowController() != nullptr; + dockInWindow( 0 ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewWindow::setMdiWindowGeometry( const RimMdiWindowGeometry& windowGeometry ) +void RimViewWindow::dockAsPlotWindow() { - if ( m_windowController() ) m_windowController()->setWindowGeometry( windowGeometry ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimMdiWindowGeometry RimViewWindow::mdiWindowGeometry() -{ - if ( m_windowController() ) - return m_windowController()->windowGeometry(); - else - return RimMdiWindowGeometry(); + dockInWindow( 1 ); } //-------------------------------------------------------------------------------------------------- @@ -272,7 +242,7 @@ void RimViewWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField, c } else { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); } uiCapability()->updateUiIconFromToggleField(); } @@ -281,7 +251,7 @@ void RimViewWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField, c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewWindow::updateMdiWindowTitle() +void RimViewWindow::updateWindowTitle() { if ( viewWidget() && dockWidget() ) { @@ -293,44 +263,21 @@ void RimViewWindow::updateMdiWindowTitle() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewWindow::setAsMdiWindow( int mainWindowID ) +void RimViewWindow::dockInWindow( int mainWindowID ) { - if ( !m_windowController() ) + if ( m_windowController == nullptr ) { - m_windowController = new RimDockWindowController; - RimMdiWindowGeometry mwg; - mwg.mainWindowID = mainWindowID; - setMdiWindowGeometry( mwg ); + m_windowController = new RimDockWindowController(); + m_windowController->setViewToControl( this ); } + m_windowController->setMainWindowId( mainWindowID ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -#include "Rim3dView.h" - void RimViewWindow::initAfterRead() { - if ( obsoleteField_windowGeometry.value().size() == 5 ) - { - RimMdiWindowGeometry wg; - int mainWindowID = -1; - - if ( dynamic_cast( this ) ) - mainWindowID = 0; - else - mainWindowID = 1; - - wg.mainWindowID = mainWindowID; - wg.x = obsoleteField_windowGeometry.value()[0]; - wg.y = obsoleteField_windowGeometry.value()[1]; - wg.width = obsoleteField_windowGeometry.value()[2]; - wg.height = obsoleteField_windowGeometry.value()[3]; - wg.isMaximized = obsoleteField_windowGeometry.value()[4]; - - setAsMdiWindow( mainWindowID ); - setMdiWindowGeometry( wg ); - } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index eac9fc374cb..33e8bc3c0e0 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -25,8 +25,6 @@ #include "cafPdmField.h" #include "cafPdmObject.h" -#include - class RimDockWindowController; namespace ads @@ -34,28 +32,6 @@ namespace ads class CDockWidget; } // namespace ads -struct RimMdiWindowGeometry -{ - RimMdiWindowGeometry() - : mainWindowID( -1 ) - , x( 0 ) - , y( 0 ) - , width( -1 ) - , height( -1 ) - , isMaximized( false ) - { - } - bool isValid() const { return ( mainWindowID >= 0 && width >= 0 && height >= 0 ); } - - int mainWindowID; - - int x; - int y; - int width; - int height; - bool isMaximized; -}; - class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface { CAF_PDM_HEADER_INIT; @@ -69,18 +45,16 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface bool showWindow() const; void setShowWindow( bool showWindow ); + bool isMainDockedWindow() const; + void loadDataAndUpdate(); void handleMdiWindowClosed(); - void updateMdiWindowVisibility(); + void updateDockWindowVisibility(); - void setAs3DViewMdiWindow(); - void setAsPlotMdiWindow(); - void revokeMdiWindowStatus(); + void removeWindowFromDock(); - bool isMdiWindow() const; - - void setMdiWindowGeometry( const RimMdiWindowGeometry& windowGeometry ); - RimMdiWindowGeometry mdiWindowGeometry(); + void dockAs3DViewWindow(); + void dockAsPlotWindow(); virtual QWidget* viewWidget() = 0; @@ -92,11 +66,9 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface void viewNavigationChanged(); - virtual void updateMdiWindowTitle(); + virtual void updateWindowTitle(); protected: - void removeMdiWindowFromMdiArea(); - ///////// Interface for the Window controller friend class RimDockWindowController; @@ -107,6 +79,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface virtual void onLoadDataAndUpdate() = 0; virtual void onViewNavigationChanged(); virtual bool isWindowVisible() const; // Virtual To allow special visibility control + void deleteDockViewer(); ////////// // Derived classes are not supposed to override this function. The intention is to always use m_showWindow @@ -121,15 +94,11 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface private: friend class RimProject; - void setAsMdiWindow( int mainWindowID ); + void dockInWindow( int mainWindowID ); virtual void assignIdIfNecessary() = 0; protected: - caf::PdmField m_showWindow; - caf::PdmChildField m_windowController; - ads::CDockWidget* m_dockWidget; - -private: - // Obsoleted field - caf::PdmField> obsoleteField_windowGeometry; + caf::PdmField m_showWindow; + RimDockWindowController* m_windowController; + ads::CDockWidget* m_dockWidget; }; diff --git a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.cpp b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.cpp index 765237bb288..751331bf83c 100644 --- a/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Seismic/RimSeismicView.cpp @@ -411,7 +411,7 @@ void RimSeismicView::onLoadDataAndUpdate() synchronizeLocalAnnotationsFromGlobal(); onUpdateScaleTransform(); - updateMdiWindowVisibility(); + updateDockWindowVisibility(); if ( m_surfaceCollection ) m_surfaceCollection->loadData( m_currentTimeStep ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp index 761bbfd9442..1875ad9a6b1 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCrossPlotCollection.cpp @@ -116,7 +116,7 @@ void RimSummaryCrossPlotCollection::removePlot( RimSummaryPlot* plot ) RimSummaryPlot* RimSummaryCrossPlotCollection::createSummaryPlot() { RimSummaryPlot* plot = new RimSummaryCrossPlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); plot->setDescription( QString( "Summary Cross Plot %1" ).arg( m_summaryCrossPlots.size() ) ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 0aee5f23fa1..bb70916832f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -192,7 +192,7 @@ RimSummaryPlot::~RimSummaryPlot() { m_isValid = false; - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); deletePlotCurvesAndPlotWidget(); @@ -503,7 +503,7 @@ void RimSummaryPlot::updatePlotTitle() } updateCurveNames(); - updateMdiWindowTitle(); + updateWindowTitle(); if ( plotWidget() ) { @@ -1784,7 +1784,7 @@ void RimSummaryPlot::onLoadDataAndUpdate() updatePlotTitle(); auto plotWindow = firstAncestorOrThisOfType(); - if ( plotWindow == nullptr ) updateMdiWindowVisibility(); + if ( plotWindow == nullptr ) updateDockWindowVisibility(); if ( m_summaryCurveCollection ) { @@ -2516,7 +2516,7 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& } caf::PdmUiGroup* mainOptions = uiOrdering.addNewGroup( "General Plot Options" ); - if ( isMdiWindow() ) + if ( isMainDockedWindow() ) { mainOptions->add( &m_showPlotTitle ); if ( m_showPlotTitle ) @@ -2534,7 +2534,7 @@ void RimSummaryPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& mainOptions->add( &m_normalizeCurveYValues ); - if ( isMdiWindow() ) + if ( isMainDockedWindow() ) { RimPlotWindow::uiOrderingForLegendsAndFonts( uiConfigName, uiOrdering ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp index 3c84c1c237c..ed12765443c 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlotCollection.cpp @@ -56,7 +56,7 @@ RimSummaryPlotCollection::~RimSummaryPlotCollection() RimSummaryPlot* RimSummaryPlotCollection::createSummaryPlotWithAutoTitle() { RimSummaryPlot* plot = new RimSummaryPlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); plot->enableAutoPlotTitle( true ); @@ -71,7 +71,7 @@ RimSummaryPlot* RimSummaryPlotCollection::createSummaryPlotWithAutoTitle() RimSummaryPlot* RimSummaryPlotCollection::createNamedSummaryPlot( const QString& name ) { RimSummaryPlot* plot = new RimSummaryPlot(); - plot->setAsPlotMdiWindow(); + plot->dockAsPlotWindow(); addPlot( plot ); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.cpp index 9598262cebc..dd4216473f9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTable.cpp @@ -121,7 +121,7 @@ RimSummaryTable::RimSummaryTable() CAF_PDM_InitField( &m_endDate, "EndDate", QDateTime::currentDateTime(), "End Date" ); setLegendsVisible( true ); - setAsPlotMdiWindow(); + dockAsPlotWindow(); setShowWindow( true ); setDeletable( true ); } @@ -131,7 +131,7 @@ RimSummaryTable::RimSummaryTable() //-------------------------------------------------------------------------------------------------- RimSummaryTable::~RimSummaryTable() { - if ( isMdiWindow() ) removeMdiWindowFromMdiArea(); + if ( isMainDockedWindow() ) removeWindowFromDock(); cleanupBeforeClose(); } @@ -432,7 +432,7 @@ QList RimSummaryTable::calculateValueOptions( const caf: //-------------------------------------------------------------------------------------------------- void RimSummaryTable::onLoadDataAndUpdate() { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); createTableData(); setExcludedRowsUiSelectionsFromTableData(); diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTableCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTableCollection.cpp index 3c5c725ce7e..14a42f32a41 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTableCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryTableCollection.cpp @@ -104,7 +104,7 @@ RimSummaryTable* RimSummaryTableCollection::createDefaultSummaryTable() { RimSummaryTable* table = new RimSummaryTable(); table->setDefaultCaseAndCategoryAndVectorName(); - table->setAsPlotMdiWindow(); + table->dockAsPlotWindow(); return table; } @@ -118,7 +118,7 @@ RimSummaryTable* RimSummaryTableCollection::createSummaryTableFromCategoryAndVec { RimSummaryTable* table = new RimSummaryTable(); table->setFromCaseAndCategoryAndVectorName( summaryCase, category, vectorName ); - table->setAsPlotMdiWindow(); + table->dockAsPlotWindow(); return table; } diff --git a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimCustomVfpPlot.cpp b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimCustomVfpPlot.cpp index c89de9f5df5..7100bc9a79d 100644 --- a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimCustomVfpPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimCustomVfpPlot.cpp @@ -163,7 +163,7 @@ RimCustomVfpPlot::RimCustomVfpPlot() m_showWindow = true; m_showPlotLegends = true; - setAsPlotMdiWindow(); + dockAsPlotWindow(); setDeletable( true ); } @@ -173,7 +173,7 @@ RimCustomVfpPlot::RimCustomVfpPlot() //-------------------------------------------------------------------------------------------------- RimCustomVfpPlot::~RimCustomVfpPlot() { - removeMdiWindowFromMdiArea(); + removeWindowFromDock(); deleteViewWidget(); } @@ -333,7 +333,7 @@ void RimCustomVfpPlot::updateLegend() // Hide the legend when in multiplot mode, as the legend is handled by the multi plot grid layout bool doShowLegend = false; - if ( isMdiWindow() ) + if ( isMainDockedWindow() ) { doShowLegend = m_showPlotLegends; } @@ -612,9 +612,9 @@ void generateCombinations( const std::vector>& vectors, //-------------------------------------------------------------------------------------------------- void RimCustomVfpPlot::onLoadDataAndUpdate() { - if ( isMdiWindow() ) + if ( isMainDockedWindow() ) { - updateMdiWindowVisibility(); + updateDockWindowVisibility(); } else { @@ -1394,7 +1394,7 @@ void RimCustomVfpPlot::updatePlotTitle( const QString& plotTitle ) { m_plotTitle = plotTitle; - updateMdiWindowTitle(); + updateWindowTitle(); if ( m_plotWidget ) { diff --git a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlotCollection.cpp index 9e3b0a1d076..5e01e4facdb 100644 --- a/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/VerticalFlowPerformance/RimVfpPlotCollection.cpp @@ -121,7 +121,7 @@ void RimVfpPlotCollection::onChildrenUpdated( caf::PdmChildArrayFieldHandle* chi { for ( auto plot : plots() ) { - plot->updateMdiWindowVisibility(); + plot->updateDockWindowVisibility(); } } diff --git a/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogPlotCollection.cpp b/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogPlotCollection.cpp index 696bacd8adf..b6274eef516 100644 --- a/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModelCommands/RimcWellLogPlotCollection.cpp @@ -76,7 +76,7 @@ RimWellLogPlot* RimcWellLogPlotCollection_newWellLogPlot::createWellLogPlot( Rim RimEclipseCase* eclipseCase ) { RimWellLogPlot* newWellLogPlot = new RimWellLogPlot; - newWellLogPlot->setAsPlotMdiWindow(); + newWellLogPlot->dockAsPlotWindow(); wellLogPlotCollection->addWellLogPlot( newWellLogPlot ); diff --git a/ApplicationLibCode/SocketInterface/RiaSocketServer.cpp b/ApplicationLibCode/SocketInterface/RiaSocketServer.cpp index 35bf574b1aa..ce536c5f481 100644 --- a/ApplicationLibCode/SocketInterface/RiaSocketServer.cpp +++ b/ApplicationLibCode/SocketInterface/RiaSocketServer.cpp @@ -150,21 +150,21 @@ RimEclipseCase* RiaSocketServer::findReservoir( int caseId ) return eclipseView->eclipseCase(); } - // If the active mdi window is different from an Eclipse view, search through available mdi windows to find the - // last activated Eclipse view. The sub windows are returned with the most recent activated window at the back. - QList subWindows = RiuMainWindow::instance()->subWindowList( QMdiArea::ActivationHistoryOrder ); - for ( int i = subWindows.size() - 1; i > -1; i-- ) - { - RiuViewer* viewer = subWindows[i]->widget()->findChild(); - if ( viewer ) - { - RimEclipseView* riv = dynamic_cast( viewer->ownerReservoirView() ); - if ( riv ) - { - return riv->eclipseCase(); - } - } - } + //// If the active mdi window is different from an Eclipse view, search through available mdi windows to find the + //// last activated Eclipse view. The sub windows are returned with the most recent activated window at the back. + // QList subWindows = RiuMainWindow::instance()->subWindowList( QMdiArea::ActivationHistoryOrder ); + // for ( int i = subWindows.size() - 1; i > -1; i-- ) + //{ + // RiuViewer* viewer = subWindows[i]->widget()->findChild(); + // if ( viewer ) + // { + // RimEclipseView* riv = dynamic_cast( viewer->ownerReservoirView() ); + // if ( riv ) + // { + // return riv->eclipseCase(); + // } + // } + // } } else { diff --git a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake index 4636d6c2633..d8389c9a0da 100644 --- a/ApplicationLibCode/UserInterface/CMakeLists_files.cmake +++ b/ApplicationLibCode/UserInterface/CMakeLists_files.cmake @@ -15,8 +15,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuPlotMainWindow.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuMainWindow.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuMainWindowBase.cpp - ${CMAKE_CURRENT_LIST_DIR}/RiuMdiArea.cpp - ${CMAKE_CURRENT_LIST_DIR}/RiuMdiSubWindow.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuProcessMonitor.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuProjectPropertyView.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuPropertyViewTabWidget.cpp @@ -93,7 +91,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RiuDepthQwtPlot.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuWellPathComponentPlotItem.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuDraggableOverlayFrame.cpp - ${CMAKE_CURRENT_LIST_DIR}/RiuMdiMaximizeWindowGuard.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuMainWindowTools.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuComparisonViewMover.cpp ${CMAKE_CURRENT_LIST_DIR}/RiuAbstractOverlayContentFrame.cpp diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index d3848629a5f..9e27fd143d1 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -54,8 +54,6 @@ #include "RiuCellSelectionTool.h" #include "RiuDepthQwtPlot.h" #include "RiuDockWidgetTools.h" -#include "RiuMdiArea.h" -#include "RiuMdiSubWindow.h" #include "RiuMenuBarBuildTools.h" #include "RiuMessagePanel.h" #include "RiuMohrsCirclePlot.h" @@ -142,22 +140,7 @@ RiuMainWindow::RiuMainWindow() { setAttribute( Qt::WA_DeleteOnClose ); - // m_mdiArea = new RiuMdiArea( this ); - // connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) ); - - // ads::CDockWidget* cWidget = RiuDockWidgetTools::createDockWidget( "3D Views", RiuDockWidgetTools::main3DWindowName(), this ); - // cWidget->setWidget( m_mdiArea ); - // dockManager()->setCentralWidget( cWidget ); - - m_centralDockWidget = RiuDockWidgetTools::createDockWidget( "Welcome", "Welcome", this ); - QTextEdit* welcome = new QTextEdit(); - welcome->setReadOnly( true ); - welcome->setPlainText( "Welcome to ResInsight!\n\n" - "To get started, open a project from the File menu or drag and drop a project file into this window." ); - m_centralDockWidget->setWidget( welcome ); - m_centralDockWidget->setFeature( ads::CDockWidget::NoTab, true ); - dockManager()->setCentralWidget( m_centralDockWidget ); - + setUpCentralDockWidget(); createActions(); createMenus(); createToolBars(); @@ -649,7 +632,6 @@ void RiuMainWindow::createToolBars() toolbar->setObjectName( toolbar->windowTitle() ); toolbar->addAction( cmdFeatureMgr->action( "RicShowPlotWindowFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicLinkVisibleViewsFeature" ) ); - toolbar->addAction( cmdFeatureMgr->action( "RicTileWindowsFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicShowGridCalculatorFeature" ) ); } @@ -1011,7 +993,7 @@ void RiuMainWindow::slotRefreshViewActions() { QStringList commandIds; - commandIds << "RicLinkVisibleViewsFeature" << "RicTileWindowsFeature" << "RicTogglePerspectiveViewFeature" + commandIds << "RicLinkVisibleViewsFeature" << "RicTogglePerspectiveViewFeature" << "RicViewZoomAllFeature" << "RicApplyUserDefinedCameraFeature" << "RicStoreUserDefinedCameraFeature"; caf::CmdFeatureManager::instance()->refreshEnabledState( commandIds ); @@ -1019,7 +1001,6 @@ void RiuMainWindow::slotRefreshViewActions() { QStringList commandIds; - commandIds << "RicTileWindowsFeature"; commandIds << "RicToggleMeasurementModeFeature"; commandIds << "RicTogglePolyMeasurementModeFeature"; @@ -1149,53 +1130,6 @@ void RiuMainWindow::slotInputMockModel() app->createInputMockModel(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QMdiSubWindow* RiuMainWindow::findMdiSubWindow( QWidget* viewer ) -{ - // QList subws = m_mdiArea->subWindowList(); - // int i; - // for ( i = 0; i < subws.size(); ++i ) - //{ - // if ( subws[i]->widget() == viewer ) - // { - // return subws[i]; - // } - // } - - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimViewWindow* RiuMainWindow::findViewWindowFromSubWindow( QMdiSubWindow* subWindow ) -{ - if ( subWindow ) - { - std::vector allViewWindows = RimProject::current()->descendantsIncludingThisOfType(); - - for ( RimViewWindow* viewWindow : allViewWindows ) - { - if ( viewWindow->viewWidget() == subWindow->widget() ) - { - return viewWindow; - } - } - } - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QList RiuMainWindow::subWindowList( QMdiArea::WindowOrder order ) -{ - // return m_mdiArea->subWindowList( order ); - return {}; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1257,38 +1191,13 @@ RiuMessagePanel* RiuMainWindow::messagePanel() //-------------------------------------------------------------------------------------------------- void RiuMainWindow::removeViewer( QWidget* viewer ) { - // m_dockManager->removeDockWidget( viewer ); - slotRefreshViewActions(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) -{ - QSize subWindowSize; - QPoint subWindowPos( -1, -1 ); - - if ( windowsGeometry.isValid() ) - { - subWindowPos = QPoint( windowsGeometry.x, windowsGeometry.y ); - subWindowSize = QSize( windowsGeometry.width, windowsGeometry.height ); - } - else - { - subWindowSize = QSize( 400, 400 ); - } - - // initializeSubWindow( m_mdiArea, subWindow, subWindowPos, subWindowSize ); - subWindow->setWidget( viewer ); - slotRefreshViewActions(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMainWindow::initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) +void RiuMainWindow::initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) { dockManager()->addDockWidget( ads::DockWidgetArea::CenterDockWidgetArea, dockWidget, dockManager()->centralWidget()->dockAreaWidget() ); @@ -1415,30 +1324,6 @@ void RiuMainWindow::slotViewFromBelow() } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow ) -{ - if ( isBlockingSubWindowActivatedSignal() ) return; - - Rim3dView* previousActiveReservoirView = RiaApplication::instance()->activeReservoirView(); - Rim3dView* activatedView = dynamic_cast( findViewWindowFromSubWindow( subWindow ) ); - - if ( !activatedView || ( previousActiveReservoirView == activatedView ) ) return; - - RiaApplication::instance()->setActiveReservoirView( activatedView ); - - if ( !isBlockingViewSelectionOnSubWindowActivated() ) - { - selectViewInProjectTreePreservingSubItemSelection( previousActiveReservoirView, activatedView ); - } - - slotRefreshViewActions(); - refreshAnimationActions(); - refreshDrawStyleActions(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -2128,15 +2013,6 @@ void RiuMainWindow::customMenuRequested( const QPoint& pos ) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RiuMainWindow::isAnyMdiSubWindowVisible() -{ - // return !m_mdiArea->subWindowList().empty(); - return false; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -2166,7 +2042,7 @@ QStringList RiuMainWindow::defaultDockStateNames() //-------------------------------------------------------------------------------------------------- QStringList RiuMainWindow::windowsMenuFeatureNames() { - return { "RicTileWindowsFeature", "RicTileWindowsVerticallyFeature", "RicTileWindowsHorizontallyFeature" }; + return {}; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index e6c8200cc87..43c7df14679 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -26,7 +26,6 @@ #include #include -#include #include #include @@ -34,7 +33,6 @@ #include class QActionGroup; -class QMdiSubWindow; class QToolButton; class QComboBox; class QTimer; @@ -53,14 +51,11 @@ class RiuDepthQwtPlot; class RiuRelativePermeabilityPlotPanel; class RiuPvtPlotPanel; class RiuMohrsCirclePlot; -class RiuMdiArea; class RiuSeismicHistogramPanel; class RiuCellSelectionTool; class RicGridCalculatorDialog; -struct RimMdiWindowGeometry; - namespace caf { class PdmUiTreeView; @@ -98,8 +93,7 @@ class RiuMainWindow : public RiuMainWindowBase void cleanupGuiBeforeProjectClose(); void removeViewer( QWidget* viewer ) override; - void initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override; - void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override; + void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) override; void setActiveViewer( QWidget* subWindow ) override; ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) override; @@ -118,11 +112,6 @@ class RiuMainWindow : public RiuMainWindowBase void refreshDrawStyleActions(); - bool isAnyMdiSubWindowVisible(); - QMdiSubWindow* findMdiSubWindow( QWidget* viewer ) override; - RimViewWindow* findViewWindowFromSubWindow( QMdiSubWindow* lhs ); - QList subWindowList( QMdiArea::WindowOrder order ); - RiuResultQwtPlot* resultPlot(); RiuDepthQwtPlot* depthPlot(); RiuRelativePermeabilityPlotPanel* relativePermeabilityPlotPanel(); @@ -207,8 +196,6 @@ class RiuMainWindow : public RiuMainWindowBase // Menu and action slots private slots: - friend class RiuMdiSubWindow; - // Memory update slot void updateMemoryUsage(); @@ -256,7 +243,7 @@ private slots: // Windows slots void slotBuildWindowActions(); - void slotSubWindowActivated( QMdiSubWindow* subWindow ); + // void slotSubWindowActivated( QMdiSubWindow* subWindow ); void selectedObjectsChanged(); void customMenuRequested( const QPoint& pos ); @@ -291,7 +278,5 @@ private slots: QToolBar* m_holoLensToolBar; - QPointer m_centralDockWidget; - std::vector> m_additionalProjectViews; }; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index d5286b1b79b..cd4f3986046 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -32,8 +32,6 @@ #include "RiuDragDrop.h" #include "RiuGuiTheme.h" #include "RiuMainWindowTools.h" -#include "RiuMdiArea.h" -#include "RiuMdiSubWindow.h" #include "cafCmdFeatureManager.h" #include "cafPdmObject.h" @@ -47,11 +45,10 @@ #include #include #include -#include -#include #include #include #include +#include #include #include #include @@ -61,12 +58,10 @@ //-------------------------------------------------------------------------------------------------- RiuMainWindowBase::RiuMainWindowBase() : m_allowActiveViewChangeFromSelection( true ) - , m_showFirstVisibleWindowMaximized( true ) , m_blockSubWindowActivation( false ) , m_blockSubWindowProjectTreeSelection( false ) , m_hasBeenVisible( false ) , m_windowMenu( nullptr ) -// , m_mdiArea( nullptr ) { ads::CDockManager::setAutoHideConfigFlags( ads::CDockManager::DefaultAutoHideConfig ); m_dockManager = new ads::CDockManager( this ); @@ -118,27 +113,18 @@ ads::CDockManager* RiuMainWindowBase::dockManager() const return m_dockManager; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuMdiArea* RiuMainWindowBase::mdiArea() -{ - return nullptr; - // return m_mdiArea; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QMdiSubWindow* RiuMainWindowBase::createViewWindow() -{ - RiuMdiSubWindow* subWin = - new RiuMdiSubWindow( nullptr, Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint ); - subWin->setAttribute( Qt::WA_DeleteOnClose ); // Make sure the contained widget is destroyed when the MDI window - // is closed - - return subWin; -} +////-------------------------------------------------------------------------------------------------- +///// +////-------------------------------------------------------------------------------------------------- +// QMdiSubWindow* RiuMainWindowBase::createViewWindow() +//{ +// RiuMdiSubWindow* subWin = +// new RiuMdiSubWindow( nullptr, Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint ); +// subWin->setAttribute( Qt::WA_DeleteOnClose ); // Make sure the contained widget is destroyed when the MDI window +// // is closed +// +// return subWin; +// } //-------------------------------------------------------------------------------------------------- /// @@ -150,21 +136,6 @@ ads::CDockWidget* RiuMainWindowBase::createDockViewWindow() return widget; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimMdiWindowGeometry RiuMainWindowBase::windowGeometryForViewer( QWidget* viewer ) -{ - RiuMdiSubWindow* mdiWindow = dynamic_cast( findMdiSubWindow( viewer ) ); - if ( mdiWindow ) - { - return mdiWindow->windowGeometry(); - } - - RimMdiWindowGeometry geo; - return geo; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -325,14 +296,6 @@ void RiuMainWindowBase::toggleItemInSelection( const caf::PdmObject* object, boo m_allowActiveViewChangeFromSelection = true; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMainWindowBase::enableShowFirstVisibleMdiWindowMaximized( bool enable ) -{ - m_showFirstVisibleWindowMaximized = enable; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -376,51 +339,51 @@ void RiuMainWindowBase::removeViewerFromDockArea( QWidget* viewer ) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMainWindowBase::removeViewerFromMdiArea( RiuMdiArea* mdiArea, QWidget* viewer ) -{ - bool removedSubWindowWasActive = false; - bool wasMaximized = true; - - if ( QMdiSubWindow* subWindowBeingClosed = findMdiSubWindow( viewer ) ) - { - wasMaximized = subWindowBeingClosed->isMaximized(); - - if ( subWindowBeingClosed->isActiveWindow() ) - { - // If we are removing the active window, we will need a new active window - // Start by making the window inactive so Qt doesn't pick the active window itself - mdiArea->setActiveSubWindow( nullptr ); - removedSubWindowWasActive = true; - } - mdiArea->removeSubWindow( subWindowBeingClosed ); - - // These two lines had to be introduced after themes was used - // Probably related to polish/unpolish of widgets in an MDI setting - // https://github.com/OPM/ResInsight/issues/6676 - subWindowBeingClosed->hide(); - subWindowBeingClosed->deleteLater(); - } - - QList subWindowList = mdiArea->subWindowList( QMdiArea::ActivationHistoryOrder ); - if ( !subWindowList.empty() ) - { - if ( removedSubWindowWasActive ) - { - mdiArea->setActiveSubWindow( nullptr ); - // Make the last activated window the current activated one - mdiArea->setActiveSubWindow( subWindowList.back() ); - } - if ( wasMaximized && mdiArea->currentSubWindow() ) - { - mdiArea->currentSubWindow()->showMaximized(); - } - - mdiArea->applyTiling(); - } -} +////-------------------------------------------------------------------------------------------------- +///// +////-------------------------------------------------------------------------------------------------- +// void RiuMainWindowBase::removeViewerFromMdiArea( RiuMdiArea* mdiArea, QWidget* viewer ) +//{ +// bool removedSubWindowWasActive = false; +// bool wasMaximized = true; +// +// if ( QMdiSubWindow* subWindowBeingClosed = findMdiSubWindow( viewer ) ) +// { +// wasMaximized = subWindowBeingClosed->isMaximized(); +// +// if ( subWindowBeingClosed->isActiveWindow() ) +// { +// // If we are removing the active window, we will need a new active window +// // Start by making the window inactive so Qt doesn't pick the active window itself +// mdiArea->setActiveSubWindow( nullptr ); +// removedSubWindowWasActive = true; +// } +// mdiArea->removeSubWindow( subWindowBeingClosed ); +// +// // These two lines had to be introduced after themes was used +// // Probably related to polish/unpolish of widgets in an MDI setting +// // https://github.com/OPM/ResInsight/issues/6676 +// subWindowBeingClosed->hide(); +// subWindowBeingClosed->deleteLater(); +// } +// +// QList subWindowList = mdiArea->subWindowList( QMdiArea::ActivationHistoryOrder ); +// if ( !subWindowList.empty() ) +// { +// if ( removedSubWindowWasActive ) +// { +// mdiArea->setActiveSubWindow( nullptr ); +// // Make the last activated window the current activated one +// mdiArea->setActiveSubWindow( subWindowList.back() ); +// } +// if ( wasMaximized && mdiArea->currentSubWindow() ) +// { +// mdiArea->currentSubWindow()->showMaximized(); +// } +// +// mdiArea->applyTiling(); +// } +// } //-------------------------------------------------------------------------------------------------- /// @@ -450,52 +413,6 @@ void RiuMainWindowBase::slotDockWidgetToggleViewActionTriggered() } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMainWindowBase::initializeSubWindow( RiuMdiArea* mdiArea, QMdiSubWindow* mdiSubWindow, const QPoint& subWindowPos, const QSize& subWindowSize ) -{ - bool initialStateMaximized = false; - auto initialState3dWindow = RimProject::current()->subWindowsTileMode3DWindow(); - auto initialStatePlotWindow = RimProject::current()->subWindowsTileModePlotWindow(); - - if ( m_showFirstVisibleWindowMaximized && mdiArea->subWindowList().empty() ) - { - // Show first 3D view maximized - initialStateMaximized = true; - } - - if ( mdiArea->currentSubWindow() && mdiArea->currentSubWindow()->isMaximized() ) - { - initialStateMaximized = true; - } - - mdiArea->addSubWindow( mdiSubWindow ); - - if ( subWindowPos.x() > -1 ) - { - mdiSubWindow->move( subWindowPos ); - } - mdiSubWindow->resize( subWindowSize ); - - if ( initialStateMaximized ) - { - mdiSubWindow->showMaximized(); - } - else - { - mdiSubWindow->showNormal(); - - if ( !isBlockingSubWindowActivatedSignal() ) - { - RimProject::current()->setSubWindowsTileMode3DWindow( initialState3dWindow ); - RimProject::current()->setSubWindowsTileModePlotWindow( initialStatePlotWindow ); - } - - mdiArea->applyTiling(); - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -553,6 +470,20 @@ void RiuMainWindowBase::createTreeViews( int numberOfTrees ) } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindowBase::setUpCentralDockWidget() +{ + m_centralDockWidget = RiuDockWidgetTools::createDockWidget( "Welcome", "Welcome", this ); + QTextEdit* welcome = new QTextEdit(); + welcome->setReadOnly( true ); + welcome->setPlainText( "\nWelcome to ResInsight!\n" ); + m_centralDockWidget->setWidget( welcome ); + m_centralDockWidget->setFeature( ads::CDockWidget::NoTab, true ); + dockManager()->setCentralWidget( m_centralDockWidget ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 873fc3d17e1..3282d7d234a 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -28,11 +28,6 @@ #include #include -class RiuMdiArea; -struct RimMdiWindowGeometry; - -class RiuMdiArea; - namespace ads { class CDockManager; @@ -49,8 +44,6 @@ class PdmUiPropertyView; } // namespace caf class QAction; -class QMdiArea; -class QMdiSubWindow; class QUndoView; //================================================================================================== @@ -66,22 +59,17 @@ class RiuMainWindowBase : public QMainWindow virtual QString mainWindowName() = 0; - QMdiSubWindow* createViewWindow(); ads::CDockWidget* createDockViewWindow(); - virtual void removeViewer( QWidget* viewer ) = 0; - virtual void initializeViewer( QMdiSubWindow* viewWindow, QWidget* viewWidget, const RimMdiWindowGeometry& windowsGeometry ) = 0; - virtual void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) {}; + virtual void removeViewer( QWidget* viewer ) = 0; + virtual void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) {}; virtual void setActiveViewer( QWidget* subWindow ) = 0; virtual ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) = 0; - virtual QMdiSubWindow* findMdiSubWindow( QWidget* viewer ) = 0; - - RimMdiWindowGeometry windowGeometryForViewer( QWidget* viewer ); - void loadWinGeoAndDockToolBarLayout(); - void saveWinGeoAndDockToolBarLayout(); - void showWindow(); + void loadWinGeoAndDockToolBarLayout(); + void saveWinGeoAndDockToolBarLayout(); + void showWindow(); std::vector projectTreeViews(); caf::PdmUiTreeView* projectTreeView( int treeId ); @@ -92,8 +80,6 @@ class RiuMainWindowBase : public QMainWindow void selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange = true ); void toggleItemInSelection( const caf::PdmObject* object, bool allowActiveViewChange = true ); - void enableShowFirstVisibleMdiWindowMaximized( bool enable ); - void setBlockSubWindowActivatedSignal( bool block ); bool isBlockingSubWindowActivatedSignal() const; @@ -102,12 +88,12 @@ class RiuMainWindowBase : public QMainWindow ads::CDockManager* dockManager() const; - RiuMdiArea* mdiArea(); + // RiuMdiArea* mdiArea(); protected: void createTreeViews( int numberOfTrees ); - void removeViewerFromMdiArea( RiuMdiArea* mdiArea, QWidget* viewer ); - void initializeSubWindow( RiuMdiArea* mdiArea, QMdiSubWindow* mdiSubWindow, const QPoint& subWindowPos, const QSize& subWindowSize ); + void setUpCentralDockWidget(); + void removeViewerFromDockArea( QWidget* viewer ); void restoreTreeViewStates( QString treeStateString, QString treeIndexString ); @@ -149,21 +135,23 @@ protected slots: // RiuMdiArea* m_mdiArea; QMenu* m_windowMenu; - const int DOCKSTATE_VERSION = 3; + const int DOCKSTATE_VERSION = 4; QByteArray m_lastDockState; std::vector m_projectTreeViews; std::vector> m_propertyViews; + QPointer m_centralDockWidget; + private: QString registryFolderName(); std::vector> m_dragDropInterfaces; - bool m_showFirstVisibleWindowMaximized; - bool m_blockSubWindowActivation; - bool m_blockSubWindowProjectTreeSelection; - bool m_hasBeenVisible; + + bool m_blockSubWindowActivation; + bool m_blockSubWindowProjectTreeSelection; + bool m_hasBeenVisible; ads::CDockManager* m_dockManager; }; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp index a2316bc01ce..bfc8bb4c2f3 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp @@ -214,12 +214,12 @@ void RiuMainWindowTools::setFixedWindowSizeFor3dViews( RiuMainWindowBase* mainWi { if ( riv && riv->viewer() ) { - // Make sure all views are maximized for snapshotting - QMdiSubWindow* subWnd = mainWindow->findMdiSubWindow( riv->viewer()->layoutWidget() ); - if ( subWnd ) - { - subWnd->showMaximized(); - } + //// Make sure all views are maximized for snapshotting + // QMdiSubWindow* subWnd = mainWindow->findMdiSubWindow( riv->viewer()->layoutWidget() ); + // if ( subWnd ) + //{ + // subWnd->showMaximized(); + // } // This size is set to match the regression test reference images QSize windowSize( width, height ); diff --git a/ApplicationLibCode/UserInterface/RiuMdiArea.cpp b/ApplicationLibCode/UserInterface/RiuMdiArea.cpp deleted file mode 100644 index ade46e5e57f..00000000000 --- a/ApplicationLibCode/UserInterface/RiuMdiArea.cpp +++ /dev/null @@ -1,202 +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 "RiuMdiArea.h" - -#include "RimProject.h" - -#include "RiuMainWindow.h" -#include "RiuMdiSubWindow.h" -#include "RiuPlotMainWindow.h" - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuMdiArea::RiuMdiArea( QWidget* parent /*= nullptr*/ ) - : QMdiArea( parent ) -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuMdiArea::~RiuMdiArea() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiaDefines::WindowTileMode RiuMdiArea::tileMode() const -{ - auto proj = RimProject::current(); - if ( proj ) - { - auto* mainWindow = dynamic_cast( window() ); - if ( mainWindow ) return proj->subWindowsTileMode3DWindow(); - - auto* plotMainWindow = dynamic_cast( window() ); - if ( plotMainWindow ) return proj->subWindowsTileModePlotWindow(); - } - - return RiaDefines::WindowTileMode::UNDEFINED; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::list RiuMdiArea::subWindowListSortedByPosition() -{ - // Tile Windows so the one with the leftmost left edge gets sorted first. - std::list windowList; - for ( QMdiSubWindow* subWindow : subWindowList( QMdiArea::CreationOrder ) ) - { - windowList.push_back( subWindow ); - } - - // Sort of list so we first sort by window position but retain activation order - // for windows with the same position - windowList.sort( - []( QMdiSubWindow* lhs, QMdiSubWindow* rhs ) - { - if ( lhs->frameGeometry().topLeft().rx() == rhs->frameGeometry().topLeft().rx() ) - { - return lhs->frameGeometry().topLeft().ry() < rhs->frameGeometry().topLeft().ry(); - } - return lhs->frameGeometry().topLeft().rx() < rhs->frameGeometry().topLeft().rx(); - } ); - return windowList; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::list RiuMdiArea::subWindowListSortedByVerticalPosition() -{ - std::list windowList; - for ( QMdiSubWindow* subWindow : subWindowList( QMdiArea::CreationOrder ) ) - { - windowList.push_back( subWindow ); - } - - windowList.sort( - []( QMdiSubWindow* lhs, QMdiSubWindow* rhs ) - { - if ( lhs->frameGeometry().topLeft().ry() == rhs->frameGeometry().topLeft().ry() ) - { - return lhs->frameGeometry().topLeft().rx() < rhs->frameGeometry().topLeft().rx(); - } - return lhs->frameGeometry().topLeft().ry() < rhs->frameGeometry().topLeft().ry(); - } ); - - return windowList; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMdiArea::tileWindowsHorizontally() -{ - // Make sure that all windows are windowed and not maximized - tileSubWindows(); - - QPoint position( 0, 0 ); - - for ( auto* window : subWindowListSortedByPosition() ) - { - QRect rect( 0, 0, width() / static_cast( subWindowListSortedByPosition().size() ), height() ); - - window->setGeometry( rect ); - window->move( position ); - position.setX( position.x() + window->width() ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMdiArea::tileWindowsVertically() -{ - // Make sure that all windows are windowed and not maximized - tileSubWindows(); - - auto windowList = subWindowListSortedByVerticalPosition(); - - QPoint position( 0, 0 ); - for ( auto* window : windowList ) - { - QRect rect( 0, 0, width(), height() / static_cast( windowList.size() ) ); - - window->setGeometry( rect ); - window->move( position ); - position.setY( position.y() + window->height() ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMdiArea::tileWindowsDefault() -{ - tileSubWindows(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMdiArea::resizeEvent( QResizeEvent* resizeEvent ) -{ - applyTiling(); - - QMdiArea::resizeEvent( resizeEvent ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMdiArea::applyTiling() -{ - for ( auto subWindow : subWindowList() ) - { - auto riuWindow = dynamic_cast( subWindow ); - riuWindow->blockTilingChanges( true ); - } - - switch ( tileMode() ) - { - case RiaDefines::WindowTileMode::UNDEFINED: - break; - case RiaDefines::WindowTileMode::DEFAULT: - tileWindowsDefault(); - break; - case RiaDefines::WindowTileMode::VERTICAL: - tileWindowsVertically(); - break; - case RiaDefines::WindowTileMode::HORIZONTAL: - tileWindowsHorizontally(); - break; - default: - break; - } - - for ( auto subWindow : subWindowList() ) - { - auto riuWindow = dynamic_cast( subWindow ); - riuWindow->blockTilingChanges( false ); - } -} diff --git a/ApplicationLibCode/UserInterface/RiuMdiArea.h b/ApplicationLibCode/UserInterface/RiuMdiArea.h deleted file mode 100644 index 45af29deb3e..00000000000 --- a/ApplicationLibCode/UserInterface/RiuMdiArea.h +++ /dev/null @@ -1,48 +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 "RiaPlotDefines.h" - -#include -#include - -class QMdiSubWindow; - -class RiuMdiArea : public QMdiArea -{ - Q_OBJECT - -public: - RiuMdiArea( QWidget* parent = nullptr ); - ~RiuMdiArea() override; - - RiaDefines::WindowTileMode tileMode() const; - void applyTiling(); - -private: - void resizeEvent( QResizeEvent* resizeEvent ) override; - - std::list subWindowListSortedByPosition(); - std::list subWindowListSortedByVerticalPosition(); - - void tileWindowsHorizontally(); - void tileWindowsVertically(); - void tileWindowsDefault(); -}; diff --git a/ApplicationLibCode/UserInterface/RiuMdiMaximizeWindowGuard.cpp b/ApplicationLibCode/UserInterface/RiuMdiMaximizeWindowGuard.cpp deleted file mode 100644 index 1ccadc4c914..00000000000 --- a/ApplicationLibCode/UserInterface/RiuMdiMaximizeWindowGuard.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "RiuMdiMaximizeWindowGuard.h" - -#include "RiaGuiApplication.h" -#include "RiuMainWindow.h" -#include "RiuPlotMainWindow.h" - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuMdiMaximizeWindowGuard::RiuMdiMaximizeWindowGuard() -{ - { - RiuMainWindow* mainWindow = RiaGuiApplication::instance()->mainWindow(); - if ( mainWindow ) - { - mainWindow->enableShowFirstVisibleMdiWindowMaximized( false ); - } - } - - { - RiuPlotMainWindow* plotMainWindow = RiaGuiApplication::instance()->mainPlotWindow(); - if ( plotMainWindow ) - { - plotMainWindow->enableShowFirstVisibleMdiWindowMaximized( false ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuMdiMaximizeWindowGuard::~RiuMdiMaximizeWindowGuard() -{ - { - RiuMainWindow* mainWindow = RiaGuiApplication::instance()->mainWindow(); - if ( mainWindow ) - { - mainWindow->enableShowFirstVisibleMdiWindowMaximized( true ); - } - } - - { - RiuPlotMainWindow* plotMainWindow = RiaGuiApplication::instance()->mainPlotWindow(); - if ( plotMainWindow ) - { - plotMainWindow->enableShowFirstVisibleMdiWindowMaximized( true ); - } - } -} diff --git a/ApplicationLibCode/UserInterface/RiuMdiMaximizeWindowGuard.h b/ApplicationLibCode/UserInterface/RiuMdiMaximizeWindowGuard.h deleted file mode 100644 index 7c1ddb53362..00000000000 --- a/ApplicationLibCode/UserInterface/RiuMdiMaximizeWindowGuard.h +++ /dev/null @@ -1,30 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2011- Statoil ASA -// Copyright (C) 2013- Ceetron Solutions AS -// Copyright (C) 2011-2012 Ceetron AS -// -// 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 - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -class RiuMdiMaximizeWindowGuard -{ -public: - RiuMdiMaximizeWindowGuard(); - ~RiuMdiMaximizeWindowGuard(); -}; diff --git a/ApplicationLibCode/UserInterface/RiuMdiSubWindow.cpp b/ApplicationLibCode/UserInterface/RiuMdiSubWindow.cpp deleted file mode 100644 index aeb563e00df..00000000000 --- a/ApplicationLibCode/UserInterface/RiuMdiSubWindow.cpp +++ /dev/null @@ -1,168 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2016 Statoil 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 "RiuMdiSubWindow.h" - -#include "RiaGuiApplication.h" -#include "RiaPlotDefines.h" - -#include "Rim3dView.h" -#include "RimProject.h" -#include "RimSummaryPlot.h" -#include "RimWellLogPlot.h" - -#include "RiuMainWindow.h" -#include "RiuPlotMainWindow.h" -#include "RiuViewer.h" - -#include - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuMdiSubWindow::RiuMdiSubWindow( QWidget* parent /*= 0*/, Qt::WindowFlags flags /*= 0*/ ) - : QMdiSubWindow( parent, flags ) - , m_normalWindowGeometry( QRect() ) - , m_blockTilingChanges( false ) -{ - setWindowIcon( QIcon( ":/Window16x16.png" ) ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiuMdiSubWindow::~RiuMdiSubWindow() -{ -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimMdiWindowGeometry RiuMdiSubWindow::windowGeometry() const -{ - RimMdiWindowGeometry geo; - - int mainWinID = 0; - if ( window() == RiaGuiApplication::instance()->mainPlotWindow() ) - { - mainWinID = 1; - } - - geo.mainWindowID = mainWinID; - geo.isMaximized = isMaximized(); - - // Save normal/non-maximized size and position so this can be restored - QRect currentGeometry = frameGeometry(); - if ( isMaximized() && !m_normalWindowGeometry.isNull() ) - { - currentGeometry = m_normalWindowGeometry; - } - - geo.x = currentGeometry.topLeft().x(); - geo.y = currentGeometry.topLeft().y(); - geo.width = currentGeometry.width(); - geo.height = currentGeometry.height(); - - return geo; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMdiSubWindow::blockTilingChanges( bool block ) -{ - m_blockTilingChanges = block; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMdiSubWindow::closeEvent( QCloseEvent* event ) -{ - QWidget* mainWidget = widget(); - - RimViewWindow* viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( mainWidget ); - if ( !viewWindow ) - { - RiuViewer* viewer = mainWidget->findChild(); - if ( viewer ) - { - viewWindow = viewer->ownerViewWindow(); - } - } - - if ( viewWindow ) - { - viewWindow->setMdiWindowGeometry( windowGeometry() ); - viewWindow->handleMdiWindowClosed(); - event->accept(); - } - else - { - QMdiSubWindow::closeEvent( event ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMdiSubWindow::resizeEvent( QResizeEvent* resizeEvent ) -{ - if ( !isMaximized() ) - { - m_normalWindowGeometry = frameGeometry(); - } - - checkAndResetTilingState(); - - QMdiSubWindow::resizeEvent( resizeEvent ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMdiSubWindow::moveEvent( QMoveEvent* moveEvent ) -{ - if ( !isMaximized() ) - { - m_normalWindowGeometry = frameGeometry(); - } - - checkAndResetTilingState(); - - QMdiSubWindow::moveEvent( moveEvent ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMdiSubWindow::checkAndResetTilingState() -{ - if ( m_blockTilingChanges ) return; - - if ( window() == RiaGuiApplication::instance()->mainWindow() && - !RiaGuiApplication::instance()->mainWindow()->isBlockingSubWindowActivatedSignal() ) - { - RimProject::current()->setSubWindowsTileMode3DWindow( RiaDefines::WindowTileMode::UNDEFINED ); - } - else if ( window() == RiaGuiApplication::instance()->mainPlotWindow() && - !RiaGuiApplication::instance()->mainPlotWindow()->isBlockingSubWindowActivatedSignal() ) - { - RimProject::current()->setSubWindowsTileModePlotWindow( RiaDefines::WindowTileMode::UNDEFINED ); - } -} diff --git a/ApplicationLibCode/UserInterface/RiuMdiSubWindow.h b/ApplicationLibCode/UserInterface/RiuMdiSubWindow.h deleted file mode 100644 index 4e697342696..00000000000 --- a/ApplicationLibCode/UserInterface/RiuMdiSubWindow.h +++ /dev/null @@ -1,46 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2016 Statoil 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 "RimViewWindow.h" -#include - -class RiuMdiSubWindow : public QMdiSubWindow -{ - Q_OBJECT -public: - RiuMdiSubWindow( QWidget* parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags() ); - - ~RiuMdiSubWindow() override; - - RimMdiWindowGeometry windowGeometry() const; - - void blockTilingChanges( bool block ); - -private: - void closeEvent( QCloseEvent* event ) override; - void resizeEvent( QResizeEvent* resizeEvent ) override; - void moveEvent( QMoveEvent* moveEvent ) override; - - void checkAndResetTilingState(); - -private: - QRect m_normalWindowGeometry; - bool m_blockTilingChanges; -}; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 7684ef439e7..c79023548ff 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -53,8 +53,6 @@ #include "RiuContextMenuLauncher.h" #include "RiuDockWidgetTools.h" #include "RiuDragDrop.h" -#include "RiuMdiArea.h" -#include "RiuMdiSubWindow.h" #include "RiuMenuBarBuildTools.h" #include "RiuMessagePanel.h" #include "RiuMultiPlotPage.h" @@ -98,20 +96,6 @@ RiuPlotMainWindow::RiuPlotMainWindow() , m_autoUpdateEnabled( false ) , m_autoUpdateTimerId( -1 ) { - // m_mdiArea = new RiuMdiArea( this ); - // connect( m_mdiArea, SIGNAL( subWindowActivated( QMdiSubWindow* ) ), SLOT( slotSubWindowActivated( QMdiSubWindow* ) ) ); - - // caf::CmdFeatureMenuBuilder menuForMdiArea; - // menuForMdiArea << "RicNewEmptySummaryMultiPlotFeature"; - // menuForMdiArea << "RicOpenSummaryPlotEditorFromMdiAreaFeature"; - // new RiuContextMenuLauncher( m_mdiArea, menuForMdiArea ); - - ads::CDockWidget* cWidget = RiuDockWidgetTools::createDockWidget( "Plot Window", RiuDockWidgetTools::mainPlotWindowName(), this ); - - // cWidget->setWidget( m_mdiArea ); - auto dockArea = dockManager()->setCentralWidget( cWidget ); - dockArea->setVisible( true ); - m_toggleSelectionLinkAction = new QAction( QIcon( ":/Link3DandPlots.png" ), tr( "Link With Selection in 3D" ), this ); m_toggleSelectionLinkAction->setToolTip( "Update wells used in plots from well selections in 3D view." ); m_toggleSelectionLinkAction->setCheckable( true ); @@ -129,6 +113,9 @@ RiuPlotMainWindow::RiuPlotMainWindow() m_reloadSelectedCasesAction->setCheckable( false ); connect( m_reloadSelectedCasesAction, SIGNAL( triggered() ), SLOT( slotReloadSelectedCases() ) ); + setAttribute( Qt::WA_DeleteOnClose ); + + setUpCentralDockWidget(); createMenus(); createToolBars(); createDockPanels(); @@ -223,20 +210,6 @@ void RiuPlotMainWindow::initializeGuiNewProjectLoaded() } } - // m_mdiArea->applyTiling(); - - if ( m_activePlotViewWindow && m_activePlotViewWindow->viewWidget() && !RiaRegressionTestRunner::instance()->isRunningRegressionTests() ) - { - if ( m_activePlotViewWindow->mdiWindowGeometry().isMaximized ) - { - auto subWin = findMdiSubWindow( m_activePlotViewWindow->viewWidget() ); - if ( subWin ) - { - subWin->showMaximized(); - } - } - } - refreshToolbars(); // Sync selections with property views. @@ -405,7 +378,6 @@ QStringList RiuPlotMainWindow::toolbarCommandIds( const QString& toolbarName ) if ( toolbarName.isEmpty() || toolbarName == "Window Management" ) { commandIds << "RicShowMainWindowFeature"; - commandIds << "RicTilePlotWindowsFeature"; commandIds << "RicShowSummaryCurveCalculatorFeature"; } @@ -635,74 +607,6 @@ void RiuPlotMainWindow::createDockPanels() } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QMdiSubWindow* RiuPlotMainWindow::findMdiSubWindow( QWidget* viewer ) -{ - // QList subws = m_mdiArea->subWindowList(); - // int i; - // for ( i = 0; i < subws.size(); ++i ) - //{ - // if ( subws[i]->widget() == viewer ) - // { - // return subws[i]; - // } - // } - - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RimViewWindow* RiuPlotMainWindow::findViewWindowFromSubWindow( QMdiSubWindow* subWindow ) -{ - RimProject* proj = RimProject::current(); - if ( subWindow && proj ) - { - return RiuInterfaceToViewWindow::viewWindowFromWidget( subWindow->widget() ); - } - return nullptr; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QList RiuPlotMainWindow::subWindowList( QMdiArea::WindowOrder order ) -{ - // return m_mdiArea->subWindowList( order ); - return {}; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindow::setWidthOfMdiWindow( QWidget* mdiWindowWidget, int newWidth ) -{ - QMdiSubWindow* mdiWindow = findMdiSubWindow( mdiWindowWidget ); - if ( mdiWindow ) - { - QSize subWindowSize = mdiWindow->size(); - - subWindowSize.setWidth( std::max( newWidth, 100 ) ); - mdiWindow->resize( subWindowSize ); - - if ( mdiWindow->isMaximized() ) - { - // Set window temporarily to normal state and back to maximized - // to redo layout so the whole window canvas is filled - // Tried to activate layout, did not work as expected - // Tested code: - // m_layout->activate(); - // mdiWindow->layout()->activate(); - - mdiWindow->showNormal(); - mdiWindow->showMaximized(); - } - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -845,25 +749,10 @@ void RiuPlotMainWindow::removeViewer( QWidget* viewer ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindow::initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) +void RiuPlotMainWindow::initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) { - QSize subWindowSize; - QPoint subWindowPos( -1, -1 ); - - if ( windowsGeometry.isValid() ) - { - subWindowPos = QPoint( windowsGeometry.x, windowsGeometry.y ); - subWindowSize = QSize( windowsGeometry.width, windowsGeometry.height ); - } - else - { - subWindowSize = QSize( 400, 400 ); - } - - // initializeSubWindow( m_mdiArea, subWindow, subWindowPos, subWindowSize ); - subWindow->setWidget( viewer ); - - refreshToolbars(); + dockManager()->addDockWidget( ads::DockWidgetArea::CenterDockWidgetArea, dockWidget, dockManager()->centralWidget()->dockAreaWidget() ); + viewer->update(); } //-------------------------------------------------------------------------------------------------- @@ -889,51 +778,51 @@ void RiuPlotMainWindow::setPdmRoot( caf::PdmObject* pdmRoot ) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow ) -{ - if ( isBlockingSubWindowActivatedSignal() ) return; - - RimViewWindow* activatedView = findViewWindowFromSubWindow( subWindow ); - - if ( !activatedView ) return; - m_activePlotViewWindow = activatedView; - - if ( !isBlockingViewSelectionOnSubWindowActivated() ) - { - caf::PdmUiTreeView* projectTree = getTreeViewWithItem( activatedView ); - if ( projectTree ) - { - std::vector currentSelection; - projectTree->selectedUiItems( currentSelection ); - bool childSelected = false; - for ( caf::PdmUiItem* uiItem : currentSelection ) - { - caf::PdmObject* pdmObject = dynamic_cast( uiItem ); - if ( pdmObject ) - { - std::vector ancestralViews = pdmObject->allAncestorsOrThisOfType(); - for ( auto ancestralView : ancestralViews ) - { - if ( ancestralView == activatedView ) - { - childSelected = true; - } - } - } - } - if ( !childSelected ) - { - selectAsCurrentItem( activatedView ); - } - } - } - - updateWellLogPlotToolBar(); - updateMultiPlotToolBar(); -} +////-------------------------------------------------------------------------------------------------- +///// +////-------------------------------------------------------------------------------------------------- +// void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow ) +//{ +// if ( isBlockingSubWindowActivatedSignal() ) return; +// +// RimViewWindow* activatedView = findViewWindowFromSubWindow( subWindow ); +// +// if ( !activatedView ) return; +// m_activePlotViewWindow = activatedView; +// +// if ( !isBlockingViewSelectionOnSubWindowActivated() ) +// { +// caf::PdmUiTreeView* projectTree = getTreeViewWithItem( activatedView ); +// if ( projectTree ) +// { +// std::vector currentSelection; +// projectTree->selectedUiItems( currentSelection ); +// bool childSelected = false; +// for ( caf::PdmUiItem* uiItem : currentSelection ) +// { +// caf::PdmObject* pdmObject = dynamic_cast( uiItem ); +// if ( pdmObject ) +// { +// std::vector ancestralViews = pdmObject->allAncestorsOrThisOfType(); +// for ( auto ancestralView : ancestralViews ) +// { +// if ( ancestralView == activatedView ) +// { +// childSelected = true; +// } +// } +// } +// } +// if ( !childSelected ) +// { +// selectAsCurrentItem( activatedView ); +// } +// } +// } +// +// updateWellLogPlotToolBar(); +// updateMultiPlotToolBar(); +// } //-------------------------------------------------------------------------------------------------- /// @@ -1004,13 +893,13 @@ void RiuPlotMainWindow::selectedObjectsChanged( caf::PdmUiTreeView* projectTree, // If we can't find the view window as an MDI sub window, we search higher in the // project tree to find a possible parent view window that has. - if ( selectedWindow && !findMdiSubWindow( selectedWindow->viewWidget() ) ) - { - if ( selectedWindow->parentField() && selectedWindow->parentField()->ownerObject() ) - { - selectedWindow = selectedWindow->parentField()->ownerObject()->firstAncestorOrThisOfType(); - } - } + // if ( selectedWindow && !findMdiSubWindow( selectedWindow->viewWidget() ) ) + //{ + // if ( selectedWindow->parentField() && selectedWindow->parentField()->ownerObject() ) + // { + // selectedWindow = selectedWindow->parentField()->ownerObject()->firstAncestorOrThisOfType(); + // } + //} if ( selectedWindow ) { @@ -1083,15 +972,6 @@ void RiuPlotMainWindow::customMenuRequested( const QPoint& pos ) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RiuPlotMainWindow::isAnyMdiSubWindowVisible() -{ - // return !m_mdiArea->subWindowList().empty(); - return false; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1129,7 +1009,7 @@ QStringList RiuPlotMainWindow::defaultDockStateNames() //-------------------------------------------------------------------------------------------------- QStringList RiuPlotMainWindow::windowsMenuFeatureNames() { - return { "RicTilePlotWindowsFeature", "RicTilePlotWindowsVerticallyFeature", "RicTilePlotWindowsHorizontallyFeature" }; + return {}; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index dbd06b89f3c..f75979d861a 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -69,7 +69,7 @@ class RiuPlotMainWindow : public RiuMainWindowBase void cleanUpTemporaryWidgets(); void removeViewer( QWidget* viewer ) override; - void initializeViewer( QMdiSubWindow* subWindow, QWidget* viewer, const RimMdiWindowGeometry& windowsGeometry ) override; + void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) override; void setActiveViewer( QWidget* subWindow ) override; ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) override; @@ -77,12 +77,6 @@ class RiuPlotMainWindow : public RiuMainWindowBase void enable3DSelectionLink( bool enable ); bool selection3DLinkEnabled(); - bool isAnyMdiSubWindowVisible(); - QMdiSubWindow* findMdiSubWindow( QWidget* viewer ) override; - RimViewWindow* findViewWindowFromSubWindow( QMdiSubWindow* subWindow ); - QList subWindowList( QMdiArea::WindowOrder order ); - - void setWidthOfMdiWindow( QWidget* mdiWindowWidget, int newWidth ); void addToTemporaryWidgets( QWidget* widget ); void updateWellLogPlotToolBar(); @@ -123,11 +117,9 @@ private slots: void slotToggleAutoUpdate(); void slotReloadSelectedCases(); - friend class RiuMdiSubWindow; - void slotBuildWindowActions(); - void slotSubWindowActivated( QMdiSubWindow* subWindow ); + // void slotSubWindowActivated( QMdiSubWindow* subWindow ); void selectedObjectsChanged( caf::PdmUiTreeView* projectTree, caf::PdmUiPropertyView* propertyView ); void customMenuRequested( const QPoint& pos ); diff --git a/ApplicationLibCode/UserInterface/RiuViewerToViewInterface.h b/ApplicationLibCode/UserInterface/RiuViewerToViewInterface.h index 714952550bc..352fedd4615 100644 --- a/ApplicationLibCode/UserInterface/RiuViewerToViewInterface.h +++ b/ApplicationLibCode/UserInterface/RiuViewerToViewInterface.h @@ -41,8 +41,7 @@ class RiuViewerToViewInterface public: virtual caf::PdmObjectHandle* implementingPdmObject() = 0; - virtual void handleMdiWindowClosed() = 0; - virtual void setMdiWindowGeometry( const RimMdiWindowGeometry& windowGeometry ) = 0; + virtual void handleMdiWindowClosed() = 0; virtual void setCameraPosition( const cvf::Mat4d& cameraPosition ) = 0; virtual void setCameraPointOfInterest( const cvf::Vec3d& cameraPointOfInterest ) = 0; From ef109f6cbb1255a05dec10f111143914f7c8ad05 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 8 May 2026 14:03:18 +0200 Subject: [PATCH 07/47] Update title in 3d window --- ApplicationLibCode/ProjectDataModel/Rim3dView.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 6b98f452263..c497de47fb7 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -416,6 +416,7 @@ void Rim3dView::updateWindowTitle() m_viewer->layoutWidget()->setWindowTitle( title ); } + RimViewWindow::updateWindowTitle(); } //-------------------------------------------------------------------------------------------------- From 763491b633d8c8fb0494bc8fa85597457d8feff9 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 12 May 2026 17:46:29 +0200 Subject: [PATCH 08/47] Work in progress --- ApplicationExeCode/Resources/ActiveWindow.svg | 25 ++++++++++++++++ ApplicationExeCode/Resources/ResInsight.qrc | 3 +- .../ProjectDataModel/Rim3dView.cpp | 8 ----- .../ProjectDataModel/Rim3dView.h | 2 -- .../RimDockWindowController.cpp | 5 ++-- .../ProjectDataModel/RimViewWindow.cpp | 29 +++++++++---------- .../ProjectDataModel/RimViewWindow.h | 9 ++++-- .../UserInterface/RiuDockWidgetTools.cpp | 8 +++++ .../UserInterface/RiuDockWidgetTools.h | 2 ++ .../UserInterface/RiuMainWindowBase.cpp | 9 +++--- .../UserInterface/RiuMainWindowBase.h | 3 -- .../UserInterface/RiuViewerToViewInterface.h | 2 -- 12 files changed, 64 insertions(+), 41 deletions(-) create mode 100644 ApplicationExeCode/Resources/ActiveWindow.svg diff --git a/ApplicationExeCode/Resources/ActiveWindow.svg b/ApplicationExeCode/Resources/ActiveWindow.svg new file mode 100644 index 00000000000..8ca0244ac1c --- /dev/null +++ b/ApplicationExeCode/Resources/ActiveWindow.svg @@ -0,0 +1,25 @@ + + + + + + + \ No newline at end of file diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index c28205b776a..a5680729e1c 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -6,7 +6,8 @@ 3DView16x16.png 3DViewGeoMech16x16.png 3DWindow.svg - AICDValve16x16.png + ActiveWindow.svg + AICDValve16x16.png SICDValve16x16.png Annotations16x16.png AnalysisPlot16x16.png diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index c497de47fb7..1af215d69bc 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -1673,14 +1673,6 @@ void Rim3dView::disablePerspectiveProjectionField() RiaFieldHandleTools::disableWriteAndSetFieldHidden( &isPerspectiveView ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void Rim3dView::handleMdiWindowClosed() -{ - RimViewWindow::handleMdiWindowClosed(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.h b/ApplicationLibCode/ProjectDataModel/Rim3dView.h index b1146e62cbf..646eac9b8f2 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.h +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.h @@ -317,8 +317,6 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public caf::PdmObjectHandle* implementingPdmObject() override; - void handleMdiWindowClosed() override; - // Pure private methods void createHighlightAndGridBoxDisplayModel(); diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index c65cfb97f1d..381b5759b77 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -67,7 +67,7 @@ void RimDockWindowController::removeWindowFromDock() RiuMainWindowBase* mainWin = getMainWindow(); if ( mainWin && viewWidget() && viewPdmObject() ) { - viewPdmObject()->deleteDockViewer(); + viewPdmObject()->deleteDockWidget(); viewPdmObject()->deleteViewWidget(); mainWin->removeViewer( viewWidget() ); @@ -126,6 +126,7 @@ void RimDockWindowController::updateViewerWidget() ads::CDockWidget* dockWidget = viewPdmObject()->createDockWidget(); QWidget* viewWidget = viewPdmObject()->createViewWidget( dockWidget ); dockWidget->setWidget( viewWidget ); + dockWidget->setObjectName( viewPdmObject()->dockWindowName() ); mainWindow->initializeViewer( dockWidget, viewWidget ); viewPdmObject()->updateViewWidgetAfterCreation(); @@ -137,7 +138,7 @@ void RimDockWindowController::updateViewerWidget() { if ( viewWidget() ) { - viewPdmObject()->deleteDockViewer(); + viewPdmObject()->deleteDockWidget(); mainWindow->removeViewer( viewWidget() ); viewPdmObject()->deleteViewWidget(); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index db891fd5134..ddd1225942b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -42,12 +42,15 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimViewWindow, "ViewWindow" ); // Do not use. Abstract class +size_t RimViewWindow::m_nextDockWindowId = 0; + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimViewWindow::RimViewWindow() : m_dockWidget( nullptr ) , m_windowController( nullptr ) + , m_dockWindowId( m_nextDockWindowId++ ) { CAF_PDM_InitScriptableObjectWithNameAndComment( "View window", "", "", "", "ViewWindow", "The Base Class for all Views and Plots in ResInsight" ); @@ -124,20 +127,12 @@ QString RimViewWindow::windowTitle() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewWindow::deleteDockViewer() +void RimViewWindow::deleteDockWidget() { m_dockWidget->deleteDockWidget(); m_dockWidget = nullptr; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimViewWindow::handleMdiWindowClosed() -{ - if ( m_windowController != nullptr ) m_windowController->handleViewerDeletion(); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -257,9 +252,18 @@ void RimViewWindow::updateWindowTitle() { viewWidget()->setWindowTitle( windowTitle() ); dockWidget()->setWindowTitle( windowTitle() ); + dockWidget()->setIcon( QIcon( ":/ActiveWindow.svg" ) ); } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RimViewWindow::dockWindowName() const +{ + return QString( "DockViewWindow_%1" ).arg( m_dockWindowId ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -273,13 +277,6 @@ void RimViewWindow::dockInWindow( int mainWindowID ) m_windowController->setMainWindowId( mainWindowID ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimViewWindow::initAfterRead() -{ -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index 33e8bc3c0e0..4037ee4b22f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -48,7 +48,6 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface bool isMainDockedWindow() const; void loadDataAndUpdate(); - void handleMdiWindowClosed(); void updateDockWindowVisibility(); void removeWindowFromDock(); @@ -68,6 +67,8 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface virtual void updateWindowTitle(); + QString dockWindowName() const; + protected: ///////// Interface for the Window controller friend class RimDockWindowController; @@ -79,7 +80,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface virtual void onLoadDataAndUpdate() = 0; virtual void onViewNavigationChanged(); virtual bool isWindowVisible() const; // Virtual To allow special visibility control - void deleteDockViewer(); + void deleteDockWidget(); ////////// // Derived classes are not supposed to override this function. The intention is to always use m_showWindow @@ -87,7 +88,6 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface // can be controlled from the project tree using check box toggles caf::PdmFieldHandle* objectToggleField() final; void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; - void initAfterRead() override; void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; @@ -101,4 +101,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface caf::PdmField m_showWindow; RimDockWindowController* m_windowController; ads::CDockWidget* m_dockWidget; + size_t m_dockWindowId; + + static size_t m_nextDockWindowId; }; diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index bf8bf5371f7..7fba43710ae 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -56,6 +56,14 @@ QString RiuDockWidgetTools::main3DWindowName() return "dock3DWindow_mainWindow"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::welcomeScreenName() +{ + return "dockWelcomeScreen"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index a76be46ecc4..eb13e12d9f8 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -52,6 +52,8 @@ class RiuDockWidgetTools static QString mainPlotWindowName(); static QString main3DWindowName(); + static QString welcomeScreenName(); + static QString mainWindowPropertyEditorName(); static QString mainWindowResultInfoName(); static QString mainWindowProcessMonitorName(); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index cd4f3986046..b9efe68156e 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -475,10 +475,10 @@ void RiuMainWindowBase::createTreeViews( int numberOfTrees ) //-------------------------------------------------------------------------------------------------- void RiuMainWindowBase::setUpCentralDockWidget() { - m_centralDockWidget = RiuDockWidgetTools::createDockWidget( "Welcome", "Welcome", this ); - QTextEdit* welcome = new QTextEdit(); - welcome->setReadOnly( true ); - welcome->setPlainText( "\nWelcome to ResInsight!\n" ); + m_centralDockWidget = RiuDockWidgetTools::createDockWidget( "Welcome", RiuDockWidgetTools::welcomeScreenName(), this ); + QLabel* welcome = new QLabel(); + welcome->setAutoFillBackground( true ); + welcome->setStyleSheet( "QLabel { background-color: darkgrey; }" ); m_centralDockWidget->setWidget( welcome ); m_centralDockWidget->setFeature( ads::CDockWidget::NoTab, true ); dockManager()->setCentralWidget( m_centralDockWidget ); @@ -687,6 +687,7 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu() keys.sort(); for ( auto& key : keys ) { + if ( key == RiuDockWidgetTools::welcomeScreenName() ) continue; auto dock = dockMap[key]; dockWindowsMenu->addAction( dock->toggleViewAction() ); } diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 3282d7d234a..5ae3823bcc1 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -88,8 +88,6 @@ class RiuMainWindowBase : public QMainWindow ads::CDockManager* dockManager() const; - // RiuMdiArea* mdiArea(); - protected: void createTreeViews( int numberOfTrees ); void setUpCentralDockWidget(); @@ -132,7 +130,6 @@ protected slots: QAction* m_redoAction; QUndoView* m_undoView; - // RiuMdiArea* m_mdiArea; QMenu* m_windowMenu; const int DOCKSTATE_VERSION = 4; diff --git a/ApplicationLibCode/UserInterface/RiuViewerToViewInterface.h b/ApplicationLibCode/UserInterface/RiuViewerToViewInterface.h index 352fedd4615..d33440fbe3a 100644 --- a/ApplicationLibCode/UserInterface/RiuViewerToViewInterface.h +++ b/ApplicationLibCode/UserInterface/RiuViewerToViewInterface.h @@ -41,8 +41,6 @@ class RiuViewerToViewInterface public: virtual caf::PdmObjectHandle* implementingPdmObject() = 0; - virtual void handleMdiWindowClosed() = 0; - virtual void setCameraPosition( const cvf::Mat4d& cameraPosition ) = 0; virtual void setCameraPointOfInterest( const cvf::Vec3d& cameraPointOfInterest ) = 0; From 51dffbcfa626959e7217eabd08275056c205fdaa Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 15 May 2026 02:25:56 +0200 Subject: [PATCH 09/47] Work in progress --- .../RiaCompletionTypeCalculationScheduler.cpp | 2 +- .../Application/RiaGuiApplication.cpp | 2 +- .../RicSnapshotAllPlotsToFileFeature.cpp | 8 +-- .../RicSnapshotAllViewsToFileFeature.cpp | 11 ++-- .../RimDockWindowController.cpp | 4 ++ .../ProjectDataModel/RimViewWindow.cpp | 1 - .../UserInterface/Riu3DMainWindowTools.cpp | 4 +- .../UserInterface/Riu3DMainWindowTools.h | 5 +- .../UserInterface/RiuMainWindow.cpp | 13 +---- .../UserInterface/RiuMainWindow.h | 1 - .../UserInterface/RiuMainWindowBase.cpp | 56 +++++++++++++++---- .../UserInterface/RiuMainWindowBase.h | 6 +- .../UserInterface/RiuPlotMainWindow.cpp | 11 +--- .../UserInterface/RiuPlotMainWindow.h | 1 - .../UserInterface/RiuPlotMainWindowTools.cpp | 4 +- .../UserInterface/RiuPlotMainWindowTools.h | 4 +- 16 files changed, 77 insertions(+), 56 deletions(-) diff --git a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp index 8cc14aec1ba..9b6c0bd280a 100644 --- a/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp +++ b/ApplicationLibCode/Application/RiaCompletionTypeCalculationScheduler.cpp @@ -151,7 +151,7 @@ void RiaCompletionTypeCalculationScheduler::performScheduledUpdates() RiaApplication::instance()->setActiveReservoirView( activeView ); if ( RiuMainWindow::instance() ) { - RiuMainWindow::instance()->setActiveViewer( activeView->viewer()->layoutWidget() ); + RiuMainWindow::instance()->setActiveViewer( activeView->dockWindowName() ); } } } diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index d2525739dbe..44b0cd88bdf 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -231,7 +231,7 @@ RiaGuiApplication::~RiaGuiApplication() delete m_mainWindow.data(); m_mainWindow.clear(); - m_mainPlotWindow.reset(); + // m_mainPlotWindow.reset(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp index 2a1999ef503..3f78477baa3 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp @@ -120,17 +120,17 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QS //-------------------------------------------------------------------------------------------------- void RicSnapshotAllPlotsToFileFeature::onActionTriggered( bool isChecked ) { - QWidget* currentActiveWidget = nullptr; + QString currentActiveViewerName; if ( RiaGuiApplication::activeViewWindow() ) { - currentActiveWidget = RiaGuiApplication::activeViewWindow()->viewWidget(); + currentActiveViewerName = RiaGuiApplication::activeViewWindow()->dockWindowName(); } RicSnapshotAllPlotsToFileFeature::saveAllPlots(); - if ( currentActiveWidget ) + if ( !currentActiveViewerName.isEmpty() ) { - RiuPlotMainWindowTools::setActiveViewer( currentActiveWidget ); + RiuPlotMainWindowTools::setActiveViewer( currentActiveViewerName ); } } diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp index 91daaf1ddec..08ec3afc278 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp @@ -117,10 +117,11 @@ void RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( const QS { RiuViewer* viewer = riv->viewer(); if ( !viewer ) continue; + if ( !viewer->ownerViewWindow() ) continue; RiaApplication::instance()->setActiveReservoirView( riv ); - Riu3DMainWindowTools::setActiveViewer( viewer->layoutWidget() ); + Riu3DMainWindowTools::setActiveViewer( viewer->ownerViewWindow()->dockWindowName() ); RiaViewRedrawScheduler::instance()->clearViewsScheduledForUpdate(); RiaPlotWindowRedrawScheduler::instance()->clearAllScheduledUpdates(); @@ -152,17 +153,17 @@ void RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( const QS //-------------------------------------------------------------------------------------------------- void RicSnapshotAllViewsToFileFeature::onActionTriggered( bool isChecked ) { - QWidget* currentActiveWidget = nullptr; + QString currentActiveViewerName; if ( RiaGuiApplication::activeViewWindow() ) { - currentActiveWidget = RiaGuiApplication::activeViewWindow()->viewWidget(); + currentActiveViewerName = RiaGuiApplication::activeViewWindow()->dockWindowName(); } RicSnapshotAllViewsToFileFeature::saveAllViews(); - if ( currentActiveWidget ) + if ( !currentActiveViewerName.isEmpty() ) { - Riu3DMainWindowTools::setActiveViewer( currentActiveWidget ); + Riu3DMainWindowTools::setActiveViewer( currentActiveViewerName ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index 381b5759b77..4118735266c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -21,7 +21,9 @@ #include "RiaGuiApplication.h" #include "RimProject.h" #include "RimViewWindow.h" + #include "RiuMainWindowBase.h" +#include "RiuViewer.h" #include "DockManager.h" #include "DockWidget.h" @@ -129,6 +131,8 @@ void RimDockWindowController::updateViewerWidget() dockWidget->setObjectName( viewPdmObject()->dockWindowName() ); mainWindow->initializeViewer( dockWidget, viewWidget ); + mainWindow->connect( dockWidget, SIGNAL( visibilityChanged( bool ) ), mainWindow, SLOT( slotDockViewerVisibilityChanged( bool ) ) ); + viewPdmObject()->updateViewWidgetAfterCreation(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index ddd1225942b..daf346da44d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -26,7 +26,6 @@ #include "RicfCommandObject.h" -#include "Rim3dView.h" #include "RimDockWindowController.h" #include "RimProject.h" diff --git a/ApplicationLibCode/UserInterface/Riu3DMainWindowTools.cpp b/ApplicationLibCode/UserInterface/Riu3DMainWindowTools.cpp index a883657e897..12cf7f8b4c7 100644 --- a/ApplicationLibCode/UserInterface/Riu3DMainWindowTools.cpp +++ b/ApplicationLibCode/UserInterface/Riu3DMainWindowTools.cpp @@ -37,9 +37,9 @@ QWidget* Riu3DMainWindowTools::mainWindowWidget() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Riu3DMainWindowTools::setActiveViewer( QWidget* subWindow ) +void Riu3DMainWindowTools::setActiveViewer( QString viewerName ) { - if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->setActiveViewer( subWindow ); + if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->setActiveViewer( viewerName ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/Riu3DMainWindowTools.h b/ApplicationLibCode/UserInterface/Riu3DMainWindowTools.h index 3201a809d6f..2c4644aa5ad 100644 --- a/ApplicationLibCode/UserInterface/Riu3DMainWindowTools.h +++ b/ApplicationLibCode/UserInterface/Riu3DMainWindowTools.h @@ -19,7 +19,8 @@ #pragma once class QWidget; -class QString; + +#include namespace caf { @@ -31,7 +32,7 @@ class Riu3DMainWindowTools { public: static QWidget* mainWindowWidget(); - static void setActiveViewer( QWidget* subWindow ); + static void setActiveViewer( QString viewerName ); static void setExpanded( const caf::PdmUiItem* uiItem, bool expanded = true ); static void selectAsCurrentItem( const caf::PdmObject* object, bool allowActiveViewChange = true ); static void reportAndShowWarning( const QString& warningDialogHeader, const QString& warningtext ); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 9e27fd143d1..dd98f9861b6 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -1402,15 +1402,6 @@ void RiuMainWindow::selectViewInProjectTreePreservingSubItemSelection( const Rim } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMainWindow::setActiveViewer( QWidget* viewer ) -{ - // QMdiSubWindow* swin = findMdiSubWindow( viewer ); - // if ( swin ) m_mdiArea->setActiveSubWindow( swin ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1483,10 +1474,10 @@ void RiuMainWindow::selectedObjectsChanged() if ( selectedReservoirView ) { // Set focus in MDI area to this window if it exists - if ( selectedReservoirView->viewer() ) + if ( selectedReservoirView->viewer() && selectedReservoirView->viewer()->ownerViewWindow() ) { setBlockViewSelectionOnSubWindowActivated( true ); - setActiveViewer( selectedReservoirView->viewer()->layoutWidget() ); + setActiveViewer( selectedReservoirView->viewer()->ownerViewWindow()->dockWindowName() ); setBlockViewSelectionOnSubWindowActivated( false ); isActiveViewChanged = true; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index 43c7df14679..af36ae73c31 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -94,7 +94,6 @@ class RiuMainWindow : public RiuMainWindowBase void removeViewer( QWidget* viewer ) override; void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) override; - void setActiveViewer( QWidget* subWindow ) override; ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) override; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index b9efe68156e..857fbed813a 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -31,7 +31,9 @@ #include "RiuDockWidgetTools.h" #include "RiuDragDrop.h" #include "RiuGuiTheme.h" +#include "RiuInterfaceToViewWindow.h" #include "RiuMainWindowTools.h" +#include "RiuViewer.h" #include "cafCmdFeatureManager.h" #include "cafPdmObject.h" @@ -113,18 +115,16 @@ ads::CDockManager* RiuMainWindowBase::dockManager() const return m_dockManager; } -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -// QMdiSubWindow* RiuMainWindowBase::createViewWindow() -//{ -// RiuMdiSubWindow* subWin = -// new RiuMdiSubWindow( nullptr, Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMaximizeButtonHint ); -// subWin->setAttribute( Qt::WA_DeleteOnClose ); // Make sure the contained widget is destroyed when the MDI window -// // is closed -// -// return subWin; -// } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindowBase::setActiveViewer( QString viewerName ) +{ + if ( auto dockWidget = dockManager()->findDockWidget( viewerName ) ) + { + dockWidget->setAsCurrentTab(); + } +} //-------------------------------------------------------------------------------------------------- /// @@ -413,6 +413,38 @@ void RiuMainWindowBase::slotDockWidgetToggleViewActionTriggered() } } +//-------------------------------------------------------------------------------------------------- +/// +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindowBase::slotDockViewerVisibilityChanged( bool visible ) +{ + if ( visible ) return; + + // TODO - handle undocking views + + if ( auto dockWidget = dynamic_cast( sender() ) ) + { + auto mainWidget = dockWidget->widget(); + RimViewWindow* viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( mainWidget ); + if ( !viewWindow ) + { + RiuViewer* viewer = mainWidget->findChild(); + if ( viewer ) + { + viewWindow = viewer->ownerViewWindow(); + } + } + + if ( viewWindow ) + { + viewWindow->setShowWindow( false ); + viewWindow->removeWindowFromDock(); + viewWindow->updateConnectedEditors(); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 5ae3823bcc1..4e9c5878b52 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -20,6 +20,8 @@ #include #include +#include +#include #include "cafPdmUiDragDropInterface.h" @@ -63,7 +65,7 @@ class RiuMainWindowBase : public QMainWindow virtual void removeViewer( QWidget* viewer ) = 0; virtual void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) {}; - virtual void setActiveViewer( QWidget* subWindow ) = 0; + virtual void setActiveViewer( QString viewerName ); virtual ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) = 0; @@ -112,6 +114,8 @@ protected slots: void slotDockWidgetToggleViewActionTriggered(); void slotRefreshHelpActions(); + void slotDockViewerVisibilityChanged( bool ); + void slotRedo(); void slotUndo(); void slotRefreshUndoRedoActions(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index c79023548ff..c41816a0b1d 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -824,15 +824,6 @@ void RiuPlotMainWindow::setPdmRoot( caf::PdmObject* pdmRoot ) // updateMultiPlotToolBar(); // } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindow::setActiveViewer( QWidget* viewer ) -{ - // QMdiSubWindow* swin = findMdiSubWindow( viewer ); - // if ( swin ) m_mdiArea->setActiveSubWindow( swin ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -906,7 +897,7 @@ void RiuPlotMainWindow::selectedObjectsChanged( caf::PdmUiTreeView* projectTree, if ( selectedWindow->viewWidget() ) { setBlockViewSelectionOnSubWindowActivated( true ); - setActiveViewer( selectedWindow->viewWidget() ); + setActiveViewer( selectedWindow->dockWindowName() ); setBlockViewSelectionOnSubWindowActivated( false ); } diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index f75979d861a..ced6ac9a11d 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -70,7 +70,6 @@ class RiuPlotMainWindow : public RiuMainWindowBase void removeViewer( QWidget* viewer ) override; void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) override; - void setActiveViewer( QWidget* subWindow ) override; ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) override; void setDefaultWindowSize(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp index 2d95e094f5b..0eb5029ef24 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp @@ -36,13 +36,13 @@ void RiuPlotMainWindowTools::showPlotMainWindow() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindowTools::setActiveViewer( QWidget* subWindow ) +void RiuPlotMainWindowTools::setActiveViewer( QString viewerName ) { if ( RiaGuiApplication::isRunning() ) { RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); - if ( mpw ) mpw->setActiveViewer( subWindow ); + if ( mpw ) mpw->setActiveViewer( viewerName ); } } diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.h index a530a3e6cfc..a8b955ec452 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.h @@ -18,7 +18,7 @@ #pragma once -class QWidget; +#include namespace caf { @@ -30,7 +30,7 @@ class RiuPlotMainWindowTools { public: static void showPlotMainWindow(); - static void setActiveViewer( QWidget* subWindow ); + static void setActiveViewer( QString viewerName ); static void setExpanded( const caf::PdmUiItem* uiItem ); static void selectAsCurrentItem( const caf::PdmObject* object ); static void selectOrToggleObject( const caf::PdmObject* object, bool toggle ); From 400c01b0aae81594fd3d763a058bed9b949c535d Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Mon, 18 May 2026 13:39:38 +0200 Subject: [PATCH 10/47] Work in progress --- .../Commands/3dView/CMakeLists_files.cmake | 5 +- ...Feature.cpp => RicDockIn3dViewFeature.cpp} | 19 ++--- ...oMdiFeature.h => RicDockIn3dViewFeature.h} | 2 +- ...ature.cpp => RicDockInPlotViewFeature.cpp} | 28 ++++---- ...ewFeature.h => RicDockInPlotViewFeature.h} | 2 +- .../3dView/RicPopOutToPlotViewFeature.cpp | 61 ---------------- .../3dView/RicPopOutToPlotViewFeature.h | 34 --------- .../ProjectDataModel/Rim3dView.cpp | 39 +++-------- .../ProjectDataModel/Rim3dView.h | 8 +-- .../RimDockWindowController.cpp | 9 +++ .../RimDockWindowController.h | 1 + .../ProjectDataModel/RimViewWindow.cpp | 16 +++++ .../ProjectDataModel/RimViewWindow.h | 3 + .../UserInterface/RiuMainWindow.cpp | 14 ---- .../UserInterface/RiuMainWindow.h | 2 - .../UserInterface/RiuMainWindowBase.cpp | 69 +++---------------- .../UserInterface/RiuMainWindowBase.h | 8 +-- .../UserInterface/RiuPlotMainWindow.cpp | 12 ---- .../UserInterface/RiuPlotMainWindow.h | 5 +- 19 files changed, 82 insertions(+), 255 deletions(-) rename ApplicationLibCode/Commands/3dView/{RicConvert3dToMdiFeature.cpp => RicDockIn3dViewFeature.cpp} (79%) rename ApplicationLibCode/Commands/3dView/{RicConvert3dToMdiFeature.h => RicDockIn3dViewFeature.h} (95%) rename ApplicationLibCode/Commands/3dView/{RicPopOutTo3dViewFeature.cpp => RicDockInPlotViewFeature.cpp} (73%) rename ApplicationLibCode/Commands/3dView/{RicPopOutTo3dViewFeature.h => RicDockInPlotViewFeature.h} (95%) delete mode 100644 ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.cpp delete mode 100644 ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.h diff --git a/ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake b/ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake index 20ad2ccb4a2..18caa0121b0 100644 --- a/ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/3dView/CMakeLists_files.cmake @@ -1,9 +1,8 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicApplyUserDefinedCameraFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicStoreUserDefinedCameraFeature.cpp - ${CMAKE_CURRENT_LIST_DIR}/RicPopOutTo3dViewFeature.cpp - ${CMAKE_CURRENT_LIST_DIR}/RicPopOutToPlotViewFeature.cpp - ${CMAKE_CURRENT_LIST_DIR}/RicConvert3dToMdiFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicDockIn3dViewFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicDockInPlotViewFeature.cpp ) list(APPEND COMMAND_CODE_SOURCE_FILES ${SOURCE_GROUP_SOURCE_FILES}) diff --git a/ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.cpp b/ApplicationLibCode/Commands/3dView/RicDockIn3dViewFeature.cpp similarity index 79% rename from ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.cpp rename to ApplicationLibCode/Commands/3dView/RicDockIn3dViewFeature.cpp index 18b3d0f2f2e..39897fe364d 100644 --- a/ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.cpp +++ b/ApplicationLibCode/Commands/3dView/RicDockIn3dViewFeature.cpp @@ -16,7 +16,7 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RicConvert3dToMdiFeature.h" +#include "RicDockIn3dViewFeature.h" #include "RiaGuiApplication.h" @@ -30,16 +30,19 @@ #include #include -CAF_CMD_SOURCE_INIT( RicConvert3dToMdiFeature, "RicConvert3dToMdiFeature" ); +CAF_CMD_SOURCE_INIT( RicDockIn3dViewFeature, "RicDockIn3dViewFeature" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RicConvert3dToMdiFeature::isCommandEnabled() const +bool RicDockIn3dViewFeature::isCommandEnabled() const { if ( auto view = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ) ) { - return view->isDockingViewer(); + if ( ( view->showWindow() ) && ( !view->isDockedIn3DView() ) ) + { + return true; + } } return false; } @@ -47,19 +50,19 @@ bool RicConvert3dToMdiFeature::isCommandEnabled() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicConvert3dToMdiFeature::onActionTriggered( bool isChecked ) +void RicDockIn3dViewFeature::onActionTriggered( bool isChecked ) { if ( auto view = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ) ) { - view->convertToMdi( RiaGuiApplication::instance()->mainWindow() ); + view->dockInMainWindow(); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicConvert3dToMdiFeature::setupActionLook( QAction* actionToSetup ) +void RicDockIn3dViewFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText( "Convert to MDI view" ); + actionToSetup->setText( "Dock in 3D Window" ); actionToSetup->setIcon( QIcon( ":/3DWindow.svg" ) ); } diff --git a/ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.h b/ApplicationLibCode/Commands/3dView/RicDockIn3dViewFeature.h similarity index 95% rename from ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.h rename to ApplicationLibCode/Commands/3dView/RicDockIn3dViewFeature.h index 51aadb201d8..811be16ba8c 100644 --- a/ApplicationLibCode/Commands/3dView/RicConvert3dToMdiFeature.h +++ b/ApplicationLibCode/Commands/3dView/RicDockIn3dViewFeature.h @@ -23,7 +23,7 @@ //================================================================================================== /// //================================================================================================== -class RicConvert3dToMdiFeature : public caf::CmdFeature +class RicDockIn3dViewFeature : public caf::CmdFeature { CAF_CMD_HEADER_INIT; diff --git a/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.cpp b/ApplicationLibCode/Commands/3dView/RicDockInPlotViewFeature.cpp similarity index 73% rename from ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.cpp rename to ApplicationLibCode/Commands/3dView/RicDockInPlotViewFeature.cpp index 98fcaa9d300..8712babafa0 100644 --- a/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.cpp +++ b/ApplicationLibCode/Commands/3dView/RicDockInPlotViewFeature.cpp @@ -16,30 +16,28 @@ // ///////////////////////////////////////////////////////////////////////////////// -#include "RicPopOutTo3dViewFeature.h" +#include "RicDockInPlotViewFeature.h" -#include "RiaGuiApplication.h" - -#include "RimGridView.h" -#include "RiuMainWindow.h" - -#include "RiuViewer.h" +#include "Rim3dView.h" #include "cafSelectionManager.h" #include #include -CAF_CMD_SOURCE_INIT( RicPopOutTo3dViewFeature, "RicPopOutTo3dViewFeature" ); +CAF_CMD_SOURCE_INIT( RicDockInPlotViewFeature, "RicDockInPlotViewFeature" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool RicPopOutTo3dViewFeature::isCommandEnabled() const +bool RicDockInPlotViewFeature::isCommandEnabled() const { if ( auto view = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ) ) { - return !view->isDockingViewer(); + if ( ( view->showWindow() ) && ( !view->isDockedInPlotView() ) ) + { + return true; + } } return false; } @@ -47,19 +45,19 @@ bool RicPopOutTo3dViewFeature::isCommandEnabled() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicPopOutTo3dViewFeature::onActionTriggered( bool isChecked ) +void RicDockInPlotViewFeature::onActionTriggered( bool isChecked ) { if ( auto view = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ) ) { - view->convertToDocking( RiaGuiApplication::instance()->mainWindow() ); + view->dockInPlotWindow(); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicPopOutTo3dViewFeature::setupActionLook( QAction* actionToSetup ) +void RicDockInPlotViewFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText( "Pop Out (in 3D View)" ); - actionToSetup->setIcon( QIcon( ":/3DWindow.svg" ) ); + actionToSetup->setText( "Dock in Plot Window" ); + actionToSetup->setIcon( QIcon( ":/PlotWindow.svg" ) ); } diff --git a/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.h b/ApplicationLibCode/Commands/3dView/RicDockInPlotViewFeature.h similarity index 95% rename from ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.h rename to ApplicationLibCode/Commands/3dView/RicDockInPlotViewFeature.h index 7c62afa512f..a85b4942442 100644 --- a/ApplicationLibCode/Commands/3dView/RicPopOutTo3dViewFeature.h +++ b/ApplicationLibCode/Commands/3dView/RicDockInPlotViewFeature.h @@ -23,7 +23,7 @@ //================================================================================================== /// //================================================================================================== -class RicPopOutTo3dViewFeature : public caf::CmdFeature +class RicDockInPlotViewFeature : public caf::CmdFeature { CAF_CMD_HEADER_INIT; diff --git a/ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.cpp b/ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.cpp deleted file mode 100644 index 6218552a361..00000000000 --- a/ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.cpp +++ /dev/null @@ -1,61 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2026 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 "RicPopOutToPlotViewFeature.h" - -#include "RiaGuiApplication.h" - -#include "RimGridView.h" -#include "RiuMainWindow.h" - -#include "RiuViewer.h" - -#include "cafSelectionManager.h" - -#include -#include - -CAF_CMD_SOURCE_INIT( RicPopOutToPlotViewFeature, "RicPopOutToPlotViewFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicPopOutToPlotViewFeature::isCommandEnabled() const -{ - return true; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicPopOutToPlotViewFeature::onActionTriggered( bool isChecked ) -{ - if ( auto view = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ) ) - { - view->convertToDocking( RiaGuiApplication::instance()->mainPlotWindow() ); - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RicPopOutToPlotViewFeature::setupActionLook( QAction* actionToSetup ) -{ - actionToSetup->setText( "Pop Out (in Plot View)" ); - actionToSetup->setIcon( QIcon( ":/PlotWindow.svg" ) ); -} diff --git a/ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.h b/ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.h deleted file mode 100644 index a7ac6d0a30c..00000000000 --- a/ApplicationLibCode/Commands/3dView/RicPopOutToPlotViewFeature.h +++ /dev/null @@ -1,34 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2026 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 RicPopOutToPlotViewFeature : public caf::CmdFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - bool isCommandEnabled() const override; - void onActionTriggered( bool isChecked ) override; - void setupActionLook( QAction* actionToSetup ) override; -}; diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 1af215d69bc..1987f25fc50 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -1897,49 +1897,28 @@ void Rim3dView::synchronizeLocalAnnotationsFromGlobal() //-------------------------------------------------------------------------------------------------- void Rim3dView::appendMenuItems( caf::CmdFeatureMenuBuilder& menuBuilder ) const { - if ( isDockingViewer() ) - { - menuBuilder << "RicConvert3dToMdiFeature"; - } - else - { - menuBuilder << "RicPopOutTo3dViewFeature"; - menuBuilder << "RicPopOutToPlotViewFeature"; - } + menuBuilder << "RicDockIn3dViewFeature"; + menuBuilder << "RicDockInPlotViewFeature"; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dView::convertToDocking( RiuMainWindowBase* mainWindow ) +void Rim3dView::dockInMainWindow() { - if ( isDockingViewer() ) return; - removeWindowFromDock(); - - QWidget* viewWidget = createViewWidget( nullptr ); - - m_dockWidget = mainWindow->initializeDockingViewer( viewWidget ); - updateViewWidgetAfterCreation(); + dockAs3DViewWindow(); + updateDockWindowVisibility(); scheduleCreateDisplayModelAndRedraw(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dView::convertToMdi( RiuMainWindowBase* mainWindow ) +void Rim3dView::dockInPlotWindow() { - if ( !isDockingViewer() ) return; - - mainWindow->dockManager()->removeDockWidget( m_dockWidget ); - - m_dockWidget->takeWidget(); - m_dockWidget = nullptr; - - m_windowController->updateViewerWidget(); - + removeWindowFromDock(); + dockAsPlotWindow(); updateDockWindowVisibility(); - - updateViewWidgetAfterCreation(); scheduleCreateDisplayModelAndRedraw(); -} \ No newline at end of file +} diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.h b/ApplicationLibCode/ProjectDataModel/Rim3dView.h index 646eac9b8f2..92256eda9e2 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.h +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.h @@ -101,8 +101,6 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public int id() const final; - bool isDockingViewer() const { return !m_dockWidget.isNull(); } - // Public fields: caf::PdmField isPerspectiveView; @@ -211,8 +209,8 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public RimAnnotationInViewCollection* annotationCollection() const; void synchronizeLocalAnnotationsFromGlobal(); - void convertToDocking( RiuMainWindowBase* mainWindow ); - void convertToMdi( RiuMainWindowBase* mainWindow ); + void dockInMainWindow(); + void dockInPlotWindow(); protected: static void removeModelByName( cvf::Scene* scene, const cvf::String& modelName ); @@ -369,6 +367,4 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public std::unique_ptr m_animationTimer; const int m_animationIntervalMillisec; int m_animationTimerUsers; - - QPointer m_dockWidget; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index 4118735266c..6514616eb00 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -131,6 +131,7 @@ void RimDockWindowController::updateViewerWidget() dockWidget->setObjectName( viewPdmObject()->dockWindowName() ); mainWindow->initializeViewer( dockWidget, viewWidget ); + mainWindow->connect( dockWidget, SIGNAL( closed() ), mainWindow, SLOT( slotDockViewerClosed() ) ); mainWindow->connect( dockWidget, SIGNAL( visibilityChanged( bool ) ), mainWindow, SLOT( slotDockViewerVisibilityChanged( bool ) ) ); viewPdmObject()->updateViewWidgetAfterCreation(); @@ -165,3 +166,11 @@ void RimDockWindowController::setViewToControl( RimViewWindow* view ) { m_viewToControl = view; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +int RimDockWindowController::mainWindowId() const +{ + return m_mainWindowID; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h index 74bb69e28c6..764d49ad66b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h @@ -40,6 +40,7 @@ class RimDockWindowController : public caf::PdmObject void setMainWindowId( int mainId ); void setViewToControl( RimViewWindow* view ); + int mainWindowId() const; void updateViewerWidget(); void handleViewerDeletion(); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index daf346da44d..77dcd4a4553 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -98,6 +98,22 @@ bool RimViewWindow::isMainDockedWindow() const return m_windowController != nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimViewWindow::isDockedIn3DView() const +{ + return ( m_windowController != nullptr ) && ( m_windowController->mainWindowId() == 0 ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimViewWindow::isDockedInPlotView() const +{ + return ( m_windowController != nullptr ) && ( m_windowController->mainWindowId() == 1 ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index 4037ee4b22f..9f9105ab4e6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -47,6 +47,9 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface bool isMainDockedWindow() const; + bool isDockedIn3DView() const; + bool isDockedInPlotView() const; + void loadDataAndUpdate(); void updateDockWindowVisibility(); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index dd98f9861b6..d0125f88f2e 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -1204,20 +1204,6 @@ void RiuMainWindow::initializeViewer( ads::CDockWidget* dockWidget, QWidget* vie slotRefreshViewActions(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -ads::CDockWidget* RiuMainWindow::initializeDockingViewer( QWidget* viewer ) -{ - auto dockWidget = RiuDockWidgetTools::createDockWidget( "3D Viewer", "3D view", dockManager() ); - dockWidget->setWidget( viewer ); - dockManager()->addDockWidgetFloating( dockWidget ); - - slotRefreshViewActions(); - - return dockWidget; -} - //-------------------------------------------------------------------------------------------------- /// This method needs to handle memory deallocation !!! //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index af36ae73c31..2879c3c8ee1 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -95,8 +95,6 @@ class RiuMainWindow : public RiuMainWindowBase void removeViewer( QWidget* viewer ) override; void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) override; - ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) override; - void setResultInfo( const QString& info ) const; void refreshViewActions(); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 857fbed813a..41416527f23 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -126,16 +126,6 @@ void RiuMainWindowBase::setActiveViewer( QString viewerName ) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -ads::CDockWidget* RiuMainWindowBase::createDockViewWindow() -{ - auto widget = RiuDockWidgetTools::createDockWidget( "3D view", "3dview", this ); - - return widget; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -339,52 +329,6 @@ void RiuMainWindowBase::removeViewerFromDockArea( QWidget* viewer ) } } -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -// void RiuMainWindowBase::removeViewerFromMdiArea( RiuMdiArea* mdiArea, QWidget* viewer ) -//{ -// bool removedSubWindowWasActive = false; -// bool wasMaximized = true; -// -// if ( QMdiSubWindow* subWindowBeingClosed = findMdiSubWindow( viewer ) ) -// { -// wasMaximized = subWindowBeingClosed->isMaximized(); -// -// if ( subWindowBeingClosed->isActiveWindow() ) -// { -// // If we are removing the active window, we will need a new active window -// // Start by making the window inactive so Qt doesn't pick the active window itself -// mdiArea->setActiveSubWindow( nullptr ); -// removedSubWindowWasActive = true; -// } -// mdiArea->removeSubWindow( subWindowBeingClosed ); -// -// // These two lines had to be introduced after themes was used -// // Probably related to polish/unpolish of widgets in an MDI setting -// // https://github.com/OPM/ResInsight/issues/6676 -// subWindowBeingClosed->hide(); -// subWindowBeingClosed->deleteLater(); -// } -// -// QList subWindowList = mdiArea->subWindowList( QMdiArea::ActivationHistoryOrder ); -// if ( !subWindowList.empty() ) -// { -// if ( removedSubWindowWasActive ) -// { -// mdiArea->setActiveSubWindow( nullptr ); -// // Make the last activated window the current activated one -// mdiArea->setActiveSubWindow( subWindowList.back() ); -// } -// if ( wasMaximized && mdiArea->currentSubWindow() ) -// { -// mdiArea->currentSubWindow()->showMaximized(); -// } -// -// mdiArea->applyTiling(); -// } -// } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -419,10 +363,17 @@ void RiuMainWindowBase::slotDockWidgetToggleViewActionTriggered() //-------------------------------------------------------------------------------------------------- void RiuMainWindowBase::slotDockViewerVisibilityChanged( bool visible ) { - if ( visible ) return; - - // TODO - handle undocking views + if ( auto dockWidget = dynamic_cast( sender() ) ) + { + } +} +//-------------------------------------------------------------------------------------------------- +/// +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindowBase::slotDockViewerClosed() +{ if ( auto dockWidget = dynamic_cast( sender() ) ) { auto mainWidget = dockWidget->widget(); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 4e9c5878b52..f64e4ccc222 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -61,14 +61,10 @@ class RiuMainWindowBase : public QMainWindow virtual QString mainWindowName() = 0; - ads::CDockWidget* createDockViewWindow(); - virtual void removeViewer( QWidget* viewer ) = 0; virtual void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) {}; virtual void setActiveViewer( QString viewerName ); - virtual ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) = 0; - void loadWinGeoAndDockToolBarLayout(); void saveWinGeoAndDockToolBarLayout(); void showWindow(); @@ -112,10 +108,10 @@ class RiuMainWindowBase : public QMainWindow protected slots: void slotDockWidgetToggleViewActionTriggered(); + void slotDockViewerVisibilityChanged( bool visible ); + void slotDockViewerClosed(); void slotRefreshHelpActions(); - void slotDockViewerVisibilityChanged( bool ); - void slotRedo(); void slotUndo(); void slotRefreshUndoRedoActions(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index c41816a0b1d..3dd68ad3ade 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -755,18 +755,6 @@ void RiuPlotMainWindow::initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer->update(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -ads::CDockWidget* RiuPlotMainWindow::initializeDockingViewer( QWidget* viewer ) -{ - auto dockViewer = RiuDockWidgetTools::createDockWidget( "3D Viewer", "3D view", dockManager() ); - dockViewer->setWidget( viewer ); - dockManager()->addDockWidgetFloating( dockViewer ); - - return dockViewer; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index ced6ac9a11d..aca4568c99f 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -68,9 +68,8 @@ class RiuPlotMainWindow : public RiuMainWindowBase void cleanupGuiBeforeProjectClose(); void cleanUpTemporaryWidgets(); - void removeViewer( QWidget* viewer ) override; - void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) override; - ads::CDockWidget* initializeDockingViewer( QWidget* viewer ) override; + void removeViewer( QWidget* viewer ) override; + void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) override; void setDefaultWindowSize(); void enable3DSelectionLink( bool enable ); From 97ab3f653fed8aa23f9ea9f13f015bfb60b4995e Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Tue, 19 May 2026 02:26:59 +0200 Subject: [PATCH 11/47] Work in progress --- .../RimDockWindowController.cpp | 12 +++++++++ .../RimDockWindowController.h | 2 ++ .../ProjectDataModel/RimViewWindow.cpp | 25 +++++++++++++++++++ .../ProjectDataModel/RimViewWindow.h | 9 +++++-- .../UserInterface/RiuViewer.cpp | 12 +++++++-- ApplicationLibCode/UserInterface/RiuViewer.h | 2 +- 6 files changed, 57 insertions(+), 5 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index 6514616eb00..ae85b84233b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -174,3 +174,15 @@ int RimDockWindowController::mainWindowId() const { return m_mainWindowID; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimDockWindowController::setActiveViewer() +{ + if ( auto pdmView = viewPdmObject() ) + { + if ( pdmView->isActive() ) return; + pdmView->setActive( true ); + } +} \ No newline at end of file diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h index 764d49ad66b..cb6d5787e60 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h @@ -42,6 +42,8 @@ class RimDockWindowController : public caf::PdmObject void setViewToControl( RimViewWindow* view ); int mainWindowId() const; + void setActiveViewer(); + void updateViewerWidget(); void handleViewerDeletion(); void removeWindowFromDock(); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index 77dcd4a4553..f6d7e99e31c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -50,6 +50,7 @@ RimViewWindow::RimViewWindow() : m_dockWidget( nullptr ) , m_windowController( nullptr ) , m_dockWindowId( m_nextDockWindowId++ ) + , m_activeViewer( false ) { CAF_PDM_InitScriptableObjectWithNameAndComment( "View window", "", "", "", "ViewWindow", "The Base Class for all Views and Plots in ResInsight" ); @@ -80,6 +81,14 @@ void RimViewWindow::setShowWindow( bool showWindow ) m_showWindow = showWindow; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimViewWindow::setAsActiveViewer() +{ + if ( m_windowController ) m_windowController->setAsActiveViewer(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -330,3 +339,19 @@ ads::CDockWidget* RimViewWindow::createDockWidget() } return m_dockWidget; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimViewWindow::setActive( bool active ) +{ + m_activeViewer = active; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +bool RimViewWindow::isActive() const +{ + return m_activeViewer; +} diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index 9f9105ab4e6..a94b0abc65d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -45,6 +45,8 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface bool showWindow() const; void setShowWindow( bool showWindow ); + void setAsActiveViewer(); + bool isMainDockedWindow() const; bool isDockedIn3DView() const; @@ -73,7 +75,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface QString dockWindowName() const; protected: - ///////// Interface for the Window controller + //// Interface for the Window controller friend class RimDockWindowController; QString windowTitle(); @@ -84,7 +86,9 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface virtual void onViewNavigationChanged(); virtual bool isWindowVisible() const; // Virtual To allow special visibility control void deleteDockWidget(); - ////////// + void setActive( bool active ); + bool isActive() const; + //// // Derived classes are not supposed to override this function. The intention is to always use m_showWindow // as the objectToggleField for this class. This way the visibility of a widget being part of a composite widget @@ -105,6 +109,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface RimDockWindowController* m_windowController; ads::CDockWidget* m_dockWidget; size_t m_dockWindowId; + bool m_activeViewer; static size_t m_nextDockWindowId; }; diff --git a/ApplicationLibCode/UserInterface/RiuViewer.cpp b/ApplicationLibCode/UserInterface/RiuViewer.cpp index 5dcd8939198..15149d3702f 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewer.cpp @@ -718,9 +718,17 @@ void RiuViewer::showHistogram( bool enable ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuViewer::mousePressEvent( QMouseEvent* event ) +void RiuViewer::mousePressEvent( QMouseEvent* mouseEvent ) { - m_lastMousePressPosition = event->pos(); + if ( mouseEvent ) + { + m_lastMousePressPosition = mouseEvent->pos(); + + if ( mouseEvent->button() == Qt::LeftButton ) + { + if ( auto ownView = ownerViewWindow() ) ownView->setAsActiveViewer(); + } + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuViewer.h b/ApplicationLibCode/UserInterface/RiuViewer.h index 0f886e9388d..6090803ae2d 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.h +++ b/ApplicationLibCode/UserInterface/RiuViewer.h @@ -149,6 +149,7 @@ public slots: void mouseMoveEvent( QMouseEvent* e ) override; void enterEvent( QEnterEvent* e ) override; void leaveEvent( QEvent* ) override; + void mousePressEvent( QMouseEvent* e ) override; private: void updateLegendLayout(); @@ -163,7 +164,6 @@ public slots: void paintOverlayItems( QPainter* painter ) override; void mouseReleaseEvent( QMouseEvent* event ) override; - void mousePressEvent( QMouseEvent* event ) override; void mouseDoubleClickEvent( QMouseEvent* event ) override; private: From dba1de8e61fce9113959d34939910d97af691b22 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 19 May 2026 18:08:18 +0200 Subject: [PATCH 12/47] Active view tracking for 3d window --- .../Application/RiaGuiApplication.cpp | 10 ++---- .../RimDockWindowController.cpp | 36 ++++++++++++++++--- .../RimDockWindowController.h | 2 +- .../ProjectDataModel/RimViewWindow.cpp | 22 ++++++++++-- .../ProjectDataModel/RimViewWindow.h | 2 +- .../UserInterface/RiuDockWidgetTools.cpp | 8 +++++ .../UserInterface/RiuDockWidgetTools.h | 2 ++ .../UserInterface/RiuMainWindow.cpp | 21 +++++++++-- .../UserInterface/RiuMainWindow.h | 4 ++- .../UserInterface/RiuMainWindowBase.cpp | 19 ++++++++-- .../UserInterface/RiuMainWindowBase.h | 6 +++- .../UserInterface/RiuPlotMainWindow.cpp | 34 ++++++++++++++++-- .../UserInterface/RiuPlotMainWindow.h | 6 ++-- .../UserInterface/RiuViewer.cpp | 5 +-- 14 files changed, 145 insertions(+), 32 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 44b0cd88bdf..6395397d137 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -1144,15 +1144,9 @@ RimViewWindow* RiaGuiApplication::activeViewWindow() { viewWindow = RiaGuiApplication::instance()->activeReservoirView(); } - else if ( dynamic_cast( mainWindowWidget ) ) + else if ( auto mainPlotWindow = dynamic_cast( mainWindowWidget ) ) { - RiuPlotMainWindow* mainPlotWindow = dynamic_cast( mainWindowWidget ); - - // QList subwindows = mainPlotWindow->subWindowList( QMdiArea::StackingOrder ); - // if ( !subwindows.empty() ) - //{ - // viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() ); - // } + viewWindow = mainPlotWindow->activePlotView(); } return viewWindow; diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index ae85b84233b..ba2d40cf2bd 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -19,9 +19,11 @@ #include "RimDockWindowController.h" #include "RiaGuiApplication.h" +#include "Rim3dView.h" #include "RimProject.h" #include "RimViewWindow.h" +#include "RiuDockWidgetTools.h" #include "RiuMainWindowBase.h" #include "RiuViewer.h" @@ -72,7 +74,7 @@ void RimDockWindowController::removeWindowFromDock() viewPdmObject()->deleteDockWidget(); viewPdmObject()->deleteViewWidget(); - mainWin->removeViewer( viewWidget() ); + mainWin->onViewerRemoved(); } } @@ -129,6 +131,7 @@ void RimDockWindowController::updateViewerWidget() QWidget* viewWidget = viewPdmObject()->createViewWidget( dockWidget ); dockWidget->setWidget( viewWidget ); dockWidget->setObjectName( viewPdmObject()->dockWindowName() ); + viewWidget->setObjectName( viewPdmObject()->dockWindowName() ); mainWindow->initializeViewer( dockWidget, viewWidget ); mainWindow->connect( dockWidget, SIGNAL( closed() ), mainWindow, SLOT( slotDockViewerClosed() ) ); @@ -144,9 +147,8 @@ void RimDockWindowController::updateViewerWidget() if ( viewWidget() ) { viewPdmObject()->deleteDockWidget(); - mainWindow->removeViewer( viewWidget() ); - viewPdmObject()->deleteViewWidget(); + mainWindow->onViewerRemoved(); } } } @@ -178,11 +180,35 @@ int RimDockWindowController::mainWindowId() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDockWindowController::setActiveViewer() +void RimDockWindowController::setAsActiveViewer() { + if ( getMainWindow() == nullptr ) return; + if ( auto pdmView = viewPdmObject() ) { if ( pdmView->isActive() ) return; + + for ( auto viewWin : getMainWindow()->viewWindows() ) + { + if ( viewWin->isActive() ) + { + viewWin->setActive( false ); + viewWin->updateWindowTitle(); + } + } + pdmView->setActive( true ); + pdmView->updateWindowTitle(); + + if ( auto resView = dynamic_cast( pdmView ) ) + { + RiaApplication::instance()->setActiveReservoirView( resView ); + if ( auto mainWin = dynamic_cast( getMainWindow() ) ) + { + mainWin->refreshViewActions(); + mainWin->refreshAnimationActions(); + mainWin->refreshDrawStyleActions(); + } + } } -} \ No newline at end of file +} diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h index cb6d5787e60..a4733c70352 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h @@ -42,7 +42,7 @@ class RimDockWindowController : public caf::PdmObject void setViewToControl( RimViewWindow* view ); int mainWindowId() const; - void setActiveViewer(); + void setAsActiveViewer(); void updateViewerWidget(); void handleViewerDeletion(); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index f6d7e99e31c..12e7e7c0ecf 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -29,6 +29,8 @@ #include "RimDockWindowController.h" #include "RimProject.h" +#include "RiuDockWidgetTools.h" + #include "cafPdmUiTreeAttributes.h" #include "cafPdmUiTreeViewEditor.h" @@ -275,8 +277,22 @@ void RimViewWindow::updateWindowTitle() if ( viewWidget() && dockWidget() ) { viewWidget()->setWindowTitle( windowTitle() ); - dockWidget()->setWindowTitle( windowTitle() ); - dockWidget()->setIcon( QIcon( ":/ActiveWindow.svg" ) ); + if ( dockWidget()->isFloating() && isActive() ) + { + dockWidget()->setWindowTitle( "* " + windowTitle() ); + } + else + { + dockWidget()->setWindowTitle( windowTitle() ); + } + if ( isActive() ) + { + dockWidget()->setIcon( QIcon( ":/ActiveWindow.svg" ) ); + } + else + { + dockWidget()->setIcon( QIcon() ); + } } } @@ -285,7 +301,7 @@ void RimViewWindow::updateWindowTitle() //-------------------------------------------------------------------------------------------------- QString RimViewWindow::dockWindowName() const { - return QString( "DockViewWindow_%1" ).arg( m_dockWindowId ); + return QString( "%1_%2" ).arg( RiuDockWidgetTools::viewWindowPrefix() ).arg( m_dockWindowId ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index a94b0abc65d..c09ae225c42 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -46,6 +46,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface void setShowWindow( bool showWindow ); void setAsActiveViewer(); + bool isActive() const; bool isMainDockedWindow() const; @@ -87,7 +88,6 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface virtual bool isWindowVisible() const; // Virtual To allow special visibility control void deleteDockWidget(); void setActive( bool active ); - bool isActive() const; //// // Derived classes are not supposed to override this function. The intention is to always use m_showWindow diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index 7fba43710ae..1628e873b2b 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -320,6 +320,14 @@ QString RiuDockWidgetTools::dockStateHideAll3DWindowName() return "Hide All"; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::viewWindowPrefix() +{ + return "DockViewWindow_"; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index eb13e12d9f8..ad5f95f9ca3 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -91,6 +91,8 @@ class RiuDockWidgetTools static QString dockStateHideAllPlotWindowName(); static QString dockStateHideAll3DWindowName(); + static QString viewWindowPrefix(); + static QAction* toggleActionForWidget( const ads::CDockManager* dockManager, const QString& dockWidgetName ); static ads::CDockWidget* findDockWidget( const ads::CDockManager* dockManager, const QString& dockWidgetName ); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index d0125f88f2e..471ff5eb160 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -1189,9 +1189,11 @@ RiuMessagePanel* RiuMainWindow::messagePanel() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMainWindow::removeViewer( QWidget* viewer ) +void RiuMainWindow::onViewerRemoved() { slotRefreshViewActions(); + refreshAnimationActions(); + refreshDrawStyleActions(); } //-------------------------------------------------------------------------------------------------- @@ -1204,6 +1206,21 @@ void RiuMainWindow::initializeViewer( ads::CDockWidget* dockWidget, QWidget* vie slotRefreshViewActions(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RiuMainWindow::viewWindows() +{ + std::vector views; + + for ( auto v : RimProject::current()->allViews() ) + { + views.push_back( v ); + } + + return views; +} + //-------------------------------------------------------------------------------------------------- /// This method needs to handle memory deallocation !!! //-------------------------------------------------------------------------------------------------- @@ -1480,7 +1497,7 @@ void RiuMainWindow::selectedObjectsChanged() slotRefreshViewActions(); // The only way to get to this code is by selection change initiated from the project tree view - // As we are activating an MDI-window, the focus is given to this MDI-window + // As we are activating an view window, the focus might be given to this window // Set focus back to the tree view to be able to continue keyboard tree view navigation projectTree->treeView()->setFocus(); } diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index 2879c3c8ee1..3cc346d1e24 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -92,9 +92,11 @@ class RiuMainWindow : public RiuMainWindowBase void cleanupGuiCaseClose(); void cleanupGuiBeforeProjectClose(); - void removeViewer( QWidget* viewer ) override; + void onViewerRemoved() override; void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) override; + std::vector viewWindows() override; + void setResultInfo( const QString& info ) const; void refreshViewActions(); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 41416527f23..69d796cdf1f 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -120,9 +120,14 @@ ads::CDockManager* RiuMainWindowBase::dockManager() const //-------------------------------------------------------------------------------------------------- void RiuMainWindowBase::setActiveViewer( QString viewerName ) { - if ( auto dockWidget = dockManager()->findDockWidget( viewerName ) ) + for ( auto view : viewWindows() ) { - dockWidget->setAsCurrentTab(); + if ( view->dockWidget() && view->dockWidget()->objectName() == viewerName ) + { + view->setAsActiveViewer(); + view->dockWidget()->setAsCurrentTab(); + break; + } } } @@ -363,8 +368,18 @@ void RiuMainWindowBase::slotDockWidgetToggleViewActionTriggered() //-------------------------------------------------------------------------------------------------- void RiuMainWindowBase::slotDockViewerVisibilityChanged( bool visible ) { + if ( !visible ) return; + if ( auto dockWidget = dynamic_cast( sender() ) ) { + for ( auto view : viewWindows() ) + { + if ( view->dockWidget() == dockWidget ) + { + view->setAsActiveViewer(); + break; + } + } } } diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index f64e4ccc222..9a7777ba700 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -48,6 +48,8 @@ class PdmUiPropertyView; class QAction; class QUndoView; +class RimViewWindow; + //================================================================================================== /// //================================================================================================== @@ -61,9 +63,11 @@ class RiuMainWindowBase : public QMainWindow virtual QString mainWindowName() = 0; - virtual void removeViewer( QWidget* viewer ) = 0; virtual void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) {}; virtual void setActiveViewer( QString viewerName ); + virtual void onViewerRemoved() = 0; + + virtual std::vector viewWindows() = 0; void loadWinGeoAndDockToolBarLayout(); void saveWinGeoAndDockToolBarLayout(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 3dd68ad3ade..35806b37767 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -740,9 +740,8 @@ void RiuPlotMainWindow::showAndSetKeyboardFocusToSummaryPlotManager() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuPlotMainWindow::removeViewer( QWidget* viewer ) +void RiuPlotMainWindow::onViewerRemoved() { - // removeViewerFromMdiArea( m_mdiArea, viewer ); refreshToolbars(); } @@ -755,6 +754,37 @@ void RiuPlotMainWindow::initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer->update(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +std::vector RiuPlotMainWindow::viewWindows() +{ + std::vector views; + + for ( auto v : RimProject::current()->descendantsOfType() ) + { + views.push_back( v ); + } + + return views; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimViewWindow* RiuPlotMainWindow::activePlotView() +{ + for ( auto view : viewWindows() ) + { + if ( view->isActive() ) + { + return view; + } + } + + return nullptr; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index aca4568c99f..df3c7c7f2e0 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -68,8 +68,10 @@ class RiuPlotMainWindow : public RiuMainWindowBase void cleanupGuiBeforeProjectClose(); void cleanUpTemporaryWidgets(); - void removeViewer( QWidget* viewer ) override; - void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) override; + void onViewerRemoved() override; + void initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) override; + std::vector viewWindows() override; + RimViewWindow* activePlotView(); void setDefaultWindowSize(); void enable3DSelectionLink( bool enable ); diff --git a/ApplicationLibCode/UserInterface/RiuViewer.cpp b/ApplicationLibCode/UserInterface/RiuViewer.cpp index 15149d3702f..0f4ea7b9ff5 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewer.cpp @@ -724,10 +724,7 @@ void RiuViewer::mousePressEvent( QMouseEvent* mouseEvent ) { m_lastMousePressPosition = mouseEvent->pos(); - if ( mouseEvent->button() == Qt::LeftButton ) - { - if ( auto ownView = ownerViewWindow() ) ownView->setAsActiveViewer(); - } + if ( auto ownView = ownerViewWindow() ) ownView->setAsActiveViewer(); } } From d452e0777d59b9df54ff79e0939a98a16b7f1825 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 19 May 2026 18:29:29 +0200 Subject: [PATCH 13/47] Minor fix --- ApplicationLibCode/UserInterface/RiuMainWindowBase.h | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 9a7777ba700..008134e9896 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -20,6 +20,7 @@ #include #include +#include #include #include From 2189e499ee157410c31977330a61262060328f3d Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Wed, 20 May 2026 13:43:29 +0200 Subject: [PATCH 14/47] Work in progress --- .../UserInterface/RiuPlotMainWindow.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 35806b37767..aaa915fe4a8 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -55,6 +55,7 @@ #include "RiuDragDrop.h" #include "RiuMenuBarBuildTools.h" #include "RiuMessagePanel.h" +#include "RiuMultiPlotBook.h" #include "RiuMultiPlotPage.h" #include "RiuToolTipMenu.h" #include "RiuTools.h" @@ -751,7 +752,17 @@ void RiuPlotMainWindow::onViewerRemoved() void RiuPlotMainWindow::initializeViewer( ads::CDockWidget* dockWidget, QWidget* viewer ) { dockManager()->addDockWidget( ads::DockWidgetArea::CenterDockWidgetArea, dockWidget, dockManager()->centralWidget()->dockAreaWidget() ); - viewer->update(); + + if ( auto book = dynamic_cast( viewer ) ) + { + book->scheduleReplotOfAllPlots(); + } + else + { + viewer->update(); + } + + refreshToolbars(); } //-------------------------------------------------------------------------------------------------- From a17511a22f637ca0bf84313d97eb3d980f3c922f Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Wed, 20 May 2026 14:24:37 +0200 Subject: [PATCH 15/47] Minor updates --- ApplicationLibCode/UserInterface/RiuMainWindow.cpp | 2 +- .../UserInterface/RiuPlotMainWindow.cpp | 14 ++------------ 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 471ff5eb160..4ed54e0c76b 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -1476,7 +1476,7 @@ void RiuMainWindow::selectedObjectsChanged() if ( selectedReservoirView ) { - // Set focus in MDI area to this window if it exists + // Set focus in dock area to this window if it exists if ( selectedReservoirView->viewer() && selectedReservoirView->viewer()->ownerViewWindow() ) { setBlockViewSelectionOnSubWindowActivated( true ); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index aaa915fe4a8..badb7d4c5fb 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -896,7 +896,7 @@ void RiuPlotMainWindow::selectedObjectsChanged( caf::PdmUiTreeView* projectTree, if ( uiItems.size() == 1 && m_allowActiveViewChangeFromSelection ) { - // Find the reservoir view or the Plot that the selected item is within + // Find the plot view that the selected item is within if ( !firstSelectedObject ) { caf::PdmFieldHandle* selectedField = dynamic_cast( uiItems.front() ); @@ -911,16 +911,6 @@ void RiuPlotMainWindow::selectedObjectsChanged( caf::PdmUiTreeView* projectTree, selectedWindow = firstSelectedObject->firstAncestorOrThisOfType(); } - // If we can't find the view window as an MDI sub window, we search higher in the - // project tree to find a possible parent view window that has. - // if ( selectedWindow && !findMdiSubWindow( selectedWindow->viewWidget() ) ) - //{ - // if ( selectedWindow->parentField() && selectedWindow->parentField()->ownerObject() ) - // { - // selectedWindow = selectedWindow->parentField()->ownerObject()->firstAncestorOrThisOfType(); - // } - //} - if ( selectedWindow ) { if ( selectedWindow->viewWidget() ) @@ -948,7 +938,7 @@ void RiuPlotMainWindow::selectedObjectsChanged( caf::PdmUiTreeView* projectTree, } // The only way to get to this code is by selection change initiated from the project tree view - // As we are activating an MDI-window, the focus is given to this MDI-window + // As we are activating an view window, the focus might be given to this window // Set focus back to the tree view to be able to continue keyboard tree view navigation projectTree->treeView()->setFocus(); } From c89685df56c1a47573e195e52240e93203cef54e Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Thu, 21 May 2026 23:04:36 +0200 Subject: [PATCH 16/47] Add default layouts for 3d window --- .../UserInterface/RiuDockWidgetTools.cpp | 176 +++++++++--------- 1 file changed, 92 insertions(+), 84 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index 1628e873b2b..4a2746f1052 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -521,35 +521,37 @@ QByteArray RiuDockWidgetTools::defaultEclipseDockState() // start paste static const char stateData[] = - { '\x00', '\x00', '\x06', '\xfe', '\x78', '\xda', '\x95', '\x55', '\xc1', '\x4e', '\xe3', '\x30', '\x10', '\xbd', '\xf3', '\x15', - '\x56', '\xee', '\xd0', '\x3a', '\x49', '\x4b', '\x90', '\xda', '\xa2', '\xaa', '\x05', '\xb1', '\x87', '\xee', '\xb6', '\xa4', - '\x2c', '\x47', '\xe4', '\x75', '\x66', '\x8b', '\xc1', '\xb1', '\xab', '\xb1', '\xd3', '\x05', '\xc4', '\xc7', '\xe3', '\xb4', - '\xa8', '\xab', '\x82', '\x93', '\x34', '\xa7', '\xd8', '\xe3', '\xf7', '\x3c', '\xf3', '\x9e', '\x27', '\xf6', '\xe0', '\xf2', - '\x25', '\x97', '\x64', '\x03', '\x68', '\x84', '\x56', '\xc3', '\x80', '\x9e', '\x75', '\x03', '\x02', '\x8a', '\xeb', '\x4c', - '\xa8', '\xd5', '\x30', '\xb8', '\x5b', '\x5e', '\x9f', '\x26', '\xc1', '\xe5', '\x68', '\xb0', '\xb0', '\xe3', '\x6c', '\xc3', - '\x14', '\x87', '\x6c', '\xaa', '\xf9', '\xb3', '\x5b', '\x4b', '\x5f', '\x8d', '\x85', '\x9c', '\xfc', '\xde', '\x13', '\x03', - '\x72', '\x67', '\x00', '\xf7', '\xf3', '\x28', '\x20', '\x13', '\xad', '\x2c', '\x13', '\xca', '\x45', '\xb6', '\xcb', '\x13', - '\x50', '\x16', '\x99', '\xbc', '\x17', '\xd9', '\x0a', '\xec', '\x30', '\xc8', '\xdc', '\x3e', '\xd1', '\xf4', '\x5e', '\xa8', - '\x4c', '\xff', '\x7b', '\xc8', '\x1d', '\x6e', '\x37', '\x0c', '\x46', '\x83', '\x3d', '\x8f', '\x5c', '\x4b', '\xcd', '\xec', - '\xb6', '\x90', '\xae', '\x8b', '\xa7', '\x6b', '\x29', '\xac', '\x75', '\xe1', '\x5f', '\x28', '\xdc', '\x5e', '\x6e', '\xa5', - '\x4c', '\xf4', '\x5e', '\x26', '\x2a', '\x94', '\xdb', '\x31', '\xac', '\xc4', '\x9c', '\x1e', '\x60', '\xc6', '\x08', '\x8c', - '\x2c', '\xd9', '\x1f', '\xb3', '\xab', '\xb2', '\x40', '\x04', '\xf5', '\x59', '\xd0', '\x1c', '\xf5', '\x13', '\x70', '\xbb', - '\x44', '\x80', '\xc3', '\x9a', '\x76', '\x55', '\x93', '\x9f', '\x2c', '\x87', '\x5a', '\x24', '\x99', '\x48', '\x6d', '\x20', - '\x2b', '\x0b', '\xee', '\x78', '\x58', '\x53', '\x66', '\x59', '\xaa', '\x0b', '\xe4', '\xd0', '\x92', '\x98', '\x72', '\x14', - '\x6b', '\x6b', '\xea', '\x59', '\x9d', '\x52', '\xd9', '\x81', '\x3e', '\xfa', '\x5d', '\xdf', '\x1a', '\xd0', '\xbe', '\x5e', - '\x65', '\xc2', '\x6a', '\x6c', '\x96', '\x58', '\x01', '\xf6', '\xa6', '\x4d', '\xc5', '\x1b', '\x98', '\xd1', '\x79', '\xbf', - '\x4b', '\x7a', '\xf4', '\x82', '\x0c', '\x3a', '\xbb', '\xb9', '\xfb', '\x7e', '\x1e', '\xc9', '\x71', '\x87', '\x73', '\xcc', - '\x21', '\xd7', '\x08', '\xf4', '\x75', '\x94', '\x6b', '\x23', '\xb6', '\xda', '\x62', '\x3d', '\x22', '\xbd', '\x84', '\x96', - '\xae', '\x2e', '\x0a', '\xc1', '\x9f', '\xc7', '\x9c', '\x83', '\x31', '\x0d', '\x96', '\x56', '\x20', '\x6b', '\xfc', '\xa4', - '\xfd', '\xe4', '\x9c', '\xc4', '\x51', '\xb7', '\x85', '\xa1', '\xff', '\xcd', '\x8a', '\xea', '\xcd', '\xba', '\x05', '\x53', - '\x48', '\xfb', '\x43', '\xfd', '\xd5', '\x0d', '\x65', '\xfb', '\x81', '\x4d', '\x36', '\xf5', '\xbd', '\xe9', '\xe6', '\x52', - '\xdb', '\xa3', '\xd2', '\x7d', '\x05', '\x36', '\xfd', '\x5a', '\xb0', '\xb6', '\x8f', '\x2d', '\x39', '\x33', '\xfd', '\x88', - '\x66', '\x22', '\x90', '\x4b', '\xa8', '\x64', '\x52', '\x2f', '\xf3', '\x16', '\xe4', '\x1c', '\x30', '\x6f', '\x99', '\x6f', - '\xbe', '\x69', '\xab', '\x2a', '\x05', '\x61', '\x6e', '\x84', '\xb1', '\x6d', '\x7c', '\x0f', '\xbf', '\xf8', '\x3e', '\x73', - '\xdd', '\xc6', '\x56', '\xd0', '\xd4', '\x9b', '\x3e', '\x58', '\x93', '\x1e', '\xd4', '\x65', '\x2b', '\xcf', '\xb4', '\x6a', - '\x71', '\x43', '\xc4', '\x09', '\x25', '\x94', '\xc6', '\x11', '\x89', '\x93', '\xc4', '\xdf', '\xd5', '\xdb', '\x48', '\xd2', - '\x8b', '\x49', '\x1c', '\xf6', '\x6a', '\x10', '\x71', '\x14', '\x91', '\x90', '\x86', '\xa1', '\x17', '\xd2', '\xd9', '\xbf', - '\x22', '\x6e', '\x5c', '\xf1', '\x7a', '\x8d', '\x4e', '\x3e', '\x00', '\xdb', '\xd5', '\x66', '\x08' }; + { '\x00', '\x00', '\x07', '\x27', '\x78', '\xda', '\x95', '\x55', '\xc1', '\x72', '\xda', '\x30', '\x10', '\xbd', '\xf7', '\x2b', + '\x34', '\xbe', '\xa7', '\x60', '\x3b', '\xc5', '\xce', '\x0c', '\x90', '\x61', '\x9c', '\x66', '\xda', '\x03', '\x2d', '\x89', + '\x49', '\x38', '\x76', '\x54', '\x79', '\x4b', '\xd4', '\xc8', '\x5a', '\x46', '\x92', '\x69', '\xd3', '\xe9', '\xc7', '\x77', + '\x0d', '\x19', '\x3a', '\x10', '\xd9', '\xc6', '\x27', '\x5b', '\xd2', '\x7b', '\xd2', '\xdb', '\xa7', '\xdd', '\xd5', '\xf8', + '\xfa', '\x77', '\xa9', '\xd8', '\x16', '\x8c', '\x95', '\xa8', '\x27', '\x41', '\xf8', '\x7e', '\x18', '\x30', '\xd0', '\x02', + '\x0b', '\xa9', '\xd7', '\x93', '\xe0', '\x61', '\x79', '\x7b', '\x91', '\x06', '\xd7', '\xd3', '\xf1', '\x9d', '\x9b', '\x15', + '\x5b', '\xae', '\x05', '\x14', '\x37', '\x28', '\x9e', '\x69', '\x2d', '\x7f', '\xb1', '\x0e', '\x4a', '\xf6', '\x78', '\x20', + '\x06', '\xec', '\xc1', '\x82', '\x39', '\x8c', '\x2f', '\x03', '\x96', '\xa1', '\x76', '\x5c', '\x6a', '\x9a', '\xd9', '\x2d', + '\x67', '\xa0', '\x9d', '\xe1', '\x6a', '\x25', '\x8b', '\x35', '\xb8', '\x49', '\x50', '\xd0', '\x3e', '\x2b', '\x50', '\x02', + '\x4b', '\xc8', '\x85', '\x01', '\xd0', '\xc1', '\x74', '\x7c', '\x60', '\xb0', '\x5b', '\x85', '\xdc', '\xed', '\x24', '\x0c', + '\x69', '\x3e', '\xdf', '\x28', '\xe9', '\x1c', '\x4d', '\x7f', '\x35', '\x92', '\x76', '\xa1', '\x95', '\xfa', '\x88', '\xbf', + '\xf5', '\x11', '\x95', '\xa6', '\xbd', '\xa2', '\x46', '\xcc', '\xc5', '\x11', '\x66', '\x66', '\x80', '\xb3', '\x25', '\xff', + '\x4e', '\x82', '\x62', '\x5a', '\xa8', '\x8c', '\x01', '\xfd', '\x2a', '\x65', '\x61', '\xf0', '\x27', '\x08', '\xb7', '\x24', + '\x25', '\xdf', '\x4a', '\xd2', '\xb0', '\x92', '\xba', '\xc0', '\x5f', '\xc4', '\xd9', '\xeb', '\x65', '\x5f', '\x78', '\x09', + '\xad', '\x48', '\x96', '\x29', '\xb4', '\x50', '\xd4', '\x82', '\x07', '\x1e', '\xd6', '\x0d', '\x77', '\x3c', '\xc7', '\xca', + '\x08', '\xe8', '\x49', '\x24', '\x73', '\xe4', '\xc6', '\xd9', '\x76', '\xd6', '\xa0', '\x8e', '\xec', '\x28', '\xbe', '\xf0', + '\x6d', '\x7c', '\x1b', '\x30', '\xee', '\xe5', '\x63', '\x21', '\x1d', '\x9a', '\xee', '\x10', '\x1b', '\xc0', '\xde', '\x63', + '\x73', '\xf9', '\x07', '\xec', '\x74', '\x34', '\x4c', '\x59', '\x9c', '\x44', '\x6c', '\x3c', '\xd8', '\x8f', '\xe9', '\xfb', + '\x7a', '\x25', '\xe7', '\x5d', '\xce', '\x39', '\x97', '\xdc', '\x12', '\xe0', '\x71', '\x2e', '\x51', '\x02', '\xf1', '\xf5', + '\x0e', '\xe5', '\x09', '\xef', '\x04', '\xda', '\xd3', '\xc9', '\xbb', '\x4a', '\x8a', '\xe7', '\x99', '\x10', '\x60', '\x6d', + '\x87', '\x8d', '\x0d', '\xc8', '\x16', '\x0f', '\xc3', '\x28', '\x49', '\x58', '\x9c', '\x5e', '\xf5', '\x30', '\xf1', '\xbf', + '\x41', '\xf1', '\xb1', '\x41', '\xd1', '\x89', '\xee', '\x7b', '\xb0', '\x95', '\x72', '\x9f', '\xf5', '\x0f', '\xec', '\x90', + '\xed', '\x07', '\x76', '\xa4', '\x69', '\x06', '\x4a', '\xe5', '\xa0', '\xa8', '\x30', '\x48', '\xd5', '\x12', '\x51', '\x79', + '\xb9', '\xa1', '\xdf', '\xe2', '\x91', '\x57', '\xea', '\x42', '\xa1', '\x3b', '\x4b', '\xea', '\x29', '\xb0', '\xab', '\x14', + '\x61', '\xe3', '\x9e', '\x7a', '\x72', '\xee', '\x41', '\x2d', '\xc0', '\x94', '\x3d', '\x59', '\x8b', '\x6d', '\x5f', '\x6d', + '\x39', '\x48', '\xfb', '\x49', '\xda', '\x3e', '\x94', '\x39', '\x3e', '\x19', '\x9b', '\x49', '\x23', '\x14', '\x34', '\x1e', + '\xd6', '\xe0', '\xfb', '\x69', '\x8a', '\xcc', '\x29', '\x53', '\xf9', '\x1a', '\xba', '\xf2', '\xda', '\x07', '\xeb', '\x72', + '\xc2', '\x60', '\x5d', '\x06', '\x73', '\xd4', '\x3d', '\x3a', '\x4a', '\x1c', '\xa5', '\xec', '\xea', '\xf2', '\x03', '\x15', + '\x44', '\xea', '\x2f', '\x88', '\x7d', '\xdf', '\x49', '\xa8', '\xef', '\x0c', '\xa3', '\x16', '\x44', '\xdd', '\x95', '\xc2', + '\x51', '\x12', '\x7a', '\x21', '\x83', '\xc3', '\xa3', '\x43', '\xff', '\x0d', '\xcf', '\xdc', '\xf4', '\xdd', '\x3f', '\x7f', + '\xa4', '\x74', '\x6f' }; // end paste @@ -566,34 +568,37 @@ QByteArray RiuDockWidgetTools::defaultGeoMechDockState() // start paste static const char stateData[] = - { '\x00', '\x00', '\x06', '\x81', '\x78', '\xda', '\x95', '\x55', '\xc1', '\x52', '\xc2', '\x30', '\x10', '\xbd', '\xfb', '\x15', - '\x99', '\xde', '\x95', '\x96', '\x16', '\xe1', '\x50', '\x70', '\x1c', '\xd0', '\xd1', '\x03', '\x5a', '\x29', '\xca', '\xd1', - '\x89', '\xed', '\x8a', '\xd1', '\x34', '\x61', '\x92', '\x2d', '\x8a', '\xe3', '\xc7', '\x9b', '\x52', '\xa7', '\x33', '\x60', - '\x68', '\xe9', '\xa9', '\xc9', '\xe6', '\xbd', '\xbc', '\xb7', '\x9b', '\x4d', '\x1a', '\x5e', '\x7c', '\x65', '\x9c', '\xac', - '\x41', '\x69', '\x26', '\xc5', '\xd0', '\xf1', '\xce', '\x5c', '\x87', '\x80', '\x48', '\x64', '\xca', '\xc4', '\x72', '\xe8', - '\x3c', '\xce', '\xaf', '\x4f', '\x07', '\xce', '\xc5', '\x28', '\x7c', '\xc0', '\xcb', '\x74', '\x4d', '\x45', '\x02', '\xe9', - '\x44', '\x26', '\x1f', '\x66', '\x2d', '\xde', '\x68', '\x84', '\x8c', '\x3c', '\x55', '\x44', '\x87', '\x3c', '\x6a', '\x50', - '\xd5', '\xdc', '\x77', '\xc8', '\x58', '\x0a', '\xa4', '\x4c', '\x98', '\xc8', '\x76', '\x79', '\x0c', '\x02', '\x15', '\xe5', - '\x0b', '\x96', '\x2e', '\x01', '\x87', '\x4e', '\x6a', '\xf6', '\xf1', '\x27', '\x0b', '\x26', '\x52', '\xf9', '\xf9', '\x9c', - '\x19', '\x5c', '\x39', '\x74', '\x46', '\x61', '\xc5', '\x23', '\xd7', '\x5c', '\x52', '\xdc', '\x1a', '\x71', '\x4d', '\x3c', - '\x5e', '\x71', '\x86', '\x68', '\xc2', '\xf7', '\x8a', '\x99', '\xbd', '\xcc', '\x4a', '\x21', '\xf4', '\x53', '\x08', '\xe5', - '\x02', '\x0b', '\xc9', '\x43', '\x98', '\xd3', '\x0a', '\xd3', '\x35', '\x98', '\x4b', '\x05', '\x94', '\xcc', '\xe9', '\x8b', - '\x2e', '\x5d', '\xe6', '\x4a', '\x81', '\xf8', '\x33', '\x14', '\x29', '\xf9', '\x0e', '\x09', '\xce', '\x15', '\xc0', '\xae', - '\xa7', '\xd2', '\x35', '\xb9', '\xa3', '\x19', '\xd4', '\x22', '\xc9', '\x98', '\x4b', '\x0d', '\x69', '\x61', '\xb8', '\x63', - '\x61', '\x4d', '\x28', '\xd2', '\x58', '\xe6', '\x2a', '\x81', '\x96', '\xc4', '\x38', '\x51', '\x6c', '\x85', '\xba', '\x9e', - '\xd5', '\x29', '\x32', '\xdb', '\xc9', '\xcf', '\xfb', '\x9f', '\xdf', '\x0a', '\x14', '\x6e', '\xae', '\x52', '\x86', '\x52', - '\x35', '\xa7', '\x78', '\x00', '\x6c', '\x95', '\x8d', '\xd9', '\x37', '\xe8', '\x51', '\x3f', '\xf0', '\x49', '\xcf', '\xed', - '\x93', '\xb0', '\x53', '\xce', '\xcd', '\xf7', '\xef', '\x48', '\x5a', '\x1f', '\xce', '\xbe', '\x79', '\x5b', '\xb7', '\x98', - '\x16', '\xa1', '\xcb', '\x2d', '\xd6', '\x92', '\x80', '\x95', '\x60', '\xb5', '\x7e', '\x44', '\x67', '\xd5', '\x18', '\x9b', - '\x81', '\xce', '\x39', '\xde', '\x8a', '\x57', '\xd9', '\x50', '\x51', '\x3b', '\xb0', '\xe9', '\x10', '\x7b', '\x56', '\xb9', - '\x88', '\x4b', '\x3c', '\x4a', '\x6e', '\x1f', '\xd8', '\xd0', '\x69', '\x53', '\xf9', '\xa6', '\xf4', '\x98', '\xa9', '\x84', - '\x43', '\x4b', '\x66', '\x0c', '\x4c', '\xdf', '\x30', '\xdd', '\x86', '\x32', '\x03', '\x1e', '\x81', '\xca', '\x0e', '\x0a', - '\x79', '\x56', '\x56', '\xb4', '\xc6', '\x7a', '\xc6', '\xff', '\x1a', '\x76', '\xf7', '\x6a', '\x38', '\x05', '\xad', '\xe9', - '\x12', '\x74', '\x43', '\x05', '\x6d', '\xb0', '\x86', '\x94', '\xcc', '\xad', '\x49', '\x0c', '\x6b', '\x2a', '\x45', '\x8b', - '\x5b', '\xd3', '\xeb', '\x7a', '\xc4', '\xf3', '\x7a', '\x2e', '\x09', '\xfc', '\x81', '\xfd', '\xea', '\x6c', '\x23', '\x83', - '\x20', '\x20', '\x81', '\x7b', '\x6e', '\x45', '\xd4', '\xf4', '\xe7', '\x04', '\x56', '\xf8', '\x76', '\x44', '\xbf', '\x58', - '\x71', '\xd6', '\xca', '\x96', '\xf2', '\x81', '\xef', '\x93', '\xae', '\x67', '\xac', '\xbb', '\x56', '\x47', '\x9d', '\xea', - '\x21', '\x37', '\xe3', '\x03', '\x3f', '\x90', '\xd1', '\xc9', '\x2f', '\xd6', '\xef', '\x3b', '\x86' }; + { '\x00', '\x00', '\x07', '\x25', '\x78', '\xda', '\x95', '\x55', '\x4d', '\x6f', '\xdb', '\x30', '\x0c', '\xbd', '\xef', '\x57', + '\x08', '\xbe', '\x77', '\xf1', '\x47', '\x97', '\x78', '\x40', '\x92', '\x22', '\x70', '\x57', '\x6c', '\x87', '\x6c', '\x69', + '\x9d', '\x2e', '\xc7', '\x41', '\x93', '\xb9', '\x54', '\xab', '\x2c', '\x05', '\x12', '\x9d', '\xad', '\xc5', '\x7e', '\xfc', + '\xe8', '\xa4', '\xf0', '\x96', '\x54', '\x8e', '\xe3', '\x93', '\x2d', '\xf1', '\x3d', '\xf1', '\x91', '\x22', '\xa9', '\xf1', + '\xd5', '\xef', '\x52', '\xb1', '\x2d', '\x58', '\x27', '\x8d', '\x9e', '\x04', '\xd1', '\xdb', '\x30', '\x60', '\xa0', '\x85', + '\x29', '\xa4', '\x5e', '\x4f', '\x82', '\xfb', '\xe5', '\xcd', '\x45', '\x1a', '\x5c', '\x4d', '\xc7', '\xb7', '\x38', '\x2b', + '\xb6', '\x5c', '\x0b', '\x28', '\xae', '\x8d', '\x78', '\x24', '\x5b', '\xfe', '\xe4', '\x10', '\x4a', '\xf6', '\xb5', '\x21', + '\x06', '\xec', '\xde', '\x81', '\x6d', '\xd6', '\x97', '\x01', '\xcb', '\x8c', '\x46', '\x2e', '\x35', '\xed', '\xec', '\xcc', + '\x19', '\x68', '\xb4', '\x5c', '\xad', '\x64', '\xb1', '\x06', '\x9c', '\x04', '\x05', '\x9d', '\xb3', '\x02', '\x25', '\x4c', + '\x09', '\xb9', '\xb0', '\x00', '\x3a', '\x98', '\x8e', '\x1b', '\x06', '\xbb', '\x51', '\x86', '\xe3', '\x4e', '\x42', '\x48', + '\xfb', '\xf9', '\x46', '\x49', '\x44', '\xda', '\xfe', '\x62', '\x25', '\x9d', '\x42', '\x96', '\xda', '\xc5', '\x9f', '\xda', + '\x45', '\xa5', '\xe9', '\xac', '\xb8', '\x15', '\x73', '\x71', '\x80', '\x99', '\x59', '\xe0', '\x6c', '\xc9', '\xbf', '\x93', + '\xa0', '\x84', '\x0c', '\x95', '\xb5', '\xa0', '\x5f', '\xa4', '\x2c', '\xac', '\xf9', '\x09', '\x02', '\x97', '\xa4', '\xe4', + '\x5b', '\x49', '\x1a', '\x56', '\x52', '\x17', '\xe6', '\x17', '\x71', '\xf6', '\x7a', '\xd9', '\x67', '\x5e', '\xc2', '\x49', + '\x24', '\xcb', '\x94', '\x71', '\x50', '\xd4', '\x82', '\x07', '\x1e', '\xd6', '\x35', '\x47', '\x9e', '\x9b', '\xca', '\x0a', + '\xe8', '\x49', '\xa4', '\xe4', '\xc8', '\x0d', '\xba', '\xd3', '\xac', '\x41', '\x1d', '\xd9', '\x41', '\x7c', '\xd1', '\xeb', + '\xf8', '\x36', '\x60', '\xf1', '\xe9', '\x43', '\x21', '\xd1', '\xd8', '\xee', '\x10', '\x5b', '\xc0', '\x5e', '\xb7', '\xb9', + '\x7c', '\x06', '\x37', '\x1d', '\x86', '\x29', '\x4b', '\x46', '\x31', '\x1b', '\x0f', '\xf6', '\x6b', '\xfa', '\xbe', '\x5c', + '\xc9', '\x79', '\x97', '\x73', '\xce', '\x25', '\x9f', '\x08', '\xf0', '\xb0', '\x96', '\xa8', '\x80', '\xf8', '\x7a', '\x87', + '\xf2', '\x84', '\x77', '\x04', '\xed', '\x99', '\xc9', '\xdb', '\x4a', '\x8a', '\xc7', '\x99', '\x10', '\xe0', '\x5c', '\x47', + '\x1a', '\x5b', '\x90', '\x8d', '\xc3', '\xe8', '\x55', '\x0e', '\xa3', '\xe1', '\x28', '\x62', '\x61', '\x8f', '\x14', '\xfe', + '\x4b', '\x4f', '\x72', '\x98', '\x9e', '\xf8', '\x48', '\xf5', '\x1d', '\xb8', '\x4a', '\xe1', '\x27', '\xfd', '\xc3', '\x74', + '\x88', '\xf6', '\x03', '\x3b', '\x8a', '\x34', '\x03', '\xa5', '\x72', '\x50', '\xd4', '\x16', '\xa4', '\x6a', '\x69', '\x8c', + '\xea', '\x8c', '\xf7', '\x3f', '\xa9', '\x43', '\xaf', '\xd4', '\x85', '\x32', '\x78', '\x96', '\xd4', '\x63', '\x60', '\x57', + '\x23', '\xc2', '\x06', '\x1f', '\x5a', '\x39', '\x91', '\x97', '\x73', '\x07', '\x6a', '\x01', '\xb6', '\xec', '\xc9', '\x5a', + '\x6c', '\xb1', '\x27', '\x63', '\x6e', '\x1e', '\xac', '\xcb', '\xa4', '\x15', '\x0a', '\x7a', '\x46', '\x95', '\x83', '\x74', + '\x1f', '\xa5', '\xc3', '\x3e', '\x23', '\xe2', '\xb8', '\x44', '\xe6', '\x54', '\xa7', '\x7c', '\x0d', '\x5d', '\x55', '\xed', + '\x83', '\x75', '\xa8', '\xa3', '\x79', '\x52', '\x37', '\xc1', '\xdc', '\xe8', '\x1e', '\xf3', '\x24', '\x89', '\x53', '\xf6', + '\xfe', '\xf2', '\x1d', '\x4b', '\xd2', '\xd4', '\xdf', '\x10', '\xfb', '\xa9', '\x33', '\xa2', '\xa9', '\x13', '\xc6', '\x27', + '\x10', '\xf5', '\x4c', '\xda', '\xf5', '\x95', '\x0f', '\x32', '\x68', '\x9e', '\x1c', '\xfa', '\x6f', '\x79', '\xe4', '\xa6', + '\x6f', '\xfe', '\x02', '\x82', '\xdf', '\x73', '\xfc' }; // end paste @@ -651,33 +656,36 @@ QByteArray RiuDockWidgetTools::hideAllDocking3DState() // start paste static const char stateData[] = - { '\x00', '\x00', '\x06', '\x51', '\x78', '\xda', '\x95', '\x95', '\x4d', '\x53', '\xc2', '\x30', '\x10', '\x86', '\xef', '\xfe', - '\x8a', '\x4c', '\xef', '\x48', '\x01', '\x65', '\x3c', '\xf0', '\x31', '\x4c', '\x91', '\x19', '\x0f', '\x28', '\x5a', '\x90', - '\xa3', '\x13', '\xdb', '\x15', '\xa2', '\x69', '\xc2', '\x24', '\x0b', '\x8a', '\xe3', '\x8f', '\x37', '\x6d', '\xb1', '\x23', - '\x25', '\x6d', '\xe9', '\xa9', '\x69', '\xf2', '\xbe', '\xd9', '\x67', '\xb3', '\x9b', '\xb6', '\x37', '\xfc', '\x8a', '\x38', - '\xd9', '\x81', '\xd2', '\x4c', '\x8a', '\xbe', '\xd3', '\xba', '\x74', '\x1d', '\x02', '\x22', '\x90', '\x21', '\x13', '\xab', - '\xbe', '\xb3', '\x98', '\x4f', '\x1a', '\x37', '\xce', '\x70', '\xd0', '\x7b', '\xc4', '\x51', '\xb8', '\xa3', '\x22', '\x80', - '\x70', '\x2c', '\x83', '\x0f', '\xb3', '\xe6', '\xef', '\x35', '\x42', '\x44', '\x9e', '\x33', '\xa3', '\x43', '\x16', '\x1a', - '\x54', '\xf6', '\xde', '\x71', '\x88', '\x27', '\x05', '\x52', '\x26', '\xcc', '\x4c', '\xb2', '\xec', '\x81', '\x40', '\x45', - '\xf9', '\x92', '\x85', '\x2b', '\xc0', '\xbe', '\x13', '\x9a', '\x7d', '\x3a', '\xe3', '\x25', '\x13', '\xa1', '\xfc', '\x7c', - '\x89', '\x8c', '\x2e', '\x1d', '\x3a', '\x83', '\x5e', '\xe6', '\x23', '\x13', '\x2e', '\x29', '\x26', '\x20', '\xae', '\x99', - '\xf7', '\x37', '\x9c', '\x21', '\x9a', '\xe9', '\x07', '\xc5', '\xcc', '\x5e', '\x66', '\x25', '\x0e', '\xf4', '\x13', '\x07', - '\xda', '\x0a', '\x8c', '\x43', '\x16', '\x69', '\x1a', '\x99', '\xa6', '\x6d', '\x34', '\x23', '\x05', '\x94', '\xcc', '\xe9', - '\xab', '\x4e', '\x29', '\xb7', '\x4a', '\x81', '\x38', '\x00', '\xf9', '\x81', '\x62', '\x1b', '\xd4', '\x73', '\x05', '\x70', - '\xcc', '\x94', '\x52', '\x93', '\x7b', '\x1a', '\x41', '\xaa', '\x9c', '\x29', '\xf9', '\x0e', '\x01', '\xe6', '\x95', '\xc4', - '\xe3', '\x52', '\x43', '\x18', '\x27', '\xdc', '\xb4', '\xb8', '\xc6', '\x14', '\xa9', '\x2f', '\xb7', '\x2a', '\x80', '\x9a', - '\xc6', '\x02', '\xb0', '\x63', '\x57', '\x33', '\xce', '\xec', '\x28', '\xbf', '\x56', '\x2e', '\x3f', '\x43', '\xbd', '\x01', - '\x85', '\xfb', '\xdb', '\x90', '\xa1', '\x54', '\xd5', '\x29', '\x16', '\x88', '\xad', '\x61', '\x7d', '\xf6', '\x0d', '\x7a', - '\xe0', '\x92', '\x56', '\xa7', '\xd5', '\x25', '\xbd', '\x66', '\xfa', '\x6a', '\x9e', '\x87', '\x8a', '\xd4', '\xae', '\x4d', - '\x9e', '\xdd', '\xd6', '\x2c', '\xa6', '\x43', '\xe8', '\x2a', '\xd1', '\x5a', '\xf8', '\xad', '\x86', '\x3f', '\x72', '\xf7', - '\x3f', '\xf9', '\x19', '\x8d', '\x55', '\x02', '\xf6', '\x04', '\x7a', '\xcb', '\xf1', '\x4e', '\xbc', '\xc9', '\x8a', '\x03', - '\xb5', '\x0b', '\xab', '\x6a', '\x78', '\x95', '\x0b', '\x37', '\x95', '\x6b', '\xa5', '\x3d', '\xa6', '\x02', '\x0e', '\x33', - '\x2e', '\xf1', '\xac', '\x98', '\x79', '\x61', '\x45', '\xb7', '\x95', '\x84', '\xa8', '\x70', '\x3e', '\x01', '\x9f', '\x81', - '\x8a', '\x6a', '\xba', '\x66', '\xbb', '\x0a', '\xc2', '\xd3', '\x53', '\x69', '\x9f', '\x76', '\x76', '\x00', '\x5a', '\x4f', - '\xa5', '\x38', '\xa3', '\xb3', '\xa7', '\x46', '\x49', '\x57', '\xa0', '\xeb', '\x20', '\x16', '\xee', '\x5f', '\x7a', '\x19', - '\x5c', '\xd2', '\xbe', '\xee', '\xba', '\xf6', '\xeb', '\x90', '\xcc', '\x24', '\xb7', '\xc5', '\x2e', '\x28', '\x69', '\xb9', - '\x31', '\x6c', '\x70', '\x7d', '\x46', '\xf5', '\xad', '\xba', '\x52', '\xe0', '\x04', '\xd7', '\xce', '\xd3', '\xcc', '\x3e', - '\xcc', '\x66', '\x5c', '\xf0', '\x43', '\x18', '\x5c', '\xfc', '\x02', '\x10', '\x78', '\x2c', '\xb5' }; + { '\x00', '\x00', '\x07', '\x20', '\x78', '\xda', '\x95', '\x55', '\x4d', '\x4f', '\xe3', '\x30', '\x10', '\xbd', '\xef', '\xaf', + '\xb0', '\x72', '\x87', '\x86', '\xf2', '\xa1', '\xae', '\xd4', '\x16', '\x55', '\x01', '\x04', '\x87', '\x42', '\x21', '\x65', + '\x7b', '\x5c', '\x79', '\x9d', '\xd9', '\x62', '\x70', '\xec', '\xca', '\x9e', '\x94', '\x65', '\xc5', '\x8f', '\x67', '\x92', + '\x42', '\x57', '\xc9', '\xe6', '\xcb', '\xa7', '\x24', '\x9e', '\xf7', '\xc6', '\x6f', '\x9e', '\x67', '\x9c', '\xf1', '\xf9', + '\x9f', '\x54', '\xb1', '\x2d', '\x58', '\x27', '\x8d', '\x9e', '\x04', '\x47', '\x87', '\x61', '\xc0', '\x40', '\x0b', '\x93', + '\x48', '\xbd', '\x9e', '\x04', '\x8f', '\xcb', '\xab', '\x83', '\x51', '\x70', '\x3e', '\x1d', '\xdf', '\xe3', '\x2c', '\xd9', + '\x72', '\x2d', '\x20', '\xb9', '\x30', '\xe2', '\x85', '\x62', '\xf1', '\x9b', '\x43', '\x48', '\xd9', '\x8f', '\x3d', '\x31', + '\x60', '\x8f', '\x0e', '\xec', '\xfe', '\xfb', '\x24', '\x60', '\x91', '\xd1', '\xc8', '\xa5', '\xa6', '\x95', '\x22', '\x1c', + '\x81', '\x46', '\xcb', '\xd5', '\x4a', '\x26', '\x6b', '\xc0', '\x49', '\x90', '\x50', '\x9e', '\x15', '\x28', '\x61', '\x52', + '\x88', '\x85', '\x05', '\xd0', '\xc1', '\x74', '\xbc', '\x67', '\xb0', '\x2b', '\x65', '\x38', '\x16', '\x12', '\x42', '\x5a', + '\x8f', '\x37', '\x4a', '\x22', '\xd2', '\xf2', '\x9d', '\x95', '\x94', '\x85', '\x22', '\xf9', '\x16', '\xef', '\xf9', '\x16', + '\x99', '\xa6', '\x5c', '\xc3', '\x46', '\xcc', '\x41', '\x09', '\x33', '\xb3', '\xc0', '\xd9', '\x92', '\xff', '\x22', '\x41', + '\xc7', '\x14', '\xc8', '\xac', '\x05', '\xfd', '\x29', '\x85', '\x34', '\xc8', '\x0d', '\xba', '\x25', '\x29', '\xf9', '\x99', + '\x92', '\x86', '\x95', '\xd4', '\x89', '\x79', '\x25', '\xce', '\x4e', '\x2f', '\xbb', '\xe5', '\x29', '\xec', '\x90', '\x0b', + '\x6b', '\x9e', '\x41', '\x60', '\x15', '\xc9', '\x22', '\x65', '\x1c', '\x24', '\x79', '\xa9', '\x83', '\x1a', '\xd6', '\x05', + '\x47', '\x1e', '\x9b', '\xcc', '\x0a', '\xf0', '\x24', '\x36', '\x08', '\x2b', '\xb3', '\x06', '\x79', '\x65', '\xa5', '\xfa', + '\x8e', '\x2a', '\xf5', '\x91', '\xea', '\x0d', '\x58', '\x7c', '\xbb', '\x4c', '\x24', '\x1a', '\xdb', '\x5d', '\x62', '\x03', + '\xb8', '\x76', '\xdb', '\x58', '\xfe', '\x05', '\x37', '\x0d', '\xd9', '\xf7', '\xd1', '\x29', '\x1b', '\x0f', '\x76', '\x5f', + '\xf4', '\xfc', '\x3c', '\x90', '\x7e', '\x47', '\xd3', '\xe7', '\x88', '\x5b', '\xca', '\x2b', '\x77', '\x12', '\xb5', '\x0f', + '\x5f', '\x17', '\xa8', '\x9a', '\xe2', '\x2a', '\xd0', '\xaf', '\x82', '\xc2', '\x7e', '\x3e', '\xde', '\x67', '\x52', '\xbc', + '\xcc', '\x84', '\x00', '\xe7', '\x3a', '\x4c', '\x6c', '\x40', '\xb6', '\x38', '\x38', '\x0c', '\x4f', '\x46', '\x2c', '\xf4', + '\xb0', '\xf0', '\x9f', '\x3d', '\xc7', '\x65', '\x7b', '\x86', '\x15', '\xd5', '\x0f', '\xe0', '\x32', '\x85', '\x37', '\xfa', + '\xb7', '\xe9', '\x10', '\x5d', '\x0f', '\xec', '\x68', '\xd1', '\x08', '\x94', '\x8a', '\x41', '\xd1', '\x50', '\x90', '\xaa', + '\xa5', '\x31', '\xca', '\xa7', '\x51', '\xcf', '\xaa', '\x83', '\x08', '\xd2', '\x5d', '\x4b', '\x87', '\xbd', '\x84', '\x2e', + '\x94', '\x41', '\x9f', '\x21', '\x84', '\x0d', '\x3e', '\x79', '\x72', '\x1e', '\x40', '\x2d', '\xc0', '\xa6', '\x9e', '\xac', + '\xc5', '\xd6', '\x57', '\xdb', '\xdc', '\x3c', '\x59', '\x17', '\x49', '\x2b', '\x14', '\x78', '\x32', '\xeb', '\x1c', '\xeb', + '\x72', '\x7d', '\xf8', '\xff', '\xf5', '\x90', '\x37', '\xea', '\xdc', '\xe8', '\x1e', '\xd7', '\xc3', '\x9c', '\x90', '\x7c', + '\x0d', '\xce', '\xc7', '\x8f', '\xc6', '\xfc', '\xad', '\x37', '\x4a', '\xc8', '\x8a', '\x99', '\xa8', '\x9d', '\x88', '\x62', + '\x25', '\xbf', '\x72', '\xc2', '\x96', '\x78', '\x4b', '\x82', '\xc1', '\xfe', '\x6f', '\x43', '\xef', '\x0d', '\xff', '\xb7', + '\xe9', '\xb7', '\x0f', '\x67', '\x50', '\x73', '\xca' }; // end paste From 64c380652b88c8ea954c2b81412cfd805da9550a Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 22 May 2026 14:30:11 +0200 Subject: [PATCH 17/47] Work in progress --- .../Application/RiaGuiApplication.cpp | 2 +- .../RimDockWindowController.cpp | 6 +++ .../RimDockWindowController.h | 1 + .../ProjectDataModel/RimPlotWindow.cpp | 12 ++++++ .../ProjectDataModel/RimPlotWindow.h | 4 ++ .../Summary/RimSummaryPlot.cpp | 4 ++ .../UserInterface/RiuMainWindow.cpp | 15 +++++++ .../UserInterface/RiuMainWindowBase.cpp | 1 + .../UserInterface/RiuPlotMainWindow.cpp | 40 ++++++++++--------- .../UserInterface/RiuQwtPlotWidget.cpp | 1 + 10 files changed, 67 insertions(+), 19 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 6395397d137..97b0e0bad31 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -231,7 +231,7 @@ RiaGuiApplication::~RiaGuiApplication() delete m_mainWindow.data(); m_mainWindow.clear(); - // m_mainPlotWindow.reset(); + m_mainPlotWindow.reset(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index ba2d40cf2bd..920208e3549 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -20,11 +20,13 @@ #include "RiaGuiApplication.h" #include "Rim3dView.h" +#include "RimPlotWindow.h" #include "RimProject.h" #include "RimViewWindow.h" #include "RiuDockWidgetTools.h" #include "RiuMainWindowBase.h" +#include "RiuPlotMainWindowTools.h" #include "RiuViewer.h" #include "DockManager.h" @@ -210,5 +212,9 @@ void RimDockWindowController::setAsActiveViewer() mainWin->refreshDrawStyleActions(); } } + else if ( auto plotView = dynamic_cast( pdmView ) ) + { + RiuPlotMainWindowTools::selectAsCurrentItem( plotView ); + } } } diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h index a4733c70352..050db2ef3fc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h @@ -21,6 +21,7 @@ #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmObject.h" +#include "cafPdmPtrField.h" class RiuMainWindowBase; class RimViewWindow; diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp index dc6f31ed4c8..20f210383c1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp @@ -29,6 +29,7 @@ #include "cafPdmFieldScriptingCapability.h" #include "cafPdmUiComboBoxEditor.h" +#include #include CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimPlotWindow, "RimPlotWindow" ); // Do not use. Abstract class @@ -435,3 +436,14 @@ bool RimPlotWindow::handleGlobalWheelEvent( QWheelEvent* wheelEvent ) { return false; } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimPlotWindow::onMousePressEvent( QMouseEvent* mouseEvent ) +{ + if ( mouseEvent ) + { + setAsActiveViewer(); + } +} diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h index 5d0518ff9f5..eb732eb08b3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h @@ -35,6 +35,7 @@ class QwtPlotCurve; class QKeyEvent; class QWheelEvent; class QPaintDevice; +class QMouseEvent; //================================================================================================== /// @@ -92,6 +93,9 @@ class RimPlotWindow : public RimViewWindow virtual bool handleGlobalKeyEvent( QKeyEvent* keyEvent ); virtual bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ); +public slots: + void onMousePressEvent( QMouseEvent* event ); + protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index bb70916832f..72624aaaa66 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2833,6 +2833,10 @@ void RimSummaryPlot::onPlotItemSelected( std::shared_ptr plotItem, auto rimPlotCurve = riuPlotCurve->ownerRimCurve(); + // if ( auto multiPlot = firstAncestorOrThisOfType() ) + //{ + // RiuPlotMainWindowTools::setActiveViewer( multiPlot->dockWindowName() ); + // } RiuPlotMainWindowTools::selectOrToggleObject( rimPlotCurve, toggle ); } diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 4ed54e0c76b..65c00ebef5b 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -1264,7 +1264,22 @@ void RiuMainWindow::slotViewFullScreen( bool showFullScreen ) if ( showFullScreen ) { m_lastDockState = dockManager()->saveState( DOCKSTATE_VERSION ); + + QString activeViewerName; + if ( auto activeViewer = RiaGuiApplication::instance()->activeReservoirView() ) + { + activeViewerName = activeViewer->dockWindowName(); + } + dockManager()->restoreState( RiuDockWidgetTools::hideAllDocking3DState(), DOCKSTATE_VERSION ); + + if ( !activeViewerName.isEmpty() ) + { + if ( auto dw = dockManager()->findDockWidget( activeViewerName ) ) + { + dockManager()->addDockWidget( ads::DockWidgetArea::CenterDockWidgetArea, dw, dockManager()->centralWidget()->dockAreaWidget() ); + } + } } else { diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 69d796cdf1f..81240ca7d3b 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -122,6 +122,7 @@ void RiuMainWindowBase::setActiveViewer( QString viewerName ) { for ( auto view : viewWindows() ) { + auto dockName = view->dockWidget()->objectName(); if ( view->dockWidget() && view->dockWidget()->objectName() == viewerName ) { view->setAsActiveViewer(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index badb7d4c5fb..ed16950a037 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -774,7 +774,7 @@ std::vector RiuPlotMainWindow::viewWindows() for ( auto v : RimProject::current()->descendantsOfType() ) { - views.push_back( v ); + if ( v->dockWidget() ) views.push_back( v ); } return views; @@ -913,27 +913,29 @@ void RiuPlotMainWindow::selectedObjectsChanged( caf::PdmUiTreeView* projectTree, if ( selectedWindow ) { - if ( selectedWindow->viewWidget() ) + m_activePlotViewWindow = selectedWindow; + + if ( auto multiSummaryPlot = firstSelectedObject->firstAncestorOrThisOfType() ) { setBlockViewSelectionOnSubWindowActivated( true ); - setActiveViewer( selectedWindow->dockWindowName() ); + setActiveViewer( multiSummaryPlot->dockWindowName() ); setBlockViewSelectionOnSubWindowActivated( false ); - } - m_activePlotViewWindow = selectedWindow; + updateMultiPlotToolBar(); - if ( firstSelectedObject ) + auto summaryPlot = firstSelectedObject->firstAncestorOrThisOfType(); + if ( summaryPlot ) + { + multiSummaryPlot->makeSureIsVisible( summaryPlot ); + } + } + else { - auto multiSummaryPlot = firstSelectedObject->firstAncestorOrThisOfType(); - if ( multiSummaryPlot ) + if ( selectedWindow->dockWidget() ) { - updateMultiPlotToolBar(); - - auto summaryPlot = firstSelectedObject->firstAncestorOrThisOfType(); - if ( summaryPlot ) - { - multiSummaryPlot->makeSureIsVisible( summaryPlot ); - } + setBlockViewSelectionOnSubWindowActivated( true ); + setActiveViewer( selectedWindow->dockWindowName() ); + setBlockViewSelectionOnSubWindowActivated( false ); } } @@ -987,9 +989,11 @@ void RiuPlotMainWindow::customMenuRequested( const QPoint& pos ) //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::dragEnterEvent( QDragEnterEvent* event ) { - // QPoint curpos = m_mdiArea->mapFromGlobal( QCursor::pos() ); - - // if ( m_mdiArea->rect().contains( curpos ) ) event->acceptProposedAction(); + if ( m_centralDockWidget != nullptr ) + { + QPoint curpos = m_centralDockWidget->mapFromGlobal( QCursor::pos() ); + if ( m_centralDockWidget->rect().contains( curpos ) ) event->acceptProposedAction(); + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index 84e61ed82ee..ffc4bb45b1d 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -107,6 +107,7 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent ) SLOT( onPlotItemSelected( std::shared_ptr, bool, int ) ) ); connect( this, SIGNAL( onKeyPressEvent( QKeyEvent* ) ), plotDefinition, SLOT( onKeyPressEvent( QKeyEvent* ) ) ); connect( this, SIGNAL( onWheelEvent( QWheelEvent* ) ), plotDefinition, SLOT( onWheelEvent( QWheelEvent* ) ) ); + connect( this, SIGNAL( onMousePressEvent( QMouseEvent* ) ), plotDefinition, SLOT( onMousePressEvent( QMouseEvent* ) ) ); connect( this, SIGNAL( destroyed() ), plotDefinition, SLOT( onViewerDestroyed() ) ); } From e0f43c384d3483e233bd9e07d2283b8f7fa299ab Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 22 May 2026 14:45:12 +0200 Subject: [PATCH 18/47] Fix fullscreen in 3d window --- ApplicationLibCode/UserInterface/RiuMainWindow.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 65c00ebef5b..c73dbac9a43 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -1283,7 +1283,21 @@ void RiuMainWindow::slotViewFullScreen( bool showFullScreen ) } else { + QString activeViewerName; + if ( auto activeViewer = RiaGuiApplication::instance()->activeReservoirView() ) + { + activeViewerName = activeViewer->dockWindowName(); + } + dockManager()->restoreState( m_lastDockState, DOCKSTATE_VERSION ); + + if ( !activeViewerName.isEmpty() ) + { + if ( auto dw = dockManager()->findDockWidget( activeViewerName ) ) + { + dw->setAsCurrentTab(); + } + } } } From e30088938f874debfc2748d262d72bf4d5475dbe Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 22 May 2026 14:46:58 +0200 Subject: [PATCH 19/47] Build fix --- ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index 920208e3549..f25215e4627 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -25,6 +25,7 @@ #include "RimViewWindow.h" #include "RiuDockWidgetTools.h" +#include "RiuMainWindow.h" #include "RiuMainWindowBase.h" #include "RiuPlotMainWindowTools.h" #include "RiuViewer.h" From ac8ae56e58d6a000f6647d2d00059e05a95409b8 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Fri, 22 May 2026 15:18:43 +0200 Subject: [PATCH 20/47] Clean up main window ids --- ApplicationLibCode/Application/RiaDefines.h | 6 ++++++ ApplicationLibCode/Application/RiaGuiApplication.cpp | 6 +++--- ApplicationLibCode/Application/RiaGuiApplication.h | 2 +- .../ProjectDataModel/RimDockWindowController.cpp | 6 +++--- .../ProjectDataModel/RimDockWindowController.h | 10 ++++++---- ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp | 10 +++++----- ApplicationLibCode/ProjectDataModel/RimViewWindow.h | 2 +- ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp | 1 + 8 files changed, 26 insertions(+), 17 deletions(-) diff --git a/ApplicationLibCode/Application/RiaDefines.h b/ApplicationLibCode/Application/RiaDefines.h index 68025e56979..92a0d1637e6 100644 --- a/ApplicationLibCode/Application/RiaDefines.h +++ b/ApplicationLibCode/Application/RiaDefines.h @@ -200,6 +200,12 @@ enum class RINavigationPolicy : short NAVIGATION_POLICY_RMS }; +enum class RIMainWindow +{ + MAIN_WINDOW_3D = 0, + MAIN_WINDOW_PLOTS = 1 +}; + enum class WellProductionType : short { PRODUCER, diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 97b0e0bad31..ffc97955807 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -1121,11 +1121,11 @@ RiuPlotMainWindow* RiaGuiApplication::mainPlotWindow() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuMainWindowBase* RiaGuiApplication::mainWindowByID( int mainWindowID ) +RiuMainWindowBase* RiaGuiApplication::mainWindowByID( RiaDefines::RIMainWindow mainWindowID ) { - if ( mainWindowID == 0 ) + if ( mainWindowID == RiaDefines::RIMainWindow::MAIN_WINDOW_3D ) return m_mainWindow; - else if ( mainWindowID == 1 ) + else if ( mainWindowID == RiaDefines::RIMainWindow::MAIN_WINDOW_PLOTS ) return m_mainPlotWindow.get(); else return nullptr; diff --git a/ApplicationLibCode/Application/RiaGuiApplication.h b/ApplicationLibCode/Application/RiaGuiApplication.h index 18d30eaee7b..728ff457c6f 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.h +++ b/ApplicationLibCode/Application/RiaGuiApplication.h @@ -103,7 +103,7 @@ class RiaGuiApplication : public QApplication, public RiaApplication RiuPlotMainWindow* getOrCreateMainPlotWindow(); RiuPlotMainWindow* getOrCreateAndShowMainPlotWindow(); RiuPlotMainWindow* mainPlotWindow(); - RiuMainWindowBase* mainWindowByID( int mainWindowID ); + RiuMainWindowBase* mainWindowByID( RiaDefines::RIMainWindow mainWindowID ); static RimViewWindow* activeViewWindow(); static RiuMainWindowBase* activeMainWindow(); diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index f25215e4627..fb9e703b1f9 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -40,7 +40,7 @@ CAF_PDM_XML_SOURCE_INIT( RimDockWindowController, "DockWindowController" ); //-------------------------------------------------------------------------------------------------- RimDockWindowController::RimDockWindowController() { - CAF_PDM_InitField( &m_mainWindowID, "MainWindowID", 0, "" ); + m_mainWindowID = RiaDefines::RIMainWindow::MAIN_WINDOW_3D; CAF_PDM_InitFieldNoDefault( &m_viewToControl, "ViewToControl", "" ); m_viewToControl = nullptr; } @@ -159,7 +159,7 @@ void RimDockWindowController::updateViewerWidget() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDockWindowController::setMainWindowId( int mainId ) +void RimDockWindowController::setMainWindowId( RiaDefines::RIMainWindow mainId ) { m_mainWindowID = mainId; } @@ -175,7 +175,7 @@ void RimDockWindowController::setViewToControl( RimViewWindow* view ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RimDockWindowController::mainWindowId() const +RiaDefines::RIMainWindow RimDockWindowController::mainWindowId() const { return m_mainWindowID; } diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h index 050db2ef3fc..e3fbbd4af07 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h @@ -23,6 +23,8 @@ #include "cafPdmObject.h" #include "cafPdmPtrField.h" +#include "RiaDefines.h" + class RiuMainWindowBase; class RimViewWindow; struct RimMdiWindowGeometry; @@ -39,9 +41,9 @@ class RimDockWindowController : public caf::PdmObject RimDockWindowController(); ~RimDockWindowController() override; - void setMainWindowId( int mainId ); - void setViewToControl( RimViewWindow* view ); - int mainWindowId() const; + void setMainWindowId( RiaDefines::RIMainWindow mainId ); + void setViewToControl( RimViewWindow* view ); + RiaDefines::RIMainWindow mainWindowId() const; void setAsActiveViewer(); @@ -58,6 +60,6 @@ class RimDockWindowController : public caf::PdmObject void setupBeforeSave() override; private: - caf::PdmField m_mainWindowID; + RiaDefines::RIMainWindow m_mainWindowID; caf::PdmPtrField m_viewToControl; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index 12e7e7c0ecf..979d88363a3 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -114,7 +114,7 @@ bool RimViewWindow::isMainDockedWindow() const //-------------------------------------------------------------------------------------------------- bool RimViewWindow::isDockedIn3DView() const { - return ( m_windowController != nullptr ) && ( m_windowController->mainWindowId() == 0 ); + return ( m_windowController != nullptr ) && ( m_windowController->mainWindowId() == RiaDefines::RIMainWindow::MAIN_WINDOW_3D ); } //-------------------------------------------------------------------------------------------------- @@ -122,7 +122,7 @@ bool RimViewWindow::isDockedIn3DView() const //-------------------------------------------------------------------------------------------------- bool RimViewWindow::isDockedInPlotView() const { - return ( m_windowController != nullptr ) && ( m_windowController->mainWindowId() == 1 ); + return ( m_windowController != nullptr ) && ( m_windowController->mainWindowId() == RiaDefines::RIMainWindow::MAIN_WINDOW_PLOTS ); } //-------------------------------------------------------------------------------------------------- @@ -191,7 +191,7 @@ void RimViewWindow::updateDockWindowVisibility() //-------------------------------------------------------------------------------------------------- void RimViewWindow::dockAs3DViewWindow() { - dockInWindow( 0 ); + dockInWindow( RiaDefines::RIMainWindow::MAIN_WINDOW_3D ); } //-------------------------------------------------------------------------------------------------- @@ -199,7 +199,7 @@ void RimViewWindow::dockAs3DViewWindow() //-------------------------------------------------------------------------------------------------- void RimViewWindow::dockAsPlotWindow() { - dockInWindow( 1 ); + dockInWindow( RiaDefines::RIMainWindow::MAIN_WINDOW_PLOTS ); } //-------------------------------------------------------------------------------------------------- @@ -307,7 +307,7 @@ QString RimViewWindow::dockWindowName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewWindow::dockInWindow( int mainWindowID ) +void RimViewWindow::dockInWindow( RiaDefines::RIMainWindow mainWindowID ) { if ( m_windowController == nullptr ) { diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index c09ae225c42..51bc99d5b13 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -101,7 +101,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface private: friend class RimProject; - void dockInWindow( int mainWindowID ); + void dockInWindow( RiaDefines::RIMainWindow mainWindowID ); virtual void assignIdIfNecessary() = 0; protected: diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 81240ca7d3b..62385bbf29f 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include From c27f6a02c03c0bb37e5fb830afe36e9746347204 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 26 May 2026 13:12:55 +0200 Subject: [PATCH 21/47] Use global event handler for tracking active plot window --- .../Application/RiaGuiApplication.cpp | 21 ++++++++++++++----- .../ProjectDataModel/RimPlotWindow.cpp | 5 +++-- .../ProjectDataModel/RimPlotWindow.h | 4 +--- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index ffc97955807..8bfbcf932e5 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -445,11 +445,7 @@ RimViewWindow* RiaGuiApplication::activePlotWindow() const if ( m_mainPlotWindow ) { - // QList subwindows = m_mainPlotWindow->subWindowList( QMdiArea::StackingOrder ); - // if ( !subwindows.empty() ) - //{ - // viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() ); - // } + return m_mainPlotWindow->activePlotView(); } return viewWindow; @@ -1804,6 +1800,21 @@ bool RiaGuiApplication::notify( QObject* receiver, QEvent* event ) if ( plot ) done = plot->handleGlobalKeyEvent( keyEvent ); } } + else if ( event->type() == QEvent::MouseButtonPress ) + { + if ( activeWindow() != mainWindow() ) + { + if ( auto plotMain = mainPlotWindow() ) + { + QMouseEvent* mouseEvent = static_cast( event ); + for ( auto view : plotMain->viewWindows() ) + { + RimPlotWindow* plot = dynamic_cast( view ); + if ( plot ) done = plot->handleGlobalMousePressEvent( mouseEvent ); + } + } + } + } else if ( event->type() == QEvent::Wheel ) { if ( activeWindow() != mainWindow() ) diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp index 20f210383c1..d4dced0aa81 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.cpp @@ -440,10 +440,11 @@ bool RimPlotWindow::handleGlobalWheelEvent( QWheelEvent* wheelEvent ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimPlotWindow::onMousePressEvent( QMouseEvent* mouseEvent ) +bool RimPlotWindow::handleGlobalMousePressEvent( QMouseEvent* mouseEvent ) { - if ( mouseEvent ) + if ( mouseEvent && viewWidget() && viewWidget()->underMouse() ) { setAsActiveViewer(); } + return false; } diff --git a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h index eb732eb08b3..8d57904e53b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimPlotWindow.h @@ -92,9 +92,7 @@ class RimPlotWindow : public RimViewWindow virtual bool handleGlobalKeyEvent( QKeyEvent* keyEvent ); virtual bool handleGlobalWheelEvent( QWheelEvent* wheelEvent ); - -public slots: - void onMousePressEvent( QMouseEvent* event ); + virtual bool handleGlobalMousePressEvent( QMouseEvent* mouseEvent ); protected: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; From 4aa96443dda588a22d9a10bd63b6f7f3755a7484 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 26 May 2026 16:03:49 +0200 Subject: [PATCH 22/47] Remove last traces of MDI --- .../Application/RiaGuiApplication.cpp | 6 +- .../Tools/RiaRegressionTestRunner.cpp | 6 +- .../RicSnapshotAllPlotsToFileFeature.cpp | 4 -- .../RicSnapshotAllViewsToFileFeature.cpp | 1 - .../RicSnapshotViewToClipboardFeature.cpp | 1 - .../RicSnapshotViewToFileFeature.cpp | 1 - .../CMakeLists_files.cmake | 1 - ...penSummaryPlotEditorFromMdiAreaFeature.cpp | 29 --------- ...cOpenSummaryPlotEditorFromMdiAreaFeature.h | 32 ---------- .../RicViewZoomAllFeature.cpp | 21 ++----- .../Flow/RimFlowPlotCollection.cpp | 2 +- .../Flow/RimWellAllocationPlot.cpp | 2 +- .../Flow/RimWellAllocationPlot.h | 2 +- .../RimDockWindowController.h | 1 - .../SocketInterface/RiaSocketServer.cpp | 17 ----- .../UserInterface/RiuMainWindow.cpp | 18 ++---- .../UserInterface/RiuMainWindow.h | 1 - .../UserInterface/RiuMainWindowTools.cpp | 63 ------------------- .../UserInterface/RiuMainWindowTools.h | 3 - .../UserInterface/RiuMatrixPlotWidget.cpp | 4 +- .../UserInterface/RiuMultiPlotBook.cpp | 1 - .../UserInterface/RiuMultiPlotPage.cpp | 1 - .../UserInterface/RiuPlotMainWindow.cpp | 52 ++------------- .../UserInterface/RiuPlotMainWindow.h | 6 -- .../UserInterface/RiuQwtPlotWidget.cpp | 1 - .../RiuTofAccumulatedPhaseFractionsPlot.cpp | 1 - .../UserInterface/RiuViewerToViewInterface.h | 1 - 27 files changed, 27 insertions(+), 251 deletions(-) delete mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.cpp delete mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.h diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 8bfbcf932e5..793b5788d50 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -862,7 +862,8 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n if ( snapshotHeight > -1 && snapshotWidth > -1 ) { - RiuMainWindowTools::setWindowSizeOnWidgetsInMdiWindows( mainPlotWnd, snapshotWidth, snapshotHeight ); + // TODO - handle snapshot view sizes + // RiuMainWindowTools::setWindowSizeOnWidgetsInViewWindows( mainPlotWnd, snapshotWidth, snapshotHeight ); } processEvents(); @@ -879,7 +880,8 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n if ( snapshotHeight > -1 && snapshotWidth > -1 ) { - RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, snapshotWidth, snapshotHeight ); + // TODO - handle snapshot view sizes + // RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, snapshotWidth, snapshotHeight ); } processEvents(); diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp index 7515bd584ec..2b0018f1dc5 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp @@ -556,7 +556,8 @@ void RiaRegressionTestRunner::setDefaultSnapshotSizeFor3dViews() QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize(); - RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, defaultSize.width(), defaultSize.height() ); + // TODO - fix snapshot view sizes + // RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, defaultSize.width(), defaultSize.height() ); } //-------------------------------------------------------------------------------------------------- @@ -569,7 +570,8 @@ void RiaRegressionTestRunner::setDefaultSnapshotSizeForPlotWindows() QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize(); - RiuMainWindowTools::setWindowSizeOnWidgetsInMdiWindows( plotMainWindow, defaultSize.width(), defaultSize.height() ); + // TODO - fix snapshot view sizes + // RiuMainWindowTools::setWindowSizeOnWidgetsInViewWindows( plotMainWindow, defaultSize.width(), defaultSize.height() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp index 3f78477baa3..255d9cbb3aa 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp @@ -37,7 +37,6 @@ #include #include #include -#include CAF_CMD_SOURCE_INIT( RicSnapshotAllPlotsToFileFeature, "RicSnapshotAllPlotsToFileFeature" ); @@ -101,9 +100,6 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QS if ( activateWidget ) { - // If the active MDI widget is maximized, all widgets will be maximized in the MDI area before taking - // snapshots - RiuPlotMainWindowTools::selectAsCurrentItem( viewWindow ); QApplication::processEvents(); } diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp index 08ec3afc278..8eac73513ea 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp @@ -47,7 +47,6 @@ #include #include #include -#include CAF_CMD_SOURCE_INIT( RicSnapshotAllViewsToFileFeature, "RicSnapshotAllViewsToFileFeature" ); diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToClipboardFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToClipboardFeature.cpp index 673fecd0ec5..9b72baefc55 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToClipboardFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToClipboardFeature.cpp @@ -33,7 +33,6 @@ #include #include #include -#include CAF_CMD_SOURCE_INIT( RicSnapshotViewToClipboardFeature, "RicSnapshotViewToClipboardFeature" ); diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp index 5127561f9ac..e1645b3491a 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp @@ -40,7 +40,6 @@ #include #include #include -#include #include #include diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index a3bfe916f47..0e1e3a99098 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -41,7 +41,6 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicDeleteSubPlotCtxFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicToggleYAxisLinkingFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicToggleXAxisLinkingFeature.cpp - ${CMAKE_CURRENT_LIST_DIR}/RicOpenSummaryPlotEditorFromMdiAreaFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicNewSummaryTableFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicDuplicateSummaryTableFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicCreateDeclineCurvesFeature.cpp diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.cpp deleted file mode 100644 index 7a6161b699a..00000000000 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.cpp +++ /dev/null @@ -1,29 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2023- 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 "RicOpenSummaryPlotEditorFromMdiAreaFeature.h" - -CAF_CMD_SOURCE_INIT( RicOpenSummaryPlotEditorFromMdiAreaFeature, "RicOpenSummaryPlotEditorFromMdiAreaFeature" ); - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -bool RicOpenSummaryPlotEditorFromMdiAreaFeature::isCommandEnabled() const -{ - return true; -} diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.h deleted file mode 100644 index f0df4473831..00000000000 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.h +++ /dev/null @@ -1,32 +0,0 @@ -///////////////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 2023- 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 "RicOpenSummaryPlotEditorFeature.h" - -//================================================================================================== -/// -//================================================================================================== -class RicOpenSummaryPlotEditorFromMdiAreaFeature : public RicOpenSummaryPlotEditorFeature -{ - CAF_CMD_HEADER_INIT; - -protected: - bool isCommandEnabled() const override; -}; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.cpp index ac8e3a16f9f..ca50ab582c5 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicViewZoomAllFeature.cpp @@ -28,7 +28,6 @@ #include "RiuPlotMainWindow.h" #include -#include CAF_CMD_SOURCE_INIT( RicViewZoomAllFeature, "RicViewZoomAllFeature" ); @@ -43,25 +42,17 @@ void RicViewZoomAllFeature::onActionTriggered( bool isChecked ) if ( dynamic_cast( topLevelWidget ) ) { - RimViewWindow* viewWindow = RiaGuiApplication::instance()->activeReservoirView(); - if ( viewWindow ) + if ( auto viewWindow = RiaGuiApplication::instance()->activeReservoirView() ) { viewWindow->zoomAll(); } } - else if ( dynamic_cast( topLevelWidget ) ) + else if ( auto plotMainWin = dynamic_cast( topLevelWidget ) ) { - RiuPlotMainWindow* mainPlotWindow = dynamic_cast( topLevelWidget ); - // QList subwindows = mainPlotWindow->subWindowList( QMdiArea::StackingOrder ); - // if ( !subwindows.empty() ) - //{ - // RimViewWindow* viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( subwindows.back()->widget() ); - - // if ( viewWindow ) - // { - // viewWindow->zoomAll(); - // } - //} + if ( auto activePlotView = plotMainWin->activePlotView() ) + { + activePlotView->zoomAll(); + } } } diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp index a673ecae8d3..26e7a94fc2f 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimFlowPlotCollection.cpp @@ -66,7 +66,7 @@ void RimFlowPlotCollection::deleteAllPlots() { if ( m_defaultWellAllocPlot ) { - m_defaultWellAllocPlot->removeFromMdiAreaAndDeleteViewWidget(); + m_defaultWellAllocPlot->removeFromDockAreaAndDeleteViewWidget(); delete m_defaultWellAllocPlot(); } delete m_defaultWellConnectivityTable; diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 2ffc1108726..877ee9cf6f8 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -737,7 +737,7 @@ QString RimWellAllocationPlot::wellName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellAllocationPlot::removeFromMdiAreaAndDeleteViewWidget() +void RimWellAllocationPlot::removeFromDockAreaAndDeleteViewWidget() { removeWindowFromDock(); deleteViewWidget(); diff --git a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.h b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.h index 84cfb4e54b1..11c39fe4ab9 100644 --- a/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Flow/RimWellAllocationPlot.h @@ -87,7 +87,7 @@ class RimWellAllocationPlot : public RimViewWindow QString wellName() const; - void removeFromMdiAreaAndDeleteViewWidget(); + void removeFromDockAreaAndDeleteViewWidget(); void showPlotLegend( bool doShow ); diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h index e3fbbd4af07..664ba1efd2b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h @@ -27,7 +27,6 @@ class RiuMainWindowBase; class RimViewWindow; -struct RimMdiWindowGeometry; //================================================================================================== /// diff --git a/ApplicationLibCode/SocketInterface/RiaSocketServer.cpp b/ApplicationLibCode/SocketInterface/RiaSocketServer.cpp index ce536c5f481..e59180c1663 100644 --- a/ApplicationLibCode/SocketInterface/RiaSocketServer.cpp +++ b/ApplicationLibCode/SocketInterface/RiaSocketServer.cpp @@ -38,7 +38,6 @@ #include "cafFactory.h" #include -#include #include @@ -149,22 +148,6 @@ RimEclipseCase* RiaSocketServer::findReservoir( int caseId ) { return eclipseView->eclipseCase(); } - - //// If the active mdi window is different from an Eclipse view, search through available mdi windows to find the - //// last activated Eclipse view. The sub windows are returned with the most recent activated window at the back. - // QList subWindows = RiuMainWindow::instance()->subWindowList( QMdiArea::ActivationHistoryOrder ); - // for ( int i = subWindows.size() - 1; i > -1; i-- ) - //{ - // RiuViewer* viewer = subWindows[i]->widget()->findChild(); - // if ( viewer ) - // { - // RimEclipseView* riv = dynamic_cast( viewer->ownerReservoirView() ); - // if ( riv ) - // { - // return riv->eclipseCase(); - // } - // } - // } } else { diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index c73dbac9a43..0d023169b32 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -100,7 +100,6 @@ #include #include #include -#include #include #include #include @@ -234,8 +233,6 @@ void RiuMainWindow::initializeGuiNewProjectLoaded() setPdmRoot( RimProject::current() ); restoreTreeViewState(); - // m_mdiArea->applyTiling(); - slotRefreshFileActions(); slotRefreshUndoRedoActions(); slotRefreshViewActions(); @@ -254,16 +251,6 @@ void RiuMainWindow::initializeGuiNewProjectLoaded() statusBar()->showMessage( "Ready ...", 5000 ); } - // QMdiSubWindow* activeSubWindow = m_mdiArea->activeSubWindow(); - // if ( activeSubWindow ) - //{ - // auto w = findViewWindowFromSubWindow( activeSubWindow ); - // if ( w && w->mdiWindowGeometry().isMaximized ) - // { - // activeSubWindow->showMaximized(); - // } - // } - // Sync selections with property editor. // Go backwards as the most "important" tree view is first in the list // and we want that to use the property editor in case multiple tree views are visible @@ -336,7 +323,10 @@ void RiuMainWindow::cleanupGuiCaseClose() //-------------------------------------------------------------------------------------------------- void RiuMainWindow::cleanupGuiBeforeProjectClose() { - // m_mdiArea->closeAllSubWindows(); + for ( auto v : viewWindows() ) + { + v->removeWindowFromDock(); + } setPdmRoot( nullptr ); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index 3cc346d1e24..8d02f6d4b78 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -242,7 +242,6 @@ private slots: // Windows slots void slotBuildWindowActions(); - // void slotSubWindowActivated( QMdiSubWindow* subWindow ); void selectedObjectsChanged(); void customMenuRequested( const QPoint& pos ); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp index bfc8bb4c2f3..29128506a53 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowTools.cpp @@ -36,7 +36,6 @@ #include "cafPdmUiTreeView.h" #include -#include #include // Dark title bar is taken from @@ -167,68 +166,6 @@ void RiuMainWindowTools::collapseSiblings( const caf::PdmUiItem* sourceUiItem ) } } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMainWindowTools::setWindowSizeOnWidgetsInMdiWindows( RiuMainWindowBase* mainWindow, int width, int height ) -{ - if ( !mainWindow ) return; - - auto widgets = mainWindow->findChildren(); - for ( auto w : widgets ) - { - if ( !w ) continue; - - w->showNormal(); - } - - // Process events before resize to make sure the widget is ready for resize - // If not, a maximized window with not get the prescribed window size - QApplication::processEvents(); - - for ( auto w : widgets ) - { - if ( !w ) continue; - auto viewWindow = RiuInterfaceToViewWindow::viewWindowFromWidget( w->widget() ); - - if ( viewWindow && viewWindow->viewWidget() ) - { - QWidget* viewWidget = viewWindow->viewWidget(); - - viewWidget->resize( width, height ); - } - } -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuMainWindowTools::setFixedWindowSizeFor3dViews( RiuMainWindowBase* mainWindow, int width, int height ) -{ - if ( !mainWindow ) return; - - RimProject* proj = RimProject::current(); - if ( !proj ) return; - - for ( Rim3dView* riv : proj->allViews() ) - { - if ( riv && riv->viewer() ) - { - //// Make sure all views are maximized for snapshotting - // QMdiSubWindow* subWnd = mainWindow->findMdiSubWindow( riv->viewer()->layoutWidget() ); - // if ( subWnd ) - //{ - // subWnd->showMaximized(); - // } - - // This size is set to match the regression test reference images - QSize windowSize( width, height ); - - riv->viewer()->setFixedSize( windowSize ); - } - } -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowTools.h b/ApplicationLibCode/UserInterface/RiuMainWindowTools.h index 6e4dcb5f3c4..36da50936b9 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowTools.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowTools.h @@ -23,7 +23,6 @@ namespace caf class PdmUiItem; } // namespace caf -class RiuMainWindowBase; class QWidget; //-------------------------------------------------------------------------------------------------- /// @@ -33,7 +32,5 @@ class RiuMainWindowTools public: static void collapseSiblings( const caf::PdmUiItem* uiItem ); - static void setWindowSizeOnWidgetsInMdiWindows( RiuMainWindowBase* mainWindow, int width, int height ); - static void setFixedWindowSizeFor3dViews( RiuMainWindowBase* mainWindow, int width, int height ); static void setDarkTitleBarWindows( QWidget* widget ); }; diff --git a/ApplicationLibCode/UserInterface/RiuMatrixPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuMatrixPlotWidget.cpp index e923b826521..04d71e85666 100644 --- a/ApplicationLibCode/UserInterface/RiuMatrixPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuMatrixPlotWidget.cpp @@ -210,8 +210,8 @@ RimViewWindow* RiuMatrixPlotWidget::ownerViewWindow() const //-------------------------------------------------------------------------------------------------- void RiuMatrixPlotWidget::contextMenuEvent( QContextMenuEvent* ) { - // Added empty override to preventing menu for Mdi Area - // I.e.: RiuContextMenuLauncher for RiuPlotMainWindow (mdi area) + // Added empty override to preventing menu for central area + // I.e.: RiuContextMenuLauncher for RiuPlotMainWindow return; } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index ad6e367339c..0ccb073da19 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -44,7 +44,6 @@ #include #include #include -#include #include #include #include diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp index 6a1b7477d5c..0a6aba196a8 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotPage.cpp @@ -59,7 +59,6 @@ #include #include #include -#include #include #include #include diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index ed16950a037..fbbc6a9e39c 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -76,7 +76,6 @@ #include #include -#include #include #include #include @@ -236,7 +235,10 @@ void RiuPlotMainWindow::initializeGuiNewProjectLoaded() //-------------------------------------------------------------------------------------------------- void RiuPlotMainWindow::cleanupGuiBeforeProjectClose() { - // m_mdiArea->closeAllSubWindows(); + for ( auto v : viewWindows() ) + { + v->removeWindowFromDock(); + } setPdmRoot( nullptr ); @@ -807,52 +809,6 @@ void RiuPlotMainWindow::setPdmRoot( caf::PdmObject* pdmRoot ) } } -////-------------------------------------------------------------------------------------------------- -///// -////-------------------------------------------------------------------------------------------------- -// void RiuPlotMainWindow::slotSubWindowActivated( QMdiSubWindow* subWindow ) -//{ -// if ( isBlockingSubWindowActivatedSignal() ) return; -// -// RimViewWindow* activatedView = findViewWindowFromSubWindow( subWindow ); -// -// if ( !activatedView ) return; -// m_activePlotViewWindow = activatedView; -// -// if ( !isBlockingViewSelectionOnSubWindowActivated() ) -// { -// caf::PdmUiTreeView* projectTree = getTreeViewWithItem( activatedView ); -// if ( projectTree ) -// { -// std::vector currentSelection; -// projectTree->selectedUiItems( currentSelection ); -// bool childSelected = false; -// for ( caf::PdmUiItem* uiItem : currentSelection ) -// { -// caf::PdmObject* pdmObject = dynamic_cast( uiItem ); -// if ( pdmObject ) -// { -// std::vector ancestralViews = pdmObject->allAncestorsOrThisOfType(); -// for ( auto ancestralView : ancestralViews ) -// { -// if ( ancestralView == activatedView ) -// { -// childSelected = true; -// } -// } -// } -// } -// if ( !childSelected ) -// { -// selectAsCurrentItem( activatedView ); -// } -// } -// } -// -// updateWellLogPlotToolBar(); -// updateMultiPlotToolBar(); -// } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index df3c7c7f2e0..115de521605 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -22,15 +22,11 @@ #include "cafPdmPointer.h" -#include #include #include #include -struct RimMdiWindowGeometry; - -class QMdiSubWindow; class RiuViewer; class RimViewWindow; class RicSummaryPlotEditorDialog; @@ -119,8 +115,6 @@ private slots: void slotBuildWindowActions(); - // void slotSubWindowActivated( QMdiSubWindow* subWindow ); - void selectedObjectsChanged( caf::PdmUiTreeView* projectTree, caf::PdmUiPropertyView* propertyView ); void customMenuRequested( const QPoint& pos ); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index ffc4bb45b1d..84e61ed82ee 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -107,7 +107,6 @@ RiuQwtPlotWidget::RiuQwtPlotWidget( RimPlot* plotDefinition, QWidget* parent ) SLOT( onPlotItemSelected( std::shared_ptr, bool, int ) ) ); connect( this, SIGNAL( onKeyPressEvent( QKeyEvent* ) ), plotDefinition, SLOT( onKeyPressEvent( QKeyEvent* ) ) ); connect( this, SIGNAL( onWheelEvent( QWheelEvent* ) ), plotDefinition, SLOT( onWheelEvent( QWheelEvent* ) ) ); - connect( this, SIGNAL( onMousePressEvent( QMouseEvent* ) ), plotDefinition, SLOT( onMousePressEvent( QMouseEvent* ) ) ); connect( this, SIGNAL( destroyed() ), plotDefinition, SLOT( onViewerDestroyed() ) ); } diff --git a/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp b/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp index 9c2feabf3fc..89bb571e7ea 100644 --- a/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp +++ b/ApplicationLibCode/UserInterface/RiuTofAccumulatedPhaseFractionsPlot.cpp @@ -39,7 +39,6 @@ #include #include -#include #include #include diff --git a/ApplicationLibCode/UserInterface/RiuViewerToViewInterface.h b/ApplicationLibCode/UserInterface/RiuViewerToViewInterface.h index d33440fbe3a..95c87b37f48 100644 --- a/ApplicationLibCode/UserInterface/RiuViewerToViewInterface.h +++ b/ApplicationLibCode/UserInterface/RiuViewerToViewInterface.h @@ -27,7 +27,6 @@ class RimCase; class RimViewLinker; -struct RimMdiWindowGeometry; class RimViewController; namespace caf From e77145c0d9411b3f36ff02cd09e0337f29f21c56 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 26 May 2026 19:05:56 +0200 Subject: [PATCH 23/47] Work in progress --- .../Application/RiaPlotWindowRedrawScheduler.cpp | 11 +++++++++++ ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp | 1 + .../UserInterface/RiuMainWindowBase.cpp | 1 + ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp | 2 ++ 4 files changed, 15 insertions(+) diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp index 8225ea7c082..d5da7748632 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp @@ -18,10 +18,14 @@ #include "RiaPlotWindowRedrawScheduler.h" +#include "RimViewWindow.h" + #include "RiuMultiPlotBook.h" #include "RiuMultiPlotPage.h" #include "RiuPlotWidget.h" +#include "DockWidget.h" + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -108,6 +112,13 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdates() if ( pagesToUpdate.count( page ) > 0 ) pagesToUpdate.erase( page ); } } + + // TODO - add method to viewer interface to get dock container size + if ( auto pdmView = plotBook->ownerViewWindow() ) + { + QSize s = pdmView->dockWidget()->size(); + plotBook->resize( s ); + } plotBook->performUpdate( updateType ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 3e03e8bddbd..55413b21760 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -353,6 +353,7 @@ void RimMultiPlot::doUpdateLayout() m_viewer->setPagePreviewModeEnabled( m_pagePreviewMode() ); m_viewer->scheduleUpdate(); + m_viewer->updateGeometry(); m_viewer->adjustSize(); } } diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 62385bbf29f..33afbb9d211 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -102,6 +102,7 @@ RiuMainWindowBase::~RiuMainWindowBase() { for ( auto v : m_projectTreeViews ) { + v->setPdmItem( nullptr ); delete v; } diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 0ccb073da19..53c9209e56b 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -452,6 +452,8 @@ void RiuMultiPlotBook::applyPagePreviewBookSize( int frameWidth ) //-------------------------------------------------------------------------------------------------- void RiuMultiPlotBook::applyBookSize( int frameWidth, int frameHeight ) { + qDebug() << "Size " << frameWidth << " x " << frameHeight << "\n"; + if ( frameWidth == 54 ) return; int totalHeight = 0; for ( auto page : m_pages ) { From dfb6c0bdb7ec79b649169cd48f0971694ec5240a Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Thu, 28 May 2026 01:34:48 +0200 Subject: [PATCH 24/47] Plot window default dock states --- .../UserInterface/RiuDockWidgetTools.cpp | 98 ++++++++++--------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index 4a2746f1052..084775aa006 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -615,31 +615,31 @@ QByteArray RiuDockWidgetTools::defaultPlotDockState() // start paste static const char stateData[] = - { '\x00', '\x00', '\x05', '\x83', '\x78', '\xda', '\xa5', '\x54', '\x5d', '\x6f', '\x82', '\x30', '\x14', '\x7d', '\xdf', '\xaf', - '\x68', '\xfa', '\xee', '\x00', '\x75', '\x8e', '\x25', '\xa8', '\x31', '\x3a', '\xdf', '\xdc', '\x17', '\x38', '\x1f', '\x4d', - '\x47', '\x6f', '\x58', '\x33', '\x68', '\x49', '\x5b', '\xdc', '\x5c', '\xf6', '\xe3', '\x57', '\x60', '\x61', '\x1f', '\x01', - '\x44', '\xf7', '\x40', '\x68', '\xef', '\x3d', '\xa7', '\xe7', '\xdc', '\xf4', '\xa4', '\xde', '\xf4', '\x2d', '\x89', '\xd1', - '\x0e', '\xa4', '\x62', '\x82', '\x8f', '\xb1', '\x73', '\x6e', '\x63', '\x04', '\x3c', '\x14', '\x94', '\xf1', '\x68', '\x8c', - '\xd7', '\xc1', '\xb2', '\xe7', '\xe2', '\xe9', '\xc4', '\xbb', '\xd7', '\x33', '\xba', '\x23', '\x3c', '\x04', '\xba', '\x10', - '\xe1', '\x8b', '\xe9', '\xf9', '\x7b', '\xa5', '\x21', '\x41', '\x8f', '\x15', '\x11', '\xa3', '\xb5', '\x02', '\x59', '\xed', - '\x07', '\x18', '\xcd', '\x05', '\xd7', '\x84', '\x71', '\x53', '\x29', '\xda', '\x73', '\xe0', '\x5a', '\x92', '\x78', '\xc3', - '\x68', '\x04', '\x7a', '\x8c', '\xa9', '\x39', '\xe7', '\x2e', '\x16', '\x7a', '\xc3', '\x38', '\x15', '\xaf', '\xdb', '\xc4', - '\x20', '\xbf', '\xb7', '\x78', '\xe2', '\x55', '\x6c', '\xb4', '\x8c', '\x05', '\xd1', '\x85', '\x1d', '\xdb', '\xd4', '\xfd', - '\x34', '\x66', '\x5a', '\x9b', '\xf2', '\xad', '\x64', '\xe6', '\x44', '\xd3', '\xc9', '\xe5', '\x3e', '\x72', '\xb9', '\x8c', - '\xeb', '\x5c', '\xb8', '\x09', '\xd3', '\xab', '\x30', '\x7d', '\x83', '\x99', '\x49', '\x20', '\x28', '\x20', '\x4f', '\xaa', - '\xf4', '\x9a', '\x49', '\x09', '\xfc', '\x87', '\x2d', '\x15', '\x48', '\x80', '\x6d', '\x6a', '\x56', '\x2b', '\xe3', '\xa2', - '\x72', '\x55', '\xba', '\x47', '\x37', '\x24', '\x81', '\x03', '\x58', '\x34', '\x8f', '\x85', '\x02', '\x9a', '\x9b', '\xb6', - '\x6a', '\x78', '\x01', '\x24', '\x69', '\x4c', '\x34', '\x9c', '\xc2', '\xf5', '\x43', '\xc9', '\xd2', '\x2e', '\xaa', '\x56', - '\x3e', '\xe4', '\xaf', '\x51', '\x9d', '\xbf', '\xa3', '\x4a', '\x91', '\x82', '\xd4', '\xfb', '\x6b', '\xca', '\xb4', '\x90', - '\x5d', '\xe6', '\x6d', '\x25', '\xd4', '\xca', '\xfb', '\xec', '\x1d', '\xd4', '\xc4', '\xb1', '\xed', '\x0b', '\x34', '\x18', - '\x5d', '\x22', '\xcf', '\x2a', '\x0b', '\xe6', '\xff', '\x75', '\x4d', '\xed', '\x0e', '\x1b', '\x33', '\x62', '\x82', '\x41', - '\xa2', '\x82', '\xd1', '\x70', '\x2f', '\x0d', '\xb4', '\x5a', '\x8f', '\x07', '\x12', '\x33', '\x68', '\x4f', '\xcc', '\x82', - '\x68', '\xe2', '\x8b', '\x4c', '\x86', '\xd0', '\x31', '\x36', '\xed', '\x84', '\x03', '\xf7', '\x6f', '\xba', '\x19', '\x3d', - '\x25', '\x37', '\x59', '\x92', '\x10', '\xb9', '\xbf', '\x2b', '\x48', '\x9c', '\x44', '\x20', '\xff', '\x99', '\x97', '\x07', - '\x16', '\x3d', '\xeb', '\xa3', '\x43', '\x53', '\xcb', '\x3a', '\xd6', '\xc8', '\x0a', '\x94', '\x32', '\x13', '\xa8', '\x0e', - '\xea', '\x4d', '\xd0', '\x96', '\xb0', '\xba', '\xb6', '\x8d', '\xfa', '\x6e', '\xfe', '\xb9', '\xb5', '\x79', '\x2d', '\x2b', - '\x43', '\xdb', '\x41', '\xce', '\x68', '\x74', '\x85', '\x86', '\x6e', '\xbf', '\x16', '\x66', '\x55', '\x8f', '\x98', '\x59', - '\x37', '\x3c', '\xa1', '\x93', '\xb3', '\x4f', '\x33', '\x96', '\xe9', '\xd8' }; + { '\x00', '\x00', '\x05', '\x5e', '\x78', '\xda', '\xa5', '\x54', '\x51', '\x4f', '\xc2', '\x30', '\x10', '\x7e', '\xf7', '\x57', + '\x34', '\x7b', '\x47', '\xb6', '\x81', '\x80', '\xc9', '\x18', '\x21', '\x20', '\x6f', '\x28', '\x3a', '\x90', '\x47', '\x53', + '\xd7', '\xcb', '\x6c', '\xdc', '\xda', '\xa5', '\xed', '\x50', '\x8c', '\x3f', '\xde', '\xdb', '\x20', '\x4b', '\x20', '\x63', + '\x0c', '\x7c', '\x6a', '\x7b', '\xf7', '\x7d', '\x77', '\xdf', '\xb5', '\x5f', '\xea', '\x8d', '\xbe', '\x93', '\x98', '\x6c', + '\x40', '\x69', '\x2e', '\xc5', '\xd0', '\x72', '\x6e', '\x6d', '\x8b', '\x80', '\x08', '\x25', '\xe3', '\x22', '\x1a', '\x5a', + '\xab', '\xe5', '\xac', '\x35', '\xb0', '\x46', '\xbe', '\xf7', '\x6c', '\xc6', '\x6c', '\x43', '\x45', '\x08', '\x6c', '\x2a', + '\xc3', '\x4f', '\xcc', '\x05', '\x5b', '\x6d', '\x20', '\x21', '\xaf', '\x25', '\xd1', '\x22', '\x2b', '\x0d', '\xaa', '\x3c', + '\x77', '\x2d', '\x32', '\x91', '\xc2', '\x50', '\x2e', '\x30', '\x52', '\xa4', '\x27', '\x20', '\x8c', '\xa2', '\xf1', '\x9a', + '\xb3', '\x08', '\xcc', '\xd0', '\x62', '\x58', '\x67', '\x0d', '\x71', '\x28', '\x13', '\x08', '\x42', '\x05', '\x20', '\x2c', + '\xdf', '\x2b', '\x19', '\x64', '\x16', '\x4b', '\x6a', '\x0a', '\x09', '\x36', '\xc6', '\x83', '\x34', '\xe6', '\xc6', '\x60', + '\xf8', '\x49', '\x71', '\xac', '\x82', '\x99', '\xbc', '\xc5', '\x6f', '\xde', '\x22', '\x13', '\x58', '\xab', '\x73', '\x12', + '\xd3', '\x2a', '\x31', '\x2e', '\x62', '\xc6', '\x0a', '\x28', '\x59', '\xd2', '\x77', '\x9d', '\x53', '\xc8', '\x24', '\x53', + '\x0a', '\xc4', '\x5e', '\xca', '\x22', '\x96', '\x46', '\x2f', '\x51', '\xc7', '\x5b', '\x8a', '\xbb', '\x39', '\xaa', '\x58', + '\x73', '\xc1', '\xe4', '\x17', '\xb2', '\x76', '\x8a', '\xc9', '\x23', '\x4d', '\xe0', '\x0c', '\x96', '\x4c', '\x62', '\xa9', + '\x81', '\xe5', '\xa2', '\xdb', '\x15', '\xbc', '\x25', '\x24', '\x69', '\x4c', '\x0d', '\x5c', '\xc3', '\xc5', '\x3b', '\xe2', + '\x69', '\x93', '\xae', '\xed', '\x7c', '\xc8', '\x83', '\x51', '\x9d', '\xe3', '\x51', '\x95', '\x4c', '\x41', '\x99', '\xed', + '\x03', '\xe3', '\x46', '\xaa', '\x26', '\xf3', '\xd6', '\x12', '\x2a', '\xdb', '\x07', '\xfc', '\x07', '\xb4', '\xdf', '\xbb', + '\xef', '\x93', '\x8e', '\x63', '\x13', '\xaf', '\xbd', '\x3b', '\xe3', '\xba', '\x7f', '\xa5', '\x5a', '\x81', '\x87', '\xb6', + '\x40', '\x2f', '\xd0', '\xa8', '\x40', '\x55', '\x48', '\x3b', '\x82', '\x56', '\x4a', '\x39', '\x63', '\x8c', '\x4e', '\xbd', + '\x31', '\xa6', '\xd4', '\xd0', '\x40', '\x66', '\x2a', '\x84', '\x86', '\xee', '\xa8', '\x27', '\x9c', '\x79', '\x66', '\xcc', + '\x66', '\xec', '\x1a', '\x7b', '\x64', '\x49', '\x42', '\xd5', '\x76', '\x51', '\x90', '\x04', '\x8d', '\x40', '\xfd', '\xd3', + '\x16', '\x2f', '\x3c', '\xfa', '\x30', '\x17', '\x7b', '\xa3', '\x92', '\x75', '\xa9', '\x90', '\x39', '\x68', '\x8d', '\x13', + '\xe8', '\x06', '\xdd', '\x4f', '\x41', '\xeb', '\x3c', '\xe9', '\xf4', '\x88', '\x33', '\xb8', '\x23', '\xae', '\xed', '\x54', + '\xfa', '\x72', '\x17', '\xe9', '\xf4', '\x6d', '\xe2', '\xb8', '\xae', '\x43', '\xba', '\xdd', '\x7e', '\x25', '\xac', '\x5d', + '\xfe', '\x55', '\xb8', '\x3f', '\xf1', '\x3b', '\xfa', '\x37', '\x7f', '\xf8', '\x8b', '\xda', '\x8b' }; // end paste @@ -702,29 +702,31 @@ QByteArray RiuDockWidgetTools::hideAllDockingPlotState() // start paste static const char stateData[] = - { '\x00', '\x00', '\x04', '\xae', '\x78', '\xda', '\x9d', '\x54', '\xc1', '\x6e', '\x82', '\x40', '\x10', '\xbd', '\xf7', '\x2b', - '\x36', '\x7b', '\xb7', '\x20', '\xa6', '\x8d', '\x07', '\xc4', '\x18', '\xad', '\x37', '\x5b', '\x1b', '\xb0', '\x1e', '\xcd', - '\x96', '\x9d', '\x90', '\x4d', '\x61', '\x97', '\xec', '\x2e', '\xb6', '\x36', '\xfd', '\xf8', '\x0e', '\xa8', '\x58', '\x2d', - '\x18', '\xf5', '\x04', '\x33', '\xf3', '\xde', '\xce', '\x1b', '\xde', '\xb0', '\xfe', '\xf0', '\x2b', '\x4b', '\xc9', '\x1a', - '\xb4', '\x11', '\x4a', '\x0e', '\x68', '\xf7', '\xde', '\xa5', '\x04', '\x64', '\xac', '\xb8', '\x90', '\xc9', '\x80', '\x2e', - '\xa2', '\x69', '\xa7', '\x4f', '\x87', '\x81', '\xff', '\x6a', '\x47', '\x7c', '\xcd', '\x64', '\x0c', '\x7c', '\xa2', '\xe2', - '\x0f', '\xac', '\x85', '\x1b', '\x63', '\x21', '\x23', '\x6f', '\x35', '\x91', '\x92', '\x85', '\x01', '\x5d', '\xc7', '\x3d', - '\x4a', '\xc6', '\x4a', '\x5a', '\x26', '\x24', '\x66', '\xaa', '\xf2', '\x18', '\xa4', '\xd5', '\x2c', '\x5d', '\x0a', '\x9e', - '\x80', '\x1d', '\x50', '\x8e', '\xe7', '\xcc', '\x53', '\x65', '\x97', '\x42', '\x72', '\xf5', '\xb9', '\xca', '\x10', '\x79', - '\x08', '\x69', '\xe0', '\xd7', '\x6c', '\x32', '\x4d', '\x15', '\xb3', '\x95', '\x1c', '\x17', '\xf3', '\x61', '\x9e', '\x0a', - '\x6b', '\x31', '\xfd', '\xa2', '\x05', '\x9e', '\x88', '\x95', '\xb2', '\xdd', '\x4f', '\xd9', '\xae', '\x90', '\xb6', '\x6c', - '\xdc', '\x86', '\xe9', '\xd4', '\x18', '\x0f', '\x31', '\x23', '\x0d', '\x8c', '\x44', '\xec', '\xdd', '\x6c', '\xb5', '\x16', - '\x5a', '\x83', '\xdc', '\xc9', '\x0a', '\x63', '\x2d', '\x72', '\x6b', '\x22', '\x0d', '\xb0', '\xca', '\x51', '\xd3', '\x0c', - '\x75', '\xd4', '\xba', '\xb6', '\xfa', '\xc9', '\x33', '\xcb', '\xe0', '\x30', '\x44', '\x23', '\x96', '\x8c', '\x53', '\x65', - '\x80', '\x97', '\xc3', '\x3b', '\x0d', '\xbc', '\x08', '\xb2', '\x3c', '\x65', '\x16', '\x6e', '\xe1', '\x9e', '\x51', '\x78', - '\xcc', '\x74', '\xca', '\x31', '\x8f', '\x86', '\xed', '\x9e', '\x0c', '\x3b', '\xd7', '\x2a', '\x07', '\x6d', '\x37', '\x4f', - '\x5c', '\x58', '\xa5', '\x2f', '\x99', '\xf7', '\x2c', '\xa1', '\xb1', '\x7d', '\x28', '\xbe', '\xc1', '\x04', '\x2e', '\xe9', - '\x7a', '\xfd', '\x1e', '\xf1', '\x9d', '\x6d', '\x88', '\xcf', '\x9d', '\x4d', '\xe7', '\xf5', '\xb5', '\xee', '\x08', '\x2e', - '\x06', '\x4b', '\x2a', '\x46', '\x8b', '\x2b', '\x2d', '\xb4', '\xbd', '\x42', '\xf7', '\xaf', '\xc2', '\xeb', '\x36', '\xc6', - '\x3b', '\xdd', '\x98', '\x22', '\xcb', '\x98', '\xde', '\xcc', '\xab', '\x6f', '\x21', '\x59', '\x02', '\xba', '\x49', '\xd3', - '\x84', '\x59', '\x16', '\xaa', '\x42', '\xc7', '\x70', '\x8b', '\xe5', '\xff', '\x5b', '\x5c', '\x6b', '\xf5', '\x0c', '\x8c', - '\x41', '\xa2', '\xb9', '\xc0', '\xe4', '\x36', '\xe8', '\x6d', '\xf6', '\xee', '\x01', '\xde', '\xc3', '\xa3', '\x4b', '\xdc', - '\x46', '\x88', '\x53', '\xff', '\xef', '\xf8', '\xde', '\x72', '\xdb', '\x04', '\x77', '\xbf', '\xe8', '\x23', '\x9f', '\x33' }; + { '\x00', '\x00', '\x05', '\x4d', '\x78', '\xda', '\xa5', '\x94', '\x4f', '\x73', '\x82', '\x30', '\x10', '\xc5', '\xef', '\xfd', + '\x14', '\x19', '\xee', '\x16', '\x50', '\x0f', '\x1e', '\x10', '\xc7', '\xc1', '\x7a', '\xb3', '\xb5', '\x05', '\xeb', '\xb1', + '\x93', '\x92', '\x1d', '\x9a', '\x29', '\x24', '\x4c', '\x12', '\x6c', '\xed', '\xf4', '\xc3', '\x77', '\x41', '\x65', '\xaa', + '\x45', '\xfc', '\xd3', '\x13', '\x24', '\xfb', '\x5e', '\xf6', '\xb7', '\x93', '\x37', '\xf1', '\x46', '\x9f', '\x59', '\x4a', + '\x56', '\xa0', '\x34', '\x97', '\x62', '\x68', '\xb9', '\xb7', '\x8e', '\x45', '\x40', '\xc4', '\x92', '\x71', '\x91', '\x0c', + '\xad', '\x45', '\x34', '\xed', '\x0c', '\xac', '\x91', '\xef', '\x3d', '\x9a', '\x31', '\x5b', '\x51', '\x11', '\x03', '\x9b', + '\xc8', '\xf8', '\x1d', '\x6b', '\xe1', '\x5a', '\x1b', '\xc8', '\xc8', '\x73', '\x6d', '\xb4', '\xc8', '\x42', '\x83', '\xaa', + '\xd7', '\x7d', '\x8b', '\x04', '\x52', '\x18', '\xca', '\x05', '\xee', '\x54', '\xe5', '\x00', '\x84', '\x51', '\x34', '\x5d', + '\x72', '\x96', '\x80', '\x19', '\x5a', '\x0c', '\xcf', '\x59', '\x42', '\x1a', '\xcb', '\x0c', '\xc2', '\x58', '\x01', '\x08', + '\xcb', '\xf7', '\x6a', '\x07', '\x99', '\xa6', '\x92', '\x9a', '\x0a', '\xc1', '\xc1', '\xfd', '\x30', '\x4f', '\xb9', '\x31', + '\xb8', '\xfd', '\xa0', '\x38', '\x9e', '\x82', '\x95', '\xb2', '\xc5', '\x77', '\xd9', '\xa2', '\x10', '\x78', '\x56', '\xef', + '\xa8', '\xa6', '\x53', '\x6b', '\xba', '\xa8', '\x19', '\x2b', '\xa0', '\x24', '\xa2', '\xaf', '\xba', '\xb4', '\x90', '\xa0', + '\x50', '\x0a', '\xc4', '\x16', '\x05', '\x19', '\x78', '\x6e', '\x74', '\x84', '\x24', '\x2f', '\x79', '\x2a', '\xcd', '\x0c', + '\x39', '\x96', '\x5c', '\x30', '\xf9', '\x81', '\xbe', '\x0d', '\x33', '\xb9', '\xa7', '\x19', '\x6c', '\xd4', '\x73', '\x54', + '\x34', '\x6a', '\x49', '\x90', '\x4a', '\x0d', '\xac', '\x1c', '\xd8', '\x6e', '\xf0', '\x45', '\x90', '\xe5', '\x29', '\x35', + '\x70', '\x8d', '\xb7', '\x85', '\x70', '\xdf', '\x69', '\x97', '\x63', '\xee', '\x0d', '\xeb', '\x1e', '\x0c', '\x3b', '\x57', + '\x32', '\x07', '\x65', '\xd6', '\x77', '\x8c', '\x1b', '\xa9', '\xce', '\x99', '\xb7', '\xd5', '\xd0', '\xd8', '\x3e', '\xe4', + '\x5f', '\xa0', '\x7d', '\x87', '\xb8', '\x8e', '\xdb', '\x25', '\x9e', '\xbd', '\x59', '\xe2', '\x77', '\x7b', '\x4d', '\xad', + '\x7c', '\xfb', '\xb9', '\xc0', '\x30', '\xd0', '\xa4', '\x52', '\x35', '\x90', '\x1d', '\x48', '\x77', '\x24', '\xce', '\x6f', + '\x92', '\x13', '\xc9', '\xe8', '\x9d', '\x48', '\x46', '\x91', '\x65', '\x54', '\xad', '\xe7', '\xd5', '\xcc', '\x82', '\x26', + '\xa0', '\x9a', '\x38', '\x26', '\xd4', '\xd0', '\x50', '\x16', '\x2a', '\x86', '\x2b', '\xae', '\x16', '\xab', '\x05', '\xbb', + '\x26', '\x12', '\x7f', '\xd1', '\xfe', '\x17', '\x85', '\x27', '\x9e', '\xbc', '\x99', '\x8b', '\xf3', '\xd0', '\xe8', '\xba', + '\x14', '\x64', '\x06', '\x5a', '\xe3', '\x04', '\xfa', '\x8c', '\xee', '\xc7', '\xa4', '\xad', '\x39', '\x6c', '\x49', '\xe2', + '\x4e', '\xd2', '\x75', '\xfa', '\x03', '\xd4', '\x35', '\x49', '\xec', '\xfa', '\x69', '\xc2', '\xff', '\x23', '\x8f', '\xa1', + '\x7f', '\xf3', '\x03', '\xbc', '\x34', '\xd5', '\x5b' }; // end paste From 7633564d1e86ad77608d52e1696e32bc3dacf066 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Thu, 28 May 2026 18:32:16 +0200 Subject: [PATCH 25/47] Store dock state in project --- .../Application/RiaGuiApplication.cpp | 41 +++++++++++++--- .../Application/RiaGuiApplication.h | 6 ++- .../ProjectDataModel/RimProject.cpp | 48 ++----------------- .../ProjectDataModel/RimProject.h | 14 ++---- .../UserInterface/RiuDockWidgetTools.cpp | 39 +++++++++++++++ .../UserInterface/RiuDockWidgetTools.h | 4 +- .../UserInterface/RiuMainWindowBase.cpp | 34 +++++++------ .../UserInterface/RiuMainWindowBase.h | 7 ++- 8 files changed, 112 insertions(+), 81 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 793b5788d50..1d93d806724 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -227,11 +227,6 @@ RiaGuiApplication::~RiaGuiApplication() } processEvents(); - - delete m_mainWindow.data(); - m_mainWindow.clear(); - - m_mainPlotWindow.reset(); } //-------------------------------------------------------------------------------------------------- @@ -404,6 +399,37 @@ void RiaGuiApplication::storeTreeViewState() } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaGuiApplication::storeDockState() +{ + if ( m_mainWindow ) + { + project()->mainWindowDockState = m_mainWindow->dockWidgetStateString(); + } + + if ( m_mainPlotWindow ) + { + project()->plotWindowDockState = m_mainPlotWindow->dockWidgetStateString(); + } +} +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiaGuiApplication::restoreDockState() +{ + if ( m_mainWindow && !project()->mainWindowDockState().isEmpty() ) + { + m_mainWindow->restoreDockWidgetState( project()->mainWindowDockState ); + } + + if ( m_mainPlotWindow && !project()->plotWindowDockState().isEmpty() ) + { + m_mainPlotWindow->restoreDockWidgetState( project()->plotWindowDockState ); + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1074,7 +1100,7 @@ void RiaGuiApplication::createMainPlotWindow() // Always enable undo/redo framework, as multi-select operations perform significantly better with it enabled caf::CmdExecCommandManager::instance()->enableUndoCommandSystem( true ); - m_mainPlotWindow = std::make_unique(); + m_mainPlotWindow = new RiuPlotMainWindow(); m_mainPlotWindow->setWindowTitle( "Plots - ResInsight" ); m_mainPlotWindow->setDefaultWindowSize(); m_mainPlotWindow->loadWinGeoAndDockToolBarLayout(); @@ -1376,6 +1402,8 @@ void RiaGuiApplication::onProjectOpened() m_mainPlotWindow->raise(); m_mainPlotWindow->activateWindow(); } + + restoreDockState(); } //-------------------------------------------------------------------------------------------------- @@ -1417,6 +1445,7 @@ void RiaGuiApplication::onProjectBeingSaved() { setLastUsedDialogDirectory( "BINARY_GRID", QFileInfo( m_project->fileName() ).absolutePath() ); storeTreeViewState(); + storeDockState(); if ( auto sumCaseMainColl = RiaSummaryTools::summaryCaseMainCollection() ) { diff --git a/ApplicationLibCode/Application/RiaGuiApplication.h b/ApplicationLibCode/Application/RiaGuiApplication.h index 728ff457c6f..5d6be3604d1 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.h +++ b/ApplicationLibCode/Application/RiaGuiApplication.h @@ -156,14 +156,16 @@ class RiaGuiApplication : public QApplication, public RiaApplication void createMainPlotWindow(); void storeTreeViewState(); + void storeDockState(); + void restoreDockState(); private slots: void slotWorkerProcessFinished( int exitCode, QProcess::ExitStatus exitStatus ); void onLastWindowClosed(); private: - QPointer m_mainWindow; - std::unique_ptr m_mainPlotWindow; + QPointer m_mainWindow; + QPointer m_mainPlotWindow; std::unique_ptr m_recentFileActionProvider; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index e1d0d4c06dc..2e4c5da19b1 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -171,11 +171,11 @@ RimProject::RimProject() CAF_PDM_InitField( &m_showPlotWindowOnTopOf3DWindow, "showPlotWindowOnTopOf3DWindow", false, "Show Plot On Top" ); m_showPlotWindowOnTopOf3DWindow.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_subWindowsTiled3DWindow_OBSOLETE, "tiled3DWindow", false, "Tile 3D Window" ); - m_subWindowsTiled3DWindow_OBSOLETE.uiCapability()->setUiHidden( true ); + CAF_PDM_InitField( &mainWindowDockState, "MainWindowDockState", QString(), "Dock State 3D Window" ); + mainWindowDockState.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_subWindowsTiledPlotWindow_OBSOLETE, "tiledPlotWindow", false, "Tile Plot Window" ); - m_subWindowsTiledPlotWindow_OBSOLETE.uiCapability()->setUiHidden( true ); + CAF_PDM_InitField( &plotWindowDockState, "PlotWindowDockState", QString(), "Dock State Plot Window" ); + plotWindowDockState.uiCapability()->setUiHidden( true ); CAF_PDM_InitFieldNoDefault( &m_dialogData, "DialogData", "DialogData" ); m_dialogData = new RimDialogData(); @@ -188,11 +188,6 @@ RimProject::RimProject() CAF_PDM_InitFieldNoDefault( &caseGroupsObsolete, "CaseGroups", "" ); RiaFieldHandleTools::disableWriteAndSetFieldHidden( &caseGroupsObsolete ); - CAF_PDM_InitFieldNoDefault( &m_subWindowsTileMode3DWindow, "TileMode3DWindow", "TileMode3DWindow" ); - m_subWindowsTileMode3DWindow.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault( &m_subWindowsTileModePlotWindow, "TileModePlotWindow", "TileModePlotWindow" ); - m_subWindowsTileModePlotWindow.uiCapability()->setUiHidden( true ); - // Initialization scriptCollection = new RimScriptCollection(); @@ -329,9 +324,6 @@ void RimProject::updatesAfterProjectFileIsRead() RimOilField* oilField = oilFields[oilFieldIdx]; if ( oilField == nullptr || oilField->wellPathCollection == nullptr ) continue; } - - if ( m_subWindowsTiled3DWindow_OBSOLETE ) m_subWindowsTileMode3DWindow = RiaDefines::WindowTileMode::DEFAULT; - if ( m_subWindowsTiledPlotWindow_OBSOLETE ) m_subWindowsTileModePlotWindow = RiaDefines::WindowTileMode::DEFAULT; } //-------------------------------------------------------------------------------------------------- @@ -1008,38 +1000,6 @@ bool RimProject::showPlotWindowOnTop() const return m_showPlotWindowOnTopOf3DWindow(); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiaDefines::WindowTileMode RimProject::subWindowsTileMode3DWindow() const -{ - return m_subWindowsTileMode3DWindow(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -RiaDefines::WindowTileMode RimProject::subWindowsTileModePlotWindow() const -{ - return m_subWindowsTileModePlotWindow(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimProject::setSubWindowsTileMode3DWindow( RiaDefines::WindowTileMode tileMode ) -{ - m_subWindowsTileMode3DWindow = tileMode; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimProject::setSubWindowsTileModePlotWindow( RiaDefines::WindowTileMode tileMode ) -{ - m_subWindowsTileModePlotWindow = tileMode; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.h b/ApplicationLibCode/ProjectDataModel/RimProject.h index 25e592e4212..c2eb9917437 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.h +++ b/ApplicationLibCode/ProjectDataModel/RimProject.h @@ -113,6 +113,9 @@ class RimProject : public caf::PdmDocument caf::PdmField plotWindowTreeViewStates; caf::PdmField plotWindowCurrentModelIndexPaths; + caf::PdmField mainWindowDockState; + caf::PdmField plotWindowDockState; + bool writeProjectFile(); void setScriptDirectories( const QString& scriptDirectories, int maxFolderDepth ); @@ -154,11 +157,6 @@ class RimProject : public caf::PdmDocument bool showPlotWindow() const; bool showPlotWindowOnTop() const; - RiaDefines::WindowTileMode subWindowsTileMode3DWindow() const; - RiaDefines::WindowTileMode subWindowsTileModePlotWindow() const; - void setSubWindowsTileMode3DWindow( RiaDefines::WindowTileMode tileMode ); - void setSubWindowsTileModePlotWindow( RiaDefines::WindowTileMode tileMode ); - void reloadCompletionTypeResultsInAllViews(); void reloadCompletionTypeResultsForEclipseCase( RimEclipseCase* eclipseCase ); @@ -222,12 +220,6 @@ class RimProject : public caf::PdmDocument caf::PdmField m_showPlotWindow; caf::PdmField m_showPlotWindowOnTopOf3DWindow; - caf::PdmField m_subWindowsTiled3DWindow_OBSOLETE; - caf::PdmField m_subWindowsTiledPlotWindow_OBSOLETE; - - caf::PdmField> m_subWindowsTileMode3DWindow; - caf::PdmField> m_subWindowsTileModePlotWindow; - caf::PdmChildArrayField casesObsolete; // obsolete caf::PdmChildArrayField caseGroupsObsolete; // obsolete }; diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index 084775aa006..b203b7fd6ac 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -18,6 +18,11 @@ #include "RiuDockWidgetTools.h" +#include "RiaGuiApplication.h" + +#include "Rim3dView.h" +#include "RimViewWindow.h" + #include "RiuMainWindow.h" #include "RiuPlotMainWindow.h" @@ -350,6 +355,40 @@ QAction* RiuDockWidgetTools::toggleActionForWidget( const ads::CDockManager* doc return nullptr; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuDockWidgetTools::setDockLayout( RiuMainWindowBase* mainWindow, const QString& layoutName ) +{ + if ( mainWindow == nullptr ) return; + + QString activeViewerName; + if ( auto activeViewer = RiaGuiApplication::instance()->activeReservoirView() ) + { + activeViewerName = activeViewer->dockWindowName(); + } + + if ( auto dm = mainWindow->dockManager() ) + { + QByteArray state = RiuDockWidgetTools::defaultDockState( layoutName ); + if ( dm->restoreState( state, RiuMainWindowBase::DOCKSTATE_VERSION ) ) + { + for ( auto view : mainWindow->viewWindows() ) + { + if ( view->showWindow() && view->dockWidget() ) + { + dm->addDockWidget( ads::DockWidgetArea::CenterDockWidgetArea, view->dockWidget(), dm->centralWidget()->dockAreaWidget() ); + } + } + } + + if ( auto dw = dm->findDockWidget( activeViewerName ) ) + { + dw->setAsCurrentTab(); + } + } +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index ad5f95f9ca3..e8493964ece 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -26,7 +26,7 @@ class QObject; class QAction; -class Rim3dView; +class RiuMainWindowBase; namespace ads { @@ -93,6 +93,8 @@ class RiuDockWidgetTools static QString viewWindowPrefix(); + static void setDockLayout( RiuMainWindowBase* mainWindow, const QString& layoutName ); + static QAction* toggleActionForWidget( const ads::CDockManager* dockManager, const QString& dockWidgetName ); static ads::CDockWidget* findDockWidget( const ads::CDockManager* dockManager, const QString& dockWidgetName ); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 33afbb9d211..ceef1b5ee5d 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -117,6 +117,23 @@ ads::CDockManager* RiuMainWindowBase::dockManager() const return m_dockManager; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuMainWindowBase::dockWidgetStateString() const +{ + return QString::fromUtf8( m_dockManager->saveState( DOCKSTATE_VERSION ).toBase64() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindowBase::restoreDockWidgetState( QString dockStateString ) +{ + QByteArray dockState = QByteArray::fromBase64( dockStateString.toUtf8() ); + m_dockManager->restoreState( dockState, DOCKSTATE_VERSION ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -585,10 +602,7 @@ void RiuMainWindowBase::setDefaultDockLayout() if ( action ) { QString layoutName = action->text(); - - QByteArray state = RiuDockWidgetTools::defaultDockState( layoutName ); - - dockManager()->restoreState( state, DOCKSTATE_VERSION ); + RiuDockWidgetTools::setDockLayout( this, layoutName ); } } @@ -601,7 +615,7 @@ void RiuMainWindowBase::setDockLayout() if ( action ) { QString layoutName = action->text(); - dockManager()->openPerspective( layoutName ); + RiuDockWidgetTools::setDockLayout( this, layoutName ); } } @@ -729,13 +743,6 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu() connect( exportLayoutAction, SIGNAL( triggered() ), this, SLOT( exportDockLayout() ) ); } - // m_windowMenu->addSeparator(); - // QAction* cascadeWindowsAction = new QAction( "Cascade Windows", this ); - // connect( cascadeWindowsAction, SIGNAL( triggered() ), m_mdiArea, SLOT( cascadeSubWindows() ) ); - - // QAction* closeAllSubWindowsAction = new QAction( "Close All Windows", this ); - // connect( closeAllSubWindowsAction, SIGNAL( triggered() ), m_mdiArea, SLOT( closeAllSubWindows() ) ); - caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance(); auto featureNames = windowsMenuFeatureNames(); @@ -743,9 +750,6 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu() { m_windowMenu->addAction( cmdFeatureMgr->action( name ) ); } - - // m_windowMenu->addAction( cascadeWindowsAction ); - // m_windowMenu->addAction( closeAllSubWindowsAction ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 008134e9896..c1ecd8a5ce5 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -59,6 +59,8 @@ class RiuMainWindowBase : public QMainWindow Q_OBJECT public: + static const int DOCKSTATE_VERSION = 4; + RiuMainWindowBase(); ~RiuMainWindowBase() override; @@ -91,6 +93,9 @@ class RiuMainWindowBase : public QMainWindow ads::CDockManager* dockManager() const; + QString dockWidgetStateString() const; + void restoreDockWidgetState( QString dockStateString ); + protected: void createTreeViews( int numberOfTrees ); void setUpCentralDockWidget(); @@ -137,8 +142,6 @@ protected slots: QMenu* m_windowMenu; - const int DOCKSTATE_VERSION = 4; - QByteArray m_lastDockState; std::vector m_projectTreeViews; From cbd02da8df5b0af8282ac24f781ba29843dccba8 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Mon, 1 Jun 2026 14:01:51 +0200 Subject: [PATCH 26/47] Fix reading old projects and restore plot views Fix crash at exit in plot window --- ApplicationLibCode/Application/RiaDefines.h | 6 ------ .../Application/RiaGuiApplication.cpp | 7 ++++--- .../Application/RiaGuiApplication.h | 2 +- .../ProjectDataModel/Rim3dView.cpp | 2 +- .../RimDockWindowController.cpp | 10 ++++----- .../RimDockWindowController.h | 13 ++++++++---- .../ProjectDataModel/RimViewWindow.cpp | 21 +++++++++++-------- .../ProjectDataModel/RimViewWindow.h | 13 ++++++------ .../UserInterface/RiuPlotMainWindow.cpp | 5 +++++ .../cafUserInterface/cafPdmUiPropertyView.cpp | 6 +++++- 10 files changed, 49 insertions(+), 36 deletions(-) diff --git a/ApplicationLibCode/Application/RiaDefines.h b/ApplicationLibCode/Application/RiaDefines.h index 92a0d1637e6..68025e56979 100644 --- a/ApplicationLibCode/Application/RiaDefines.h +++ b/ApplicationLibCode/Application/RiaDefines.h @@ -200,12 +200,6 @@ enum class RINavigationPolicy : short NAVIGATION_POLICY_RMS }; -enum class RIMainWindow -{ - MAIN_WINDOW_3D = 0, - MAIN_WINDOW_PLOTS = 1 -}; - enum class WellProductionType : short { PRODUCER, diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 1d93d806724..aa679285f01 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -57,6 +57,7 @@ #include "RimAnnotationCollection.h" #include "RimAnnotationInViewCollection.h" #include "RimAnnotationTextAppearance.h" +#include "RimDockWindowController.h" #include "RimEclipseCaseCollection.h" #include "RimEclipseView.h" #include "RimFlowPlotCollection.h" @@ -1145,11 +1146,11 @@ RiuPlotMainWindow* RiaGuiApplication::mainPlotWindow() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuMainWindowBase* RiaGuiApplication::mainWindowByID( RiaDefines::RIMainWindow mainWindowID ) +RiuMainWindowBase* RiaGuiApplication::mainWindowByID( int mainWindowID ) { - if ( mainWindowID == RiaDefines::RIMainWindow::MAIN_WINDOW_3D ) + if ( mainWindowID == RimDockWindowController::MAIN_WINDOW_ID_3D ) return m_mainWindow; - else if ( mainWindowID == RiaDefines::RIMainWindow::MAIN_WINDOW_PLOTS ) + else if ( mainWindowID == RimDockWindowController::MAIN_WINDOW_ID_PLOTS ) return m_mainPlotWindow.get(); else return nullptr; diff --git a/ApplicationLibCode/Application/RiaGuiApplication.h b/ApplicationLibCode/Application/RiaGuiApplication.h index 5d6be3604d1..caaaf5da00c 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.h +++ b/ApplicationLibCode/Application/RiaGuiApplication.h @@ -103,7 +103,7 @@ class RiaGuiApplication : public QApplication, public RiaApplication RiuPlotMainWindow* getOrCreateMainPlotWindow(); RiuPlotMainWindow* getOrCreateAndShowMainPlotWindow(); RiuPlotMainWindow* mainPlotWindow(); - RiuMainWindowBase* mainWindowByID( RiaDefines::RIMainWindow mainWindowID ); + RiuMainWindowBase* mainWindowByID( int mainWindowID ); static RimViewWindow* activeViewWindow(); static RiuMainWindowBase* activeMainWindow(); diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 1987f25fc50..955d8b58ae3 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -186,7 +186,7 @@ Rim3dView::Rim3dView() m_annotationsPartManager = new RivAnnotationsPartMgr( this ); m_measurementPartManager = new RivMeasurementPartMgr( this ); - this->dockAs3DViewWindow(); + dockAs3DViewWindow(); // Every timer tick, send a signal for updating animations. // Any animation is supposed to connect to this signal diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index fb9e703b1f9..6155aed346e 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -33,14 +33,14 @@ #include "DockManager.h" #include "DockWidget.h" -CAF_PDM_XML_SOURCE_INIT( RimDockWindowController, "DockWindowController" ); +CAF_PDM_XML_SOURCE_INIT( RimDockWindowController, "DockWindowController", "MdiWindowController" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimDockWindowController::RimDockWindowController() { - m_mainWindowID = RiaDefines::RIMainWindow::MAIN_WINDOW_3D; + CAF_PDM_InitField( &m_mainWindowID, "MainWindowID", RimDockWindowController::MAIN_WINDOW_ID_UNASSIGNED, "" ); CAF_PDM_InitFieldNoDefault( &m_viewToControl, "ViewToControl", "" ); m_viewToControl = nullptr; } @@ -159,7 +159,7 @@ void RimDockWindowController::updateViewerWidget() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimDockWindowController::setMainWindowId( RiaDefines::RIMainWindow mainId ) +void RimDockWindowController::setMainWindowId( int mainId ) { m_mainWindowID = mainId; } @@ -175,9 +175,9 @@ void RimDockWindowController::setViewToControl( RimViewWindow* view ) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiaDefines::RIMainWindow RimDockWindowController::mainWindowId() const +int RimDockWindowController::mainWindowId() const { - return m_mainWindowID; + return m_mainWindowID(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h index 664ba1efd2b..06ebf934b7f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h @@ -36,13 +36,18 @@ class RimDockWindowController : public caf::PdmObject { CAF_PDM_HEADER_INIT; +public: + static constexpr int MAIN_WINDOW_ID_UNASSIGNED = -1; + static constexpr int MAIN_WINDOW_ID_3D = 0; + static constexpr int MAIN_WINDOW_ID_PLOTS = 1; + public: RimDockWindowController(); ~RimDockWindowController() override; - void setMainWindowId( RiaDefines::RIMainWindow mainId ); - void setViewToControl( RimViewWindow* view ); - RiaDefines::RIMainWindow mainWindowId() const; + void setMainWindowId( int mainId ); + void setViewToControl( RimViewWindow* view ); + int mainWindowId() const; void setAsActiveViewer(); @@ -59,6 +64,6 @@ class RimDockWindowController : public caf::PdmObject void setupBeforeSave() override; private: - RiaDefines::RIMainWindow m_mainWindowID; + caf::PdmField m_mainWindowID; caf::PdmPtrField m_viewToControl; }; diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index 979d88363a3..b04b56c179f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -50,12 +50,14 @@ size_t RimViewWindow::m_nextDockWindowId = 0; //-------------------------------------------------------------------------------------------------- RimViewWindow::RimViewWindow() : m_dockWidget( nullptr ) - , m_windowController( nullptr ) , m_dockWindowId( m_nextDockWindowId++ ) - , m_activeViewer( false ) + , m_isActiveViewer( false ) { CAF_PDM_InitScriptableObjectWithNameAndComment( "View window", "", "", "", "ViewWindow", "The Base Class for all Views and Plots in ResInsight" ); + CAF_PDM_InitFieldNoDefault( &m_windowController, "WindowController", "" ); + m_windowController.uiCapability()->setUiTreeChildrenHidden( true ); + CAF_PDM_InitField( &m_showWindow, "ShowWindow", true, "Show Window" ); m_showWindow.uiCapability()->setUiHidden( true ); } @@ -114,7 +116,7 @@ bool RimViewWindow::isMainDockedWindow() const //-------------------------------------------------------------------------------------------------- bool RimViewWindow::isDockedIn3DView() const { - return ( m_windowController != nullptr ) && ( m_windowController->mainWindowId() == RiaDefines::RIMainWindow::MAIN_WINDOW_3D ); + return ( m_windowController != nullptr ) && ( m_windowController->mainWindowId() == RimDockWindowController::MAIN_WINDOW_ID_3D ); } //-------------------------------------------------------------------------------------------------- @@ -122,7 +124,7 @@ bool RimViewWindow::isDockedIn3DView() const //-------------------------------------------------------------------------------------------------- bool RimViewWindow::isDockedInPlotView() const { - return ( m_windowController != nullptr ) && ( m_windowController->mainWindowId() == RiaDefines::RIMainWindow::MAIN_WINDOW_PLOTS ); + return ( m_windowController != nullptr ) && ( m_windowController->mainWindowId() == RimDockWindowController::MAIN_WINDOW_ID_PLOTS ); } //-------------------------------------------------------------------------------------------------- @@ -168,6 +170,7 @@ void RimViewWindow::updateDockWindowVisibility() if ( m_windowController != nullptr ) { + m_windowController->setViewToControl( this ); m_windowController->updateViewerWidget(); } else @@ -191,7 +194,7 @@ void RimViewWindow::updateDockWindowVisibility() //-------------------------------------------------------------------------------------------------- void RimViewWindow::dockAs3DViewWindow() { - dockInWindow( RiaDefines::RIMainWindow::MAIN_WINDOW_3D ); + dockInWindow( RimDockWindowController::MAIN_WINDOW_ID_3D ); } //-------------------------------------------------------------------------------------------------- @@ -199,7 +202,7 @@ void RimViewWindow::dockAs3DViewWindow() //-------------------------------------------------------------------------------------------------- void RimViewWindow::dockAsPlotWindow() { - dockInWindow( RiaDefines::RIMainWindow::MAIN_WINDOW_PLOTS ); + dockInWindow( RimDockWindowController::MAIN_WINDOW_ID_PLOTS ); } //-------------------------------------------------------------------------------------------------- @@ -307,7 +310,7 @@ QString RimViewWindow::dockWindowName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewWindow::dockInWindow( RiaDefines::RIMainWindow mainWindowID ) +void RimViewWindow::dockInWindow( int mainWindowID ) { if ( m_windowController == nullptr ) { @@ -361,7 +364,7 @@ ads::CDockWidget* RimViewWindow::createDockWidget() //-------------------------------------------------------------------------------------------------- void RimViewWindow::setActive( bool active ) { - m_activeViewer = active; + m_isActiveViewer = active; } //-------------------------------------------------------------------------------------------------- @@ -369,5 +372,5 @@ void RimViewWindow::setActive( bool active ) //-------------------------------------------------------------------------------------------------- bool RimViewWindow::isActive() const { - return m_activeViewer; + return m_isActiveViewer; } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index 51bc99d5b13..fd7eb670fde 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -101,15 +101,16 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface private: friend class RimProject; - void dockInWindow( RiaDefines::RIMainWindow mainWindowID ); + void dockInWindow( int mainWindowID ); virtual void assignIdIfNecessary() = 0; protected: - caf::PdmField m_showWindow; - RimDockWindowController* m_windowController; - ads::CDockWidget* m_dockWidget; - size_t m_dockWindowId; - bool m_activeViewer; + caf::PdmChildField m_windowController; + + caf::PdmField m_showWindow; + ads::CDockWidget* m_dockWidget; + size_t m_dockWindowId; + bool m_isActiveViewer; static size_t m_nextDockWindowId; }; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index fbbc6a9e39c..24d1d1aeb71 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -210,6 +210,11 @@ void RiuPlotMainWindow::initializeGuiNewProjectLoaded() } } + for ( auto view : viewWindows() ) + { + view->updateDockWindowVisibility(); + } + refreshToolbars(); // Sync selections with property views. diff --git a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp index 0571f64a69f..4d2be3c33b3 100644 --- a/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp +++ b/Fwk/AppFwk/cafUserInterface/cafPdmUiPropertyView.cpp @@ -115,7 +115,11 @@ PdmUiPropertyView::PdmUiPropertyView( QWidget* parent, Qt::WindowFlags f ) //-------------------------------------------------------------------------------------------------- PdmUiPropertyView::~PdmUiPropertyView() { - if ( m_defaultObjectEditor ) delete m_defaultObjectEditor; + if ( m_defaultObjectEditor ) + { + m_defaultObjectEditor->setPdmObject( nullptr ); + delete m_defaultObjectEditor; + } } //-------------------------------------------------------------------------------------------------- From 1eee0cf8170fb5dfb55ec21c9419f91f30bbc335 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Mon, 1 Jun 2026 15:52:15 +0200 Subject: [PATCH 27/47] Sync plot toolbars with active plot view --- .../ProjectDataModel/RimDockWindowController.cpp | 1 + ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp | 11 +++-------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index 6155aed346e..514950512bb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -216,6 +216,7 @@ void RimDockWindowController::setAsActiveViewer() else if ( auto plotView = dynamic_cast( pdmView ) ) { RiuPlotMainWindowTools::selectAsCurrentItem( plotView ); + RiuPlotMainWindowTools::refreshToolbars(); } } } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index b04b56c179f..ebaaafab624 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -263,6 +263,7 @@ void RimViewWindow::fieldChangedByUi( const caf::PdmFieldHandle* changedField, c if ( isWindowVisible() ) { onLoadDataAndUpdate(); + setAsActiveViewer(); } else { @@ -280,14 +281,8 @@ void RimViewWindow::updateWindowTitle() if ( viewWidget() && dockWidget() ) { viewWidget()->setWindowTitle( windowTitle() ); - if ( dockWidget()->isFloating() && isActive() ) - { - dockWidget()->setWindowTitle( "* " + windowTitle() ); - } - else - { - dockWidget()->setWindowTitle( windowTitle() ); - } + dockWidget()->setWindowTitle( windowTitle() ); + if ( isActive() ) { dockWidget()->setIcon( QIcon( ":/ActiveWindow.svg" ) ); From feb27d61e5b2e9e34ceff37c086ffa0b73495667 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Mon, 1 Jun 2026 15:54:04 +0200 Subject: [PATCH 28/47] Build fix --- .../Application/Tools/RiaRegressionTestRunner.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp index 2b0018f1dc5..ff4ffd6b671 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp @@ -554,9 +554,8 @@ void RiaRegressionTestRunner::setDefaultSnapshotSizeFor3dViews() RiuMainWindow* mainWnd = RiuMainWindow::instance(); if ( !mainWnd ) return; - QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize(); - // TODO - fix snapshot view sizes + // QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize(); // RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, defaultSize.width(), defaultSize.height() ); } @@ -568,9 +567,8 @@ void RiaRegressionTestRunner::setDefaultSnapshotSizeForPlotWindows() RiuPlotMainWindow* plotMainWindow = RiaGuiApplication::instance()->mainPlotWindow(); if ( !plotMainWindow ) return; - QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize(); - // TODO - fix snapshot view sizes + // QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize(); // RiuMainWindowTools::setWindowSizeOnWidgetsInViewWindows( plotMainWindow, defaultSize.width(), defaultSize.height() ); } From 829a19d328a8df4ffd8d1ae439a5786731a416c2 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Mon, 1 Jun 2026 17:34:43 +0200 Subject: [PATCH 29/47] Some cleanup --- .../RiaPlotWindowRedrawScheduler.cpp | 1 - .../ProjectDataModel/Rim3dView.h | 5 -- .../RimDockWindowController.cpp | 7 --- .../RimDockWindowController.h | 3 -- .../Summary/RimSummaryPlot.cpp | 4 -- .../UserInterface/RiuDockWidgetTools.cpp | 4 +- .../UserInterface/RiuDockWidgetTools.h | 2 +- .../UserInterface/RiuMainWindow.cpp | 8 --- .../UserInterface/RiuMainWindow.h | 1 - .../UserInterface/RiuMainWindowBase.cpp | 20 +++---- .../UserInterface/RiuMainWindowBase.h | 2 - .../UserInterface/RiuMultiPlotBook.cpp | 2 - .../UserInterface/RiuPlotMainWindow.cpp | 8 --- .../UserInterface/RiuPlotMainWindow.h | 1 - .../UserInterface/RiuPlotMainWindowTools.cpp | 52 +++++++++---------- .../UserInterface/RiuViewer.cpp | 2 - 16 files changed, 35 insertions(+), 87 deletions(-) diff --git a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp index d5da7748632..ef74e91302c 100644 --- a/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp +++ b/ApplicationLibCode/Application/RiaPlotWindowRedrawScheduler.cpp @@ -113,7 +113,6 @@ void RiaPlotWindowRedrawScheduler::performScheduledUpdates() } } - // TODO - add method to viewer interface to get dock container size if ( auto pdmView = plotBook->ownerViewWindow() ) { QSize s = pdmView->dockWidget()->size(); diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.h b/ApplicationLibCode/ProjectDataModel/Rim3dView.h index 92256eda9e2..d40be63b1e3 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.h +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.h @@ -71,11 +71,6 @@ namespace caf class DisplayCoordTransform; } -namespace ads -{ -class CDockWidget; -} - enum PartRenderMaskEnum { surfaceBit = 1, diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index 514950512bb..4b56f565094 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -110,13 +110,6 @@ RiuMainWindowBase* RimDockWindowController::getMainWindow() return nullptr; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RimDockWindowController::setupBeforeSave() -{ -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h index 06ebf934b7f..e742e3d1460 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.h @@ -60,9 +60,6 @@ class RimDockWindowController : public caf::PdmObject QWidget* viewWidget(); RiuMainWindowBase* getMainWindow(); - // Overridden PDM methods - void setupBeforeSave() override; - private: caf::PdmField m_mainWindowID; caf::PdmPtrField m_viewToControl; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 72624aaaa66..bb70916832f 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -2833,10 +2833,6 @@ void RimSummaryPlot::onPlotItemSelected( std::shared_ptr plotItem, auto rimPlotCurve = riuPlotCurve->ownerRimCurve(); - // if ( auto multiPlot = firstAncestorOrThisOfType() ) - //{ - // RiuPlotMainWindowTools::setActiveViewer( multiPlot->dockWindowName() ); - // } RiuPlotMainWindowTools::selectOrToggleObject( rimPlotCurve, toggle ); } diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index b203b7fd6ac..6b621117b5b 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -64,9 +64,9 @@ QString RiuDockWidgetTools::main3DWindowName() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RiuDockWidgetTools::welcomeScreenName() +QString RiuDockWidgetTools::centralScreenName() { - return "dockWelcomeScreen"; + return "dockCentralScreen"; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index e8493964ece..7b63aa819b1 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -52,7 +52,7 @@ class RiuDockWidgetTools static QString mainPlotWindowName(); static QString main3DWindowName(); - static QString welcomeScreenName(); + static QString centralScreenName(); static QString mainWindowPropertyEditorName(); static QString mainWindowResultInfoName(); diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index 0d023169b32..c792ce8effd 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -2050,14 +2050,6 @@ QStringList RiuMainWindow::defaultDockStateNames() return retList; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QStringList RiuMainWindow::windowsMenuFeatureNames() -{ - return {}; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index 8d02f6d4b78..2d0ffd81d61 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -128,7 +128,6 @@ class RiuMainWindow : public RiuMainWindowBase protected: void closeEvent( QCloseEvent* event ) override; QStringList defaultDockStateNames() override; - QStringList windowsMenuFeatureNames() override; void dragEnterEvent( QDragEnterEvent* event ) override; void dropEvent( QDropEvent* event ) override; diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index ceef1b5ee5d..84cf0b72b95 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -493,11 +493,11 @@ void RiuMainWindowBase::createTreeViews( int numberOfTrees ) //-------------------------------------------------------------------------------------------------- void RiuMainWindowBase::setUpCentralDockWidget() { - m_centralDockWidget = RiuDockWidgetTools::createDockWidget( "Welcome", RiuDockWidgetTools::welcomeScreenName(), this ); - QLabel* welcome = new QLabel(); - welcome->setAutoFillBackground( true ); - welcome->setStyleSheet( "QLabel { background-color: darkgrey; }" ); - m_centralDockWidget->setWidget( welcome ); + m_centralDockWidget = RiuDockWidgetTools::createDockWidget( "", RiuDockWidgetTools::centralScreenName(), this ); + QLabel* label = new QLabel(); + label->setAutoFillBackground( true ); + label->setStyleSheet( "QLabel { background-color: darkgrey; }" ); + m_centralDockWidget->setWidget( label ); m_centralDockWidget->setFeature( ads::CDockWidget::NoTab, true ); dockManager()->setCentralWidget( m_centralDockWidget ); } @@ -702,7 +702,7 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu() keys.sort(); for ( auto& key : keys ) { - if ( key == RiuDockWidgetTools::welcomeScreenName() ) continue; + if ( key == RiuDockWidgetTools::centralScreenName() ) continue; auto dock = dockMap[key]; dockWindowsMenu->addAction( dock->toggleViewAction() ); } @@ -742,14 +742,6 @@ void RiuMainWindowBase::addDefaultEntriesToWindowsMenu() QAction* exportLayoutAction = m_windowMenu->addAction( "Export Layout to Clipboard" ); connect( exportLayoutAction, SIGNAL( triggered() ), this, SLOT( exportDockLayout() ) ); } - - caf::CmdFeatureManager* cmdFeatureMgr = caf::CmdFeatureManager::instance(); - - auto featureNames = windowsMenuFeatureNames(); - for ( const auto& name : featureNames ) - { - m_windowMenu->addAction( cmdFeatureMgr->action( name ) ); - } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index c1ecd8a5ce5..831360c0d9f 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -112,8 +112,6 @@ class RiuMainWindowBase : public QMainWindow virtual QStringList defaultDockStateNames() = 0; - virtual QStringList windowsMenuFeatureNames() = 0; - void showEvent( QShowEvent* event ) override; protected slots: diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 53c9209e56b..0ccb073da19 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -452,8 +452,6 @@ void RiuMultiPlotBook::applyPagePreviewBookSize( int frameWidth ) //-------------------------------------------------------------------------------------------------- void RiuMultiPlotBook::applyBookSize( int frameWidth, int frameHeight ) { - qDebug() << "Size " << frameWidth << " x " << frameHeight << "\n"; - if ( frameWidth == 54 ) return; int totalHeight = 0; for ( auto page : m_pages ) { diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 24d1d1aeb71..f4ed1e5d47e 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -979,14 +979,6 @@ QStringList RiuPlotMainWindow::defaultDockStateNames() return retList; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QStringList RiuPlotMainWindow::windowsMenuFeatureNames() -{ - return {}; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 115de521605..2d21071f531 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -93,7 +93,6 @@ class RiuPlotMainWindow : public RiuMainWindowBase void timerEvent( QTimerEvent* event ) override; QStringList defaultDockStateNames() override; - QStringList windowsMenuFeatureNames() override; private: void setPdmRoot( caf::PdmObject* pdmRoot ); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp index 0eb5029ef24..cd3d83fa09c 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindowTools.cpp @@ -40,9 +40,10 @@ void RiuPlotMainWindowTools::setActiveViewer( QString viewerName ) { if ( RiaGuiApplication::isRunning() ) { - RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); - - if ( mpw ) mpw->setActiveViewer( viewerName ); + if ( auto mpw = RiaGuiApplication::instance()->mainPlotWindow() ) + { + mpw->setActiveViewer( viewerName ); + } } } @@ -53,10 +54,10 @@ void RiuPlotMainWindowTools::setExpanded( const caf::PdmUiItem* uiItem ) { if ( RiaGuiApplication::isRunning() ) { - RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); - - bool expand = true; - if ( mpw ) mpw->setExpanded( uiItem, expand ); + if ( auto mpw = RiaGuiApplication::instance()->mainPlotWindow() ) + { + mpw->setExpanded( uiItem, true ); + } } } @@ -67,10 +68,10 @@ void RiuPlotMainWindowTools::selectAsCurrentItem( const caf::PdmObject* object ) { if ( RiaGuiApplication::isRunning() ) { - RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); - - bool allowActiveViewChange = true; - if ( mpw ) mpw->selectAsCurrentItem( object, allowActiveViewChange ); + if ( auto mpw = RiaGuiApplication::instance()->mainPlotWindow() ) + { + mpw->selectAsCurrentItem( object, true /* allowActiveViewChange */ ); + } } } @@ -81,17 +82,18 @@ const caf::PdmObject* RiuPlotMainWindowTools::firstVisibleAncestorOrThis( const { if ( RiaGuiApplication::isRunning() ) { - RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); - - auto current = const_cast( object ); - while ( current ) + if ( auto mpw = RiaGuiApplication::instance()->mainPlotWindow() ) { - if ( mpw->getTreeViewWithItem( current ) ) + auto current = const_cast( object ); + while ( current ) { - return current; - } + if ( mpw->getTreeViewWithItem( current ) ) + { + return current; + } - current = current->firstAncestorOfType(); + current = current->firstAncestorOfType(); + } } } @@ -105,10 +107,10 @@ void RiuPlotMainWindowTools::toggleItemInSelection( const caf::PdmObject* object { if ( RiaGuiApplication::isRunning() ) { - RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); - - bool allowActiveViewChange = true; - if ( mpw ) mpw->toggleItemInSelection( object, allowActiveViewChange ); + if ( auto mpw = RiaGuiApplication::instance()->mainPlotWindow() ) + { + mpw->toggleItemInSelection( object, true /* allowActiveViewChange */ ); + } } } @@ -134,9 +136,7 @@ void RiuPlotMainWindowTools::refreshToolbars() { if ( RiaGuiApplication::isRunning() ) { - RiuPlotMainWindow* mpw = RiaGuiApplication::instance()->mainPlotWindow(); - - if ( mpw ) + if ( auto mpw = RiaGuiApplication::instance()->mainPlotWindow() ) { mpw->updateWellLogPlotToolBar(); mpw->updateMultiPlotToolBar(); diff --git a/ApplicationLibCode/UserInterface/RiuViewer.cpp b/ApplicationLibCode/UserInterface/RiuViewer.cpp index 0f4ea7b9ff5..a4597d4f884 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewer.cpp @@ -723,8 +723,6 @@ void RiuViewer::mousePressEvent( QMouseEvent* mouseEvent ) if ( mouseEvent ) { m_lastMousePressPosition = mouseEvent->pos(); - - if ( auto ownView = ownerViewWindow() ) ownView->setAsActiveViewer(); } } From 8210d6ffcd8c6fe9376f201c3dc1d31cce150e33 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Tue, 2 Jun 2026 00:55:26 +0200 Subject: [PATCH 30/47] Some fixes --- ApplicationLibCode/ProjectDataModel/RimProject.cpp | 2 ++ ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp | 6 ++++-- ApplicationLibCode/ProjectDataModel/RimViewWindow.h | 8 ++++---- ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp | 2 +- ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp | 4 ++-- ApplicationLibCode/UserInterface/RiuViewer.cpp | 2 ++ 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimProject.cpp b/ApplicationLibCode/ProjectDataModel/RimProject.cpp index 2e4c5da19b1..38ab26da75c 100644 --- a/ApplicationLibCode/ProjectDataModel/RimProject.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimProject.cpp @@ -267,6 +267,8 @@ void RimProject::close() mainWindowTreeViewStates = ""; plotWindowCurrentModelIndexPaths = ""; plotWindowTreeViewStates = ""; + mainWindowDockState = ""; + plotWindowDockState = ""; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index ebaaafab624..56cb1a2c51d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -50,7 +50,6 @@ size_t RimViewWindow::m_nextDockWindowId = 0; //-------------------------------------------------------------------------------------------------- RimViewWindow::RimViewWindow() : m_dockWidget( nullptr ) - , m_dockWindowId( m_nextDockWindowId++ ) , m_isActiveViewer( false ) { CAF_PDM_InitScriptableObjectWithNameAndComment( "View window", "", "", "", "ViewWindow", "The Base Class for all Views and Plots in ResInsight" ); @@ -60,6 +59,9 @@ RimViewWindow::RimViewWindow() CAF_PDM_InitField( &m_showWindow, "ShowWindow", true, "Show Window" ); m_showWindow.uiCapability()->setUiHidden( true ); + + CAF_PDM_InitField( &m_dockWindowId, "DockWindowId", m_nextDockWindowId++, "Dock Window Id" ); + m_dockWindowId.uiCapability()->setUiHidden( true ); } //-------------------------------------------------------------------------------------------------- @@ -299,7 +301,7 @@ void RimViewWindow::updateWindowTitle() //-------------------------------------------------------------------------------------------------- QString RimViewWindow::dockWindowName() const { - return QString( "%1_%2" ).arg( RiuDockWidgetTools::viewWindowPrefix() ).arg( m_dockWindowId ); + return QString( "%1_%2" ).arg( RiuDockWidgetTools::viewWindowPrefix() ).arg( m_dockWindowId() ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index fd7eb670fde..ef64617f1dc 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -107,10 +107,10 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface protected: caf::PdmChildField m_windowController; - caf::PdmField m_showWindow; - ads::CDockWidget* m_dockWidget; - size_t m_dockWindowId; - bool m_isActiveViewer; + caf::PdmField m_showWindow; + ads::CDockWidget* m_dockWidget; + caf::PdmField m_dockWindowId; + bool m_isActiveViewer; static size_t m_nextDockWindowId; }; diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index 6b621117b5b..8cc98fd1416 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -66,7 +66,7 @@ QString RiuDockWidgetTools::main3DWindowName() //-------------------------------------------------------------------------------------------------- QString RiuDockWidgetTools::centralScreenName() { - return "dockCentralScreen"; + return "dockWelcomeScreen"; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 84cf0b72b95..d2283c005b6 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -122,7 +122,7 @@ ads::CDockManager* RiuMainWindowBase::dockManager() const //-------------------------------------------------------------------------------------------------- QString RiuMainWindowBase::dockWidgetStateString() const { - return QString::fromUtf8( m_dockManager->saveState( DOCKSTATE_VERSION ).toBase64() ); + return QString::fromLatin1( m_dockManager->saveState( DOCKSTATE_VERSION ).toBase64() ); } //-------------------------------------------------------------------------------------------------- @@ -130,7 +130,7 @@ QString RiuMainWindowBase::dockWidgetStateString() const //-------------------------------------------------------------------------------------------------- void RiuMainWindowBase::restoreDockWidgetState( QString dockStateString ) { - QByteArray dockState = QByteArray::fromBase64( dockStateString.toUtf8() ); + QByteArray dockState = QByteArray::fromBase64( dockStateString.toLatin1() ); m_dockManager->restoreState( dockState, DOCKSTATE_VERSION ); } diff --git a/ApplicationLibCode/UserInterface/RiuViewer.cpp b/ApplicationLibCode/UserInterface/RiuViewer.cpp index a4597d4f884..0f4ea7b9ff5 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewer.cpp @@ -723,6 +723,8 @@ void RiuViewer::mousePressEvent( QMouseEvent* mouseEvent ) if ( mouseEvent ) { m_lastMousePressPosition = mouseEvent->pos(); + + if ( auto ownView = ownerViewWindow() ) ownView->setAsActiveViewer(); } } From 10da443185fe37c4b5d8377f5af42dc1c82b7e0e Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 2 Jun 2026 13:34:48 +0200 Subject: [PATCH 31/47] Use unique id for all 3d and plot dock widgets. --- .../ProjectDataModel/RimViewWindow.cpp | 12 ++++---- .../ProjectDataModel/RimViewWindow.h | 12 ++++---- .../UserInterface/RiuDockWidgetTools.cpp | 29 +++++++++++++++++++ .../UserInterface/RiuDockWidgetTools.h | 2 ++ 4 files changed, 43 insertions(+), 12 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index 56cb1a2c51d..b55908c9f84 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -43,8 +43,6 @@ CAF_PDM_XML_ABSTRACT_SOURCE_INIT( RimViewWindow, "ViewWindow" ); // Do not use. Abstract class -size_t RimViewWindow::m_nextDockWindowId = 0; - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -60,7 +58,7 @@ RimViewWindow::RimViewWindow() CAF_PDM_InitField( &m_showWindow, "ShowWindow", true, "Show Window" ); m_showWindow.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField( &m_dockWindowId, "DockWindowId", m_nextDockWindowId++, "Dock Window Id" ); + CAF_PDM_InitField( &m_dockWindowId, "DockWindowId", QString(), "Dock Window Id" ); m_dockWindowId.uiCapability()->setUiHidden( true ); } @@ -299,9 +297,13 @@ void RimViewWindow::updateWindowTitle() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimViewWindow::dockWindowName() const +QString RimViewWindow::dockWindowName() { - return QString( "%1_%2" ).arg( RiuDockWidgetTools::viewWindowPrefix() ).arg( m_dockWindowId() ); + if ( m_dockWindowId().isEmpty() ) + { + m_dockWindowId = RiuDockWidgetTools::uniqueIdForDockWidget(); + } + return m_dockWindowId(); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index ef64617f1dc..2270950ad37 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -73,7 +73,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface virtual void updateWindowTitle(); - QString dockWindowName() const; + QString dockWindowName(); protected: //// Interface for the Window controller @@ -107,10 +107,8 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface protected: caf::PdmChildField m_windowController; - caf::PdmField m_showWindow; - ads::CDockWidget* m_dockWidget; - caf::PdmField m_dockWindowId; - bool m_isActiveViewer; - - static size_t m_nextDockWindowId; + caf::PdmField m_showWindow; + ads::CDockWidget* m_dockWidget; + caf::PdmField m_dockWindowId; + bool m_isActiveViewer; }; diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index 8cc98fd1416..49e01a1da81 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -32,6 +32,8 @@ #include "cafAssert.h" #include "cafPdmUiTreeView.h" +#include + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -527,6 +529,33 @@ void RiuDockWidgetTools::selectItemsInTreeView( const QString& dockWidgetName, c } } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QString RiuDockWidgetTools::uniqueIdForDockWidget() +{ + auto main3dWindow = RiuMainWindow::instance(); + auto mainPlotWindow = RiuPlotMainWindow::instance(); + + QString strId; + do + { + strId = QUuid::createUuid().toString(); + if ( main3dWindow && findDockWidget( main3dWindow->dockManager(), strId ) ) + { + strId.clear(); + continue; + } + if ( mainPlotWindow && findDockWidget( mainPlotWindow->dockManager(), strId ) ) + { + strId.clear(); + continue; + } + } while ( strId.isEmpty() ); + + return strId; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index 7b63aa819b1..94674b9c611 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -110,6 +110,8 @@ class RiuDockWidgetTools static std::vector selectedItemsInTreeView( const QString& dockWidgetName ); static void selectItemsInTreeView( const QString& dockWidgetName, const std::vector& items ); + static QString uniqueIdForDockWidget(); + private: static QByteArray defaultEclipseDockState(); static QByteArray defaultGeoMechDockState(); From 2f14e10db89f9847a9c856b0c6701410ca85b7a9 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 2 Jun 2026 14:30:54 +0200 Subject: [PATCH 32/47] Update test data --- .../TEST10K_FLT_LGR_NNC/10KWithWellLog.rsp | 3205 ++++++++++++++--- 1 file changed, 2802 insertions(+), 403 deletions(-) diff --git a/TestModels/TEST10K_FLT_LGR_NNC/10KWithWellLog.rsp b/TestModels/TEST10K_FLT_LGR_NNC/10KWithWellLog.rsp index 5c220be7a7c..213d7f766ba 100644 --- a/TestModels/TEST10K_FLT_LGR_NNC/10KWithWellLog.rsp +++ b/TestModels/TEST10K_FLT_LGR_NNC/10KWithWellLog.rsp @@ -1,173 +1,428 @@ - + - C:/gitRoot/OPM/ResInsight/TestModels/TEST10K_FLT_LGR_NNC/10KWithWellLog.rsp - 1.6.1-dev - 1 - 0 + E:/src/ResInsight/TestModels/TEST10K_FLT_LGR_NNC/10KWithWellLog.rsp + 2026.02.3-dev.01 + + $PathId_001$ E:/src/ResInsight/TestModels/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID; + $PathId_001_Name$ TEST10K_FLT_LGR_NNC; + $PathId_002$ E:/src/ResInsight/TestModels/TEST10K_FLT_LGR_NNC/wellpath_a.dev; + $PathId_003$ E:/src/ResInsight/TestModels/TEST10K_FLT_LGR_NNC/wellpath_b.dev; + $PathId_004$ C:/Users/JonJenssen; + + + + + + - TEST10K_FLT_LGR_NNC - 0 - - - 635 0 440 639 0 - View 1 - True - 1 0 0 -438.988 0 1 0 -608.278 0 0 1 -1086.95 0 0 0 1 - True - 5 - 0.752941 0.823529 0.870588 - 10 - True - 0 - - - True - True - True - True - True - ALL_TIMESTEPS - ALL_CELLS - - - FULL_MESH - SURFACE - True - False - - - - True - - - - - - True - - - - - True - - - - - DYNAMIC_NATIVE - MATRIX_MODEL - SWAT - - - 8 - 4 - FIXED - NORMAL - LinearContinuous - AUTOMATIC_ALLTIMESTEPS - 1 - 0 - None - - - 8 - 4 - FIXED - NORMAL - LinearContinuous - AUTOMATIC_ALLTIMESTEPS - 1 - 0 - SOIL - - - 8 - 4 - FIXED - NORMAL - LinearContinuous - AUTOMATIC_ALLTIMESTEPS - 1 - 0 - SGAS - - - 8 - 4 - FIXED - NORMAL - LinearContinuous - AUTOMATIC_ALLTIMESTEPS - 1 - 0 - SWAT - - - - - 2 - USER_DEFINED_MAX_MIN - - 1 - 0 - 1 - 0 - 1 - 0 - - - ResultVarLegendDefinitionList 3 - - - - - False - MULT - True - True - True - - - 8 - 4 - FIXED - PINK_WHITE - LinearContinuous - AUTOMATIC_ALLTIMESTEPS - 1 - 0 - - - - - - - - False - + $PathId_001_Name$ + CUSTOM_NAME + 0 + $PathId_001$ + + + + TS_ALL + 0 + 8 + 1 + dd.MMM yyyy + 0 1 2 3 4 5 6 7 8 + True + + + + + + + + + + + + + + + + + + + + + False + False + + + + + + + + + + + + + + + + + 0 + 635 + 0 + 440 + 639 + False + + + True + 0 + + + 3D View + False + True + True + False + + + 1 0 0 -438.988 0 1 0 -608.278 0 0 1 -1086.95 0 0 0 1 + 0 0 0 + True + 5 + 0.752941012382507 0.823529005050659 0.870588004589081 + 10 + 0 + FULL_MESH + SURFACE + True + False + True + + Medium + RIGHT + 5 + False + + + + + True + 0 + 0 + False + INTERSECT_SHOW_BELOW + False + + False + + + + + False + + + True + .. .. .. .. + 0 + + + True + DYNAMIC_NATIVE + MATRIX_MODEL + None + .. .. .. .. .. FlowDiagSolutions 0 + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + + + + + True + NODAL + + + -1 + 0 + 0 + False + 0 + + + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 0 + LinearContinuous + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + + False + + + + + True + 2 + USER_DEFINED_MAX_MIN + + 1 + 0 + 1 + 0 + 1 + 0 + + + + + + + + + False + + + True + .. .. .. .. + 0 + + + True + DYNAMIC_NATIVE + MATRIX_MODEL + None + .. .. .. .. .. FlowDiagSolutions 0 + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + + + + + True + NODAL + + + -1 + 0 + 0 + False + 0 + + + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 0 + LinearContinuous + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + + False + + + + + True + 2 + USER_DEFINED_MAX_MIN + + 1 + 0 + 1 + 0 + 1 + 0 + + + + + + + + + True + + + True + + 0 + + + + + True + + + + + + + + True + True + True + True + True + True + True + ALL_TIMESTEPS + ALL_CELLS + + + + + Well Measurements + False + + True + + + + + + Seismic Sections + True + Seismic Sections + + 5 + + + + + + Polygons + True + + + .. .. .. .. .. PolygonCollection 0 + + + + + True + OR + + + + + .. .. + KEEP_CURRENT_SETTINGS + + True DYNAMIC_NATIVE MATRIX_MODEL - None + SWAT + + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + True 8 4 FIXED - NORMAL + $ROOT$ ColorLegendCollection 0 StandardColorLegends 0 LinearContinuous AUTOMATIC_ALLTIMESTEPS 1 0 + INTERPOLATE None + False + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 0 + LinearContinuous + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + SOIL + False + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 0 + LinearContinuous + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + SGAS + False + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 0 + LinearContinuous + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + SWAT + False + True 2 USER_DEFINED_MAX_MIN @@ -179,116 +434,470 @@ 0 - ResultVarLegendDefinitionList 0 + ResultVarLegendDefinitionList 3 - - - - - - True - True - True - 1 - WELLHEAD_POS_TOP_COLUMN - 0.890196 0.890196 0.890196 - OPEN_IN_VISIBLE_CELLS - 0.1 - 12 - FORCE_ALL_OFF - False - K_DIRECTION - 0.5 - True - - - GI1 - True - True - True - 1 - 0.588 0.588 0.804 - True - False - - - GP1 - True - True - True - 1 - 0.588 0.588 0.804 - True - False - - - GP2 - True - True - True - 1 - 0.588 0.588 0.804 - True - False - - - - - - - True - True - True - True - FAULT_BACK_FACE_CULLING - False - 0.890196 0.890196 0.890196 - True - True - - - NNCs With No Common Area (0) - - - - - Undefined grid faults - True - 0.396078 0.517647 0.376471 - - - - - - - True - - - - True - False - False - - - - - - - - - - - - - - - False - False - - C:/gitRoot/OPM/ResInsight/TestModels/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID + + + + False + MULTI_AXIS_STATIC_PROPERTY + MULT + True + True + True + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 3 + LinearContinuous + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + + False + + + + False + + + True + DYNAMIC_NATIVE + MATRIX_MODEL + None + + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 0 + LinearContinuous + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + None + False + + + + + True + 2 + USER_DEFINED_MAX_MIN + + 1 + 0 + 1 + 0 + 1 + 0 + + + ResultVarLegendDefinitionList 0 + + + + + + + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 0 + LinearContinuous + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + + False + + + True + True + True + False + AGGREGATED + VECTOR_ANCHOR + True + True + True + True + 0 + RESULT_COLORS + 0 0 0 + 1 + + + + + False + + + True + DYNAMIC_NATIVE + MATRIX_MODEL + None + + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 0 + LinearContinuous + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + None + False + + + + + True + 2 + USER_DEFINED_MAX_MIN + + 1 + 0 + 1 + 0 + 1 + 0 + + + ResultVarLegendDefinitionList 0 + + + + + + + True + + 0.647058844566345 0.164705887436867 0.164705887436867 + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 11 + LinearDiscrete + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + CONDUCTIVITY [md-m] + False + + + True + COLOR_INTERPOLATION + + + + + False + True + 2 + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 0 + LinearContinuous + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + + False + + + + + + + True + False + False + 1 + 0.1 + 0.1 + 0.2 + 0.890196025371552 0.890196025371552 0.890196025371552 + True + 1 1 0 + WELLPIPE_COLOR_INDIDUALLY + 12 + WELLPIPE_INTERPOLATED + K_DIRECTION + 0.5 + True + WELLHEAD_POS_TOP_COLUMN + + + GI1 + True + True + True + True + False + False + 1 + 1 + 0.587999999523163 0.587999999523163 0.804000020027161 + 0.501960813999176 0.501960813999176 0 + True + False + + + GP1 + True + True + True + True + False + False + 1 + 1 + 0.587999999523163 0.587999999523163 0.804000020027161 + 0.501960813999176 0.501960813999176 0 + True + False + + + GP2 + True + True + True + True + False + False + 1 + 1 + 0.587999999523163 0.587999999523163 0.804000020027161 + 0.501960813999176 0.501960813999176 0 + True + False + + + True + + WOPT + PROPERTY_TYPE_PREDEFINED + PRODUCTION_RATES + True + False + 1 + 0.501960813999176 0.501960813999176 0 + False + + + + + True + True + True + False + 1 + False + FAULT_BACK_FACE_CULLING + False + 0.890196025371552 0.890196025371552 0.890196025371552 + True + True + + + Undefined Grid Faults + True + 0.396078437566757 0.517647087574005 0.376470595598221 + + + Undefined Grid Faults With Inactive + False + 1 0.513725519180298 0.549019634723663 + + + + + + + + + + + + Fault Reactivation Models + True + Fault Reactivation Models + + + + + + True + + + True + + + + 0 + False + + + True + + + + + + True + + + + Medium + + + + + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 0 + Log10Continuous + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + + False + + + Streamlines + 0.01 + 100 + 20 + 5000 + True + True + COMBINED + False + ANIMATION + PHASE_COLORS + 10 + 0 + 100 + 100 + + + + + True + + + + + + Data Filters + True + + .. .. .. DataFilterCollection 0 + + + + + Filters + True + .. RangeFilters 0 + .. PropertyFilters 0 + .. DataFiltersInView 0 + + + False + False + + + True + False + False + + + + + + + True + + + + + + + + + + + + + + + + + All Wells + + + + False 3 + + @@ -296,86 +905,703 @@ True True - 0.890196 0.890196 0.890196 + 0.890196025371552 0.890196025371552 0.890196025371552 ALL_ON 0.1 True 100 - C:\gitRoot\OPM\ResInsight\TestModels\TEST10K_FLT_LGR_NNC\wellpath_a.dev - 0 + Well Path A + UNITS_METRIC + + 0 True + False 50 True 1 - 0.999 0.333 0.999 - + 0.999000012874603 0.333000004291534 0.999000012874603 + + + + + Perforations + True + + + + None + 1 + 1 + 0.108 + 0.8 + 0.02 + 883.9 + -1.1045 + 0 + + + + + + + Valves + True + + + + + + Fishbones + True + + FIXED + 0 + FIXED + 0 + 0.216 + 0 + + + + + Fractures + True + + + + + + StimPlan Models + True + + + + + + MSW Segments + True + + + + + + + + + + + + OIL + STD + STOP + True + 0 + SEG + 0 + + + GridEntryPoint + 0 + False + 0.152 + 1e-05 + Uniform + + + + + + HF- + ABS + False + 200 + + + + + + + + + + + + + True + 1 + True + False + + + + + + + + Casing Design + True + + + + + + + .. + 0 + False + + + + True + + 0 + True + + + VALVE_COUNT + 100 + 250 + 0 + 13 + + + + False + 2026_06_02-14:20:12 + + + False 0 + + + + + + + + $PathId_002$ + 0 + False - C:\gitRoot\OPM\ResInsight\TestModels\TEST10K_FLT_LGR_NNC\wellpath_b.dev - 0 + Well Path B + UNITS_METRIC + + 0 True + False 50 True 1 - 0.999 0.333 0.999 - + 0.999000012874603 0.333000004291534 0.999000012874603 + + + + + Perforations + True + + + + None + 1 + 1 + 0.108 + 0.8 + 0.02 + 883.9 + -1.1045 + 0 + + + + + + + Valves + True + + + + + + Fishbones + True + + FIXED + 0 + FIXED + 0 + 0.216 + 0 + + + + + Fractures + True + + + + + + StimPlan Models + True + + + + + + MSW Segments + True + + + + + + + + + + + + OIL + STD + STOP + True + 0 + SEG + 0 + + + GridEntryPoint + 0 + False + 0.152 + 1e-05 + Uniform + + + + + + HF- + ABS + False + 200 + + + + + + + + + + + + + True + 1 + True + False + + + + + + + + Casing Design + True + + + + + + + .. + 0 + False + + + + True + + 0 + True + + + VALVE_COUNT + 100 + 250 + 0 + 13 + + + + False + 2026_06_02-14:20:12 + + + False 0 + + + + + + + + $PathId_003$ + 0 + False + + + + + + + + + + + + USE_PREFERENCES + ?*Y* + + True + True + + + + + UNITS_METRIC + + + 0 + Ellipse Fracture Template + UNITS_METRIC + Transverse + False + 0 + 0 + 1 + 1 + 0.216 + FiniteConductivity + 37.5 + + + False + 0 + 0 + False + 0 + + + None + 1 + FractureWidth + 0.01 + UserDefinedBetaFactor + 0.006083236 + FractureConductivity + 1 + 0 + 0.8 + 0.02 + 1 + 1 + 1 + 1 + 100 + 75 + 0.01 + 100000 + + + + + + + + + + + + + + AICD: Valve Template #1 + UNITS_UNKNOWN + AICD + Valve Template #1 + 8 + 0.7 + + + True + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + True + + + + + ICD: Valve Template #2 + UNITS_UNKNOWN + ICD + Valve Template #2 + 8 + 0.7 + + + True + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + True + + + + + ICV: Valve Template #3 + UNITS_UNKNOWN + ICV + Valve Template #3 + 8 + 0.7 + + + True + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + True + + + + + SICD: Valve Template #4 + UNITS_UNKNOWN + SICD + Valve Template #4 + 8 + 0.7 + + + True + + + + + + + + + + + + + + + + + + + + 1 + + + + + + + True + + + + + UNITS_METRIC + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + + + True + + + + + + True + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - C:\gitRoot\OPM\ResInsight\OctavePlugin\OctaveScripts - - - C:\gitRoot\OPM\ResInsight\OctavePlugin\OctaveScripts\InputPropTest.m - - - C:\gitRoot\OPM\ResInsight\OctavePlugin\OctaveScripts\kaverage.m - - - C:\gitRoot\OPM\ResInsight\OctavePlugin\OctaveScripts\kslice.m - - - C:\gitRoot\OPM\ResInsight\OctavePlugin\OctaveScripts\LGRSOIL.m - - - C:\gitRoot\OPM\ResInsight\OctavePlugin\OctaveScripts\OctaveInterfaceTest.m - - - C:\gitRoot\OPM\ResInsight\OctavePlugin\OctaveScripts\ResInsightIterfaceUnitTest.m - - - C:\gitRoot\OPM\ResInsight\OctavePlugin\OctaveScripts\SatNum.m - - - C:\gitRoot\OPM\ResInsight\OctavePlugin\OctaveScripts\SoilTimeDiff.m - - - - - - - - -1-100000020;-1-1000000;-1-10000;-1-100;-1-1200000;-1-12000;-1-1201000;-1-12010;-1-120;-1-130 - - - True - True - UTM_FILTER_OFF - 0 - 0 - 0 - 0 - - - + + + + + + + + + + True @@ -383,257 +1609,1430 @@ - 318 0 317 639 0 + + + 1 + 318 + 0 + 317 + 639 + False + + True - Well Log Plot 1 + 0 + False + True + False + True + XX_Large + Large + ABOVE + $CASE, $WELL + CUSTOM MEASURED_DEPTH UNIT_METER - 87.0125 - 2133.94 + 46.479375749957 + 2175.27993514863 + GRID_X_MAJOR True + ONE_VISIBLE + False + 0 + 0 + + Medium + Medium + Medium + + + Well Log Plot 1 + + + + NONE + + True + -1 + True + True + True + True + XX_Large + Large + ABOVE + ONE + ONE Track 1 - True - + True - Well Path B,SWAT, 01.jan 2014 - - True - 0.501961 0.501961 0 - 1 - STYLE_SOLID - SYMBOL_NONE - .. .. .. .. .. OilFields 0 WellPathCollection 0 WellPaths 1 - .. .. .. .. .. OilFields 0 AnalysisModels 0 Reservoirs 0 + False + Well Path B, SWAT, 01.Jan 2014 + $CASE, $RESULT_NAME + AUTO + + True + True + + + 0.50196099281311 0.50196099281311 0 + 1 + -1 -1 -1 + 1 + 1 + INTERPOLATION_POINT_TO_POINT + STYLE_SOLID + NO_FILL + SYMBOL_NONE + 0.0784313753247261 0.0901960805058479 0.0980392172932625 + 0 + 1 + + 6 + LABEL_ABOVE_SYMBOL + + + + + False + False + WELL_PATH + $ROOT$ OilFields 0 WellPathCollection 0 WellPaths 1 + + + True + -1 + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 + True DYNAMIC_NATIVE MATRIX_MODEL SWAT + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 FlowDiagSolutions 0 + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + True NODAL + -1 + 0 + 0 + False + 0 0 + 0 False True True False True - - + + True - Well Path B,SOIL, 01.jan 2014 - - True - 0 0 0 - 1 - STYLE_SOLID - SYMBOL_NONE - .. .. .. .. .. OilFields 0 WellPathCollection 0 WellPaths 1 - .. .. .. .. .. OilFields 0 AnalysisModels 0 Reservoirs 0 + False + Well Path B, SOIL, 01.Jan 2014 + $CASE, $RESULT_NAME + AUTO + + True + True + + + 0 0 0 + 1 + -1 -1 -1 + 1 + 1 + INTERPOLATION_POINT_TO_POINT + STYLE_SOLID + NO_FILL + SYMBOL_NONE + 0.0784313753247261 0.0901960805058479 0.0980392172932625 + 0 + 1 + + 6 + LABEL_ABOVE_SYMBOL + + + + + False + False + WELL_PATH + $ROOT$ OilFields 0 WellPathCollection 0 WellPaths 1 + + + True + -1 + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 + True DYNAMIC_NATIVE MATRIX_MODEL SOIL + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 FlowDiagSolutions 0 + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + True NODAL + -1 + 0 + 0 + False + 0 0 + 0 False True True False True - - + + True - Well Path B,SGAS, 01.jan 2014 - - True - 0.501961 0 0 - 1 - STYLE_SOLID - SYMBOL_NONE - .. .. .. .. .. OilFields 0 WellPathCollection 0 WellPaths 1 - .. .. .. .. .. OilFields 0 AnalysisModels 0 Reservoirs 0 + False + Well Path B, SGAS, 01.Jan 2014 + $CASE, $RESULT_NAME + AUTO + + True + True + + + 0.50196099281311 0 0 + 1 + -1 -1 -1 + 1 + 1 + INTERPOLATION_POINT_TO_POINT + STYLE_SOLID + NO_FILL + SYMBOL_NONE + 0.0784313753247261 0.0901960805058479 0.0980392172932625 + 0 + 1 + + 6 + LABEL_ABOVE_SYMBOL + + + + + False + False + WELL_PATH + $ROOT$ OilFields 0 WellPathCollection 0 WellPaths 1 + + + True + -1 + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 + True DYNAMIC_NATIVE MATRIX_MODEL SGAS + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 FlowDiagSolutions 0 + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + True NODAL + -1 + 0 + 0 + False + 0 0 + 0 False True True False True - + - 0 - 0.955563 - True - False + + + True + 0 + 1.05111937522888 + True + False + False + GRID_X_MAJOR + False + False + 0 + 0 + + + Medium + + + NO_ANNOTATIONS + SHADING_AND_LINES + + 50 + True + Small + + + + + CASE + WELL_PATH + + + None + 0 + True + + ALL + False + + + + + False + True + True + True + True + False + + + 0 + 0 + + + False + + + True + DYNAMIC_NATIVE + MATRIX_MODEL + None + + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + + + + VERTICAL - 0 0 318 619 0 + + + 1 + 0 + 0 + 318 + 619 + False + + True - Well Log Plot 4 + 1 + False + True + False + True + XX_Large + Large + ABOVE + $CASE, $WELL + CUSTOM MEASURED_DEPTH UNIT_METER - 162.724 - 2490.69 + 116.625255349006 + 2537.71432384999 + GRID_X_MAJOR True + ONE_VISIBLE + False + 0 + 0 + + Medium + Medium + Medium + + + Well Log Plot 4 + + + + NONE + + True + -1 + True + True + True + True + XX_Large + Large + ABOVE + ONE + ONE Track 1 - True - + True - Well Path A,SOIL, 01.jan 2014 - - True - 0 0 0.501961 - 1 - STYLE_SOLID - SYMBOL_NONE - .. .. .. .. .. OilFields 0 WellPathCollection 0 WellPaths 0 - .. .. .. .. .. OilFields 0 AnalysisModels 0 Reservoirs 0 + False + Well Path A, SOIL, 01.Jan 2014 + $CASE, $RESULT_NAME + AUTO + + True + True + + + 0 0 0.50196099281311 + 1 + -1 -1 -1 + 1 + 1 + INTERPOLATION_POINT_TO_POINT + STYLE_SOLID + NO_FILL + SYMBOL_NONE + 0.0784313753247261 0.0901960805058479 0.0980392172932625 + 0 + 1 + + 6 + LABEL_ABOVE_SYMBOL + + + + + False + False + WELL_PATH + $ROOT$ OilFields 0 WellPathCollection 0 WellPaths 0 + + + True + -1 + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 + True DYNAMIC_NATIVE MATRIX_MODEL SOIL + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 FlowDiagSolutions 0 + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + True NODAL + -1 + 0 + 0 + False + 0 0 + 0 False True True False True - - + + True - Well Path A,SGAS, 01.jan 2014 - - True - 0 0.501961 0 - 1 - STYLE_SOLID - SYMBOL_NONE - .. .. .. .. .. OilFields 0 WellPathCollection 0 WellPaths 0 - .. .. .. .. .. OilFields 0 AnalysisModels 0 Reservoirs 0 + False + Well Path A, SGAS, 01.Jan 2014 + $CASE, $RESULT_NAME + AUTO + + True + True + + + 0 0.50196099281311 0 + 1 + -1 -1 -1 + 1 + 1 + INTERPOLATION_POINT_TO_POINT + STYLE_SOLID + NO_FILL + SYMBOL_NONE + 0.0784313753247261 0.0901960805058479 0.0980392172932625 + 0 + 1 + + 6 + LABEL_ABOVE_SYMBOL + + + + + False + False + WELL_PATH + $ROOT$ OilFields 0 WellPathCollection 0 WellPaths 0 + + + True + -1 + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 + True DYNAMIC_NATIVE MATRIX_MODEL SGAS + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 FlowDiagSolutions 0 + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + True NODAL + -1 + 0 + 0 + False + 0 0 + 0 False True True False True - - + + True - Well Path A,SWAT, 01.jan 2014 - - True - 0.501961 0 0.501961 - 1 - STYLE_SOLID - SYMBOL_NONE - .. .. .. .. .. OilFields 0 WellPathCollection 0 WellPaths 0 - .. .. .. .. .. OilFields 0 AnalysisModels 0 Reservoirs 0 + False + Well Path A, SWAT, 01.Jan 2014 + $CASE, $RESULT_NAME + AUTO + + True + True + + + 0.50196099281311 0 0.50196099281311 + 1 + -1 -1 -1 + 1 + 1 + INTERPOLATION_POINT_TO_POINT + STYLE_SOLID + NO_FILL + SYMBOL_NONE + 0.0784313753247261 0.0901960805058479 0.0980392172932625 + 0 + 1 + + 6 + LABEL_ABOVE_SYMBOL + + + + + False + False + WELL_PATH + $ROOT$ OilFields 0 WellPathCollection 0 WellPaths 0 + + + True + -1 + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 + True DYNAMIC_NATIVE MATRIX_MODEL SWAT + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 FlowDiagSolutions 0 + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + True NODAL + -1 + 0 + 0 + False + 0 0 + 0 False True True False True - + - 0 - 0.956023 - True - False + + + True + 0 + 1.051624751091 + True + False + False + GRID_X_MAJOR + False + False + 0 + 0 + + + Medium + + + NO_ANNOTATIONS + SHADING_AND_LINES + + 50 + True + Small + + + + + CASE + WELL_PATH + + + None + 0 + True + + ALL + False + + + + + False + True + True + True + True + False + + + 0 + 0 + + + False + + + True + DYNAMIC_NATIVE + MATRIX_MODEL + None + + -1 + + False + True + + + + FLOW_TR_INJ_AND_PROD + PHASE_ALL + True + False + False + + + + VERTICAL - - - - - + + + + + + + + + + + + + + False + + + SNAP_TO_POINT + + + False + 0.250980406999588 0.250980406999588 0.250980406999588 + 2 + + + + LEFT + LEFT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 0 + 0 + -1 + -1 + False + + + False + + + SELECTED + + + 0.1 + True + CELLS_ACTIVE + + + + 0 + 146000 + + + + + + + 1 + 0 + 0 + -1 + -1 + False + + + False + 2 + True + True + True + True + XX_Large + Large + ABOVE + + + FILTER_BY_VISIBLE_PRODUCERS + + SINGLE_TIME_STEP + True + 0 + FLOW_RATE_FRACTION + + ACCUMULATED_FLOW_VOLUME_FRACTION + + + TIME_STEP_COUNT + 10 + + + + False + False + False + Large + Medium + Medium + + + True + 8 + 4 + FIXED + $ROOT$ ColorLegendCollection 0 StandardColorLegends 18 + LinearContinuous + AUTOMATIC_ALLTIMESTEPS + 1 + 0 + INTERPOLATE + + False + + + LinearContinuous + AUTOMATIC + + + + + + + 1 + 0 + 0 + -1 + -1 + False + + + False + 3 + True + True + True + True + XX_Large + Medium + ABOVE + ONE + ONE + Default Well Allocation Over Time Plot + + None + + + TIME_STEP_COUNT + 10 + + + FLOW_RATE + True + 0.005 + Large + Medium + + + + + + + 1 + 0 + 0 + -1 + -1 + False + + + False + Default Flow Diagnostics Plot + True + True + + 0 + None + + INFLOW + True + 0.005 + + + + True + -1 + False + False + False + True + XX_Large + Large + ABOVE + $CASE, $WELL + CUSTOM + CONNECTION_NUMBER + UNIT_NONE + 0 + 1000 + GRID_X_MAJOR + True + ONE_VISIBLE + False + 0 + 0 + + Medium + Medium + Medium + + + Accumulated Flow Chart + + + + NONE + + VERTICAL + + + + + + True + Total Allocation + True + + + + + True + + + + + + False + Cumulative Saturation by Time of Flight + True + 50 + + + + + + + + + 1 + 0 + 0 + -1 + -1 + False + + + False + 4 + True + True + True + True + XX_Large + Large + ABOVE + + -1 + None + True + 0.005 + 20 + + + + True + -1 + True + False + True + True + XX_Large + Large + ABOVE + ONE + ONE + + -1 + None + OIL_PHASE + True + 0.005 + 20 + + + + True + -1 + True + False + True + True + XX_Large + Large + ABOVE + ONE + ONE + + -1 + None + GAS_PHASE + True + 0.005 + 20 + + + + True + -1 + True + False + True + True + XX_Large + Large + ABOVE + ONE + ONE + + -1 + None + WATER_PHASE + True + 0.005 + 20 + + + True + True + True + Cumulative Phase Distribution Plots + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 ViewCollection 0 Views 0 + EclipseCase + + + + + $ROOT$ OilFields 0 AnalysisModels 0 Reservoirs 0 ViewCollection 0 Views 0 + + + + True - - 2 0;0 0 + + + + + + + + + + + + || + || + -1-100;-1-140|-1-100||| + 4 0;1 0|||| + True + True + True + False + False + + + + + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + + + + + 2 + 2 + 2 + 8 + + + + + + + SPLIT_ON_WELL + TRANSMISSIBILITIES + 0 + True + False + True + True + True + False + 0 + WBHP_SUMMARY + 200 + False + True + True + True + False + + + + + + + 10 + 10 + + + + + + + + + + + + + 5 + + + + + + + 0 + True + True + True + 2 + 2 + 2 + LGR_PER_COMPLETION + + + + + True + GRID.GRDECL + False + False + VISIBLE_CELLS + 2 + 2147483647 + 2147483647 + 2147483647 + -2147483647 + -2147483647 + -2147483647 + TO_SINGLE_RESULT_FILE + FAULTS.GRDECL + 1 + 1 + 1 + TO_SEPARATE_RESULT_FILES + RESULTS.GRDECL + + False + $PathId_004$ + + + + + 100 + 100 + 10 + 0 + 6000 + 12000 + 500 + 400000 + 6000000 + 3 + 10 + + + + + + False + 0 + 0 + + + + + True + 0 + FILE + + + + + + + + $PathId_004$ + + 1000000 + OPERNUM_OPERATER + VISIBLE_CELLS + 2 + 1 + 1 + 1 + 1 + 1 + 1 + + + True + 0.5, 0.5 + True + 0.5, 0.5 + True + 0.5, 0.5 + LINEAR_EQUAL_SPLIT + 2 + 2 + 2 + 10 + 10 + 10 + + + + + ACTION ACTIONX ACTIONW BOX UDQ + False + 0 + 0 + 0 + 1 + 0 + 0 + 0.1 + False + False + False + False + + + False + + + + + + + UNDEFINED + UNDEFINED + + + + 15 + + From ec316c730e671f3e200e816606ed52ad4e2c4c5a Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 2 Jun 2026 17:29:04 +0200 Subject: [PATCH 33/47] Update to latest qt adv docking version Make sure copied 3d or plot views get a unique id --- .../Application/Tools/Summary/RiaSummaryPlotTools.cpp | 2 ++ .../ExportCommands/RicAdvancedSnapshotExportFeature.cpp | 1 + .../RicAddStoredFlowCharacteristicsPlotFeature.cpp | 1 + .../RicAddStoredWellAllocationPlotFeature.cpp | 1 + .../RicPasteEclipseViewsFeature.cpp | 1 + .../RicPasteGeoMechViewsFeature.cpp | 5 +++-- .../Commands/RicNewContourMapViewFeature.cpp | 7 +++++++ .../Commands/WellLogCommands/RicCreateRftPlotsFeature.cpp | 1 + .../WellLogCommands/RicPasteWellLogPlotFeature.cpp | 1 + .../ProjectDataModel/GeoMech/RimGeoMechCase.cpp | 1 + ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp | 1 + ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp | 8 ++++++++ ApplicationLibCode/ProjectDataModel/RimViewWindow.h | 1 + .../Summary/RimSummaryMultiPlotCollection.cpp | 1 + ThirdParty/qtadvanceddocking | 2 +- 15 files changed, 31 insertions(+), 3 deletions(-) diff --git a/ApplicationLibCode/Application/Tools/Summary/RiaSummaryPlotTools.cpp b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryPlotTools.cpp index 04a02488956..6e6390c2742 100644 --- a/ApplicationLibCode/Application/Tools/Summary/RiaSummaryPlotTools.cpp +++ b/ApplicationLibCode/Application/Tools/Summary/RiaSummaryPlotTools.cpp @@ -114,6 +114,7 @@ std::vector duplicatePlots( const std::vector& sourcePlots ) for ( auto plot : sourcePlots ) { auto copy = plot->copyObject(); + copy->resetDockWindowId(); { // TODO: Workaround for fixing the PdmPointer in RimEclipseResultDefinition // caf::PdmPointer m_eclipseCase; @@ -145,6 +146,7 @@ std::vector duplicateSummaryPlots( const std::vectorcopyObject(); if ( copy ) { + copy->resetDockWindowId(); plots.push_back( copy ); } } diff --git a/ApplicationLibCode/Commands/ExportCommands/RicAdvancedSnapshotExportFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicAdvancedSnapshotExportFeature.cpp index 98cc41a0a2b..ec0779ed12a 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicAdvancedSnapshotExportFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicAdvancedSnapshotExportFeature.cpp @@ -159,6 +159,7 @@ void RicAdvancedSnapshotExportFeature::exportMultipleSnapshots( const QString& f { auto copyOfGeoMechView = sourceGeoMechView->copyObject(); CVF_ASSERT( copyOfGeoMechView ); + copyOfGeoMechView->resetDockWindowId(); geomCase->geoMechViews().push_back( copyOfGeoMechView ); diff --git a/ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp index 1a123191cd5..21bf3c3c730 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicAddStoredFlowCharacteristicsPlotFeature.cpp @@ -65,6 +65,7 @@ void RicAddStoredFlowCharacteristicsPlotFeature::onActionTriggered( bool isCheck auto flowCharacteristicsPlot = sourceObject->copyObject(); CVF_ASSERT( flowCharacteristicsPlot ); + flowCharacteristicsPlot->resetDockWindowId(); flowPlotColl->addFlowCharacteristicsPlotToStoredPlots( flowCharacteristicsPlot ); flowCharacteristicsPlot->resolveReferencesRecursively(); diff --git a/ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp b/ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp index 9fb03b5f079..efc9f947b60 100644 --- a/ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp +++ b/ApplicationLibCode/Commands/FlowCommands/RicAddStoredWellAllocationPlotFeature.cpp @@ -64,6 +64,7 @@ void RicAddStoredWellAllocationPlotFeature::onActionTriggered( bool isChecked ) auto wellAllocationPlot = sourceObject->copyObject(); CVF_ASSERT( wellAllocationPlot ); + wellAllocationPlot->resetDockWindowId(); flowPlotColl->addWellAllocPlotToStoredPlots( wellAllocationPlot ); wellAllocationPlot->resolveReferencesRecursively(); diff --git a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.cpp b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.cpp index 76288ac3074..cbd5a6ce89a 100644 --- a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.cpp +++ b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteEclipseViewsFeature.cpp @@ -89,6 +89,7 @@ void RicPasteEclipseViewsFeature::onActionTriggered( bool isChecked ) { auto* rimReservoirView = eclipseView->copyObject(); CVF_ASSERT( rimReservoirView ); + rimReservoirView->resetDockWindowId(); QString nameOfCopy = QString( "Copy of " ) + rimReservoirView->name(); rimReservoirView->setName( nameOfCopy ); diff --git a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp index 2a469aa8bb9..243cb3e9584 100644 --- a/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp +++ b/ApplicationLibCode/Commands/OperationsUsingObjReferences/RicPasteGeoMechViewsFeature.cpp @@ -80,8 +80,9 @@ void RicPasteGeoMechViewsFeature::onActionTriggered( bool isChecked ) // Add cases to case group for ( size_t i = 0; i < geomViews.size(); i++ ) { - auto rimReservoirView = geomViews[i]->copyObject(); - QString nameOfCopy = QString( "Copy of " ) + rimReservoirView->name(); + auto rimReservoirView = geomViews[i]->copyObject(); + rimReservoirView->resetDockWindowId(); + QString nameOfCopy = QString( "Copy of " ) + rimReservoirView->name(); rimReservoirView->setName( nameOfCopy ); geomCase->geoMechViews().push_back( rimReservoirView ); diff --git a/ApplicationLibCode/Commands/RicNewContourMapViewFeature.cpp b/ApplicationLibCode/Commands/RicNewContourMapViewFeature.cpp index 4eec8fccd53..6d4cb032233 100644 --- a/ApplicationLibCode/Commands/RicNewContourMapViewFeature.cpp +++ b/ApplicationLibCode/Commands/RicNewContourMapViewFeature.cpp @@ -212,6 +212,8 @@ RimEclipseContourMapView* { auto contourMap = existingContourMap->copyObject(); CVF_ASSERT( contourMap ); + + contourMap->resetDockWindowId(); contourMap->setEclipseCase( eclipseCase ); auto col = RiuGuiTheme::getColorByVariableName( "backgroundColor2" ); @@ -242,6 +244,7 @@ RimEclipseContourMapView* RicNewContourMapViewFeature::createEclipseContourMapFr caf::PdmDefaultObjectFactory::instance() ) ); CVF_ASSERT( contourMap ); + contourMap->resetDockWindowId(); contourMap->setEclipseCase( eclipseCase ); auto col = RiuGuiTheme::getColorByVariableName( "backgroundColor2" ); @@ -308,6 +311,7 @@ RimEclipseContourMapView* RicNewContourMapViewFeature::createEclipseContourMap( RimEclipseContourMapView* contourMap = new RimEclipseContourMapView(); contourMap->setEclipseCase( eclipseCase ); + contourMap->resetDockWindowId(); assignDefaultResultAndLegend( contourMap ); @@ -339,6 +343,7 @@ RimGeoMechContourMapView* auto contourMap = existingContourMap->copyObject(); CVF_ASSERT( contourMap ); contourMap->setGeoMechCase( geoMechCase ); + contourMap->resetDockWindowId(); auto col = RiuGuiTheme::getColorByVariableName( "backgroundColor2" ); contourMap->setBackgroundColor( RiaColorTools::fromQColorTo3f( col ) ); // Ignore original view background @@ -369,6 +374,7 @@ RimGeoMechContourMapView* RicNewContourMapViewFeature::createGeoMechContourMapFr CVF_ASSERT( contourMap ); contourMap->setGeoMechCase( geoMechCase ); + contourMap->resetDockWindowId(); auto col = RiuGuiTheme::getColorByVariableName( "backgroundColor2" ); contourMap->setBackgroundColor( RiaColorTools::fromQColorTo3f( col ) ); // Ignore original view background @@ -395,6 +401,7 @@ RimGeoMechContourMapView* RicNewContourMapViewFeature::createGeoMechContourMap( { RimGeoMechContourMapView* contourMap = new RimGeoMechContourMapView(); contourMap->setGeoMechCase( geoMechCase ); + contourMap->resetDockWindowId(); caf::PdmDocument::updateUiIconStateRecursively( contourMap ); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.cpp index 459b2fcdf4a..9d4458184fa 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicCreateRftPlotsFeature.cpp @@ -105,6 +105,7 @@ void RicCreateRftPlotsFeature::appendRftPlotForWell( const QString& wellName, Ri auto rftPlot = sourcePlot->copyObject(); if ( !rftPlot ) return; + rftPlot->resetDockWindowId(); rftPlot->setSimWellOrWellPathName( wellName ); rftPlotColl->addPlot( rftPlot ); rftPlot->resolveReferencesRecursively(); diff --git a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.cpp b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.cpp index 1304dcfa98f..9c9d9926f01 100644 --- a/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.cpp +++ b/ApplicationLibCode/Commands/WellLogCommands/RicPasteWellLogPlotFeature.cpp @@ -75,6 +75,7 @@ void RicPasteWellLogPlotFeature::onActionTriggered( bool isChecked ) auto newObject = fileCurve->copyObject(); CVF_ASSERT( newObject ); + newObject->resetDockWindowId(); wellLogPlotCollection->addWellLogPlot( newObject ); // Resolve references after object has been inserted into the project data model diff --git a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp index 74051c12832..e73685a6a45 100644 --- a/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/GeoMech/RimGeoMechCase.cpp @@ -244,6 +244,7 @@ RimGeoMechView* RimGeoMechCase::createCopyAndAddView( const RimGeoMechView* sour auto rimGeoMechView = sourceView->copyObject(); CVF_ASSERT( rimGeoMechView ); + rimGeoMechView->resetDockWindowId(); rimGeoMechView->setGeoMechCase( this ); caf::PdmDocument::updateUiIconStateRecursively( rimGeoMechView ); diff --git a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp index c8020ebca8e..4da1d7a45d6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimEclipseCase.cpp @@ -400,6 +400,7 @@ RimEclipseView* RimEclipseCase::createCopyAndAddView( const RimEclipseView* sour auto rimEclipseView = sourceView->copyObject(); CVF_ASSERT( rimEclipseView ); + rimEclipseView->resetDockWindowId(); rimEclipseView->setEclipseCase( this ); caf::PdmDocument::updateUiIconStateRecursively( rimEclipseView ); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index b55908c9f84..b89e045911a 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -306,6 +306,14 @@ QString RimViewWindow::dockWindowName() return m_dockWindowId(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimViewWindow::resetDockWindowId() +{ + m_dockWindowId = ""; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index 2270950ad37..46c0dc2054f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -73,6 +73,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface virtual void updateWindowTitle(); + void resetDockWindowId(); QString dockWindowName(); protected: diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp index 3661a91c94b..124c1ed9688 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryMultiPlotCollection.cpp @@ -207,6 +207,7 @@ RimSummaryMultiPlot* RimSummaryMultiPlotCollection::duplicatePlot( RimSummaryMul if ( !plotToDuplicate ) return nullptr; auto plotCopy = plotToDuplicate->copyObject(); + plotCopy->resetDockWindowId(); addSummaryMultiPlot( plotCopy ); plotCopy->resolveReferencesRecursively(); diff --git a/ThirdParty/qtadvanceddocking b/ThirdParty/qtadvanceddocking index 369bc1b5390..f7779eff0cc 160000 --- a/ThirdParty/qtadvanceddocking +++ b/ThirdParty/qtadvanceddocking @@ -1 +1 @@ -Subproject commit 369bc1b5390a9354e8f78149233e5ef17dd40546 +Subproject commit f7779eff0ccf4edfae15222131bbb375c8c8a0ea From e4d0e28e419fbb51c588daeaf2e7769d4486df91 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 2 Jun 2026 18:14:34 +0200 Subject: [PATCH 34/47] Minor fixes --- ApplicationLibCode/ProjectDataModel/Rim3dView.cpp | 2 ++ ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 955d8b58ae3..cd2efece8b1 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -1909,6 +1909,7 @@ void Rim3dView::dockInMainWindow() removeWindowFromDock(); dockAs3DViewWindow(); updateDockWindowVisibility(); + setAsActiveViewer(); scheduleCreateDisplayModelAndRedraw(); } @@ -1920,5 +1921,6 @@ void Rim3dView::dockInPlotWindow() removeWindowFromDock(); dockAsPlotWindow(); updateDockWindowVisibility(); + setAsActiveViewer(); scheduleCreateDisplayModelAndRedraw(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index 4b56f565094..b2a2fa37813 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -182,8 +182,6 @@ void RimDockWindowController::setAsActiveViewer() if ( auto pdmView = viewPdmObject() ) { - if ( pdmView->isActive() ) return; - for ( auto viewWin : getMainWindow()->viewWindows() ) { if ( viewWin->isActive() ) From 0d83239f952061101ddbedc11c5bdf10766e1b20 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Thu, 4 Jun 2026 17:27:13 +0200 Subject: [PATCH 35/47] Work in progress: Support capturing snapshots with a given size. --- .../RicSnapshotViewToPdfFeature.cpp | 2 +- .../ProjectDataModel/Rim3dView.cpp | 25 ++++++++++++++ .../ProjectDataModel/Rim3dView.h | 1 + .../ProjectDataModel/RimMultiPlot.cpp | 20 +++++++++++ .../ProjectDataModel/RimMultiPlot.h | 1 + .../ProjectDataModel/RimViewWindow.cpp | 34 +++++++++++++++++++ .../ProjectDataModel/RimViewWindow.h | 4 +++ .../UserInterface/RiuMultiPlotBook.cpp | 8 +++++ .../UserInterface/RiuMultiPlotBook.h | 2 ++ 9 files changed, 96 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToPdfFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToPdfFeature.cpp index 649c46b8fe3..8dc6d65e34a 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToPdfFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToPdfFeature.cpp @@ -46,7 +46,7 @@ void RicSnapshotViewToPdfFeature::onActionTriggered( bool isChecked ) RimViewWindow* viewWindow = RiaGuiApplication::activeViewWindow(); if ( !viewWindow ) { - RiaLogging::error( "No view window is available, nothing to do" ); + RiaLogging::error( "No plot window is available, nothing to do" ); return; } diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index cd2efece8b1..e3e009caac9 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -513,6 +513,31 @@ QImage Rim3dView::snapshotWindowContent() return QImage(); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QImage Rim3dView::captureSnapshot( int width, int height ) +{ + QImage image; + if ( m_viewer ) + { + QSize orgSize = m_viewer->layoutWidget()->size(); + + // adjust for possible display DPI scaling + const auto ratio = m_viewer->displayScalingRatio(); + m_viewer->layoutWidget()->setFixedSize( (int)( 1.0 * width / ratio ), (int)( 1.0 * height / ratio ) ); + + image = m_viewer->snapshotImage(); + + // reset fixed size and restore original size + m_viewer->layoutWidget()->setMinimumSize( 0, 0 ); + m_viewer->layoutWidget()->setMaximumSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX ); + m_viewer->layoutWidget()->resize( orgSize ); + } + + return image; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.h b/ApplicationLibCode/ProjectDataModel/Rim3dView.h index d40be63b1e3..a95c7598169 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.h +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.h @@ -147,6 +147,7 @@ class Rim3dView : public RimViewWindow, public RiuViewerToViewInterface, public cvf::ref displayCoordTransform() const override; virtual std::vector legendConfigs() const = 0; + QImage captureSnapshot( int width, int height ) override; QImage snapshotWindowContent() override; void zoomAll() override; void forceShowWindowOn(); diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 55413b21760..d8cdbae446d 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -35,6 +35,7 @@ #include "cafPdmUiToolButtonEditor.h" #include +#include #include #include @@ -639,6 +640,25 @@ QImage RimMultiPlot::snapshotWindowContent() return image; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QImage RimMultiPlot::captureSnapshot( int width, int height ) +{ + QImage image; + + if ( m_viewer.isNull() ) return image; + + QSize orgViewSize = m_viewer->size(); + + image = captureImage( m_viewer->bookWidget(), width, height ); + + m_viewer->resize( orgViewSize ); + doUpdateLayout(); + + return image; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h index 220b5d205ae..d8fb7aec550 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.h @@ -117,6 +117,7 @@ class RimMultiPlot : public RimPlotWindow, public RimTypedPlotCollection #include +#include #include #include @@ -222,6 +223,39 @@ QImage RimViewWindow::snapshotWindowContent() return image; } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QImage RimViewWindow::captureSnapshot( int width, int height ) +{ + return captureImage( viewWidget(), width, height ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QImage RimViewWindow::captureImage( QWidget* widget, int width, int height ) +{ + if ( !widget ) return QImage(); + + QSize orgSize = widget->size(); + + widget->setFixedSize( width, height ); + + QPixmap pix( width, height ); + pix.fill( Qt::transparent ); + + QPainter painter( &pix ); + widget->render( &painter ); + + // reset fixed size and restore original size + widget->setMinimumSize( 0, 0 ); + widget->setMaximumSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX ); + widget->resize( orgSize ); + + return pix.toImage(); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index 46c0dc2054f..b33fce97c5b 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -66,6 +66,8 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface ads::CDockWidget* dockWidget(); ads::CDockWidget* createDockWidget(); + virtual QImage captureSnapshot( int width, int height ); + virtual QImage snapshotWindowContent(); virtual void zoomAll() = 0; @@ -99,6 +101,8 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; + QImage captureImage( QWidget* widget, int width, int height ); + private: friend class RimProject; diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp index 0ccb073da19..b4c9bbc7e0b 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.cpp @@ -797,3 +797,11 @@ void RiuMultiPlotBook::adjustBookFrame() { m_book->adjustSize(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QWidget* RiuMultiPlotBook::bookWidget() +{ + return m_book; +} diff --git a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h index 546f8b1a0d3..94e7b4ea83f 100644 --- a/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h +++ b/ApplicationLibCode/UserInterface/RiuMultiPlotBook.h @@ -98,6 +98,8 @@ class RiuMultiPlotBook : public QWidget, public RiuInterfaceToViewWindow // The code used to be called from RiuMultiPlotBook::showEvent(), but this caused a crash when a dock widget was hidden and shown again. void forcePerformUpdate(); + QWidget* bookWidget(); + protected: void contextMenuEvent( QContextMenuEvent* ) override; From 0f991130de6621a226901137e70315783dd08fc9 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Tue, 9 Jun 2026 01:12:48 +0200 Subject: [PATCH 36/47] Snapshot work in progress --- .../Application/RiaGuiApplication.cpp | 16 +------- .../Tools/RiaRegressionTestRunner.cpp | 40 ++++--------------- .../Tools/RiaRegressionTestRunner.h | 4 +- .../RicfExportSnapshots.cpp | 40 +++++++++++++------ .../RicfExportSnapshots.h | 2 + .../RicfSetMainWindowSize.cpp | 4 +- .../RicSnapshotAllPlotsToFileFeature.cpp | 8 ++-- .../RicSnapshotAllPlotsToFileFeature.h | 2 + .../RicSnapshotAllViewsToFileFeature.cpp | 11 +++-- .../RicSnapshotAllViewsToFileFeature.h | 8 +++- .../RicSnapshotViewToFileFeature.cpp | 4 +- .../RicSnapshotViewToFileFeature.h | 2 +- .../ProjectDataModel/RimMultiPlot.cpp | 2 +- .../ProjectDataModel/RimViewWindow.cpp | 27 +++++++++---- .../ProjectDataModel/RimViewWindow.h | 4 +- GrpcInterface/GrpcProtos/Commands.proto | 2 + .../export_and_plotting/export_plots.py | 2 +- .../export_and_plotting/export_snapshots.py | 4 +- GrpcInterface/Python/rips/plot.py | 6 ++- GrpcInterface/Python/rips/view.py | 4 +- 20 files changed, 103 insertions(+), 89 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index aa679285f01..3248d5a8113 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -887,15 +887,9 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n mainPlotWnd->show(); mainPlotWnd->raise(); - if ( snapshotHeight > -1 && snapshotWidth > -1 ) - { - // TODO - handle snapshot view sizes - // RiuMainWindowTools::setWindowSizeOnWidgetsInViewWindows( mainPlotWnd, snapshotWidth, snapshotHeight ); - } - processEvents(); - RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( snapshotFolder ); + RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( snapshotFolder, snapshotWidth, snapshotHeight ); } } @@ -905,15 +899,9 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n mainWnd->show(); mainWnd->raise(); - if ( snapshotHeight > -1 && snapshotWidth > -1 ) - { - // TODO - handle snapshot view sizes - // RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, snapshotWidth, snapshotHeight ); - } - processEvents(); - RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( snapshotFolder ); + RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( snapshotFolder, snapshotWidth, snapshotHeight ); } auto mainPlotWnd = mainPlotWindow(); diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp index ff4ffd6b671..60c367b4de4 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.cpp @@ -249,18 +249,20 @@ void RiaRegressionTestRunner::runRegressionTest() QString fullPathGeneratedFolder = testCaseFolder.absoluteFilePath( generatedFolderName ); if ( regressionTestConfig.exportSnapshots3dViews ) { - setDefaultSnapshotSizeFor3dViews(); - - RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( fullPathGeneratedFolder ); + QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize(); + RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( fullPathGeneratedFolder, + defaultSize.width(), + defaultSize.height() ); QApplication::processEvents(); } if ( regressionTestConfig.exportSnapshotsPlots ) { - setDefaultSnapshotSizeForPlotWindows(); - - RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( fullPathGeneratedFolder ); + QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize(); + RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( fullPathGeneratedFolder, + defaultSize.width(), + defaultSize.height() ); } uint64_t usedMemoryBeforeClose = caf::MemoryInspector::getApplicationPhysicalMemoryUsageMiB(); @@ -546,32 +548,6 @@ void RiaRegressionTestRunner::removeDirectoryWithContent( QDir& dirToDelete ) caf::Utils::removeDirectoryAndFilesRecursively( dirToDelete.absolutePath() ); } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaRegressionTestRunner::setDefaultSnapshotSizeFor3dViews() -{ - RiuMainWindow* mainWnd = RiuMainWindow::instance(); - if ( !mainWnd ) return; - - // TODO - fix snapshot view sizes - // QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize(); - // RiuMainWindowTools::setFixedWindowSizeFor3dViews( mainWnd, defaultSize.width(), defaultSize.height() ); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiaRegressionTestRunner::setDefaultSnapshotSizeForPlotWindows() -{ - RiuPlotMainWindow* plotMainWindow = RiaGuiApplication::instance()->mainPlotWindow(); - if ( !plotMainWindow ) return; - - // TODO - fix snapshot view sizes - // QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize(); - // RiuMainWindowTools::setWindowSizeOnWidgetsInViewWindows( plotMainWindow, defaultSize.width(), defaultSize.height() ); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h index 6033e993b11..fd1cb2bfd79 100644 --- a/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h +++ b/ApplicationLibCode/Application/Tools/RiaRegressionTestRunner.h @@ -45,8 +45,7 @@ class RiaRegressionTestRunner static void updateRegressionTest( const QString& testRootPath ); - static void setDefaultSnapshotSizeFor3dViews(); - static void setDefaultSnapshotSizeForPlotWindows(); + static QSize regressionDefaultImageSize(); private: RiaRegressionTestRunner(); @@ -64,7 +63,6 @@ class RiaRegressionTestRunner const QDir& testDir ); static void removeDirectoryWithContent( QDir& dirToDelete ); - static QSize regressionDefaultImageSize(); static QString diff2htmlHeaderText( const QString& testRootPath ); QFileInfoList subDirectoriesForTestExecution( const QDir& directory ); diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp index 0c40125a251..5b7002da9a7 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp @@ -69,6 +69,8 @@ RicfExportSnapshots::RicfExportSnapshots() CAF_PDM_InitScriptableField( &m_viewId, "viewId", -1, "View Id" ); CAF_PDM_InitScriptableField( &m_exportFolder, "exportFolder", QString(), "Export Folder" ); CAF_PDM_InitScriptableFieldNoDefault( &m_plotOutputFormat, "plotOutputFormat", "Output Format" ); + CAF_PDM_InitScriptableField( &m_width, "width", -1, "Width" ); + CAF_PDM_InitScriptableField( &m_height, "height", -1, "Height" ); } //-------------------------------------------------------------------------------------------------- @@ -83,13 +85,16 @@ caf::PdmScriptResponse RicfExportSnapshots::execute() return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, error ); } + int width = m_width(); + int height = m_height(); + RiuMainWindow* mainWnd = RiuMainWindow::instance(); CVF_ASSERT( mainWnd ); - QByteArray curState = mainWnd->dockManager()->saveState( 0 ); - mainWnd->dockManager()->restoreState( RiuDockWidgetTools::defaultDockState( RiuDockWidgetTools::dockStateHideAll3DWindowName() ) ); + // QByteArray curState = mainWnd->dockManager()->saveState( 0 ); + // mainWnd->dockManager()->restoreState( RiuDockWidgetTools::defaultDockState( RiuDockWidgetTools::dockStateHideAll3DWindowName() ) ); - QApplication::processEvents(); + // QApplication::processEvents(); QString absolutePathToSnapshotDir = RicfCommandFileExecutor::instance()->getExportPath( RicfCommandFileExecutor::ExportType::SNAPSHOTS ); @@ -105,21 +110,26 @@ caf::PdmScriptResponse RicfExportSnapshots::execute() { if ( RiaRegressionTestRunner::instance()->isRunningRegressionTests() ) { - RiaRegressionTestRunner::setDefaultSnapshotSizeFor3dViews(); - - QApplication::processEvents(); + QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize(); + width = defaultSize.width(); + height = defaultSize.height(); } - RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( absolutePathToSnapshotDir, m_prefix, m_caseId(), m_viewId() ); + RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( absolutePathToSnapshotDir, + width, + height, + m_prefix, + m_caseId(), + m_viewId() ); } if ( m_type == RicfExportSnapshots::SnapshotsType::PLOTS || m_type == RicfExportSnapshots::SnapshotsType::ALL ) { bool activateWidget = false; if ( RiaRegressionTestRunner::instance()->isRunningRegressionTests() ) { - RiaRegressionTestRunner::setDefaultSnapshotSizeForPlotWindows(); - - QApplication::processEvents(); + QSize defaultSize = RiaRegressionTestRunner::regressionDefaultImageSize(); + width = defaultSize.width(); + height = defaultSize.height(); } else { @@ -128,12 +138,18 @@ caf::PdmScriptResponse RicfExportSnapshots::execute() QString fileSuffix = ".png"; if ( m_plotOutputFormat == PlotOutputFormat::PDF ) fileSuffix = ".pdf"; - RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( absolutePathToSnapshotDir, activateWidget, m_prefix, m_viewId(), fileSuffix ); + RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( absolutePathToSnapshotDir, + width, + height, + activateWidget, + m_prefix, + m_viewId(), + fileSuffix ); } QApplication::processEvents(); - mainWnd->dockManager()->restoreState( curState ); + // mainWnd->dockManager()->restoreState( curState ); return caf::PdmScriptResponse(); } diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.h b/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.h index 52c58cfc65d..4c515b459f0 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.h +++ b/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.h @@ -62,4 +62,6 @@ class RicfExportSnapshots : public RicfCommandObject caf::PdmField m_viewId; caf::PdmField m_exportFolder; caf::PdmField m_plotOutputFormat; + caf::PdmField m_width; + caf::PdmField m_height; }; diff --git a/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp b/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp index c7247f672db..2e6885db218 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp @@ -19,6 +19,8 @@ #include "RicfSetMainWindowSize.h" +#include "RiaLogging.h" + #include "RiuMainWindow.h" #include "cafPdmFieldScriptingCapability.h" @@ -39,6 +41,6 @@ RicfSetMainWindowSize::RicfSetMainWindowSize() //-------------------------------------------------------------------------------------------------- caf::PdmScriptResponse RicfSetMainWindowSize::execute() { - if ( RiuMainWindow::instance() ) RiuMainWindow::instance()->resize( m_width, m_height ); + RiaLogging::warning( "Method set_main_window_size has been obsoleted. Set size of image snapshots directly in the snapshot methods." ); return caf::PdmScriptResponse(); } diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp index 255d9cbb3aa..86aae644fe7 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.cpp @@ -56,8 +56,8 @@ void RicSnapshotAllPlotsToFileFeature::saveAllPlots() // Save images in snapshot catalog relative to project directory QString snapshotFolderName = app->createAbsolutePathFromProjectRelativePath( "snapshots" ); - bool activateWidget = true; - exportSnapshotOfPlotsIntoFolder( snapshotFolderName, activateWidget ); + // save using existing plot sizes + exportSnapshotOfPlotsIntoFolder( snapshotFolderName, -1, -1, true /* activateWidget */ ); QString text = QString( "Exported snapshots to folder : \n%1" ).arg( snapshotFolderName ); RiaLogging::info( text.toStdString() ); @@ -67,6 +67,8 @@ void RicSnapshotAllPlotsToFileFeature::saveAllPlots() /// //-------------------------------------------------------------------------------------------------- void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QString& snapshotFolderName, + int width, + int height, bool activateWidget, const QString& prefix, int viewId, @@ -106,7 +108,7 @@ void RicSnapshotAllPlotsToFileFeature::exportSnapshotOfPlotsIntoFolder( const QS QString absoluteFileName = caf::Utils::constructFullFileName( absSnapshotPath, fileName, preferredFileSuffix ); - RicSnapshotViewToFileFeature::saveSnapshotAs( absoluteFileName, viewWindow ); + RicSnapshotViewToFileFeature::saveSnapshotAs( absoluteFileName, viewWindow, width, height ); } } } diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.h b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.h index 658bdac2ae2..7fee4334af3 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllPlotsToFileFeature.h @@ -33,6 +33,8 @@ class RicSnapshotAllPlotsToFileFeature : public caf::CmdFeature static void saveAllPlots(); static void exportSnapshotOfPlotsIntoFolder( const QString& snapshotFolderName, + int width = -1, + int height = -1, bool activateWidget = false, const QString& prefix = "", int viewId = -1, diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp index 8eac73513ea..d4a51d04f0f 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp @@ -70,11 +70,14 @@ void RicSnapshotAllViewsToFileFeature::saveAllViews() //-------------------------------------------------------------------------------------------------- /// Export snapshots of a given view (or viewId == -1 for all views) for the given case (or caseId == -1 for all cases) +/// -1 for width and height means to use the existing view size //-------------------------------------------------------------------------------------------------- void RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( const QString& snapshotFolderName, - const QString& prefix /*= ""*/, - int caseId /*= -1*/, - int viewId /*= -1*/ ) + int width, + int height, + const QString& prefix, + int caseId, + int viewId ) { RimProject* project = RimProject::current(); if ( project == nullptr ) return; @@ -136,7 +139,7 @@ void RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( const QS QString absoluteFileName = caf::Utils::constructFullFileName( absSnapshotPath, fileName, ".png" ); - RicSnapshotViewToFileFeature::saveSnapshotAs( absoluteFileName, riv ); + RicSnapshotViewToFileFeature::saveSnapshotAs( absoluteFileName, riv, width, height ); if ( RimGridView* rigv = dynamic_cast( riv ) ) { diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.h b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.h index c95b5d4698c..e317183ab05 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.h @@ -29,8 +29,12 @@ class RicSnapshotAllViewsToFileFeature : public caf::CmdFeature public: static void saveAllViews(); - static void - exportSnapshotOfViewsIntoFolder( const QString& snapshotFolderName, const QString& prefix = "", int caseId = -1, int viewId = -1 ); + static void exportSnapshotOfViewsIntoFolder( const QString& snapshotFolderName, + int width = -1, + int height = -1, + const QString& prefix = "", + int caseId = -1, + int viewId = -1 ); protected: void onActionTriggered( bool isChecked ) override; diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp index e1645b3491a..51c130827be 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp @@ -48,7 +48,7 @@ CAF_CMD_SOURCE_INIT( RicSnapshotViewToFileFeature, "RicSnapshotViewToFileFeature //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RicSnapshotViewToFileFeature::saveSnapshotAs( const QString& fileName, RimViewWindow* viewWindow ) +void RicSnapshotViewToFileFeature::saveSnapshotAs( const QString& fileName, RimViewWindow* viewWindow, int width, int height ) { auto* plotWindow = dynamic_cast( viewWindow ); if ( plotWindow && fileName.endsWith( ".pdf" ) ) @@ -57,7 +57,7 @@ void RicSnapshotViewToFileFeature::saveSnapshotAs( const QString& fileName, RimV } else if ( viewWindow ) { - QImage image = viewWindow->snapshotWindowContent(); + QImage image = viewWindow->captureSnapshot( width, height ); saveSnapshotAs( fileName, image ); } } diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.h b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.h index 9eb446ab59b..dd72e9d1370 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.h +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.h @@ -32,7 +32,7 @@ class RicSnapshotViewToFileFeature : public caf::CmdFeature CAF_CMD_HEADER_INIT; public: - static void saveSnapshotAs( const QString& fileName, RimViewWindow* viewWindow ); + static void saveSnapshotAs( const QString& fileName, RimViewWindow* viewWindow, int width = -1, int height = -1 ); static void saveSnapshotAs( const QString& fileName, const QImage& image ); static void savePlotPdfReportAs( const QString& fileName, RimPlotWindow* plotWindow ); diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index d8cdbae446d..7393ed36ffa 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -651,7 +651,7 @@ QImage RimMultiPlot::captureSnapshot( int width, int height ) QSize orgViewSize = m_viewer->size(); - image = captureImage( m_viewer->bookWidget(), width, height ); + image = RimViewWindow::captureSnapshot( m_viewer->bookWidget(), width, height ); m_viewer->resize( orgViewSize ); doUpdateLayout(); diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index 6ede9a37d55..97db4c3bb9f 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -228,19 +228,28 @@ QImage RimViewWindow::snapshotWindowContent() //-------------------------------------------------------------------------------------------------- QImage RimViewWindow::captureSnapshot( int width, int height ) { - return captureImage( viewWidget(), width, height ); + return captureSnapshot( viewWidget(), width, height ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QImage RimViewWindow::captureImage( QWidget* widget, int width, int height ) +QImage RimViewWindow::captureSnapshot( QWidget* widget, int width, int height ) { if ( !widget ) return QImage(); - QSize orgSize = widget->size(); + bool shouldResize = width > 0 && height > 0 && ( widget->width() != width || widget->height() != height ); - widget->setFixedSize( width, height ); + QSize orgSize = widget->size(); + if ( shouldResize ) + { + widget->setFixedSize( width, height ); + } + else + { + width = widget->width(); + height = widget->height(); + } QPixmap pix( width, height ); pix.fill( Qt::transparent ); @@ -248,10 +257,12 @@ QImage RimViewWindow::captureImage( QWidget* widget, int width, int height ) QPainter painter( &pix ); widget->render( &painter ); - // reset fixed size and restore original size - widget->setMinimumSize( 0, 0 ); - widget->setMaximumSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX ); - widget->resize( orgSize ); + if ( shouldResize ) + { + widget->setMinimumSize( 0, 0 ); + widget->setMaximumSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX ); + widget->resize( orgSize ); + } return pix.toImage(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index b33fce97c5b..052b140f680 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -25,6 +25,8 @@ #include "cafPdmField.h" #include "cafPdmObject.h" +#include + class RimDockWindowController; namespace ads @@ -101,7 +103,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - QImage captureImage( QWidget* widget, int width, int height ); + QImage captureSnapshot( QWidget* widget, int width, int height ); private: friend class RimProject; diff --git a/GrpcInterface/GrpcProtos/Commands.proto b/GrpcInterface/GrpcProtos/Commands.proto index 5dbdf8fc6ec..8449d6c7e82 100644 --- a/GrpcInterface/GrpcProtos/Commands.proto +++ b/GrpcInterface/GrpcProtos/Commands.proto @@ -55,6 +55,8 @@ message ExportSnapshotsRequest { int32 viewId = 4; string exportFolder = 5; PlotOutputFormat plotOutputFormat = 6; + int32 width = 7; + int32 height = 8; } message ExportPropertyRequest { diff --git a/GrpcInterface/Python/rips/PythonExamples/export_and_plotting/export_plots.py b/GrpcInterface/Python/rips/PythonExamples/export_and_plotting/export_plots.py index e54926b1104..577069ae013 100644 --- a/GrpcInterface/Python/rips/PythonExamples/export_and_plotting/export_plots.py +++ b/GrpcInterface/Python/rips/PythonExamples/export_and_plotting/export_plots.py @@ -15,7 +15,7 @@ print("Exporting to: " + export_folder) for plot in plots: - plot.export_snapshot(export_folder=export_folder) + plot.export_snapshot(export_folder=export_folder, width=1024, height=768) plot.export_snapshot(export_folder=export_folder, output_format="PDF") if isinstance(plot, rips.WellLogPlot): plot.export_data_as_las(export_folder=export_folder) diff --git a/GrpcInterface/Python/rips/PythonExamples/export_and_plotting/export_snapshots.py b/GrpcInterface/Python/rips/PythonExamples/export_and_plotting/export_snapshots.py index f4f49366d00..e67d35f386f 100644 --- a/GrpcInterface/Python/rips/PythonExamples/export_and_plotting/export_snapshots.py +++ b/GrpcInterface/Python/rips/PythonExamples/export_and_plotting/export_snapshots.py @@ -10,7 +10,7 @@ cases = resinsight.project.cases() # Set main window size -resinsight.set_main_window_size(width=800, height=500) +# resinsight.set_main_window_size(width=1280, height=900) n = 5 # every n-th time_step for snapshot property_list = ["SOIL", "PRESSURE"] # list of parameter for snapshot @@ -42,4 +42,4 @@ ) for time_step in range(0, len(time_steps), 10): view.set_time_step(time_step=time_step) - view.export_snapshot() + view.export_snapshot(width=1024, height=768) diff --git a/GrpcInterface/Python/rips/plot.py b/GrpcInterface/Python/rips/plot.py index 2c6300a1fdd..d1176ce1096 100644 --- a/GrpcInterface/Python/rips/plot.py +++ b/GrpcInterface/Python/rips/plot.py @@ -9,13 +9,15 @@ @add_method(PlotWindow) -def export_snapshot(self, export_folder="", file_prefix="", output_format="PNG"): +def export_snapshot(self, export_folder="", file_prefix="", output_format="PNG", width=-1, height=-1): """Export snapshot for the current plot Arguments: export_folder(str): The path to export to. By default will use the global export folder prefix (str): Exported file name prefix output_format(str): Enum string. Can be 'PNG' or 'PDF'. + width (int): The width of the exported snapshot. By default will use the existing size. + height (int): The height of the exported snapshot. By default will use the existing size. """ return self._execute_command( @@ -25,5 +27,7 @@ def export_snapshot(self, export_folder="", file_prefix="", output_format="PNG") viewId=self.id, exportFolder=export_folder, plotOutputFormat=output_format, + width=width, + height=height, ) ) diff --git a/GrpcInterface/Python/rips/view.py b/GrpcInterface/Python/rips/view.py index 901e75a7be1..04b30bdc6cb 100644 --- a/GrpcInterface/Python/rips/view.py +++ b/GrpcInterface/Python/rips/view.py @@ -245,7 +245,7 @@ def visible_cells(self, time_step=0): @add_method(ViewWindow) -def export_snapshot(self, prefix="", export_folder=""): +def export_snapshot(self, prefix="", export_folder="", width=-1, height=-1): """Export snapshot for the current view Arguments: @@ -260,5 +260,7 @@ def export_snapshot(self, prefix="", export_folder=""): caseId=case_id, viewId=self.id, exportFolder=export_folder, + width=width, + height=height ) ) From 2c4e6cf315da91feb2302ac7f4d8031287783f0b Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 9 Jun 2026 17:50:23 +0200 Subject: [PATCH 37/47] Clean up delete 3d views and project close/open Update to latest qtadv docking --- .../Application/RiaGuiApplication.cpp | 25 +++++++++++++++---- .../ProjectDataModel/Rim3dView.cpp | 15 +++++++---- .../RimDockWindowController.cpp | 7 +++--- .../ProjectDataModel/RimViewWindow.cpp | 10 ++++++-- .../UserInterface/RiuMainWindowBase.cpp | 4 +-- .../UserInterface/RiuMainWindowBase.h | 2 +- ThirdParty/qtadvanceddocking | 2 +- 7 files changed, 45 insertions(+), 20 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 3248d5a8113..9f29bc306dd 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -420,14 +420,29 @@ void RiaGuiApplication::storeDockState() //-------------------------------------------------------------------------------------------------- void RiaGuiApplication::restoreDockState() { - if ( m_mainWindow && !project()->mainWindowDockState().isEmpty() ) + if ( m_mainWindow ) { - m_mainWindow->restoreDockWidgetState( project()->mainWindowDockState ); + bool useDefault = true; + if ( !project()->mainWindowDockState().isEmpty() ) + { + useDefault = !m_mainWindow->restoreDockWidgetState( project()->mainWindowDockState ); + } + if ( useDefault ) + { + RiuDockWidgetTools::setDockLayout( m_mainWindow, RiuDockWidgetTools::dockState3DEclipseName() ); + } } - - if ( m_mainPlotWindow && !project()->plotWindowDockState().isEmpty() ) + if ( m_mainPlotWindow ) { - m_mainPlotWindow->restoreDockWidgetState( project()->plotWindowDockState ); + bool useDefault = true; + if ( !project()->plotWindowDockState().isEmpty() ) + { + useDefault = !m_mainPlotWindow->restoreDockWidgetState( project()->plotWindowDockState ); + } + if ( useDefault ) + { + RiuDockWidgetTools::setDockLayout( m_mainPlotWindow, RiuDockWidgetTools::dockStatePlotWindowName() ); + } } } diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index e3e009caac9..77a71e47118 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -206,6 +206,8 @@ Rim3dView::~Rim3dView() RiaApplication::instance()->setActiveReservoirView( nullptr ); } + removeWindowFromDock(); + if ( m_viewer ) { m_viewer->clearRimView(); @@ -214,8 +216,6 @@ Rim3dView::~Rim3dView() // Make sure the object is disconnected from other objects before delete prepareForDelete(); - removeWindowFromDock(); - if ( m_viewer ) { m_viewer->deleteLater(); @@ -463,9 +463,12 @@ void Rim3dView::deleteViewWidget() // Earlier implementations has used m_viewer->deleteLater(). This caused issues triggered by 3D editors and // interaction with the event processing. deleteLater() will not be handled by processEvents() if we are in the // state of processing UI events, ie in the process of handling a QAction - - delete m_viewer; - m_viewer = nullptr; + if ( m_viewer ) + { + m_viewer->setParent( nullptr ); + delete m_viewer; + m_viewer = nullptr; + } } //-------------------------------------------------------------------------------------------------- @@ -497,6 +500,8 @@ void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOr m_annotationCountHint.uiCapability()->setUiReadOnly( !m_useCustomAnnotationStrategy || ( m_annotationStrategy() != RivAnnotationTools::LabelPositionStrategy::COUNT_HINT ) ); + uiOrdering.add( &m_dockWindowId ); + uiOrdering.skipRemainingFields( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp index b2a2fa37813..6be1f22a043 100644 --- a/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimDockWindowController.cpp @@ -62,7 +62,6 @@ void RimDockWindowController::handleViewerDeletion() viewPdmObject()->updateUiIconFromToggleField(); uiCapability()->updateUiIconFromToggleField(); removeWindowFromDock(); - updateConnectedEditors(); } @@ -72,7 +71,7 @@ void RimDockWindowController::handleViewerDeletion() void RimDockWindowController::removeWindowFromDock() { RiuMainWindowBase* mainWin = getMainWindow(); - if ( mainWin && viewWidget() && viewPdmObject() ) + if ( mainWin && viewPdmObject() ) { viewPdmObject()->deleteDockWidget(); viewPdmObject()->deleteViewWidget(); @@ -124,7 +123,7 @@ void RimDockWindowController::updateViewerWidget() if ( !viewWidget() ) { ads::CDockWidget* dockWidget = viewPdmObject()->createDockWidget(); - QWidget* viewWidget = viewPdmObject()->createViewWidget( dockWidget ); + QWidget* viewWidget = viewPdmObject()->createViewWidget(); dockWidget->setWidget( viewWidget ); dockWidget->setObjectName( viewPdmObject()->dockWindowName() ); viewWidget->setObjectName( viewPdmObject()->dockWindowName() ); @@ -140,9 +139,9 @@ void RimDockWindowController::updateViewerWidget() } else { + viewPdmObject()->deleteDockWidget(); if ( viewWidget() ) { - viewPdmObject()->deleteDockWidget(); viewPdmObject()->deleteViewWidget(); mainWindow->onViewerRemoved(); } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index 97db4c3bb9f..050ccce83d6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -34,6 +34,7 @@ #include "cafPdmUiTreeAttributes.h" #include "cafPdmUiTreeViewEditor.h" +#include "DockManager.h" #include "DockWidget.h" #include @@ -68,6 +69,7 @@ RimViewWindow::RimViewWindow() //-------------------------------------------------------------------------------------------------- RimViewWindow::~RimViewWindow() { + if ( m_windowController ) delete m_windowController; } //-------------------------------------------------------------------------------------------------- @@ -158,8 +160,12 @@ QString RimViewWindow::windowTitle() //-------------------------------------------------------------------------------------------------- void RimViewWindow::deleteDockWidget() { - m_dockWidget->deleteDockWidget(); - m_dockWidget = nullptr; + if ( m_dockWidget && m_dockWidget->dockManager() ) + { + m_dockWidget->dockManager()->removeDockWidget( m_dockWidget ); + m_dockWidget->deleteLater(); + m_dockWidget = nullptr; + } } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index d2283c005b6..0f135a9d722 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -128,10 +128,10 @@ QString RiuMainWindowBase::dockWidgetStateString() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuMainWindowBase::restoreDockWidgetState( QString dockStateString ) +bool RiuMainWindowBase::restoreDockWidgetState( QString dockStateString ) { QByteArray dockState = QByteArray::fromBase64( dockStateString.toLatin1() ); - m_dockManager->restoreState( dockState, DOCKSTATE_VERSION ); + return m_dockManager->restoreState( dockState, DOCKSTATE_VERSION ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h index 831360c0d9f..7fb34574149 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.h @@ -94,7 +94,7 @@ class RiuMainWindowBase : public QMainWindow ads::CDockManager* dockManager() const; QString dockWidgetStateString() const; - void restoreDockWidgetState( QString dockStateString ); + bool restoreDockWidgetState( QString dockStateString ); protected: void createTreeViews( int numberOfTrees ); diff --git a/ThirdParty/qtadvanceddocking b/ThirdParty/qtadvanceddocking index f7779eff0cc..3af0cedd5ba 160000 --- a/ThirdParty/qtadvanceddocking +++ b/ThirdParty/qtadvanceddocking @@ -1 +1 @@ -Subproject commit f7779eff0ccf4edfae15222131bbb375c8c8a0ea +Subproject commit 3af0cedd5ba218850ebffd807fddb67cfd4fc335 From aedc30b544de52eaaf3fa609af908213e4b466e9 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 9 Jun 2026 17:55:28 +0200 Subject: [PATCH 38/47] Whatever --- GrpcInterface/Python/rips/plot.py | 4 +++- GrpcInterface/Python/rips/view.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/GrpcInterface/Python/rips/plot.py b/GrpcInterface/Python/rips/plot.py index d1176ce1096..55d419f633a 100644 --- a/GrpcInterface/Python/rips/plot.py +++ b/GrpcInterface/Python/rips/plot.py @@ -9,7 +9,9 @@ @add_method(PlotWindow) -def export_snapshot(self, export_folder="", file_prefix="", output_format="PNG", width=-1, height=-1): +def export_snapshot( + self, export_folder="", file_prefix="", output_format="PNG", width=-1, height=-1 +): """Export snapshot for the current plot Arguments: diff --git a/GrpcInterface/Python/rips/view.py b/GrpcInterface/Python/rips/view.py index 04b30bdc6cb..29c812671ab 100644 --- a/GrpcInterface/Python/rips/view.py +++ b/GrpcInterface/Python/rips/view.py @@ -261,6 +261,6 @@ def export_snapshot(self, prefix="", export_folder="", width=-1, height=-1): viewId=self.id, exportFolder=export_folder, width=width, - height=height + height=height, ) ) From fe3b2205c8c4562df5f684fdcc879025bcdf99c1 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Tue, 9 Jun 2026 18:10:48 +0200 Subject: [PATCH 39/47] Fix advanced snapshot export. --- .../ProjectDataModel/Rim3dView.cpp | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index 77a71e47118..be1b021e9d7 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -526,18 +526,25 @@ QImage Rim3dView::captureSnapshot( int width, int height ) QImage image; if ( m_viewer ) { - QSize orgSize = m_viewer->layoutWidget()->size(); + if ( width <= 0 || height <= 0 ) + { + image = m_viewer->snapshotImage(); + } + else + { + QSize orgSize = m_viewer->layoutWidget()->size(); - // adjust for possible display DPI scaling - const auto ratio = m_viewer->displayScalingRatio(); - m_viewer->layoutWidget()->setFixedSize( (int)( 1.0 * width / ratio ), (int)( 1.0 * height / ratio ) ); + // adjust for possible display DPI scaling + const auto ratio = m_viewer->displayScalingRatio(); + m_viewer->layoutWidget()->setFixedSize( (int)( 1.0 * width / ratio ), (int)( 1.0 * height / ratio ) ); - image = m_viewer->snapshotImage(); + image = m_viewer->snapshotImage(); - // reset fixed size and restore original size - m_viewer->layoutWidget()->setMinimumSize( 0, 0 ); - m_viewer->layoutWidget()->setMaximumSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX ); - m_viewer->layoutWidget()->resize( orgSize ); + // reset fixed size and restore original size + m_viewer->layoutWidget()->setMinimumSize( 0, 0 ); + m_viewer->layoutWidget()->setMaximumSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX ); + m_viewer->layoutWidget()->resize( orgSize ); + } } return image; From 3a0a51cff89d07456bc5da59795365e08dda1da7 Mon Sep 17 00:00:00 2001 From: jonjenssen Date: Wed, 10 Jun 2026 16:20:17 +0200 Subject: [PATCH 40/47] Clean up PDF snapshots a bit --- .../CommandFileInterface/RicfExportSnapshots.cpp | 9 --------- .../ExportCommands/RicSnapshotViewToFileFeature.cpp | 9 ++++++++- ApplicationLibCode/ProjectDataModel/RimPlot.cpp | 3 ++- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp b/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp index 5b7002da9a7..012a09565de 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfExportSnapshots.cpp @@ -91,11 +91,6 @@ caf::PdmScriptResponse RicfExportSnapshots::execute() RiuMainWindow* mainWnd = RiuMainWindow::instance(); CVF_ASSERT( mainWnd ); - // QByteArray curState = mainWnd->dockManager()->saveState( 0 ); - // mainWnd->dockManager()->restoreState( RiuDockWidgetTools::defaultDockState( RiuDockWidgetTools::dockStateHideAll3DWindowName() ) ); - - // QApplication::processEvents(); - QString absolutePathToSnapshotDir = RicfCommandFileExecutor::instance()->getExportPath( RicfCommandFileExecutor::ExportType::SNAPSHOTS ); if ( !m_exportFolder().isEmpty() ) @@ -147,9 +142,5 @@ caf::PdmScriptResponse RicfExportSnapshots::execute() fileSuffix ); } - QApplication::processEvents(); - - // mainWnd->dockManager()->restoreState( curState ); - return caf::PdmScriptResponse(); } diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp index 51c130827be..b4c726e935c 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotViewToFileFeature.cpp @@ -113,10 +113,17 @@ void RicSnapshotViewToFileFeature::savePlotPdfReportAs( const QString& fileName, else { QRect pageRect = pdfPrinter.pageLayout().paintRectPixels( resolution ); - viewWidget->resize( pageRect.size() ); + viewWidget->setFixedSize( pageRect.size() ); plot->renderWindowContent( &pdfPrinter ); + viewWidget->setMinimumSize( 0, 0 ); + viewWidget->setMaximumSize( QWIDGETSIZE_MAX, QWIDGETSIZE_MAX ); viewWidget->resize( widgetRect.size() ); } + + if ( multiPlot ) + { + multiPlot->updateLayout(); + } } else { diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp index 8a10cd851cb..e1c7f5b51a6 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp @@ -196,7 +196,8 @@ void RimPlot::doRenderWindowContent( QPaintDevice* paintDevice ) { if ( plotWidget() ) { - plotWidget()->renderTo( paintDevice, plotWidget()->frameGeometry() ); + auto rect = plotWidget()->frameGeometry(); + plotWidget()->renderTo( paintDevice, rect ); } } From 423998b7142ce6e5aad78beb108623ffc8f61097 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Thu, 11 Jun 2026 16:30:46 +0200 Subject: [PATCH 41/47] Some cleanup --- .../Application/RiaGuiApplication.cpp | 8 +++++--- .../CommandFileInterface/RicfSetMainWindowSize.cpp | 7 +++---- .../CommandFileInterface/RicfSetPlotWindowSize.cpp | 13 ++++--------- .../RicSnapshotAllViewsToFileFeature.cpp | 2 +- ApplicationLibCode/ProjectDataModel/Rim3dView.cpp | 2 -- .../ProjectDataModel/RimMultiPlot.cpp | 3 +-- ApplicationLibCode/ProjectDataModel/RimPlot.cpp | 3 +-- .../ProjectDataModel/RimViewWindow.cpp | 8 ++++---- ApplicationLibCode/ProjectDataModel/RimViewWindow.h | 4 ++-- .../UserInterface/RiuDockWidgetTools.cpp | 8 -------- .../UserInterface/RiuDockWidgetTools.h | 2 -- .../export_and_plotting/export_snapshots.py | 3 --- .../command_example.py | 10 ++-------- GrpcInterface/Python/rips/project.py | 4 +++- 14 files changed, 26 insertions(+), 51 deletions(-) diff --git a/ApplicationLibCode/Application/RiaGuiApplication.cpp b/ApplicationLibCode/Application/RiaGuiApplication.cpp index 9f29bc306dd..490c1e990c5 100644 --- a/ApplicationLibCode/Application/RiaGuiApplication.cpp +++ b/ApplicationLibCode/Application/RiaGuiApplication.cpp @@ -1854,9 +1854,11 @@ bool RiaGuiApplication::notify( QObject* receiver, QEvent* event ) { if ( activeWindow() != mainWindow() ) { - QWheelEvent* wheelEvent = static_cast( event ); - RimPlotWindow* plot = dynamic_cast( activePlotWindow() ); - if ( plot ) done = plot->handleGlobalWheelEvent( wheelEvent ); + QWheelEvent* wheelEvent = static_cast( event ); + if ( RimPlotWindow* plot = dynamic_cast( activePlotWindow() ) ) + { + done = plot->handleGlobalWheelEvent( wheelEvent ); + } } } if ( !done ) diff --git a/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp b/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp index 2e6885db218..be1f087f156 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfSetMainWindowSize.cpp @@ -21,8 +21,6 @@ #include "RiaLogging.h" -#include "RiuMainWindow.h" - #include "cafPdmFieldScriptingCapability.h" CAF_PDM_SOURCE_INIT( RicfSetMainWindowSize, "setMainWindowSize" ); @@ -41,6 +39,7 @@ RicfSetMainWindowSize::RicfSetMainWindowSize() //-------------------------------------------------------------------------------------------------- caf::PdmScriptResponse RicfSetMainWindowSize::execute() { - RiaLogging::warning( "Method set_main_window_size has been obsoleted. Set size of image snapshots directly in the snapshot methods." ); - return caf::PdmScriptResponse(); + RiaLogging::warning( "Method set_main_window_size has been obsoleted. Set image sizes directly in the snapshot methods." ); + return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_WARNING, + "Obsolete command. Set image sizes directly in the snapshot methods." ); } diff --git a/ApplicationLibCode/CommandFileInterface/RicfSetPlotWindowSize.cpp b/ApplicationLibCode/CommandFileInterface/RicfSetPlotWindowSize.cpp index cfa4e22fe95..1cc10388b41 100644 --- a/ApplicationLibCode/CommandFileInterface/RicfSetPlotWindowSize.cpp +++ b/ApplicationLibCode/CommandFileInterface/RicfSetPlotWindowSize.cpp @@ -18,8 +18,7 @@ #include "RicfSetPlotWindowSize.h" -#include "RiaGuiApplication.h" -#include "RiuPlotMainWindow.h" +#include "RiaLogging.h" #include "cafPdmFieldScriptingCapability.h" @@ -39,11 +38,7 @@ RicfSetPlotWindowSize::RicfSetPlotWindowSize() //-------------------------------------------------------------------------------------------------- caf::PdmScriptResponse RicfSetPlotWindowSize::execute() { - RiaGuiApplication* guiApp = RiaGuiApplication::instance(); - if ( guiApp ) - { - guiApp->getOrCreateAndShowMainPlotWindow()->resize( m_width, m_height ); - return caf::PdmScriptResponse(); - } - return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_ERROR, "Need GUI ResInsight to set plot window size" ); + RiaLogging::warning( "Method set_plot_window_size has been obsoleted. Set image sizes directly in the snapshot methods." ); + return caf::PdmScriptResponse( caf::PdmScriptResponse::COMMAND_WARNING, + "Obsolete command. Set image sizes directly in the snapshot methods." ); } diff --git a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp index d4a51d04f0f..c7f0d28ab40 100644 --- a/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp +++ b/ApplicationLibCode/Commands/ExportCommands/RicSnapshotAllViewsToFileFeature.cpp @@ -70,7 +70,7 @@ void RicSnapshotAllViewsToFileFeature::saveAllViews() //-------------------------------------------------------------------------------------------------- /// Export snapshots of a given view (or viewId == -1 for all views) for the given case (or caseId == -1 for all cases) -/// -1 for width and height means to use the existing view size +/// <= 0 for width and height means to use the existing view size //-------------------------------------------------------------------------------------------------- void RicSnapshotAllViewsToFileFeature::exportSnapshotOfViewsIntoFolder( const QString& snapshotFolderName, int width, diff --git a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp index be1b021e9d7..f4bf46c9564 100644 --- a/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationLibCode/ProjectDataModel/Rim3dView.cpp @@ -500,8 +500,6 @@ void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOr m_annotationCountHint.uiCapability()->setUiReadOnly( !m_useCustomAnnotationStrategy || ( m_annotationStrategy() != RivAnnotationTools::LabelPositionStrategy::COUNT_HINT ) ); - uiOrdering.add( &m_dockWindowId ); - uiOrdering.skipRemainingFields( true ); } diff --git a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp index 7393ed36ffa..166037aa232 100644 --- a/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimMultiPlot.cpp @@ -35,7 +35,6 @@ #include "cafPdmUiToolButtonEditor.h" #include -#include #include #include @@ -651,7 +650,7 @@ QImage RimMultiPlot::captureSnapshot( int width, int height ) QSize orgViewSize = m_viewer->size(); - image = RimViewWindow::captureSnapshot( m_viewer->bookWidget(), width, height ); + image = RimViewWindow::internalCaptureSnapshot( m_viewer->bookWidget(), width, height ); m_viewer->resize( orgViewSize ); doUpdateLayout(); diff --git a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp index e1c7f5b51a6..8a10cd851cb 100644 --- a/ApplicationLibCode/ProjectDataModel/RimPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimPlot.cpp @@ -196,8 +196,7 @@ void RimPlot::doRenderWindowContent( QPaintDevice* paintDevice ) { if ( plotWidget() ) { - auto rect = plotWidget()->frameGeometry(); - plotWidget()->renderTo( paintDevice, rect ); + plotWidget()->renderTo( paintDevice, plotWidget()->frameGeometry() ); } } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp index 050ccce83d6..975369d6e20 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.cpp @@ -69,7 +69,7 @@ RimViewWindow::RimViewWindow() //-------------------------------------------------------------------------------------------------- RimViewWindow::~RimViewWindow() { - if ( m_windowController ) delete m_windowController; + if ( m_windowController() ) delete m_windowController(); } //-------------------------------------------------------------------------------------------------- @@ -234,13 +234,13 @@ QImage RimViewWindow::snapshotWindowContent() //-------------------------------------------------------------------------------------------------- QImage RimViewWindow::captureSnapshot( int width, int height ) { - return captureSnapshot( viewWidget(), width, height ); + return internalCaptureSnapshot( viewWidget(), width, height ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QImage RimViewWindow::captureSnapshot( QWidget* widget, int width, int height ) +QImage RimViewWindow::internalCaptureSnapshot( QWidget* widget, int width, int height ) { if ( !widget ) return QImage(); @@ -400,7 +400,7 @@ void RimViewWindow::defineObjectEditorAttribute( QString uiConfigName, caf::PdmU //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -ads::CDockWidget* RimViewWindow::dockWidget() +ads::CDockWidget* RimViewWindow::dockWidget() const { return m_dockWidget; } diff --git a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h index 052b140f680..7679c3dfe03 100644 --- a/ApplicationLibCode/ProjectDataModel/RimViewWindow.h +++ b/ApplicationLibCode/ProjectDataModel/RimViewWindow.h @@ -65,7 +65,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface virtual QWidget* viewWidget() = 0; - ads::CDockWidget* dockWidget(); + ads::CDockWidget* dockWidget() const; ads::CDockWidget* createDockWidget(); virtual QImage captureSnapshot( int width, int height ); @@ -103,7 +103,7 @@ class RimViewWindow : public caf::PdmObject, public caf::FontHolderInterface void defineObjectEditorAttribute( QString uiConfigName, caf::PdmUiEditorAttribute* attribute ) override; - QImage captureSnapshot( QWidget* widget, int width, int height ); + static QImage internalCaptureSnapshot( QWidget* widget, int width, int height ); private: friend class RimProject; diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp index 49e01a1da81..efe7b70f547 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.cpp @@ -327,14 +327,6 @@ QString RiuDockWidgetTools::dockStateHideAll3DWindowName() return "Hide All"; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -QString RiuDockWidgetTools::viewWindowPrefix() -{ - return "DockViewWindow_"; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h index 94674b9c611..59b47268cae 100644 --- a/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h +++ b/ApplicationLibCode/UserInterface/RiuDockWidgetTools.h @@ -91,8 +91,6 @@ class RiuDockWidgetTools static QString dockStateHideAllPlotWindowName(); static QString dockStateHideAll3DWindowName(); - static QString viewWindowPrefix(); - static void setDockLayout( RiuMainWindowBase* mainWindow, const QString& layoutName ); static QAction* toggleActionForWidget( const ads::CDockManager* dockManager, const QString& dockWidgetName ); diff --git a/GrpcInterface/Python/rips/PythonExamples/export_and_plotting/export_snapshots.py b/GrpcInterface/Python/rips/PythonExamples/export_and_plotting/export_snapshots.py index e67d35f386f..aa1ed4a5bdd 100644 --- a/GrpcInterface/Python/rips/PythonExamples/export_and_plotting/export_snapshots.py +++ b/GrpcInterface/Python/rips/PythonExamples/export_and_plotting/export_snapshots.py @@ -9,9 +9,6 @@ resinsight = rips.Instance.find() cases = resinsight.project.cases() -# Set main window size -# resinsight.set_main_window_size(width=1280, height=900) - n = 5 # every n-th time_step for snapshot property_list = ["SOIL", "PRESSURE"] # list of parameter for snapshot diff --git a/GrpcInterface/Python/rips/PythonExamples/instance_and_project_management/command_example.py b/GrpcInterface/Python/rips/PythonExamples/instance_and_project_management/command_example.py index cd0822bad6c..756c55efcc6 100644 --- a/GrpcInterface/Python/rips/PythonExamples/instance_and_project_management/command_example.py +++ b/GrpcInterface/Python/rips/PythonExamples/instance_and_project_management/command_example.py @@ -1,5 +1,5 @@ ############################################################################### -# This example will show setting time step, window size and export snapshots and properties +# This example will show setting time step and export snapshots and properties ############################################################################### import os import tempfile @@ -8,11 +8,6 @@ # Load instance resinsight = rips.Instance.find() -# Set window sizes -resinsight.set_main_window_size(width=800, height=500) -resinsight.set_plot_window_size(width=1000, height=1000) - - # Retrieve first case case = resinsight.project.cases()[0] @@ -30,7 +25,6 @@ result_type=rips.PropertyType.DYNAMIC_NATIVE, result_variable="SOIL" ) - # Create a temporary directory which will disappear at the end of this script # If you want to keep the files, provide a good path name instead of tmpdirname with tempfile.TemporaryDirectory(prefix="rips") as tmpdirname: @@ -41,7 +35,7 @@ resinsight.set_export_folder(export_type="PROPERTIES", path=tmpdirname) # Export all snapshots - resinsight.project.export_snapshots() + resinsight.project.export_snapshots(width=1024, height=768) assert len(os.listdir(tmpdirname)) > 0 diff --git a/GrpcInterface/Python/rips/project.py b/GrpcInterface/Python/rips/project.py index 1dfdc7e9130..f8675ef23bf 100644 --- a/GrpcInterface/Python/rips/project.py +++ b/GrpcInterface/Python/rips/project.py @@ -283,7 +283,7 @@ def export_multi_case_snapshots(self, grid_list_file): @add_method(Project) -def export_snapshots(self, snapshot_type="ALL", prefix="", plot_format="PNG"): +def export_snapshots(self, snapshot_type="ALL", prefix="", plot_format="PNG", width=-1, height=-1): """Export all snapshots of a given type Arguments: @@ -298,6 +298,8 @@ def export_snapshots(self, snapshot_type="ALL", prefix="", plot_format="PNG"): caseId=-1, viewId=-1, plotOutputFormat=plot_format, + width=width, + height=height ) ) From c8e24d72e3bcfef9671d9be406364b63b2deff08 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Thu, 11 Jun 2026 17:22:30 +0200 Subject: [PATCH 42/47] Whatever --- GrpcInterface/Python/rips/project.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GrpcInterface/Python/rips/project.py b/GrpcInterface/Python/rips/project.py index f8675ef23bf..7b4789960dd 100644 --- a/GrpcInterface/Python/rips/project.py +++ b/GrpcInterface/Python/rips/project.py @@ -283,7 +283,9 @@ def export_multi_case_snapshots(self, grid_list_file): @add_method(Project) -def export_snapshots(self, snapshot_type="ALL", prefix="", plot_format="PNG", width=-1, height=-1): +def export_snapshots( + self, snapshot_type="ALL", prefix="", plot_format="PNG", width=-1, height=-1 +): """Export all snapshots of a given type Arguments: @@ -299,7 +301,7 @@ def export_snapshots(self, snapshot_type="ALL", prefix="", plot_format="PNG", wi viewId=-1, plotOutputFormat=plot_format, width=width, - height=height + height=height, ) ) From 4d2527d04035549de5f42b5cccd54438266ac11e Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Thu, 11 Jun 2026 17:53:08 +0200 Subject: [PATCH 43/47] Update python test and example --- .../launch_load_case_snapshot_exit.py | 2 +- GrpcInterface/Python/rips/tests/test_project.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/GrpcInterface/Python/rips/PythonExamples/instance_and_project_management/launch_load_case_snapshot_exit.py b/GrpcInterface/Python/rips/PythonExamples/instance_and_project_management/launch_load_case_snapshot_exit.py index 904d12b9e69..30f26772cf5 100644 --- a/GrpcInterface/Python/rips/PythonExamples/instance_and_project_management/launch_load_case_snapshot_exit.py +++ b/GrpcInterface/Python/rips/PythonExamples/instance_and_project_management/launch_load_case_snapshot_exit.py @@ -36,7 +36,7 @@ resinsight.set_export_folder(export_type="PROPERTIES", path="e:/temp") # Export all snapshots -resinsight.project.export_snapshots() +resinsight.project.export_snapshots(width=800, height=600) # Export properties in the view view1.export_property() diff --git a/GrpcInterface/Python/rips/tests/test_project.py b/GrpcInterface/Python/rips/tests/test_project.py index 8e5c6c83fc9..0c7f80bc7bb 100644 --- a/GrpcInterface/Python/rips/tests/test_project.py +++ b/GrpcInterface/Python/rips/tests/test_project.py @@ -248,7 +248,7 @@ def test_exportSnapshots(rips_instance, initialize_test): with tempfile.TemporaryDirectory(prefix="rips") as tmpdirname: print("Temporary folder: ", tmpdirname) rips_instance.set_export_folder(export_type="SNAPSHOTS", path=tmpdirname) - rips_instance.project.export_snapshots() + rips_instance.project.export_snapshots(width=640, height=480) print(os.listdir(tmpdirname)) # assert(len(os.listdir(tmpdirname)) > 0) for fileName in os.listdir(tmpdirname): From dbca88e6b5600c46ff87a89e0ab3ee6a430f197d Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Mon, 15 Jun 2026 12:33:41 +0200 Subject: [PATCH 44/47] Update docking to latest version to support wayland --- ThirdParty/qtadvanceddocking | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ThirdParty/qtadvanceddocking b/ThirdParty/qtadvanceddocking index 3af0cedd5ba..82df2b64f66 160000 --- a/ThirdParty/qtadvanceddocking +++ b/ThirdParty/qtadvanceddocking @@ -1 +1 @@ -Subproject commit 3af0cedd5ba218850ebffd807fddb67cfd4fc335 +Subproject commit 82df2b64f661e63ac60a4e6ab8ac82c95347b01e From 5694ce05e73e1b53d52137adf07c427eb74774a0 Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Mon, 15 Jun 2026 13:11:38 +0200 Subject: [PATCH 45/47] Trigger selection update when a new tab is activated --- ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp index 0f135a9d722..4f027ec29e2 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindowBase.cpp @@ -397,6 +397,7 @@ void RiuMainWindowBase::slotDockViewerVisibilityChanged( bool visible ) if ( view->dockWidget() == dockWidget ) { view->setAsActiveViewer(); + selectAsCurrentItem( view ); break; } } From cdba66cc49f059e5063e482164afe6e96257260a Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Mon, 15 Jun 2026 13:17:36 +0200 Subject: [PATCH 46/47] Track selection in 3d viewers --- ApplicationLibCode/UserInterface/RiuViewer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ApplicationLibCode/UserInterface/RiuViewer.cpp b/ApplicationLibCode/UserInterface/RiuViewer.cpp index 0f4ea7b9ff5..708640fa940 100644 --- a/ApplicationLibCode/UserInterface/RiuViewer.cpp +++ b/ApplicationLibCode/UserInterface/RiuViewer.cpp @@ -35,6 +35,7 @@ #include "RivTernarySaturationOverlayItem.h" #include "WindowEdgeAxesOverlayItem/RivWindowEdgeAxesOverlayItem.h" +#include "Riu3DMainWindowTools.h" #include "RiuCadNavigation.h" #include "RiuComparisonViewMover.h" #include "RiuGeoQuestNavigation.h" @@ -724,7 +725,11 @@ void RiuViewer::mousePressEvent( QMouseEvent* mouseEvent ) { m_lastMousePressPosition = mouseEvent->pos(); - if ( auto ownView = ownerViewWindow() ) ownView->setAsActiveViewer(); + if ( auto ownView = ownerViewWindow() ) + { + ownView->setAsActiveViewer(); + Riu3DMainWindowTools::selectAsCurrentItem( ownView ); + } } } From 43b2cb16819ecd62de5bd930c285f4a2fd0c433c Mon Sep 17 00:00:00 2001 From: Jon Jenssen Date: Mon, 15 Jun 2026 17:46:08 +0200 Subject: [PATCH 47/47] Work in progress- hide/show titlebars --- ApplicationExeCode/Resources/HideTabs.svg | 21 ++++ ApplicationExeCode/Resources/ResInsight.qrc | 1 + .../UserInterface/RiuMainWindow.cpp | 25 +++++ .../UserInterface/RiuMainWindow.h | 3 + .../UserInterface/RiuPlotMainWindow.cpp | 97 +++++++++++++++---- .../UserInterface/RiuPlotMainWindow.h | 3 + 6 files changed, 132 insertions(+), 18 deletions(-) create mode 100644 ApplicationExeCode/Resources/HideTabs.svg diff --git a/ApplicationExeCode/Resources/HideTabs.svg b/ApplicationExeCode/Resources/HideTabs.svg new file mode 100644 index 00000000000..16501928347 --- /dev/null +++ b/ApplicationExeCode/Resources/HideTabs.svg @@ -0,0 +1,21 @@ + + + + + + + diff --git a/ApplicationExeCode/Resources/ResInsight.qrc b/ApplicationExeCode/Resources/ResInsight.qrc index a5680729e1c..7f225fafa1c 100644 --- a/ApplicationExeCode/Resources/ResInsight.qrc +++ b/ApplicationExeCode/Resources/ResInsight.qrc @@ -76,6 +76,7 @@ GridModels.png HelpCircle.svg WhatsNew.svg + HideTabs.svg Histogram16x16.png Histograms16x16.png HoloLensConnect24x24.png diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp index c792ce8effd..e3430a39a7a 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.cpp @@ -89,8 +89,10 @@ #include "cvfTimer.h" +#include "DockAreaTitleBar.h" #include "DockAreaWidget.h" #include "DockManager.h" +#include "DockWidget.h" #include #include @@ -100,6 +102,7 @@ #include #include #include +#include #include #include #include @@ -112,6 +115,7 @@ #include #include #include +#include #include @@ -424,6 +428,11 @@ void RiuMainWindow::createActions() connect( m_viewFromBelow, SIGNAL( triggered() ), SLOT( slotViewFromBelow() ) ); connect( m_viewFullScreen, SIGNAL( toggled( bool ) ), SLOT( slotViewFullScreen( bool ) ) ); + m_hideTabsAction = new QAction( QIcon( ":/HideTabs.svg" ), "Show/Hide Tabs", this ); + m_hideTabsAction->setToolTip( "Show/Hide Tabs in Main Views" ); + m_hideTabsAction->setCheckable( true ); + connect( m_hideTabsAction, SIGNAL( toggled( bool ) ), SLOT( slotHideTabs( bool ) ) ); + // Debug actions m_newPropertyView = new QAction( "New Project and Property View", this ); connect( m_newPropertyView, SIGNAL( triggered() ), SLOT( slotNewObjectPropertyView() ) ); @@ -528,6 +537,7 @@ void RiuMainWindow::createMenus() QMenu* viewMenu = RiuMenuBarBuildTools::createDefaultViewMenu( menuBar() ); viewMenu->addSeparator(); viewMenu->addAction( m_viewFullScreen ); + viewMenu->addAction( m_hideTabsAction ); viewMenu->addSeparator(); viewMenu->addAction( m_viewFromSouth ); viewMenu->addAction( m_viewFromNorth ); @@ -642,6 +652,7 @@ void RiuMainWindow::createToolBars() toolbar->addAction( cmdFeatureMgr->action( "RicTogglePerspectiveViewFeature" ) ); toolbar->addAction( cmdFeatureMgr->action( "RicViewZoomAllFeature" ) ); toolbar->addAction( m_viewFullScreen ); + toolbar->addAction( m_hideTabsAction ); toolbar->addAction( m_viewFromNorth ); toolbar->addAction( m_viewFromSouth ); toolbar->addAction( m_viewFromEast ); @@ -2082,3 +2093,17 @@ void RiuMainWindow::dropEvent( QDropEvent* event ) event->acceptProposedAction(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuMainWindow::slotHideTabs( bool hideTabs ) +{ + // TODO - go through all 3d view dock widgets and collect the unique dock areas that only contains 3d viewsand hide those. + auto central = dockManager()->centralWidget()->dockAreaWidget()->titleBar(); + + if ( hideTabs ) + central->hide(); + else + central->show(); +} diff --git a/ApplicationLibCode/UserInterface/RiuMainWindow.h b/ApplicationLibCode/UserInterface/RiuMainWindow.h index 2d0ffd81d61..f2e746bac3c 100644 --- a/ApplicationLibCode/UserInterface/RiuMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuMainWindow.h @@ -154,6 +154,7 @@ class RiuMainWindow : public RiuMainWindowBase QAction* m_viewFromAbove; QAction* m_viewFromBelow; QAction* m_viewFullScreen; + QAction* m_hideTabsAction; // Mock actions QAction* m_mockModelAction; @@ -224,6 +225,8 @@ private slots: void slotAnimationSliderMoved( int newValue ); void slotAnimationControlFrameChanged( int newValue ); + void slotHideTabs( bool hideTabs ); + // Debug slots void slotSnapshotAllViewsToFile(); diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index f4ed1e5d47e..6e36f15f114 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -96,26 +96,10 @@ RiuPlotMainWindow::RiuPlotMainWindow() , m_autoUpdateEnabled( false ) , m_autoUpdateTimerId( -1 ) { - m_toggleSelectionLinkAction = new QAction( QIcon( ":/Link3DandPlots.png" ), tr( "Link With Selection in 3D" ), this ); - m_toggleSelectionLinkAction->setToolTip( "Update wells used in plots from well selections in 3D view." ); - m_toggleSelectionLinkAction->setCheckable( true ); - m_toggleSelectionLinkAction->setChecked( m_selection3DLinkEnabled ); - connect( m_toggleSelectionLinkAction, SIGNAL( triggered() ), SLOT( slotToggleSelectionLink() ) ); - - m_toggleAutoUpdateAction = new QAction( QIcon( ":/TimedRefresh.png" ), tr( "Auto-update plots." ), this ); - m_toggleAutoUpdateAction->setToolTip( "Reload cases at interval specified in Automation Settings." ); - m_toggleAutoUpdateAction->setCheckable( true ); - m_toggleAutoUpdateAction->setChecked( m_autoUpdateEnabled ); - connect( m_toggleAutoUpdateAction, SIGNAL( triggered() ), SLOT( slotToggleAutoUpdate() ) ); - - m_reloadSelectedCasesAction = new QAction( QIcon( ":/Refresh.svg" ), tr( "Reload Selected Cases" ), this ); - m_reloadSelectedCasesAction->setToolTip( "Reload selected summary and/or ensemble cases." ); - m_reloadSelectedCasesAction->setCheckable( false ); - connect( m_reloadSelectedCasesAction, SIGNAL( triggered() ), SLOT( slotReloadSelectedCases() ) ); - setAttribute( Qt::WA_DeleteOnClose ); setUpCentralDockWidget(); + createActions(); createMenus(); createToolBars(); createDockPanels(); @@ -308,6 +292,35 @@ void RiuPlotMainWindow::keyPressEvent( QKeyEvent* keyEvent ) RiuMainWindowBase::keyPressEvent( keyEvent ); } +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotMainWindow::createActions() +{ + m_toggleSelectionLinkAction = new QAction( QIcon( ":/Link3DandPlots.png" ), tr( "Link With Selection in 3D" ), this ); + m_toggleSelectionLinkAction->setToolTip( "Update wells used in plots from well selections in 3D view." ); + m_toggleSelectionLinkAction->setCheckable( true ); + m_toggleSelectionLinkAction->setChecked( m_selection3DLinkEnabled ); + connect( m_toggleSelectionLinkAction, SIGNAL( triggered() ), SLOT( slotToggleSelectionLink() ) ); + + m_toggleAutoUpdateAction = new QAction( QIcon( ":/TimedRefresh.png" ), tr( "Auto-update plots." ), this ); + m_toggleAutoUpdateAction->setToolTip( "Reload cases at interval specified in Automation Settings." ); + m_toggleAutoUpdateAction->setCheckable( true ); + m_toggleAutoUpdateAction->setChecked( m_autoUpdateEnabled ); + connect( m_toggleAutoUpdateAction, SIGNAL( triggered() ), SLOT( slotToggleAutoUpdate() ) ); + + m_reloadSelectedCasesAction = new QAction( QIcon( ":/Refresh.svg" ), tr( "Reload Selected Cases" ), this ); + m_reloadSelectedCasesAction->setToolTip( "Reload selected summary and/or ensemble cases." ); + m_reloadSelectedCasesAction->setCheckable( false ); + connect( m_reloadSelectedCasesAction, SIGNAL( triggered() ), SLOT( slotReloadSelectedCases() ) ); + + m_viewFullScreenAction = new QAction( QIcon( ":/Fullscreen.png" ), "Full Screen", this ); + m_viewFullScreenAction->setToolTip( "Full Screen (Ctrl+Alt+F)" ); + m_viewFullScreenAction->setCheckable( true ); + caf::CmdFeature::applyShortcutWithHintToAction( m_viewFullScreenAction, QKeySequence( tr( "Ctrl+Alt+F" ) ) ); + connect( m_viewFullScreenAction, SIGNAL( toggled( bool ) ), SLOT( slotViewFullScreen( bool ) ) ); +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -355,7 +368,9 @@ void RiuPlotMainWindow::createMenus() connect( editMenu, SIGNAL( aboutToShow() ), SLOT( slotRefreshUndoRedoActions() ) ); // View menu - RiuMenuBarBuildTools::createDefaultViewMenu( menuBar() ); + QMenu* viewMenu = RiuMenuBarBuildTools::createDefaultViewMenu( menuBar() ); + viewMenu->addSeparator(); + viewMenu->addAction( m_viewFullScreenAction ); // Windows menu m_windowMenu = menuBar()->addMenu( "&Windows" ); @@ -435,6 +450,7 @@ void RiuPlotMainWindow::createToolBars() } if ( toolbarName == "View" ) { + toolbar->addAction( m_viewFullScreenAction ); toolbar->addAction( m_toggleSelectionLinkAction ); toolbar->addAction( m_reloadSelectedCasesAction ); toolbar->addAction( m_toggleAutoUpdateAction ); @@ -1043,3 +1059,48 @@ void RiuPlotMainWindow::timerEvent( QTimerEvent* event ) RicReloadSummaryCaseFeature::reloadTaggedSummaryCasesAndUpdate(); } } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuPlotMainWindow::slotViewFullScreen( bool showFullScreen ) +{ + if ( showFullScreen ) + { + m_lastDockState = dockManager()->saveState( DOCKSTATE_VERSION ); + + QString activeViewerName; + if ( auto activeViewer = RiaGuiApplication::instance()->activePlotWindow() ) + { + activeViewerName = activeViewer->dockWindowName(); + } + + dockManager()->restoreState( RiuDockWidgetTools::hideAllDockingPlotState(), DOCKSTATE_VERSION ); + + if ( !activeViewerName.isEmpty() ) + { + if ( auto dw = dockManager()->findDockWidget( activeViewerName ) ) + { + dockManager()->addDockWidget( ads::DockWidgetArea::CenterDockWidgetArea, dw, dockManager()->centralWidget()->dockAreaWidget() ); + } + } + } + else + { + QString activeViewerName; + if ( auto activeViewer = RiaGuiApplication::instance()->activePlotWindow() ) + { + activeViewerName = activeViewer->dockWindowName(); + } + + dockManager()->restoreState( m_lastDockState, DOCKSTATE_VERSION ); + + if ( !activeViewerName.isEmpty() ) + { + if ( auto dw = dockManager()->findDockWidget( activeViewerName ) ) + { + dw->setAsCurrentTab(); + } + } + } +} diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h index 2d21071f531..92913471eae 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.h @@ -97,6 +97,7 @@ class RiuPlotMainWindow : public RiuMainWindowBase private: void setPdmRoot( caf::PdmObject* pdmRoot ); + void createActions(); void createMenus(); void createToolBars(); void createDockPanels(); @@ -111,6 +112,7 @@ private slots: void slotToggleSelectionLink(); void slotToggleAutoUpdate(); void slotReloadSelectedCases(); + void slotViewFullScreen( bool ); void slotBuildWindowActions(); @@ -139,4 +141,5 @@ private slots: bool m_autoUpdateEnabled; int m_autoUpdateTimerId; QAction* m_reloadSelectedCasesAction; + QAction* m_viewFullScreenAction; };