From a5e628a552174ff2293f4b11a687164a82cea316 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Fri, 30 Oct 2020 09:28:54 -0400 Subject: [PATCH] Symbol editor: fix missing footprint filter support for derived symbols. Fixes https://gitlab.com/kicad/code/kicad/-/issues/6038 --- eeschema/class_libentry.cpp | 13 +++++++------ eeschema/class_libentry.h | 8 ++++---- eeschema/dialogs/dialog_lib_symbol_properties.cpp | 9 +-------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index 3a87c4ebfd..8cbff94a9a 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -121,7 +121,7 @@ LIB_PART::LIB_PART( const LIB_PART& aPart, PART_LIB* aLibrary ) : m_library = aLibrary; m_name = aPart.m_name; - m_FootprintList = wxArrayString( aPart.m_FootprintList ); + m_footprintFilters = wxArrayString( aPart.m_footprintFilters ); m_unitCount = aPart.m_unitCount; m_unitsLocked = aPart.m_unitsLocked; m_pinNameOffset = aPart.m_pinNameOffset; @@ -176,7 +176,7 @@ const LIB_PART& LIB_PART::operator=( const LIB_PART& aPart ) m_library = aPart.m_library; m_name = aPart.m_name; - m_FootprintList = wxArrayString( aPart.m_FootprintList ); + m_footprintFilters = wxArrayString( aPart.m_footprintFilters ); m_unitCount = aPart.m_unitCount; m_unitsLocked = aPart.m_unitsLocked; m_pinNameOffset = aPart.m_pinNameOffset; @@ -258,12 +258,12 @@ int LIB_PART::Compare( const LIB_PART& aRhs ) const ++rhsItem; } - if( m_FootprintList.GetCount() != aRhs.m_FootprintList.GetCount() ) - return m_FootprintList.GetCount() - aRhs.m_FootprintList.GetCount(); + if( m_footprintFilters.GetCount() != aRhs.m_footprintFilters.GetCount() ) + return m_footprintFilters.GetCount() - aRhs.m_footprintFilters.GetCount(); - for( size_t i = 0; i < m_FootprintList.GetCount(); i++ ) + for( size_t i = 0; i < m_footprintFilters.GetCount(); i++ ) { - retv = m_FootprintList[i].Cmp( aRhs.m_FootprintList[i] ); + retv = m_footprintFilters[i].Cmp( aRhs.m_footprintFilters[i] ); if( retv ) return retv; @@ -384,6 +384,7 @@ std::unique_ptr< LIB_PART > LIB_PART::Flatten() const retv->SetKeyWords( m_keyWords ); retv->SetDescription( m_description ); + retv->SetFootprintFilters( m_footprintFilters ); } else { diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index a1fd6e5719..188399190f 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -110,13 +110,13 @@ class LIB_PART : public EDA_ITEM, public LIB_TREE_ITEM bool m_showPinNumbers; ///< Determines if part pin numbers are visible. bool m_includeInBom; ///< Determines if symbol should be included in ///< schematic BOM. - bool m_includeOnBoard; ///< Determines if symbol should be excluded from + bool m_includeOnBoard; ///< Determines if symbol should be excluded from ///< netlist when updating board. timestamp_t m_dateLastEdition; ///< Date of the last modification. LIBRENTRYOPTIONS m_options; ///< Special part features such as POWER or NORMAL.) int m_unitCount; ///< Number of units (parts) per package. LIB_ITEMS_CONTAINER m_drawings; ///< Drawing items of this part. - wxArrayString m_FootprintList; /**< List of suitable footprint names for the + wxArrayString m_footprintFilters; /**< List of suitable footprint names for the part (wild card names accepted). */ PART_LIB* m_library; ///< Library the part belongs to if any. wxString m_name; ///< Symbol name. @@ -196,10 +196,10 @@ public: timestamp_t GetDateLastEdition() const { return m_dateLastEdition; } - wxArrayString GetFootprints() const { return m_FootprintList; } + wxArrayString GetFootprints() const { return m_footprintFilters; } void SetFootprintFilters( const wxArrayString& aFootprintFilters ) { - m_FootprintList = aFootprintFilters; + m_footprintFilters = aFootprintFilters; } void ViewGetLayers( int aLayers[], int& aCount ) const override; diff --git a/eeschema/dialogs/dialog_lib_symbol_properties.cpp b/eeschema/dialogs/dialog_lib_symbol_properties.cpp index c53abb116c..74d7dfe6e8 100644 --- a/eeschema/dialogs/dialog_lib_symbol_properties.cpp +++ b/eeschema/dialogs/dialog_lib_symbol_properties.cpp @@ -49,7 +49,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::LAST_LAYOUT DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( LIB_EDIT_FRAME* aParent, - LIB_PART* aLibEntry ) : + LIB_PART* aLibEntry ) : DIALOG_LIB_SYMBOL_PROPERTIES_BASE( aParent ), m_Parent( aParent ), m_libEntry( aLibEntry ), @@ -757,14 +757,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnSizeGrid( wxSizeEvent& event ) void DIALOG_LIB_SYMBOL_PROPERTIES::syncControlStates( bool aIsAlias ) { - // Remove the not wanted notebook page. - // *Do not use* Hide(), it is suitable to hide a widget, - // but it is not suitable to hide a notebook page (that is not a widget) - if( aIsAlias ) - m_NoteBook->RemovePage( 1 ); - bSizerLowerBasicPanel->Show( !aIsAlias ); - // bButtonSize->Show( !aIsAlias ); #ifdef KICAD_SPICE m_spiceFieldsButton->Show( !aIsAlias );