Browse Source

Use settings keys, not error codes, for ERC/DRC reports

Error codes can shift around if the enum ordering is
not maintained, which is more fragile than the settings
key which should never be changed after a new code is
created.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6001
6.0.7
Jon Evans 5 years ago
parent
commit
cb1d416e5a
  1. 12
      common/rc_item.cpp
  2. 2
      eeschema/erc_item.cpp
  3. 2
      pcbnew/drc/drc_item.cpp

12
common/rc_item.cpp

@ -87,8 +87,8 @@ wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity,
if( mainItem && auxItem )
{
return wxString::Format( wxT( "ErrType(%d): %s %s\n %s: %s\n %s: %s\n" ),
GetErrorCode(),
return wxString::Format( wxT( "[%s]: %s %s\n %s: %s\n %s: %s\n" ),
GetSettingsKey(),
GetErrorMessage(),
severity,
ShowCoord( aUnits, mainItem->GetPosition() ),
@ -98,8 +98,8 @@ wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity,
}
else if( mainItem )
{
return wxString::Format( wxT( "ErrType(%d): %s %s\n %s: %s\n" ),
GetErrorCode(),
return wxString::Format( wxT( "[%s]: %s %s\n %s: %s\n" ),
GetSettingsKey(),
GetErrorMessage(),
severity,
ShowCoord( aUnits, mainItem->GetPosition() ),
@ -107,8 +107,8 @@ wxString RC_ITEM::ShowReport( EDA_UNITS aUnits, SEVERITY aSeverity,
}
else
{
return wxString::Format( wxT( "ErrType(%d): %s %s\n" ),
GetErrorCode(),
return wxString::Format( wxT( "[%s]: %s %s\n" ),
GetSettingsKey(),
GetErrorMessage(),
severity );
}

2
eeschema/erc_item.cpp

@ -36,6 +36,8 @@
#undef _
#define _(s) s
// NOTE: Avoid changing the settings key for an ERC item after it has been created
ERC_ITEM ERC_ITEM::duplicateSheetName( ERCE_DUPLICATE_SHEET_NAME,
_( "Duplicate sheet names within a given sheet" ),
wxT( "duplicate_sheet_names" ) );

2
pcbnew/drc/drc_item.cpp

@ -36,6 +36,8 @@
#undef _
#define _(s) s
// NOTE: Avoid changing the settings key for a DRC item after it has been created
DRC_ITEM DRC_ITEM::unconnectedItems( DRCE_UNCONNECTED_ITEMS,
_( "Unconnected items" ),
wxT( "unconnected_items" ) );

Loading…
Cancel
Save