From c324c2cbf6cceb9e6478b96f3d9aa681f04fede3 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Fri, 21 Aug 2020 20:31:43 +0100 Subject: [PATCH] Make sure zone fills are up-to-date before deleting unconnected things. Fixes https://gitlab.com/kicad/code/kicad/issues/5253 --- pcbnew/cleanup_item.cpp | 1 + pcbnew/cleanup_item.h | 13 +++++-------- .../dialogs/dialog_cleanup_tracks_and_vias.cpp | 16 +++++++++++++++- pcbnew/dialogs/dialog_cleanup_tracks_and_vias.h | 6 ++++-- 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/pcbnew/cleanup_item.cpp b/pcbnew/cleanup_item.cpp index 3d718e5f2e..6ff31884f1 100644 --- a/pcbnew/cleanup_item.cpp +++ b/pcbnew/cleanup_item.cpp @@ -44,6 +44,7 @@ wxString CLEANUP_ITEM::GetErrorText( int aCode, bool aTranslate ) const switch( aCode ) { // For cleanup tracks and vias: + case CLEANUP_CHECKING_ZONE_FILLS: msg = _HKI( "Checking zone fills..." ); break; case CLEANUP_SHORTING_TRACK: msg = _HKI( "Remove track shorting two nets" ); break; case CLEANUP_SHORTING_VIA: msg = _HKI( "Remove via shorting two nets" ); break; case CLEANUP_REDUNDANT_VIA: msg = _HKI( "Remove redundant via" ); break; diff --git a/pcbnew/cleanup_item.h b/pcbnew/cleanup_item.h index 6df60e66ff..cf7b8a1ef3 100644 --- a/pcbnew/cleanup_item.h +++ b/pcbnew/cleanup_item.h @@ -32,7 +32,8 @@ class PCB_BASE_FRAME; enum CLEANUP_RC_CODE { CLEANUP_FIRST = DRCE_LAST + 1, - CLEANUP_SHORTING_TRACK = CLEANUP_FIRST, + CLEANUP_CHECKING_ZONE_FILLS = CLEANUP_FIRST, + CLEANUP_SHORTING_TRACK, CLEANUP_SHORTING_VIA, CLEANUP_REDUNDANT_VIA, CLEANUP_DUPLICATE_TRACK, @@ -48,6 +49,9 @@ enum CLEANUP_RC_CODE { class CLEANUP_ITEM : public RC_ITEM { +private: + wxString m_errorMessage; + public: CLEANUP_ITEM( int aErrorCode ); @@ -56,13 +60,6 @@ public: * returns the string form of a drc error code. */ wxString GetErrorText( int aErrorCode = -1, bool aTranslate = true ) const; - - /** - * Function ShowHtml - * translates this object into a fragment of HTML suitable for the wxHtmlListBox class. - * @return wxString - the html text. - */ - wxString ShowHtml( PCB_BASE_FRAME* aFrame ) const; }; diff --git a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp index 508b1e4d82..b4a3276a86 100644 --- a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.cpp @@ -30,10 +30,12 @@ #include #include #include +#include DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME* aParentFrame ) : DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE( aParentFrame ), - m_parentFrame( aParentFrame ) + m_parentFrame( aParentFrame ), + m_firstRun( true ) { auto cfg = m_parentFrame->GetPcbNewSettings(); @@ -114,6 +116,18 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun ) m_items.clear(); + if( m_firstRun ) + { + m_items.push_back( std::make_shared( CLEANUP_CHECKING_ZONE_FILLS ) ); + RC_ITEMS_PROVIDER* provider = new VECTOR_CLEANUP_ITEMS_PROVIDER( &m_items ); + m_changesTreeModel->SetProvider( provider ); + + m_parentFrame->GetToolManager()->GetTool()->CheckAllZones( this ); + + m_changesTreeModel->SetProvider( nullptr ); + m_items.clear(); + } + // Old model has to be refreshed, GAL normally does not keep updating it m_parentFrame->Compile_Ratsnest( false ); diff --git a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.h b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.h index 6b1f209ce5..77e91d4bbe 100644 --- a/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.h +++ b/pcbnew/dialogs/dialog_cleanup_tracks_and_vias.h @@ -34,9 +34,11 @@ class PCB_EDIT_FRAME; class DIALOG_CLEANUP_TRACKS_AND_VIAS: public DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE { - PCB_EDIT_FRAME* m_parentFrame; + PCB_EDIT_FRAME* m_parentFrame; + RC_TREE_MODEL* m_changesTreeModel; + bool m_firstRun; + std::vector > m_items; - RC_TREE_MODEL* m_changesTreeModel; void doCleanup( bool aDryRun );