Don't clear marker counts when closing DRC dialog.
Fixes https://gitlab.com/kicad/code/kicad/issues/11844
(cherry picked from commit 801a98a302
)
This commit is contained in:
parent
0bc97b7952
commit
7bf66be2ac
|
@ -47,6 +47,15 @@
|
|||
#include <tools/board_inspection_tool.h>
|
||||
#include <kiplatform/ui.h>
|
||||
|
||||
// wxWidgets spends *far* too long calcuating column widths (most of it, believe it or
|
||||
// not, in repeatedly creating/destroying a wxDC to do the measurement in).
|
||||
// Use default column widths instead.
|
||||
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_BASE( aParent ),
|
||||
PROGRESS_REPORTER_BASE( 1 ),
|
||||
|
@ -79,6 +88,16 @@ DIALOG_DRC::DIALOG_DRC( PCB_EDIT_FRAME* aEditorFrame, wxWindow* aParent ) :
|
|||
m_footprintWarningsTreeModel = new RC_TREE_MODEL( m_frame, m_footprintsDataView );
|
||||
m_footprintsDataView->AssociateModel( m_footprintWarningsTreeModel );
|
||||
|
||||
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 );
|
||||
}
|
||||
|
||||
if( Kiface().IsSingle() )
|
||||
m_cbTestFootprints->Hide();
|
||||
|
||||
|
@ -100,6 +119,16 @@ DIALOG_DRC::~DIALOG_DRC()
|
|||
{
|
||||
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();
|
||||
settings->m_DrcDialog.refill_zones = m_cbRefillZones->GetValue();
|
||||
settings->m_DrcDialog.test_all_track_errors = m_cbReportAllTrackErrors->GetValue();
|
||||
|
@ -233,7 +262,6 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent )
|
|||
return;
|
||||
}
|
||||
|
||||
m_drcRun = false;
|
||||
m_footprintTestsRun = false;
|
||||
m_cancelled = false;
|
||||
|
||||
|
@ -956,7 +984,6 @@ void DIALOG_DRC::OnDeleteAllClick( wxCommandEvent& aEvent )
|
|||
|
||||
deleteAllMarkers( s_includeExclusions );
|
||||
|
||||
m_drcRun = false;
|
||||
refreshEditor();
|
||||
updateDisplayedCounts();
|
||||
}
|
||||
|
@ -998,43 +1025,91 @@ void DIALOG_DRC::updateDisplayedCounts()
|
|||
numExcluded += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
||||
}
|
||||
|
||||
bool errorsOverflowed = false;
|
||||
bool warningsOverflowed = false;
|
||||
bool markersOverflowed = false;
|
||||
bool unconnectedOverflowed = false;
|
||||
bool footprintsOverflowed = false;
|
||||
|
||||
for( int ii = DRCE_FIRST; ii < DRCE_LAST; ++ii )
|
||||
{
|
||||
if( drcEngine->IsErrorLimitExceeded( ii ) && bds.GetSeverity( ii ) != RPT_SEVERITY_IGNORE )
|
||||
{
|
||||
if( bds.GetSeverity( ii ) == RPT_SEVERITY_ERROR )
|
||||
{
|
||||
errorsOverflowed = true;
|
||||
}
|
||||
else if( bds.GetSeverity( ii ) == RPT_SEVERITY_WARNING )
|
||||
{
|
||||
warningsOverflowed = true;
|
||||
}
|
||||
|
||||
if( ii == DRCE_UNCONNECTED_ITEMS )
|
||||
{
|
||||
unconnectedOverflowed = true;
|
||||
}
|
||||
else if( ii == DRCE_MISSING_FOOTPRINT
|
||||
|| ii == DRCE_DUPLICATE_FOOTPRINT
|
||||
|| ii == DRCE_EXTRA_FOOTPRINT
|
||||
|| ii == DRCE_NET_CONFLICT )
|
||||
{
|
||||
footprintsOverflowed = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
markersOverflowed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
wxString msg;
|
||||
wxString num;
|
||||
|
||||
// Update tab headers:
|
||||
|
||||
if( m_drcRun )
|
||||
{
|
||||
msg.sprintf( m_markersTitleTemplate, numMarkers );
|
||||
m_Notebook->SetPageText( 0, msg );
|
||||
|
||||
msg.sprintf( m_unconnectedTitleTemplate, numUnconnected );
|
||||
m_Notebook->SetPageText( 1, msg );
|
||||
|
||||
if( m_footprintTestsRun )
|
||||
{
|
||||
msg.sprintf( m_footprintsTitleTemplate, numFootprints );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = m_footprintsTitleTemplate;
|
||||
msg.Replace( wxT( "%d" ), _( "not run" ) );
|
||||
}
|
||||
m_Notebook->SetPageText( 2, msg );
|
||||
num.Printf( markersOverflowed ? wxT( "%d+" ) : wxT( "%d" ), numMarkers );
|
||||
msg.Printf( m_markersTitleTemplate, num );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = m_markersTitleTemplate;
|
||||
msg.Replace( wxT( "(%d)" ), wxEmptyString );
|
||||
msg.Replace( wxT( "(%s)" ), wxEmptyString );
|
||||
}
|
||||
|
||||
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.Replace( wxT( "(%d)" ), wxEmptyString );
|
||||
msg.Replace( wxT( "(%s)" ), wxEmptyString );
|
||||
}
|
||||
|
||||
m_Notebook->SetPageText( 1, msg );
|
||||
|
||||
msg = m_footprintsTitleTemplate;
|
||||
msg.Replace( wxT( "(%d)" ), wxEmptyString );
|
||||
m_Notebook->SetPageText( 2, 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.Replace( wxT( "(%s)" ), wxEmptyString );
|
||||
}
|
||||
|
||||
m_Notebook->SetPageText( 2, msg );
|
||||
|
||||
// Update badges:
|
||||
|
||||
|
|
Loading…
Reference in New Issue