From 808a5f7cbc44ff0116ef34ffef71734357da6187 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Herje?= Date: Wed, 22 Feb 2023 14:56:03 +0100 Subject: [PATCH] Add open plot editor to menus - Add to summary plot node in project tree - Add to empty space in plot window (mdi area) --- .../CMakeLists_files.cmake | 2 ++ .../RicOpenSummaryPlotEditorFeature.cpp | 5 +++ ...penSummaryPlotEditorFromMdiAreaFeature.cpp | 29 +++++++++++++++++ ...cOpenSummaryPlotEditorFromMdiAreaFeature.h | 32 +++++++++++++++++++ .../UserInterface/RiuPlotMainWindow.cpp | 1 + 5 files changed, 69 insertions(+) create mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.cpp create mode 100644 ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.h diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake index 72459daef4..5688de25df 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/CMakeLists_files.cmake @@ -48,6 +48,7 @@ set(SOURCE_GROUP_HEADER_FILES ${CMAKE_CURRENT_LIST_DIR}/RicEditSummaryPlotCtxFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicToggleYAxisLinkingFeature.h ${CMAKE_CURRENT_LIST_DIR}/RicToggleXAxisLinkingFeature.h + ${CMAKE_CURRENT_LIST_DIR}/RicOpenSummaryPlotEditorFromMdiAreaFeature.h ) set(SOURCE_GROUP_SOURCE_FILES @@ -100,6 +101,7 @@ set(SOURCE_GROUP_SOURCE_FILES ${CMAKE_CURRENT_LIST_DIR}/RicEditSummaryPlotCtxFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicToggleYAxisLinkingFeature.cpp ${CMAKE_CURRENT_LIST_DIR}/RicToggleXAxisLinkingFeature.cpp + ${CMAKE_CURRENT_LIST_DIR}/RicOpenSummaryPlotEditorFromMdiAreaFeature.cpp ) list(APPEND COMMAND_CODE_HEADER_FILES ${SOURCE_GROUP_HEADER_FILES}) diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp index 8f4317f8b7..2b47d26851 100644 --- a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFeature.cpp @@ -36,6 +36,7 @@ #include "RimSummaryCaseCollection.h" #include "RimSummaryCaseMainCollection.h" #include "RimSummaryMultiPlot.h" +#include "RimSummaryMultiPlotCollection.h" #include "RimSummaryPlot.h" #include "RiuPlotMainWindow.h" @@ -61,6 +62,10 @@ bool RicOpenSummaryPlotEditorFeature::isCommandEnabled() std::vector selectedGroups = caf::selectedObjectsByType(); if ( selectedGroups.size() > 0 ) return true; + std::vector selectedPlotCollections = + caf::selectedObjectsByType(); + if ( selectedPlotCollections.size() > 0 ) return true; + caf::PdmObject* selObj = dynamic_cast( caf::SelectionManager::instance()->selectedItem() ); if ( !selObj ) return false; diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.cpp b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.cpp new file mode 100644 index 0000000000..efdac87a1e --- /dev/null +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.cpp @@ -0,0 +1,29 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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() +{ + return true; +} diff --git a/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.h b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.h new file mode 100644 index 0000000000..659d33e849 --- /dev/null +++ b/ApplicationLibCode/Commands/SummaryPlotCommands/RicOpenSummaryPlotEditorFromMdiAreaFeature.h @@ -0,0 +1,32 @@ +///////////////////////////////////////////////////////////////////////////////// +// +// 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() override; +}; diff --git a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp index 26d67473f3..cdae16cc72 100644 --- a/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp +++ b/ApplicationLibCode/UserInterface/RiuPlotMainWindow.cpp @@ -95,6 +95,7 @@ RiuPlotMainWindow::RiuPlotMainWindow() caf::CmdFeatureMenuBuilder menuForMdiArea; menuForMdiArea << "RicNewEmptySummaryMultiPlotFeature"; + menuForMdiArea << "RicOpenSummaryPlotEditorFromMdiAreaFeature"; new RiuContextMenuLauncher( m_mdiArea, menuForMdiArea ); ads::CDockWidget* cWidget =