Don't write out synthetic severities (they're headings).

Fixes https://gitlab.com/kicad/code/kicad/issues/6726
This commit is contained in:
Jeff Young 2020-12-14 13:33:51 +00:00
parent d0e008053a
commit 3b35bfc0a5
13 changed files with 41 additions and 45 deletions

View File

@ -30,7 +30,7 @@
PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
std::vector<std::reference_wrapper<RC_ITEM>> aItems,
std::map<int, int>& aSeverities,
std::map<int, SEVERITY>& aSeverities,
RC_ITEM* aPinMapSpecialCase ) :
wxPanel( aParent->GetTreebook() ),
m_severities( aSeverities ),
@ -147,7 +147,7 @@ PANEL_SETUP_SEVERITIES::PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
}
void PANEL_SETUP_SEVERITIES::ImportSettingsFrom( std::map<int, int>& aSettings )
void PANEL_SETUP_SEVERITIES::ImportSettingsFrom( std::map<int, SEVERITY>& aSettings )
{
for( const RC_ITEM& item : m_items )
{
@ -222,7 +222,7 @@ bool PANEL_SETUP_SEVERITIES::TransferDataFromWindow()
if( !m_buttonMap[ errorCode ][0] ) // this entry does not actually exist
continue;
int severity = RPT_SEVERITY_UNDEFINED;
SEVERITY severity = RPT_SEVERITY_UNDEFINED;
if( m_buttonMap[ errorCode ][0]->GetValue() )
severity = RPT_SEVERITY_ERROR;
@ -236,8 +236,8 @@ bool PANEL_SETUP_SEVERITIES::TransferDataFromWindow()
if( m_pinMapSpecialCase )
{
int pinMapCode = m_pinMapSpecialCase->GetErrorCode();
int severity = RPT_SEVERITY_UNDEFINED;
int pinMapCode = m_pinMapSpecialCase->GetErrorCode();
SEVERITY severity = RPT_SEVERITY_UNDEFINED;
if( m_buttonMap[ pinMapCode ][0]->GetValue() )
severity = RPT_SEVERITY_ERROR;

View File

@ -37,7 +37,7 @@ class wxRadioButton;
class PANEL_SETUP_SEVERITIES : public wxPanel
{
private:
std::map<int, int>& m_severities;
std::map<int, SEVERITY>& m_severities;
/// A list of item templates (to get descriptive text and error codes from)
std::vector<std::reference_wrapper<RC_ITEM>> m_items;
@ -57,10 +57,10 @@ public:
*/
PANEL_SETUP_SEVERITIES( PAGED_DIALOG* aParent,
std::vector<std::reference_wrapper<RC_ITEM>> aItems,
std::map<int, int>& aSeverities,
std::map<int, SEVERITY>& aSeverities,
RC_ITEM* aPinMapSpecialCase = nullptr );
void ImportSettingsFrom( std::map<int, int>& aSettings );
void ImportSettingsFrom( std::map<int, SEVERITY>& aSettings );
private:
bool TransferDataToWindow() override;

View File

@ -802,7 +802,7 @@ bool DIALOG_ERC::writeReport( const wxString& aFullFileName )
{
const SCH_MARKER* marker = static_cast<const SCH_MARKER*>( aItem );
RC_ITEM* item = marker->GetRCItem().get();
SEVERITY severity = (SEVERITY)settings.GetSeverity( item->GetErrorCode() );
SEVERITY severity = settings.GetSeverity( item->GetErrorCode() );
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
continue;

View File

@ -107,15 +107,13 @@ ERC_SETTINGS::ERC_SETTINGS( JSON_SETTINGS* aParent, const std::string& aPath ) :
for( const RC_ITEM& item : ERC_ITEM::GetItemsWithSeverities() )
{
int code = item.GetErrorCode();
wxString name = item.GetSettingsKey();
int code = item.GetErrorCode();
if( !m_Severities.count( code ) )
if( name.IsEmpty() || m_Severities.count( code ) == 0 )
continue;
wxString name = item.GetSettingsKey();
ret[std::string( name.ToUTF8() )] =
SeverityToString( static_cast<SEVERITY>( m_Severities[code] ) );
ret[std::string( name.ToUTF8() )] = SeverityToString( m_Severities[code] );
}
return ret;
@ -223,7 +221,7 @@ ERC_SETTINGS::~ERC_SETTINGS()
}
int ERC_SETTINGS::GetSeverity( int aErrorCode ) const
SEVERITY ERC_SETTINGS::GetSeverity( int aErrorCode ) const
{
// Special-case pin-to-pin errors:
// Ignore-or-not is controlled by ERCE_PIN_TO_PIN_WARNING (for both)
@ -254,7 +252,7 @@ int ERC_SETTINGS::GetSeverity( int aErrorCode ) const
}
void ERC_SETTINGS::SetSeverity( int aErrorCode, int aSeverity )
void ERC_SETTINGS::SetSeverity( int aErrorCode, SEVERITY aSeverity )
{
m_Severities[ aErrorCode ] = aSeverity;
}
@ -280,7 +278,7 @@ void SHEETLIST_ERC_ITEMS_PROVIDER::SetSeverities( int aSeverities )
for( SCH_ITEM* aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
{
SCH_MARKER* marker = static_cast<SCH_MARKER*>( aItem );
int markerSeverity;
SEVERITY markerSeverity;
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
continue;
@ -312,7 +310,7 @@ int SHEETLIST_ERC_ITEMS_PROVIDER::GetCount( int aSeverity )
for( SCH_ITEM* aItem : sheetList[i].LastScreen()->Items().OfType( SCH_MARKER_T ) )
{
SCH_MARKER* marker = static_cast<SCH_MARKER*>( aItem );
int markerSeverity;
SEVERITY markerSeverity;
if( marker->GetMarkerType() != MARKER_BASE::MARKER_ERC )
continue;

View File

@ -116,9 +116,9 @@ public:
return GetSeverity( aErrorCode ) != RPT_SEVERITY_IGNORE;
}
int GetSeverity( int aErrorCode ) const;
SEVERITY GetSeverity( int aErrorCode ) const;
void SetSeverity( int aErrorCode, int aSeverity );
void SetSeverity( int aErrorCode, SEVERITY aSeverity );
void ResetPinMap();
@ -154,8 +154,8 @@ public:
public:
std::map<int, int> m_Severities;
std::set<wxString> m_ErcExclusions;
std::map<int, SEVERITY> m_Severities;
std::set<wxString> m_ErcExclusions;
PIN_ERROR m_PinMap[ELECTRICAL_PINTYPES_TOTAL][ELECTRICAL_PINTYPES_TOTAL];

View File

@ -245,7 +245,7 @@ public:
int m_SilkClearance;
std::shared_ptr<DRC_ENGINE> m_DRCEngine;
std::map<int, int> m_DRCSeverities; // Map from DRCErrorCode to SEVERITY
std::map<int, SEVERITY> m_DRCSeverities; // Map from DRCErrorCode to SEVERITY
std::set<wxString> m_DrcExclusions;
/*
@ -368,7 +368,7 @@ public:
BOARD_STACKUP& GetStackupDescriptor() { return m_stackup; }
int GetSeverity( int aDRCErrorCode );
SEVERITY GetSeverity( int aDRCErrorCode );
/**
* returns true if the DRC error code's severity is SEVERITY_IGNORE

View File

@ -252,7 +252,7 @@ public:
SETTINGS_MANAGER* GetSettingsManager() const { return m_settingsManager; }
virtual int GetSeverity( int aErrorCode ) const { return RPT_SEVERITY_UNDEFINED; }
virtual SEVERITY GetSeverity( int aErrorCode ) const { return RPT_SEVERITY_UNDEFINED; }
/**
* Override the default process event handler to implement the auto save feature.

View File

@ -386,7 +386,7 @@ public:
return GetScreen()->m_Active_Layer;
}
int GetSeverity( int aErrorCode ) const override;
SEVERITY GetSeverity( int aErrorCode ) const override;
virtual void OnDisplayOptionsChanged() {}

View File

@ -261,15 +261,13 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
for( const RC_ITEM& item : DRC_ITEM::GetItemsWithSeverities() )
{
int code = item.GetErrorCode();
wxString name = item.GetSettingsKey();
int code = item.GetErrorCode();
if( !m_DRCSeverities.count( code ) )
if( name.IsEmpty() || m_DRCSeverities.count( code ) == 0 )
continue;
wxString name = item.GetSettingsKey();
ret[std::string( name.ToUTF8() )] =
SeverityToString( static_cast<SEVERITY>( m_DRCSeverities[code] ) );
ret[std::string( name.ToUTF8() )] = SeverityToString( m_DRCSeverities[code] );
}
return ret;
@ -838,7 +836,7 @@ bool BOARD_DESIGN_SETTINGS::LoadFromFile( const wxString& aDirectory )
}
int BOARD_DESIGN_SETTINGS::GetSeverity( int aDRCErrorCode )
SEVERITY BOARD_DESIGN_SETTINGS::GetSeverity( int aDRCErrorCode )
{
return m_DRCSeverities[ aDRCErrorCode ];
}

View File

@ -779,7 +779,7 @@ bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
for( int i = 0; i < count; ++i )
{
const std::shared_ptr<RC_ITEM>& item = m_markersProvider->GetItem( i );
SEVERITY severity = (SEVERITY) bds.GetSeverity( item->GetErrorCode() );
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
fprintf( fp, "%s", TO_UTF8( item->ShowReport( units, severity, itemMap ) ) );
}
@ -791,7 +791,7 @@ bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
for( int i = 0; i < count; ++i )
{
const std::shared_ptr<RC_ITEM>& item = m_unconnectedItemsProvider->GetItem( i );
SEVERITY severity = (SEVERITY) bds.GetSeverity( item->GetErrorCode() );
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
fprintf( fp, "%s", TO_UTF8( item->ShowReport( units, severity, itemMap ) ) );
}
@ -803,7 +803,7 @@ bool DIALOG_DRC::writeReport( const wxString& aFullFileName )
for( int i = 0; i < count; ++i )
{
const std::shared_ptr<RC_ITEM>& item = m_footprintWarningsProvider->GetItem( i );
SEVERITY severity = (SEVERITY) bds.GetSeverity( item->GetErrorCode() );
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
fprintf( fp, "%s", TO_UTF8( item->ShowReport( units, severity, itemMap ) ) );
}

View File

@ -63,7 +63,7 @@ public:
for( PCB_MARKER* marker : m_board->Markers() )
{
int markerSeverity;
SEVERITY markerSeverity;
if( marker->IsExcluded() )
markerSeverity = RPT_SEVERITY_EXCLUSION;
@ -86,7 +86,7 @@ public:
for( PCB_MARKER* marker : m_board->Markers() )
{
int markerSeverity;
SEVERITY markerSeverity;
if( marker->IsExcluded() )
markerSeverity = RPT_SEVERITY_EXCLUSION;
@ -159,7 +159,7 @@ public:
if( m_sourceVector )
{
for( auto item : *m_sourceVector )
for( const std::shared_ptr<DRC_ITEM>& item : *m_sourceVector )
{
if( bds.GetSeverity( item->GetErrorCode() ) & aSeverities )
m_filteredVector.push_back( item );
@ -177,7 +177,7 @@ public:
if( m_sourceVector )
{
for( auto item : *m_sourceVector )
for( const std::shared_ptr<DRC_ITEM>& item : *m_sourceVector )
{
if( bds.GetSeverity( item->GetErrorCode() ) == aSeverity )
count++;

View File

@ -628,7 +628,7 @@ void PCB_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
}
int PCB_BASE_FRAME::GetSeverity( int aErrorCode ) const
SEVERITY PCB_BASE_FRAME::GetSeverity( int aErrorCode ) const
{
if( aErrorCode >= CLEANUP_FIRST )
return RPT_SEVERITY_ACTION;

View File

@ -428,7 +428,7 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits,
for( const std::shared_ptr<DRC_ITEM>& item : violations )
{
SEVERITY severity = static_cast<SEVERITY>( bds.GetSeverity( item->GetErrorCode() ) );
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
fprintf( fp, "%s", TO_UTF8( item->ShowReport( aUnits, severity, itemMap ) ) );
}
@ -436,7 +436,7 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits,
for( const std::shared_ptr<DRC_ITEM>& item : unconnected )
{
SEVERITY severity = static_cast<SEVERITY>( bds.GetSeverity( item->GetErrorCode() ) );
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
fprintf( fp, "%s", TO_UTF8( item->ShowReport( aUnits, severity, itemMap ) ) );
}
@ -444,7 +444,7 @@ bool WriteDRCReport( BOARD* aBoard, const wxString& aFileName, EDA_UNITS aUnits,
for( const std::shared_ptr<DRC_ITEM>& item : footprints )
{
SEVERITY severity = static_cast<SEVERITY>( bds.GetSeverity( item->GetErrorCode() ) );
SEVERITY severity = bds.GetSeverity( item->GetErrorCode() );
fprintf( fp, "%s", TO_UTF8( item->ShowReport( aUnits, severity, itemMap ) ) );
}