diff --git a/common/rc_item.cpp b/common/rc_item.cpp index 8b35734a30..388c8d8a44 100644 --- a/common/rc_item.cpp +++ b/common/rc_item.cpp @@ -539,8 +539,8 @@ void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, boo ItemDeleted( parentItem, markerItem ); } - // Only deep delete the current item here; others will be done through the - // DeleteAllItems() call below, which is more efficient. + // Only deep delete the current item here; others will be done by the caller, which + // can more efficiently delete all markers on the board. m_rcItemsProvider->DeleteItem( i, aDeep && aCurrentOnly ); if( lastGood > i ) @@ -555,9 +555,6 @@ void RC_TREE_MODEL::DeleteItems( bool aCurrentOnly, bool aIncludeExclusions, boo for( RC_TREE_NODE* item : to_delete ) delete( item ); - if( !aCurrentOnly && aDeep ) - m_rcItemsProvider->DeleteAllItems( aIncludeExclusions, aDeep ); - if( m_view ) m_view->Thaw(); } diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index 0d46a3a0f5..5912bf0075 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -908,7 +908,10 @@ void DIALOG_ERC::deleteAllMarkers( bool aIncludeExclusions ) // Clear current selection list to avoid selection of deleted items m_parent->GetToolManager()->RunAction( EE_ACTIONS::clearSelection, true ); - m_markerTreeModel->DeleteItems( false, aIncludeExclusions, true ); + m_markerTreeModel->DeleteItems( false, aIncludeExclusions, false ); + + SCH_SCREENS screens( m_parent->Schematic().Root() ); + screens.DeleteAllMarkers( MARKER_BASE::MARKER_ERC, aIncludeExclusions ); } diff --git a/eeschema/erc_settings.cpp b/eeschema/erc_settings.cpp index cb904c7c6f..dbdc7d123b 100644 --- a/eeschema/erc_settings.cpp +++ b/eeschema/erc_settings.cpp @@ -379,13 +379,3 @@ void SHEETLIST_ERC_ITEMS_PROVIDER::DeleteItem( int aIndex, bool aDeep ) } -void SHEETLIST_ERC_ITEMS_PROVIDER::DeleteAllItems( bool aIncludeExclusions, bool aDeep ) -{ - // Filtered list was already handled through DeleteItem() by the tree control - - if( aDeep ) - { - SCH_SCREENS screens( m_schematic->Root() ); - screens.DeleteAllMarkers( MARKER_BASE::MARKER_ERC, aIncludeExclusions ); - } -} diff --git a/eeschema/erc_settings.h b/eeschema/erc_settings.h index 5e0ffa9aa1..1fe1f55433 100644 --- a/eeschema/erc_settings.h +++ b/eeschema/erc_settings.h @@ -204,8 +204,6 @@ public: void DeleteItem( int aIndex, bool aDeep ) override; - void DeleteAllItems( bool aIncludeExclusions, bool aDeep ) override; - private: void visitMarkers( std::function aVisitor ) const; diff --git a/include/rc_item.h b/include/rc_item.h index 063c15f477..120a9e3c7e 100644 --- a/include/rc_item.h +++ b/include/rc_item.h @@ -61,8 +61,6 @@ public: */ virtual void DeleteItem( int aIndex, bool aDeep ) = 0; - virtual void DeleteAllItems( bool aIncludeExclusions, bool aDeep ) = 0; - virtual ~RC_ITEMS_PROVIDER() { } }; diff --git a/pcbnew/cleanup_item.h b/pcbnew/cleanup_item.h index 2bbd4f01ff..46c24dd51a 100644 --- a/pcbnew/cleanup_item.h +++ b/pcbnew/cleanup_item.h @@ -92,7 +92,6 @@ public: return m_sourceVector->at( aIndex ); } - void DeleteItem( int aIndex, bool aDeep ) override { if( aDeep ) @@ -102,14 +101,6 @@ public: } } - void DeleteAllItems( bool aIncludeExclusions, bool aDeep ) override - { - if( aDeep ) - { - m_sourceVector->clear(); - } - } - private: std::vector >* m_sourceVector; // owns its CLEANUP_ITEMs }; diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 5cbb51b9c8..90b55e7512 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -267,8 +267,6 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent ) m_frame->RecordDRCExclusions(); deleteAllMarkers( true ); - m_unconnectedTreeModel->DeleteItems( false, true, true ); - m_footprintWarningsTreeModel->DeleteItems( false, true, true ); std::vector> violations = DRC_ITEM::GetItemsWithSeverities(); m_ignoredList->DeleteAllItems(); @@ -998,7 +996,11 @@ void DIALOG_DRC::deleteAllMarkers( bool aIncludeExclusions ) // Clear current selection list to avoid selection of deleted items m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); - m_markersTreeModel->DeleteItems( false, aIncludeExclusions, true ); + m_markersTreeModel->DeleteItems( false, aIncludeExclusions, false ); + m_unconnectedTreeModel->DeleteItems( false, aIncludeExclusions, false ); + m_footprintWarningsTreeModel->DeleteItems( false, aIncludeExclusions, false ); + + m_frame->GetBoard()->DeleteMARKERs( true, aIncludeExclusions ); } diff --git a/pcbnew/dialogs/dialog_footprint_checker.cpp b/pcbnew/dialogs/dialog_footprint_checker.cpp index d2ff16e184..aec07046a6 100644 --- a/pcbnew/dialogs/dialog_footprint_checker.cpp +++ b/pcbnew/dialogs/dialog_footprint_checker.cpp @@ -354,7 +354,8 @@ void DIALOG_FOOTPRINT_CHECKER::deleteAllMarkers() // Clear current selection list to avoid selection of deleted items m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true ); - m_markersTreeModel->DeleteItems( false, true, true ); + m_markersTreeModel->DeleteItems( false, true, false ); + m_frame->GetBoard()->DeleteMARKERs( true, true ); } diff --git a/pcbnew/drc/drc_item.cpp b/pcbnew/drc/drc_item.cpp index 999a312e2f..f593132d0e 100644 --- a/pcbnew/drc/drc_item.cpp +++ b/pcbnew/drc/drc_item.cpp @@ -484,11 +484,3 @@ void DRC_ITEMS_PROVIDER::DeleteItem( int aIndex, bool aDeep ) m_board->Delete( marker ); } - -void DRC_ITEMS_PROVIDER::DeleteAllItems( bool aIncludeExclusions, bool aDeep ) -{ - // Filtered list was already handled through DeleteItem() by the tree control - - if( aDeep ) - m_board->DeleteMARKERs( true, aIncludeExclusions ); -} diff --git a/pcbnew/drc/drc_item.h b/pcbnew/drc/drc_item.h index 024da432bf..f75cbc2652 100644 --- a/pcbnew/drc/drc_item.h +++ b/pcbnew/drc/drc_item.h @@ -231,8 +231,6 @@ public: void DeleteItem( int aIndex, bool aDeep ) override; - void DeleteAllItems( bool aIncludeExclusions, bool aDeep ) override; - private: BOARD* m_board; MARKER_BASE::TYPEMARKER m_markerType;