Improve Cleanup Tracks and Vias messages.

This commit is contained in:
Jeff Young 2022-04-23 21:04:43 +01:00
parent 9b6a10fa6a
commit dd561f1e4d
2 changed files with 55 additions and 20 deletions

View File

@ -24,7 +24,6 @@
#include <dialog_cleanup_tracks_and_vias.h>
#include <board_commit.h>
#include <pcb_edit_frame.h>
#include <pcbnew_settings.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tracks_cleaner.h>
@ -131,7 +130,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
if( m_firstRun )
{
m_reporter->Report( _( "Check zones..." ) );
m_reporter->Report( _( "Checking zones..." ) );
wxSafeYield(); // Timeslice to update UI
m_parentFrame->GetToolManager()->GetTool<ZONE_FILLER_TOOL>()->CheckAllZones( this );
wxSafeYield(); // Timeslice to close zone progress reporter
@ -139,13 +138,10 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
}
// Old model has to be refreshed, GAL normally does not keep updating it
m_reporter->Report( _( "Rebuild connectivity..." ) );
m_reporter->Report( _( "Rebuilding connectivity..." ) );
wxSafeYield(); // Timeslice to update UI
m_parentFrame->Compile_Ratsnest( false );
m_reporter->Report( _( "Check items..." ) );
wxSafeYield(); // Timeslice to update UI
cleaner.CleanupBoard( aDryRun, &m_items, m_cleanShortCircuitOpt->GetValue(),
m_cleanViasOpt->GetValue(),
m_mergeSegmOpt->GetValue(),
@ -154,9 +150,6 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
m_deleteDanglingViasOpt->GetValue(),
m_reporter );
m_reporter->Report( _( "Items checked..." ) );
wxSafeYield(); // Timeslice to update UI
if( aDryRun )
{
RC_ITEMS_PROVIDER* provider = new VECTOR_CLEANUP_ITEMS_PROVIDER( &m_items );
@ -169,7 +162,7 @@ void DIALOG_CLEANUP_TRACKS_AND_VIAS::doCleanup( bool aDryRun )
m_parentFrame->GetCanvas()->Refresh( true );
}
m_reporter->Report( _( "Finished..." ) );
m_reporter->Report( _( "Done." ) );
setupOKButtonLabel();
}

View File

@ -50,10 +50,11 @@ TRACKS_CLEANER::TRACKS_CLEANER( BOARD* aPcb, BOARD_COMMIT& aCommit ) :
* - vias on pad
* - null length segments
*/
void TRACKS_CLEANER::CleanupBoard( bool aDryRun, std::vector<std::shared_ptr<CLEANUP_ITEM> >* aItemsList,
void TRACKS_CLEANER::CleanupBoard( bool aDryRun,
std::vector<std::shared_ptr<CLEANUP_ITEM> >* aItemsList,
bool aRemoveMisConnected, bool aCleanVias, bool aMergeSegments,
bool aDeleteUnconnected, bool aDeleteTracksinPad, bool aDeleteDanglingVias,
REPORTER* aReporter )
bool aDeleteUnconnected, bool aDeleteTracksinPad,
bool aDeleteDanglingVias, REPORTER* aReporter )
{
m_reporter = aReporter;
bool has_deleted = false;
@ -63,7 +64,11 @@ void TRACKS_CLEANER::CleanupBoard( bool aDryRun, std::vector<std::shared_ptr<CLE
if( m_reporter )
{
m_reporter->Report( _( "Clean vias and tracks" ) );
if( aDryRun )
m_reporter->Report( _( "Checking null tracks and vias..." ) );
else
m_reporter->Report( _( "Removing null tracks and vias..." ) );
wxSafeYield(); // Timeslice to update UI
}
@ -72,7 +77,11 @@ void TRACKS_CLEANER::CleanupBoard( bool aDryRun, std::vector<std::shared_ptr<CLE
if( m_reporter )
{
m_reporter->Report( _( "Merge collinear tracks" ) );
if( aDryRun )
m_reporter->Report( _( "Checking redundant tracks..." ) );
else
m_reporter->Report( _( "Removing redundant tracks..." ) );
wxSafeYield(); // Timeslice to update UI
}
@ -82,7 +91,11 @@ void TRACKS_CLEANER::CleanupBoard( bool aDryRun, std::vector<std::shared_ptr<CLE
{
if( m_reporter )
{
m_reporter->Report( _( "Remove misconnected" ) );
if( aDryRun )
m_reporter->Report( _( "Checking shorting tracks..." ) );
else
m_reporter->Report( _( "Removing shorting tracks..." ) );
wxSafeYield(); // Timeslice to update UI
}
@ -93,20 +106,49 @@ void TRACKS_CLEANER::CleanupBoard( bool aDryRun, std::vector<std::shared_ptr<CLE
{
if( m_reporter )
{
m_reporter->Report( _( "Delete tracks in pads" ) );
if( aDryRun )
m_reporter->Report( _( "Checking tracks in pads..." ) );
else
m_reporter->Report( _( "Removing tracks in pads..." ) );
wxSafeYield(); // Timeslice to update UI
}
deleteTracksInPads();
}
if( aDeleteUnconnected || aDeleteDanglingVias )
{
if( m_reporter )
{
if( aDryRun )
{
m_reporter->Report( _( "Checking dangling tracks and vias..." ) );
}
else
{
if( aDeleteUnconnected )
m_reporter->Report( _( "Removing dangling tracks..." ) );
if( aDeleteDanglingVias )
m_reporter->Report( _( "Removing dangling vias..." ) );
}
wxSafeYield(); // Timeslice to update UI
}
has_deleted = deleteDanglingTracks( aDeleteUnconnected, aDeleteDanglingVias );
}
if( has_deleted && aMergeSegments )
{
if( m_reporter )
{
m_reporter->Report( _( "Merge segments" ) );
if( aDryRun )
m_reporter->Report( _( "Checking collinear tracks..." ) );
else
m_reporter->Report( _( "Merging collinear tracks..." ) );
wxSafeYield(); // Timeslice to update UI
}