Don't clear marker counts when closing DRC dialog.

Fixes https://gitlab.com/kicad/code/kicad/issues/11844
This commit is contained in:
Jeff Young 2022-06-19 20:51:19 +01:00
parent 45ab15dc95
commit 801a98a302
1 changed files with 58 additions and 28 deletions

View File

@ -55,6 +55,9 @@
// Use default column widths instead. // Use default column widths instead.
static int DEFAULT_SINGLE_COL_WIDTH = 660; static int DEFAULT_SINGLE_COL_WIDTH = 660;
static BOARD* g_lastDRCBoard = nullptr;
static std::vector<wxString> g_lastIgnored;
DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) : DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
DIALOG_DRC_BASE( aParent ), DIALOG_DRC_BASE( aParent ),
@ -90,6 +93,14 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
m_ignoredList->InsertColumn( 0, wxEmptyString, wxLIST_FORMAT_LEFT, DEFAULT_SINGLE_COL_WIDTH ); m_ignoredList->InsertColumn( 0, wxEmptyString, wxLIST_FORMAT_LEFT, DEFAULT_SINGLE_COL_WIDTH );
if( m_currentBoard == g_lastDRCBoard )
{
m_drcRun = true;
for( const wxString& str : g_lastIgnored )
m_ignoredList->InsertItem( m_ignoredList->GetItemCount(), str );
}
m_Notebook->SetSelection( 0 ); m_Notebook->SetSelection( 0 );
if( Kiface().IsSingle() ) if( Kiface().IsSingle() )
@ -130,6 +141,16 @@ DIALOG_DRC::~DIALOG_DRC()
{ {
m_frame->FocusOnItem( nullptr ); m_frame->FocusOnItem( nullptr );
if( m_drcRun )
{
g_lastDRCBoard = m_currentBoard;
g_lastIgnored.clear();
for( int ii = 0; ii < m_ignoredList->GetItemCount(); ++ii )
g_lastIgnored.push_back( m_ignoredList->GetItemText( ii ) );
}
PCBNEW_SETTINGS* settings = m_frame->GetPcbNewSettings(); PCBNEW_SETTINGS* settings = m_frame->GetPcbNewSettings();
settings->m_DrcDialog.refill_zones = m_cbRefillZones->GetValue(); settings->m_DrcDialog.refill_zones = m_cbRefillZones->GetValue();
settings->m_DrcDialog.test_all_track_errors = m_cbReportAllTrackErrors->GetValue(); settings->m_DrcDialog.test_all_track_errors = m_cbReportAllTrackErrors->GetValue();
@ -239,7 +260,6 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
return; return;
} }
m_drcRun = false;
m_footprintTestsRun = false; m_footprintTestsRun = false;
m_cancelled = false; m_cancelled = false;
@ -1104,7 +1124,6 @@ void DIALOG_DRC::OnDeleteAllClick( wxCommandEvent& aEvent )
deleteAllMarkers( s_includeExclusions ); deleteAllMarkers( s_includeExclusions );
m_drcRun = false;
refreshEditor(); refreshEditor();
updateDisplayedCounts(); updateDisplayedCounts();
} }
@ -1196,48 +1215,59 @@ void DIALOG_DRC::updateDisplayedCounts()
{ {
num.Printf( markersOverflowed ? wxT( "%d+" ) : wxT( "%d" ), numMarkers ); num.Printf( markersOverflowed ? wxT( "%d+" ) : wxT( "%d" ), numMarkers );
msg.Printf( m_markersTitleTemplate, num ); msg.Printf( m_markersTitleTemplate, num );
m_Notebook->SetPageText( 0, msg );
num.Printf( unconnectedOverflowed ? wxT( "%d+" ) : wxT( "%d" ), numUnconnected );
msg.sprintf( m_unconnectedTitleTemplate, num );
m_Notebook->SetPageText( 1, msg );
if( m_footprintTestsRun )
{
num.Printf( footprintsOverflowed ? wxT( "%d+" ) : wxT( "%d" ), numFootprints );
msg.sprintf( m_footprintsTitleTemplate, num );
}
else
{
msg = m_footprintsTitleTemplate;
msg.Replace( wxT( "%s" ), _( "not run" ) );
}
m_Notebook->SetPageText( 2, msg );
num.Printf( wxT( "%d" ), m_ignoredList->GetItemCount() );
msg.sprintf( m_ignoredTitleTemplate, num );
m_Notebook->SetPageText( 3, msg );
} }
else else
{ {
msg = m_markersTitleTemplate; msg = m_markersTitleTemplate;
msg.Replace( wxT( "(%s)" ), wxEmptyString ); msg.Replace( wxT( "(%s)" ), wxEmptyString );
m_Notebook->SetPageText( 0, msg ); }
m_Notebook->SetPageText( 0, msg );
if( m_drcRun )
{
num.Printf( unconnectedOverflowed ? wxT( "%d+" ) : wxT( "%d" ), numUnconnected );
msg.sprintf( m_unconnectedTitleTemplate, num );
}
else
{
msg = m_unconnectedTitleTemplate; msg = m_unconnectedTitleTemplate;
msg.Replace( wxT( "(%s)" ), wxEmptyString ); msg.Replace( wxT( "(%s)" ), wxEmptyString );
m_Notebook->SetPageText( 1, msg ); }
m_Notebook->SetPageText( 1, msg );
if( m_footprintTestsRun )
{
num.Printf( footprintsOverflowed ? wxT( "%d+" ) : wxT( "%d" ), numFootprints );
msg.sprintf( m_footprintsTitleTemplate, num );
}
else if( m_drcRun )
{
msg = m_footprintsTitleTemplate;
msg.Replace( wxT( "%s" ), _( "not run" ) );
}
else
{
msg = m_footprintsTitleTemplate; msg = m_footprintsTitleTemplate;
msg.Replace( wxT( "(%s)" ), wxEmptyString ); msg.Replace( wxT( "(%s)" ), wxEmptyString );
m_Notebook->SetPageText( 2, msg ); }
m_Notebook->SetPageText( 2, msg );
if( m_drcRun )
{
num.Printf( wxT( "%d" ), m_ignoredList->GetItemCount() );
msg.sprintf( m_ignoredTitleTemplate, num );
}
else
{
msg = m_ignoredTitleTemplate; msg = m_ignoredTitleTemplate;
msg.Replace( wxT( "(%s)" ), wxEmptyString ); msg.Replace( wxT( "(%s)" ), wxEmptyString );
m_Notebook->SetPageText( 3, msg );
} }
m_Notebook->SetPageText( 3, msg );
// Update badges: // Update badges:
if( !m_drcRun && numErrors == 0 ) if( !m_drcRun && numErrors == 0 )