Make sure zone fills are up-to-date before deleting unconnected things.

Fixes https://gitlab.com/kicad/code/kicad/issues/5253
This commit is contained in:
Jeff Young 2020-08-21 20:31:43 +01:00
parent 842641308f
commit c324c2cbf6
4 changed files with 25 additions and 11 deletions

View File

@ -44,6 +44,7 @@ wxString CLEANUP_ITEM::GetErrorText( int aCode, bool aTranslate ) const
switch( aCode ) switch( aCode )
{ {
// For cleanup tracks and vias: // 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_TRACK: msg = _HKI( "Remove track shorting two nets" ); break;
case CLEANUP_SHORTING_VIA: msg = _HKI( "Remove via 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; case CLEANUP_REDUNDANT_VIA: msg = _HKI( "Remove redundant via" ); break;

View File

@ -32,7 +32,8 @@ class PCB_BASE_FRAME;
enum CLEANUP_RC_CODE { enum CLEANUP_RC_CODE {
CLEANUP_FIRST = DRCE_LAST + 1, CLEANUP_FIRST = DRCE_LAST + 1,
CLEANUP_SHORTING_TRACK = CLEANUP_FIRST, CLEANUP_CHECKING_ZONE_FILLS = CLEANUP_FIRST,
CLEANUP_SHORTING_TRACK,
CLEANUP_SHORTING_VIA, CLEANUP_SHORTING_VIA,
CLEANUP_REDUNDANT_VIA, CLEANUP_REDUNDANT_VIA,
CLEANUP_DUPLICATE_TRACK, CLEANUP_DUPLICATE_TRACK,
@ -48,6 +49,9 @@ enum CLEANUP_RC_CODE {
class CLEANUP_ITEM : public RC_ITEM class CLEANUP_ITEM : public RC_ITEM
{ {
private:
wxString m_errorMessage;
public: public:
CLEANUP_ITEM( int aErrorCode ); CLEANUP_ITEM( int aErrorCode );
@ -56,13 +60,6 @@ public:
* returns the string form of a drc error code. * returns the string form of a drc error code.
*/ */
wxString GetErrorText( int aErrorCode = -1, bool aTranslate = true ) const; 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;
}; };

View File

@ -30,10 +30,12 @@
#include <tracks_cleaner.h> #include <tracks_cleaner.h>
#include <drc/drc_item.h> #include <drc/drc_item.h>
#include <drc/drc_provider.h> #include <drc/drc_provider.h>
#include <tools/zone_filler_tool.h>
DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME* aParentFrame ) : DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS( PCB_EDIT_FRAME* aParentFrame ) :
DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE( aParentFrame ), DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE( aParentFrame ),
m_parentFrame( aParentFrame ) m_parentFrame( aParentFrame ),
m_firstRun( true )
{ {
auto cfg = m_parentFrame->GetPcbNewSettings(); auto cfg = m_parentFrame->GetPcbNewSettings();
@ -114,6 +116,18 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
m_items.clear(); m_items.clear();
if( m_firstRun )
{
m_items.push_back( std::make_shared<CLEANUP_ITEM>( CLEANUP_CHECKING_ZONE_FILLS ) );
RC_ITEMS_PROVIDER* provider = new VECTOR_CLEANUP_ITEMS_PROVIDER( &m_items );
m_changesTreeModel->SetProvider( provider );
m_parentFrame->GetToolManager()->GetTool<ZONE_FILLER_TOOL>()->CheckAllZones( this );
m_changesTreeModel->SetProvider( nullptr );
m_items.clear();
}
// Old model has to be refreshed, GAL normally does not keep updating it // Old model has to be refreshed, GAL normally does not keep updating it
m_parentFrame->Compile_Ratsnest( false ); m_parentFrame->Compile_Ratsnest( false );

View File

@ -35,8 +35,10 @@ class PCB_EDIT_FRAME;
class DIALOG_CLEANUP_TRACKS_AND_VIAS: public DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE class DIALOG_CLEANUP_TRACKS_AND_VIAS: public DIALOG_CLEANUP_TRACKS_AND_VIAS_BASE
{ {
PCB_EDIT_FRAME* m_parentFrame; PCB_EDIT_FRAME* m_parentFrame;
std::vector<std::shared_ptr<CLEANUP_ITEM> > m_items;
RC_TREE_MODEL* m_changesTreeModel; RC_TREE_MODEL* m_changesTreeModel;
bool m_firstRun;
std::vector<std::shared_ptr<CLEANUP_ITEM> > m_items;
void doCleanup( bool aDryRun ); void doCleanup( bool aDryRun );