Show DRC overflows in both tab titles and number badges.
Fixes https://gitlab.com/kicad/code/kicad/issues/10617
This commit is contained in:
parent
e93b7b05ec
commit
ca56de7816
|
@ -90,6 +90,8 @@ void NUMBER_BADGE::UpdateNumber( int aNumber, SEVERITY aSeverity )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
computeSize();
|
||||||
|
|
||||||
// Force the badge UI to refresh so the new number and color is displayed
|
// Force the badge UI to refresh so the new number and color is displayed
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
@ -98,7 +100,6 @@ void NUMBER_BADGE::UpdateNumber( int aNumber, SEVERITY aSeverity )
|
||||||
void NUMBER_BADGE::SetMaximumNumber( int aMax )
|
void NUMBER_BADGE::SetMaximumNumber( int aMax )
|
||||||
{
|
{
|
||||||
m_maxNumber = aMax;
|
m_maxNumber = aMax;
|
||||||
computeSize();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ void NUMBER_BADGE::SetTextSize( int aSize )
|
||||||
// match those. Other platforms may also need tweaks to spacing, fontweight, etc.
|
// match those. Other platforms may also need tweaks to spacing, fontweight, etc.
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
#define BADGE_FONTWEIGHT wxFONTWEIGHT_NORMAL
|
#define BADGE_FONTWEIGHT wxFONTWEIGHT_NORMAL
|
||||||
#define PLATFORM_FUDGE_X 0.8
|
#define PLATFORM_FUDGE_X 0.92
|
||||||
#define PLATFORM_FUDGE_Y 1.6
|
#define PLATFORM_FUDGE_Y 1.6
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -133,14 +134,16 @@ void NUMBER_BADGE::computeSize()
|
||||||
{
|
{
|
||||||
wxClientDC dc( this );
|
wxClientDC dc( this );
|
||||||
|
|
||||||
wxString test = wxString::Format( wxT( "%d" ), m_maxNumber );
|
wxString test = wxString::Format( wxT( "%d" ), m_currentNumber );
|
||||||
int len = test.length();
|
int len = test.length();
|
||||||
|
|
||||||
// Determine the size using the string "-999+" where the - on the front is for spacing from
|
// Determine the size using the string "m999{+}" where the 'm' on the front serves as a margin
|
||||||
// the start of the rectangle so the number isn't close to the curved edge.
|
// so the number isn't too close to the curved edge.
|
||||||
test = "-";
|
test = "m";
|
||||||
test.Pad( len, '9' );
|
test.Pad( len, '9' );
|
||||||
test += "+";
|
|
||||||
|
if( m_currentNumber > m_maxNumber )
|
||||||
|
test += "+";
|
||||||
|
|
||||||
dc.SetFont( wxFont( m_textSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, BADGE_FONTWEIGHT ) );
|
dc.SetFont( wxFont( m_textSize, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, BADGE_FONTWEIGHT ) );
|
||||||
wxSize size = dc.GetTextExtent( test );
|
wxSize size = dc.GetTextExtent( test );
|
||||||
|
|
|
@ -1071,6 +1071,10 @@ void DIALOG_DRC::OnDeleteAllClick( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
void DIALOG_DRC::updateDisplayedCounts()
|
void DIALOG_DRC::updateDisplayedCounts()
|
||||||
{
|
{
|
||||||
|
BOARD_DESIGN_SETTINGS& bds = m_frame->GetDesignSettings();
|
||||||
|
DRC_TOOL* drcTool = m_frame->GetToolManager()->GetTool<DRC_TOOL>();
|
||||||
|
DRC_ENGINE* drcEngine = drcTool->GetDRCEngine().get();
|
||||||
|
|
||||||
// Collect counts:
|
// Collect counts:
|
||||||
|
|
||||||
int numMarkers = 0;
|
int numMarkers = 0;
|
||||||
|
@ -1105,49 +1109,91 @@ void DIALOG_DRC::updateDisplayedCounts()
|
||||||
numExcluded += m_footprintWarningsProvider->GetCount( RPT_SEVERITY_EXCLUSION );
|
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 msg;
|
||||||
|
wxString num;
|
||||||
|
|
||||||
// Update tab headers:
|
// Update tab headers:
|
||||||
|
|
||||||
if( m_drcRun )
|
if( m_drcRun )
|
||||||
{
|
{
|
||||||
msg.sprintf( m_markersTitleTemplate, numMarkers );
|
num.Printf( markersOverflowed ? wxT( "%d+" ) : wxT( "%d" ), numMarkers );
|
||||||
|
msg.Printf( m_markersTitleTemplate, num );
|
||||||
m_Notebook->SetPageText( 0, msg );
|
m_Notebook->SetPageText( 0, msg );
|
||||||
|
|
||||||
msg.sprintf( m_unconnectedTitleTemplate, numUnconnected );
|
num.Printf( unconnectedOverflowed ? wxT( "%d+" ) : wxT( "%d" ), numUnconnected );
|
||||||
|
msg.sprintf( m_unconnectedTitleTemplate, num );
|
||||||
m_Notebook->SetPageText( 1, msg );
|
m_Notebook->SetPageText( 1, msg );
|
||||||
|
|
||||||
if( m_footprintTestsRun )
|
if( m_footprintTestsRun )
|
||||||
{
|
{
|
||||||
msg.sprintf( m_footprintsTitleTemplate, numFootprints );
|
num.Printf( footprintsOverflowed ? wxT( "%d+" ) : wxT( "%d" ), numFootprints );
|
||||||
|
msg.sprintf( m_footprintsTitleTemplate, num );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg = m_footprintsTitleTemplate;
|
msg = m_footprintsTitleTemplate;
|
||||||
msg.Replace( wxT( "%d" ), _( "not run" ) );
|
msg.Replace( wxT( "%s" ), _( "not run" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Notebook->SetPageText( 2, msg );
|
m_Notebook->SetPageText( 2, msg );
|
||||||
|
|
||||||
msg.sprintf( m_ignoredTitleTemplate, m_ignoredList->GetItemCount() );
|
num.Printf( wxT( "%d" ), m_ignoredList->GetItemCount() );
|
||||||
|
msg.sprintf( m_ignoredTitleTemplate, num );
|
||||||
m_Notebook->SetPageText( 3, msg );
|
m_Notebook->SetPageText( 3, msg );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg = m_markersTitleTemplate;
|
msg = m_markersTitleTemplate;
|
||||||
msg.Replace( wxT( "(%d)" ), wxEmptyString );
|
msg.Replace( wxT( "(%s)" ), wxEmptyString );
|
||||||
m_Notebook->SetPageText( 0, msg );
|
m_Notebook->SetPageText( 0, msg );
|
||||||
|
|
||||||
msg = m_unconnectedTitleTemplate;
|
msg = m_unconnectedTitleTemplate;
|
||||||
msg.Replace( wxT( "(%d)" ), wxEmptyString );
|
msg.Replace( wxT( "(%s)" ), wxEmptyString );
|
||||||
m_Notebook->SetPageText( 1, msg );
|
m_Notebook->SetPageText( 1, msg );
|
||||||
|
|
||||||
msg = m_footprintsTitleTemplate;
|
msg = m_footprintsTitleTemplate;
|
||||||
msg.Replace( wxT( "(%d)" ), wxEmptyString );
|
msg.Replace( wxT( "(%s)" ), wxEmptyString );
|
||||||
m_Notebook->SetPageText( 2, msg );
|
m_Notebook->SetPageText( 2, msg );
|
||||||
|
|
||||||
msg = m_ignoredTitleTemplate;
|
msg = m_ignoredTitleTemplate;
|
||||||
msg.Replace( wxT( "(%d)" ), wxEmptyString );
|
msg.Replace( wxT( "(%s)" ), wxEmptyString );
|
||||||
m_Notebook->SetPageText( 3, msg );
|
m_Notebook->SetPageText( 3, msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1160,10 +1206,12 @@ void DIALOG_DRC::updateDisplayedCounts()
|
||||||
numWarnings = -1;
|
numWarnings = -1;
|
||||||
|
|
||||||
m_errorsBadge->SetMaximumNumber( numErrors );
|
m_errorsBadge->SetMaximumNumber( numErrors );
|
||||||
m_errorsBadge->UpdateNumber( numErrors, RPT_SEVERITY_ERROR );
|
m_errorsBadge->UpdateNumber( errorsOverflowed ? numErrors + 1 : numErrors,
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
|
|
||||||
m_warningsBadge->SetMaximumNumber( numWarnings );
|
m_warningsBadge->SetMaximumNumber( numWarnings );
|
||||||
m_warningsBadge->UpdateNumber( numWarnings, RPT_SEVERITY_WARNING );
|
m_warningsBadge->UpdateNumber( warningsOverflowed ? numWarnings + 1 : numWarnings,
|
||||||
|
RPT_SEVERITY_WARNING );
|
||||||
|
|
||||||
m_exclusionsBadge->SetMaximumNumber( numExcluded );
|
m_exclusionsBadge->SetMaximumNumber( numExcluded );
|
||||||
m_exclusionsBadge->UpdateNumber( numExcluded, RPT_SEVERITY_EXCLUSION );
|
m_exclusionsBadge->UpdateNumber( numExcluded, RPT_SEVERITY_EXCLUSION );
|
||||||
|
|
|
@ -104,7 +104,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
|
||||||
m_panelViolations->SetSizer( bSizerViolationsBox );
|
m_panelViolations->SetSizer( bSizerViolationsBox );
|
||||||
m_panelViolations->Layout();
|
m_panelViolations->Layout();
|
||||||
bSizerViolationsBox->Fit( m_panelViolations );
|
bSizerViolationsBox->Fit( m_panelViolations );
|
||||||
m_Notebook->AddPage( m_panelViolations, _("Violations (%d)"), false );
|
m_Notebook->AddPage( m_panelViolations, _("Violations (%s)"), false );
|
||||||
m_panelUnconnectedItems = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
m_panelUnconnectedItems = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||||
wxBoxSizer* bSizerUnconnectedBox;
|
wxBoxSizer* bSizerUnconnectedBox;
|
||||||
bSizerUnconnectedBox = new wxBoxSizer( wxVERTICAL );
|
bSizerUnconnectedBox = new wxBoxSizer( wxVERTICAL );
|
||||||
|
@ -116,7 +116,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
|
||||||
m_panelUnconnectedItems->SetSizer( bSizerUnconnectedBox );
|
m_panelUnconnectedItems->SetSizer( bSizerUnconnectedBox );
|
||||||
m_panelUnconnectedItems->Layout();
|
m_panelUnconnectedItems->Layout();
|
||||||
bSizerUnconnectedBox->Fit( m_panelUnconnectedItems );
|
bSizerUnconnectedBox->Fit( m_panelUnconnectedItems );
|
||||||
m_Notebook->AddPage( m_panelUnconnectedItems, _("Unconnected Items (%d)"), false );
|
m_Notebook->AddPage( m_panelUnconnectedItems, _("Unconnected Items (%s)"), false );
|
||||||
m_panelFootprintWarnings = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
m_panelFootprintWarnings = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||||
wxBoxSizer* bSizerFootprintsBox;
|
wxBoxSizer* bSizerFootprintsBox;
|
||||||
bSizerFootprintsBox = new wxBoxSizer( wxVERTICAL );
|
bSizerFootprintsBox = new wxBoxSizer( wxVERTICAL );
|
||||||
|
@ -128,7 +128,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
|
||||||
m_panelFootprintWarnings->SetSizer( bSizerFootprintsBox );
|
m_panelFootprintWarnings->SetSizer( bSizerFootprintsBox );
|
||||||
m_panelFootprintWarnings->Layout();
|
m_panelFootprintWarnings->Layout();
|
||||||
bSizerFootprintsBox->Fit( m_panelFootprintWarnings );
|
bSizerFootprintsBox->Fit( m_panelFootprintWarnings );
|
||||||
m_Notebook->AddPage( m_panelFootprintWarnings, _("Schematic Parity (%d)"), false );
|
m_Notebook->AddPage( m_panelFootprintWarnings, _("Schematic Parity (%s)"), false );
|
||||||
m_panelIgnored = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
m_panelIgnored = new wxPanel( m_Notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||||
wxBoxSizer* bSizer15;
|
wxBoxSizer* bSizer15;
|
||||||
bSizer15 = new wxBoxSizer( wxVERTICAL );
|
bSizer15 = new wxBoxSizer( wxVERTICAL );
|
||||||
|
@ -140,7 +140,7 @@ DIALOG_DRC_BASE::DIALOG_DRC_BASE( wxWindow* parent, wxWindowID id, const wxStrin
|
||||||
m_panelIgnored->SetSizer( bSizer15 );
|
m_panelIgnored->SetSizer( bSizer15 );
|
||||||
m_panelIgnored->Layout();
|
m_panelIgnored->Layout();
|
||||||
bSizer15->Fit( m_panelIgnored );
|
bSizer15->Fit( m_panelIgnored );
|
||||||
m_Notebook->AddPage( m_panelIgnored, _("Ignored Tests (%d)"), false );
|
m_Notebook->AddPage( m_panelIgnored, _("Ignored Tests (%s)"), false );
|
||||||
|
|
||||||
bSizer13->Add( m_Notebook, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
bSizer13->Add( m_Notebook, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
|
@ -777,7 +777,7 @@
|
||||||
<event name="OnNotebookPageChanged">OnChangingNotebookPage</event>
|
<event name="OnNotebookPageChanged">OnChangingNotebookPage</event>
|
||||||
<object class="notebookpage" expanded="1">
|
<object class="notebookpage" expanded="1">
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
<property name="label">Violations (%d)</property>
|
<property name="label">Violations (%s)</property>
|
||||||
<property name="select">0</property>
|
<property name="select">0</property>
|
||||||
<object class="wxPanel" expanded="1">
|
<object class="wxPanel" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -870,7 +870,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="notebookpage" expanded="1">
|
<object class="notebookpage" expanded="1">
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
<property name="label">Unconnected Items (%d)</property>
|
<property name="label">Unconnected Items (%s)</property>
|
||||||
<property name="select">0</property>
|
<property name="select">0</property>
|
||||||
<object class="wxPanel" expanded="1">
|
<object class="wxPanel" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -963,7 +963,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="notebookpage" expanded="1">
|
<object class="notebookpage" expanded="1">
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
<property name="label">Schematic Parity (%d)</property>
|
<property name="label">Schematic Parity (%s)</property>
|
||||||
<property name="select">0</property>
|
<property name="select">0</property>
|
||||||
<object class="wxPanel" expanded="1">
|
<object class="wxPanel" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
@ -1056,7 +1056,7 @@
|
||||||
</object>
|
</object>
|
||||||
<object class="notebookpage" expanded="1">
|
<object class="notebookpage" expanded="1">
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
<property name="label">Ignored Tests (%d)</property>
|
<property name="label">Ignored Tests (%s)</property>
|
||||||
<property name="select">0</property>
|
<property name="select">0</property>
|
||||||
<object class="wxPanel" expanded="1">
|
<object class="wxPanel" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
|
|
|
@ -45,7 +45,8 @@
|
||||||
|
|
||||||
// wxListBox's performance degrades horrifically with very large datasets. It's not clear
|
// wxListBox's performance degrades horrifically with very large datasets. It's not clear
|
||||||
// they're useful to the user anyway.
|
// they're useful to the user anyway.
|
||||||
#define ERROR_LIMIT_MAX 199
|
#define ERROR_LIMIT 199
|
||||||
|
#define EXTENDED_ERROR_LIMIT 499
|
||||||
|
|
||||||
|
|
||||||
void drcPrintDebugMessage( int level, const wxString& msg, const char *function, int line )
|
void drcPrintDebugMessage( int level, const wxString& msg, const char *function, int line )
|
||||||
|
@ -77,7 +78,7 @@ DRC_ENGINE::DRC_ENGINE( BOARD* aBoard, BOARD_DESIGN_SETTINGS *aSettings ) :
|
||||||
m_errorLimits.resize( DRCE_LAST + 1 );
|
m_errorLimits.resize( DRCE_LAST + 1 );
|
||||||
|
|
||||||
for( int ii = DRCE_FIRST; ii <= DRCE_LAST; ++ii )
|
for( int ii = DRCE_FIRST; ii <= DRCE_LAST; ++ii )
|
||||||
m_errorLimits[ ii ] = ERROR_LIMIT_MAX;
|
m_errorLimits[ ii ] = ERROR_LIMIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -578,7 +579,7 @@ void DRC_ENGINE::InitEngine( const wxFileName& aRulePath )
|
||||||
}
|
}
|
||||||
|
|
||||||
for( int ii = DRCE_FIRST; ii < DRCE_LAST; ++ii )
|
for( int ii = DRCE_FIRST; ii < DRCE_LAST; ++ii )
|
||||||
m_errorLimits[ ii ] = ERROR_LIMIT_MAX;
|
m_errorLimits[ ii ] = ERROR_LIMIT;
|
||||||
|
|
||||||
m_rulesValid = true;
|
m_rulesValid = true;
|
||||||
}
|
}
|
||||||
|
@ -595,8 +596,10 @@ void DRC_ENGINE::RunTests( EDA_UNITS aUnits, bool aReportAllTrackErrors, bool aT
|
||||||
{
|
{
|
||||||
if( m_designSettings->Ignore( ii ) )
|
if( m_designSettings->Ignore( ii ) )
|
||||||
m_errorLimits[ ii ] = 0;
|
m_errorLimits[ ii ] = 0;
|
||||||
|
else if( ii == DRCE_CLEARANCE || ii == DRCE_UNCONNECTED_ITEMS )
|
||||||
|
m_errorLimits[ ii ] = EXTENDED_ERROR_LIMIT;
|
||||||
else
|
else
|
||||||
m_errorLimits[ ii ] = ERROR_LIMIT_MAX;
|
m_errorLimits[ ii ] = ERROR_LIMIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_board->IncrementTimeStamp(); // Invalidate all caches
|
m_board->IncrementTimeStamp(); // Invalidate all caches
|
||||||
|
|
Loading…
Reference in New Issue