From b16482bb2f413d2e5be01fa541f76918d3674340 Mon Sep 17 00:00:00 2001 From: Kristian Bendiksen Date: Thu, 8 Oct 2020 08:58:44 +0200 Subject: [PATCH] #6490: Improve color legends right-click menus --- .../RicCopyStandardLegendFeature.cpp | 2 +- .../RicInsertColorLegendFeature.cpp | 14 ++++++++++++-- .../RicInsertColorLegendItemFeature.cpp | 2 +- .../ProjectDataModel/RimColorLegendCollection.cpp | 2 +- 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/Commands/ColorLegendCommands/RicCopyStandardLegendFeature.cpp b/ApplicationCode/Commands/ColorLegendCommands/RicCopyStandardLegendFeature.cpp index bc9a6a6e1b..3684f9534d 100644 --- a/ApplicationCode/Commands/ColorLegendCommands/RicCopyStandardLegendFeature.cpp +++ b/ApplicationCode/Commands/ColorLegendCommands/RicCopyStandardLegendFeature.cpp @@ -71,7 +71,7 @@ void RicCopyStandardLegendFeature::onActionTriggered( bool isChecked ) void RicCopyStandardLegendFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setIcon( QIcon( ":/Legend.png" ) ); - actionToSetup->setText( "Copy Legend to Custom Legends" ); + actionToSetup->setText( "Copy to Custom Color Legends" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/Commands/ColorLegendCommands/RicInsertColorLegendFeature.cpp b/ApplicationCode/Commands/ColorLegendCommands/RicInsertColorLegendFeature.cpp index 9f99f3cb17..f47b75671e 100644 --- a/ApplicationCode/Commands/ColorLegendCommands/RicInsertColorLegendFeature.cpp +++ b/ApplicationCode/Commands/ColorLegendCommands/RicInsertColorLegendFeature.cpp @@ -71,7 +71,7 @@ void RicInsertColorLegendFeature::onActionTriggered( bool isChecked ) void RicInsertColorLegendFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setIcon( QIcon( ":/Legend.png" ) ); - actionToSetup->setText( "New Custom Color Legend" ); + actionToSetup->setText( "New Color Legend" ); } //-------------------------------------------------------------------------------------------------- @@ -86,7 +86,17 @@ RimColorLegendCollection* RicInsertColorLegendFeature::selectedColorLegendCollec RimColorLegendCollection* colorLegendCollection = nullptr; selectedObject->firstAncestorOrThisOfType( colorLegendCollection ); - if ( colorLegendCollection ) return colorLegendCollection; + if ( colorLegendCollection ) + { + // Disable the menu for standard color legends + RimColorLegend* colorLegend = dynamic_cast( selectedObject ); + if ( colorLegend && colorLegendCollection->isStandardColorLegend( colorLegend ) ) + { + return nullptr; + } + + return colorLegendCollection; + } return nullptr; } diff --git a/ApplicationCode/Commands/ColorLegendCommands/RicInsertColorLegendItemFeature.cpp b/ApplicationCode/Commands/ColorLegendCommands/RicInsertColorLegendItemFeature.cpp index 5b61132ddf..ace756c121 100644 --- a/ApplicationCode/Commands/ColorLegendCommands/RicInsertColorLegendItemFeature.cpp +++ b/ApplicationCode/Commands/ColorLegendCommands/RicInsertColorLegendItemFeature.cpp @@ -80,7 +80,7 @@ void RicInsertColorLegendItemFeature::onActionTriggered( bool isChecked ) void RicInsertColorLegendItemFeature::setupActionLook( QAction* actionToSetup ) { actionToSetup->setIcon( QIcon( ":/Legend.png" ) ); - actionToSetup->setText( "Append Color Legend Item" ); + actionToSetup->setText( "Append Color" ); } //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/ProjectDataModel/RimColorLegendCollection.cpp b/ApplicationCode/ProjectDataModel/RimColorLegendCollection.cpp index e2bc5fd485..dde9304590 100644 --- a/ApplicationCode/ProjectDataModel/RimColorLegendCollection.cpp +++ b/ApplicationCode/ProjectDataModel/RimColorLegendCollection.cpp @@ -34,7 +34,7 @@ CAF_PDM_SOURCE_INIT( RimColorLegendCollection, "ColorLegendCollection" ); //-------------------------------------------------------------------------------------------------- RimColorLegendCollection::RimColorLegendCollection() { - CAF_PDM_InitObject( "Color Legend Collection", ":/Legend.png", "", "" ); + CAF_PDM_InitObject( "Color Legends", ":/Legend.png", "", "" ); CAF_PDM_InitFieldNoDefault( &m_standardColorLegends, "StandardColorLegends",