mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-19 23:31:40 +00:00
Migrate DRC Exclusion names
Changing names like was done in https://gitlab.com/kicad/code/kicad/-/issues/18040 breaks old project files unless the DRCE names are migrated.
This commit is contained in:
parent
e9bc8cfe9d
commit
9c0890302e
@ -335,7 +335,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS( JSON_SETTINGS* aParent, const std:
|
||||
if( !aJson.is_object() )
|
||||
return;
|
||||
|
||||
for( const RC_ITEM& item : DRC_ITEM::GetItemsWithSeverities() )
|
||||
for( const RC_ITEM& item : DRC_ITEM::GetItemsWithSeverities( true ) )
|
||||
{
|
||||
wxString name = item.GetSettingsKey();
|
||||
std::string key( name.ToUTF8() );
|
||||
|
@ -49,6 +49,7 @@ DRC_ITEM DRC_ITEM::heading_signal_integrity( 0, _( "Signal Integrity" ), "" );
|
||||
DRC_ITEM DRC_ITEM::heading_readability( 0, _( "Readability" ), "" );
|
||||
DRC_ITEM DRC_ITEM::heading_misc( 0, _( "Miscellaneous" ), "" );
|
||||
DRC_ITEM DRC_ITEM::heading_internal( 0, "", "" );
|
||||
DRC_ITEM DRC_ITEM::heading_deprecated( 0, "", "" );
|
||||
|
||||
DRC_ITEM DRC_ITEM::unconnectedItems( DRCE_UNCONNECTED_ITEMS,
|
||||
_( "Missing connection between items" ),
|
||||
@ -299,6 +300,12 @@ DRC_ITEM DRC_ITEM::nonMirroredTextOnBackLayer( DRCE_NONMIRRORED_TEXT_ON_BACK_LAY
|
||||
_( "Non-Mirrored text on back layer" ),
|
||||
wxT( "nonmirrored_text_on_back_layer" ) );
|
||||
|
||||
/// Deprecated item names
|
||||
/// They have the current error code but the old name for compatibility with old settings files
|
||||
|
||||
DRC_ITEM DRC_ITEM::holeNearHolev8( DRCE_DRILLED_HOLES_TOO_CLOSE,
|
||||
_( "Drilled hole too close to other hole - deprecated" ),
|
||||
wxT( "hole_near_hole" ) );
|
||||
|
||||
std::vector<std::reference_wrapper<RC_ITEM>> DRC_ITEM::allItemTypes(
|
||||
{
|
||||
@ -370,12 +377,18 @@ std::vector<std::reference_wrapper<RC_ITEM>> DRC_ITEM::allItemTypes(
|
||||
DRC_ITEM::libFootprintMismatch,
|
||||
DRC_ITEM::footprintTHPadhasNoHole,
|
||||
|
||||
// Deprecated items need to come second to last in the list
|
||||
// They will not be shown in the panel but will be used to
|
||||
// parse old settings files
|
||||
DRC_ITEM::heading_deprecated,
|
||||
DRC_ITEM::holeNearHolev8,
|
||||
|
||||
// DRC_ITEM types with no user-editable severities
|
||||
// NOTE: this MUST be the last grouping in the list!
|
||||
DRC_ITEM::heading_internal,
|
||||
DRC_ITEM::padstackInvalid,
|
||||
DRC_ITEM::genericError,
|
||||
DRC_ITEM::genericWarning
|
||||
DRC_ITEM::genericWarning,
|
||||
} );
|
||||
|
||||
|
||||
|
@ -130,22 +130,34 @@ public:
|
||||
*/
|
||||
static std::shared_ptr<DRC_ITEM> Create( const wxString& aErrorKey );
|
||||
|
||||
static std::vector<std::reference_wrapper<RC_ITEM>> GetItemsWithSeverities()
|
||||
static std::vector<std::reference_wrapper<RC_ITEM>> GetItemsWithSeverities( bool aIncludeDeprecated = false )
|
||||
{
|
||||
static std::vector<std::reference_wrapper<RC_ITEM>> itemsWithSeverities;
|
||||
static std::vector<std::reference_wrapper<RC_ITEM>> itemsWithSeveritiesAll;
|
||||
static std::vector<std::reference_wrapper<RC_ITEM>> itemsWithSeveritiesDeprecated;
|
||||
|
||||
if( itemsWithSeverities.empty() )
|
||||
if( itemsWithSeveritiesAll.empty() )
|
||||
{
|
||||
for( RC_ITEM& item : allItemTypes )
|
||||
{
|
||||
if( &item == &heading_internal )
|
||||
break;
|
||||
|
||||
itemsWithSeverities.push_back( item );
|
||||
itemsWithSeveritiesAll.push_back( item );
|
||||
}
|
||||
}
|
||||
|
||||
return itemsWithSeverities;
|
||||
if( itemsWithSeveritiesDeprecated.empty() )
|
||||
{
|
||||
for( RC_ITEM& item : allItemTypes )
|
||||
{
|
||||
if( &item == &heading_deprecated )
|
||||
break;
|
||||
|
||||
itemsWithSeveritiesDeprecated.push_back( item );
|
||||
}
|
||||
}
|
||||
|
||||
return aIncludeDeprecated ? itemsWithSeveritiesAll : itemsWithSeveritiesDeprecated;
|
||||
}
|
||||
|
||||
void SetViolatingRule ( DRC_RULE *aRule ) { m_violatingRule = aRule; }
|
||||
@ -178,6 +190,7 @@ private:
|
||||
static DRC_ITEM heading_readability;
|
||||
static DRC_ITEM heading_misc;
|
||||
static DRC_ITEM heading_internal;
|
||||
static DRC_ITEM heading_deprecated;
|
||||
|
||||
static DRC_ITEM unconnectedItems;
|
||||
static DRC_ITEM shortingItems;
|
||||
@ -242,6 +255,9 @@ private:
|
||||
static DRC_ITEM mirroredTextOnFrontLayer;
|
||||
static DRC_ITEM nonMirroredTextOnBackLayer;
|
||||
|
||||
/// Deprecated items
|
||||
static DRC_ITEM holeNearHolev8;
|
||||
|
||||
private:
|
||||
DRC_RULE* m_violatingRule = nullptr;
|
||||
DRC_TEST_PROVIDER* m_violatingTest = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user