From fe1dfebea22cbf1c94d5300f6f296ac0ad82623e Mon Sep 17 00:00:00 2001 From: Rebecca Cox Date: Tue, 19 Sep 2017 14:47:36 +0200 Subject: [PATCH] #1813 Observed data: Remove right click options if any object in selection is an observed data --- .../Commands/RicCloseSummaryCaseFeature.cpp | 14 +++++++++++++- .../RicCreateSummaryCaseCollectionFeature.cpp | 14 +++++++++++++- .../Commands/RicReloadSummaryCaseFeature.cpp | 15 ++++++++++++++- .../RicPasteSummaryCaseFeature.cpp | 14 +++++++++++++- 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/ApplicationCode/Commands/RicCloseSummaryCaseFeature.cpp b/ApplicationCode/Commands/RicCloseSummaryCaseFeature.cpp index 31fcb8051e..7e008caa3f 100644 --- a/ApplicationCode/Commands/RicCloseSummaryCaseFeature.cpp +++ b/ApplicationCode/Commands/RicCloseSummaryCaseFeature.cpp @@ -77,7 +77,19 @@ bool RicCloseSummaryCaseFeature::isCommandEnabled() std::vector selection; caf::SelectionManager::instance()->objectsByType(&selection); - return (selection.size() > 0 && !selection[0]->isObservedData()); + if (selection.size() == 0) + { + return false; + } + + for (RimSummaryCase* summaryCase : selection) + { + if (summaryCase->isObservedData()) + { + return false; + } + } + return true; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp b/ApplicationCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp index f95740b052..82ec8357fe 100644 --- a/ApplicationCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp +++ b/ApplicationCode/Commands/RicCreateSummaryCaseCollectionFeature.cpp @@ -37,7 +37,19 @@ bool RicCreateSummaryCaseCollectionFeature::isCommandEnabled() std::vector selection; caf::SelectionManager::instance()->objectsByType(&selection); - return (selection.size() > 0 && !selection[0]->isObservedData()); + if (selection.size() == 0) + { + return false; + } + + for (RimSummaryCase* summaryCase : selection) + { + if (summaryCase->isObservedData()) + { + return false; + } + } + return true; } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/RicReloadSummaryCaseFeature.cpp b/ApplicationCode/Commands/RicReloadSummaryCaseFeature.cpp index eb0ec4a082..4443341473 100644 --- a/ApplicationCode/Commands/RicReloadSummaryCaseFeature.cpp +++ b/ApplicationCode/Commands/RicReloadSummaryCaseFeature.cpp @@ -43,7 +43,20 @@ bool RicReloadSummaryCaseFeature::isCommandEnabled() { std::vector caseSelection = selectedSummaryCases(); - return (caseSelection.size() > 0 && !caseSelection[0]->isObservedData()); + if (caseSelection.size() == 0) + { + return false; + } + + for (RimSummaryCase* summaryCase : caseSelection) + { + if (summaryCase->isObservedData()) + { + return false; + } + } + return true; + } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteSummaryCaseFeature.cpp b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteSummaryCaseFeature.cpp index 2fb8a7c4c8..754e8d55ab 100644 --- a/ApplicationCode/Commands/SummaryPlotCommands/RicPasteSummaryCaseFeature.cpp +++ b/ApplicationCode/Commands/SummaryPlotCommands/RicPasteSummaryCaseFeature.cpp @@ -57,7 +57,19 @@ bool RicPasteSummaryCaseFeature::isCommandEnabled() std::vector > summaryCases = RicPasteSummaryCaseFeature::summaryCases(); - return (summaryCases.size() > 0 && !summaryCases[0]->isObservedData()); + if (summaryCases.size() == 0) + { + return false; + } + + for (RimSummaryCase* summaryCase : summaryCases) + { + if (summaryCase->isObservedData()) + { + return false; + } + } + return true; } //--------------------------------------------------------------------------------------------------