Add open plot editor to menus

- Add to summary plot node in project tree
- Add to empty space in plot window (mdi area)
This commit is contained in:
Jørgen Herje 2023-02-22 14:56:03 +01:00 committed by jonjenssen
parent a6ee41aaee
commit 88ebf857ff
5 changed files with 69 additions and 0 deletions

View File

@ -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})

View File

@ -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<RimSummaryCaseCollection*> selectedGroups = caf::selectedObjectsByType<RimSummaryCaseCollection*>();
if ( selectedGroups.size() > 0 ) return true;
std::vector<RimSummaryMultiPlotCollection*> selectedPlotCollections =
caf::selectedObjectsByType<RimSummaryMultiPlotCollection*>();
if ( selectedPlotCollections.size() > 0 ) return true;
caf::PdmObject* selObj = dynamic_cast<caf::PdmObject*>( caf::SelectionManager::instance()->selectedItem() );
if ( !selObj ) return false;

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RicOpenSummaryPlotEditorFromMdiAreaFeature.h"
CAF_CMD_SOURCE_INIT( RicOpenSummaryPlotEditorFromMdiAreaFeature, "RicOpenSummaryPlotEditorFromMdiAreaFeature" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RicOpenSummaryPlotEditorFromMdiAreaFeature::isCommandEnabled()
{
return true;
}

View File

@ -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 <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "RicOpenSummaryPlotEditorFeature.h"
//==================================================================================================
///
//==================================================================================================
class RicOpenSummaryPlotEditorFromMdiAreaFeature : public RicOpenSummaryPlotEditorFeature
{
CAF_CMD_HEADER_INIT;
protected:
bool isCommandEnabled() override;
};

View File

@ -95,6 +95,7 @@ RiuPlotMainWindow::RiuPlotMainWindow()
caf::CmdFeatureMenuBuilder menuForMdiArea;
menuForMdiArea << "RicNewEmptySummaryMultiPlotFeature";
menuForMdiArea << "RicOpenSummaryPlotEditorFromMdiAreaFeature";
new RiuContextMenuLauncher( m_mdiArea, menuForMdiArea );
ads::CDockWidget* cWidget =