From f67ba62c11b88c4fe6fafd64e9c75e6b63ddc1f8 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 4 Aug 2020 11:50:39 +0100 Subject: [PATCH] Don't stop when current item is reached: there might be more. In particular, the two sub-items also count as "current" and need to be deleted. Fixes https://gitlab.com/kicad/code/kicad/issues/5057 --- common/rc_item.cpp | 7 ++----- pcbnew/dialogs/dialog_drc.cpp | 9 +++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/common/rc_item.cpp b/common/rc_item.cpp index 5ac85b83bf..7248186009 100644 --- a/common/rc_item.cpp +++ b/common/rc_item.cpp @@ -379,7 +379,7 @@ void RC_TREE_MODEL::ValueChanged( RC_TREE_NODE* aNode ) { wxDataViewModel::ValueChanged( ToItem( aNode ), 0 ); - for( auto & child : aNode->m_Children ) + for( RC_TREE_NODE* child : aNode->m_Children ) wxDataViewModel::ValueChanged( ToItem( child ), 0 ); } } @@ -387,7 +387,7 @@ void RC_TREE_MODEL::ValueChanged( RC_TREE_NODE* aNode ) void RC_TREE_MODEL::DeleteCurrentItem( bool aDeep ) { - DeleteItems( true, false, aDeep ); + DeleteItems( true, true, aDeep ); } @@ -434,9 +434,6 @@ void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, boo // Only deep delete the current item here; others will be done through the // DeleteAllItems() call below, which is more efficient. m_rcItemsProvider->DeleteItem( i, aDeep && aCurrentOnly ); - - if( aCurrentOnly ) - break; } if( !aCurrentOnly ) diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 9e74b8e4f5..65cb44fcce 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -607,15 +607,16 @@ void DIALOG_DRC::OnDeleteAllClick( wxCommandEvent& aEvent ) if( numExcluded > 0 ) { - wxMessageDialog dlg( this, _( "Delete exclusions too?" ), _( "Delete All Markers" ), - wxYES_NO | wxCANCEL | wxCENTER | wxICON_QUESTION ); - dlg.SetYesNoLabels( _( "Errors and Warnings Only" ) , _( "Errors, Warnings and Exclusions" ) ); + wxRichMessageDialog dlg( this, _( "Do you wish to delete excluded markers as well?" ), + _( "Delete All Markers" ), + wxOK | wxCANCEL | wxCENTER | wxICON_QUESTION ); + dlg.ShowCheckBox( _( "Delete exclusions" ) ); int ret = dlg.ShowModal(); if( ret == wxID_CANCEL ) return; - else if( ret == wxID_NO ) + else if( dlg.IsCheckBoxChecked() ) includeExclusions = true; }