diff --git a/common/widgets/ui_common.cpp b/common/widgets/ui_common.cpp index c2f367c700..2bbb12cc54 100644 --- a/common/widgets/ui_common.cpp +++ b/common/widgets/ui_common.cpp @@ -61,29 +61,45 @@ wxBitmap MakeBadge( SEVERITY aStyle, int aCount, wxWindow* aWindow, int aDepth ) badgeDC.SetBackground( brush ); badgeDC.Clear(); - if( aCount == 0 ) - return bitmap; - - switch( aStyle ) + if( aCount < 0 ) { - case RPT_SEVERITY_ERROR: - badgeColour = *wxRED; - textColour = *wxWHITE; - break; - case RPT_SEVERITY_WARNING: - badgeColour = *wxYELLOW; - textColour = *wxBLACK; - break; - case RPT_SEVERITY_ACTION: - badgeColour = *wxGREEN; - textColour = *wxWHITE; - break; - case RPT_SEVERITY_EXCLUSION: - case RPT_SEVERITY_INFO: - default: - badgeColour = *wxLIGHT_GREY; - textColour = *wxBLACK; - break; + return bitmap; + } + else if( aCount == 0 ) + { + if( aStyle == RPT_SEVERITY_ERROR || aStyle == RPT_SEVERITY_WARNING ) + { + badgeColour = *wxGREEN; + textColour = *wxWHITE; + } + else + { + return bitmap; + } + } + else + { + switch( aStyle ) + { + case RPT_SEVERITY_ERROR: + badgeColour = *wxRED; + textColour = *wxWHITE; + break; + case RPT_SEVERITY_WARNING: + badgeColour = *wxYELLOW; + textColour = *wxBLACK; + break; + case RPT_SEVERITY_ACTION: + badgeColour = *wxGREEN; + textColour = *wxWHITE; + break; + case RPT_SEVERITY_EXCLUSION: + case RPT_SEVERITY_INFO: + default: + badgeColour = *wxLIGHT_GREY; + textColour = *wxBLACK; + break; + } } brush.SetStyle( wxBRUSHSTYLE_SOLID ); diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index a60eee65fd..008beefbcb 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -53,6 +53,7 @@ DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) : DIALOG_ERC_BASE( parent, ID_DIALOG_ERC ), // parent looks for this ID explicitly m_parent( parent ), + m_ercRun( false ), m_severities( RPT_SEVERITY_ERROR | RPT_SEVERITY_WARNING ) { EESCHEMA_SETTINGS* settings = dynamic_cast( Kiface().KifaceSettings() ); @@ -113,6 +114,12 @@ void DIALOG_ERC::updateDisplayedCounts() numExcluded += m_markerProvider->GetCount( RPT_SEVERITY_EXCLUSION ); } + if( !m_ercRun ) + { + numErrors = -1; + numWarnings = -1; + } + m_errorsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_ERROR, numErrors, m_errorsBadge ) ); m_warningsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_WARNING, numWarnings, m_warningsBadge ) ); m_exclusionsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_EXCLUSION, numExcluded, m_exclusionsBadge ) ); @@ -145,6 +152,7 @@ void DIALOG_ERC::OnEraseDrcMarkersClick( wxCommandEvent& event ) deleteAllMarkers( includeExclusions ); + m_ercRun = false; updateDisplayedCounts(); m_parent->GetCanvas()->Refresh(); } @@ -188,11 +196,14 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event ) wxSafeYield(); // m_MarkersList must be redraw WX_TEXT_CTRL_REPORTER reporter( m_MessagesList ); - TestErc( reporter ); + testErc( reporter ); + + m_ercRun = true; + updateDisplayedCounts(); } -void DIALOG_ERC::RedrawDrawPanel() +void DIALOG_ERC::redrawDrawPanel() { WINDOW_THAWER thawer( m_parent ); @@ -200,7 +211,7 @@ void DIALOG_ERC::RedrawDrawPanel() } -void DIALOG_ERC::TestErc( REPORTER& aReporter ) +void DIALOG_ERC::testErc( REPORTER& aReporter ) { wxFileName fn; @@ -291,9 +302,6 @@ void DIALOG_ERC::TestErc( REPORTER& aReporter ) // Display diags: m_markerTreeModel->SetProvider( m_markerProvider ); - // Displays global results: - updateDisplayedCounts(); - // Display new markers from the current screen: KIGFX::VIEW* view = m_parent->GetCanvas()->GetView(); @@ -328,7 +336,7 @@ void DIALOG_ERC::OnERCItemSelected( wxDataViewEvent& aEvent ) } m_parent->FocusOnItem( item ); - RedrawDrawPanel(); + redrawDrawPanel(); } aEvent.Skip(); diff --git a/eeschema/dialogs/dialog_erc.h b/eeschema/dialogs/dialog_erc.h index a114e5e2e5..9fb47f5b74 100644 --- a/eeschema/dialogs/dialog_erc.h +++ b/eeschema/dialogs/dialog_erc.h @@ -42,6 +42,8 @@ private: RC_ITEMS_PROVIDER* m_markerProvider; RC_TREE_MODEL* m_markerTreeModel; + bool m_ercRun; + int m_severities; public: @@ -61,9 +63,9 @@ private: void OnSaveReport( wxCommandEvent& aEvent ) override; void OnButtonCloseClick( wxCommandEvent& event ) override; - void RedrawDrawPanel(); + void redrawDrawPanel(); - void TestErc( REPORTER& aReporter ); + void testErc( REPORTER& aReporter ); bool writeReport( const wxString& aFullFileName ); diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 8c6117ef3c..8fa13f4fc7 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -752,6 +752,7 @@ void DIALOG_DRC::OnDeleteAllClick( wxCommandEvent& aEvent ) deleteAllMarkers( s_includeExclusions ); + m_drcRun = false; refreshBoardEditor(); updateDisplayedCounts(); } @@ -817,13 +818,19 @@ void DIALOG_DRC::updateDisplayedCounts() numExcluded += m_unconnectedItemsProvider->GetCount( RPT_SEVERITY_EXCLUSION ); } - if( m_footprintWarningsProvider ) + if( m_footprintTestsRun && m_footprintWarningsProvider ) { numErrors += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_ERROR ); numWarnings += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_WARNING ); numExcluded += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_EXCLUSION ); } + if( !m_drcRun ) + { + numErrors = -1; + numWarnings = -1; + } + m_errorsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_ERROR, numErrors, m_errorsBadge ) ); m_warningsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_WARNING, numWarnings, m_warningsBadge ) ); m_exclusionsBadge->SetBitmap( MakeBadge( RPT_SEVERITY_EXCLUSION, numExcluded, m_exclusionsBadge ) );