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
This commit is contained in:
Jeff Young 2020-08-04 11:50:39 +01:00
parent c01bf9c911
commit f67ba62c11
2 changed files with 7 additions and 9 deletions

View File

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

View File

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