From e9f8b72666cd5d806880e05bdedf03fc7747c869 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 20 Aug 2025 10:11:51 +0100 Subject: [PATCH] Allow clearing of multiple tuning patterns. Fixes https://gitlab.com/kicad/code/kicad/-/issues/21508 --- pcbnew/tools/edit_tool.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 857710b61f..58efd9d610 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -2674,17 +2674,15 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut ) break; case PCB_GENERATOR_T: - if( aItems.Size() == 1 ) - { - PCB_GENERATOR* generator = static_cast( board_item ); + { + PCB_GENERATOR* generator = static_cast( board_item ); - m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genRemove, &commit, - generator ); + if( SELECTION_CONDITIONS::OnlyTypes( { PCB_GENERATOR_T } ) ) + { + m_toolMgr->RunSynchronousAction( PCB_ACTIONS::genRemove, &commit, generator ); } else { - PCB_GENERATOR* generator = static_cast( board_item ); - for( EDA_ITEM* member : generator->GetItems() ) commit.Remove( member ); @@ -2693,9 +2691,9 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut ) itemsDeleted++; break; + } default: - wxASSERT_MSG( parentFP == nullptr, wxT( "Try to delete an item living in a footprint" ) ); commit.Remove( board_item ); itemsDeleted++; break;