From 76535d8572376de6ea46073f48902836eedca3ce Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Thu, 3 Mar 2022 12:20:30 +0000 Subject: [PATCH] Make LIB_ITEM::COMPARE_FLAGS really a flags field, and add ERC. Before they were 1/2 treated as flags and 1/2 treated as a mode enum. The ERC flag relaxes constraints on data that is settable in the schematic editor. Fixes https://gitlab.com/kicad/code/kicad/issues/11018 --- eeschema/erc.cpp | 3 ++- eeschema/lib_field.cpp | 2 +- eeschema/lib_field.h | 3 +-- eeschema/lib_item.cpp | 2 +- eeschema/lib_item.h | 19 +++++++++++++------ eeschema/lib_pin.cpp | 2 +- eeschema/lib_pin.h | 3 +-- eeschema/lib_shape.cpp | 2 +- eeschema/lib_shape.h | 3 +-- eeschema/lib_symbol.cpp | 21 ++++++++++++--------- eeschema/lib_symbol.h | 3 +-- eeschema/lib_text.cpp | 2 +- eeschema/lib_text.h | 3 +-- eeschema/lib_textbox.cpp | 2 +- eeschema/lib_textbox.h | 3 +-- 15 files changed, 39 insertions(+), 34 deletions(-) diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index 887a024faf..33da22df0c 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -756,8 +756,9 @@ int ERC_TESTER::TestLibSymbolIssues() } std::unique_ptr flattenedSymbol = libSymbol->Flatten(); + constexpr int flags = LIB_ITEM::COMPARE_FLAGS::EQUALITY | LIB_ITEM::COMPARE_FLAGS::ERC; - if( *flattenedSymbol != *libSymbolInSchematic ) + if( flattenedSymbol->Compare( *libSymbolInSchematic, flags ) != 0 ) { std::shared_ptr ercItem = ERC_ITEM::Create( ERCE_LIB_SYMBOL_ISSUES ); ercItem->SetItems( symbol ); diff --git a/eeschema/lib_field.cpp b/eeschema/lib_field.cpp index d2f9a25d9c..dc2418f67f 100644 --- a/eeschema/lib_field.cpp +++ b/eeschema/lib_field.cpp @@ -190,7 +190,7 @@ void LIB_FIELD::Copy( LIB_FIELD* aTarget ) const } -int LIB_FIELD::compare( const LIB_ITEM& aOther, LIB_ITEM::COMPARE_FLAGS aCompareFlags ) const +int LIB_FIELD::compare( const LIB_ITEM& aOther, int aCompareFlags ) const { wxASSERT( aOther.Type() == LIB_FIELD_T ); diff --git a/eeschema/lib_field.h b/eeschema/lib_field.h index 1ecf62fbd2..f7e44f9f40 100644 --- a/eeschema/lib_field.h +++ b/eeschema/lib_field.h @@ -187,8 +187,7 @@ private: * - Field width. * - Field height. */ - int compare( const LIB_ITEM& aOther, - LIB_ITEM::COMPARE_FLAGS aCompareFlags = LIB_ITEM::COMPARE_FLAGS::NORMAL ) const override; + int compare( const LIB_ITEM& aOther, int aCompareFlags = 0 ) const override; /** * Print the field. diff --git a/eeschema/lib_item.cpp b/eeschema/lib_item.cpp index 86d003f9ac..f3da31f64a 100644 --- a/eeschema/lib_item.cpp +++ b/eeschema/lib_item.cpp @@ -71,7 +71,7 @@ void LIB_ITEM::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector