Symbol editor: fix missing footprint filter support for derived symbols.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/6038
This commit is contained in:
Wayne Stambaugh 2020-10-30 09:28:54 -04:00
parent 9ed6cdd943
commit a5e628a552
3 changed files with 12 additions and 18 deletions

View File

@ -121,7 +121,7 @@ LIB_PART::LIB_PART( const LIB_PART& aPart, PART_LIB* aLibrary ) :
m_library = aLibrary; m_library = aLibrary;
m_name = aPart.m_name; m_name = aPart.m_name;
m_FootprintList = wxArrayString( aPart.m_FootprintList ); m_footprintFilters = wxArrayString( aPart.m_footprintFilters );
m_unitCount = aPart.m_unitCount; m_unitCount = aPart.m_unitCount;
m_unitsLocked = aPart.m_unitsLocked; m_unitsLocked = aPart.m_unitsLocked;
m_pinNameOffset = aPart.m_pinNameOffset; 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_library = aPart.m_library;
m_name = aPart.m_name; m_name = aPart.m_name;
m_FootprintList = wxArrayString( aPart.m_FootprintList ); m_footprintFilters = wxArrayString( aPart.m_footprintFilters );
m_unitCount = aPart.m_unitCount; m_unitCount = aPart.m_unitCount;
m_unitsLocked = aPart.m_unitsLocked; m_unitsLocked = aPart.m_unitsLocked;
m_pinNameOffset = aPart.m_pinNameOffset; m_pinNameOffset = aPart.m_pinNameOffset;
@ -258,12 +258,12 @@ int LIB_PART::Compare( const LIB_PART& aRhs ) const
++rhsItem; ++rhsItem;
} }
if( m_FootprintList.GetCount() != aRhs.m_FootprintList.GetCount() ) if( m_footprintFilters.GetCount() != aRhs.m_footprintFilters.GetCount() )
return m_FootprintList.GetCount() - aRhs.m_FootprintList.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 ) if( retv )
return retv; return retv;
@ -384,6 +384,7 @@ std::unique_ptr< LIB_PART > LIB_PART::Flatten() const
retv->SetKeyWords( m_keyWords ); retv->SetKeyWords( m_keyWords );
retv->SetDescription( m_description ); retv->SetDescription( m_description );
retv->SetFootprintFilters( m_footprintFilters );
} }
else else
{ {

View File

@ -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_showPinNumbers; ///< Determines if part pin numbers are visible.
bool m_includeInBom; ///< Determines if symbol should be included in bool m_includeInBom; ///< Determines if symbol should be included in
///< schematic BOM. ///< 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. ///< netlist when updating board.
timestamp_t m_dateLastEdition; ///< Date of the last modification. timestamp_t m_dateLastEdition; ///< Date of the last modification.
LIBRENTRYOPTIONS m_options; ///< Special part features such as POWER or NORMAL.) LIBRENTRYOPTIONS m_options; ///< Special part features such as POWER or NORMAL.)
int m_unitCount; ///< Number of units (parts) per package. int m_unitCount; ///< Number of units (parts) per package.
LIB_ITEMS_CONTAINER m_drawings; ///< Drawing items of this part. 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 (wild card names accepted). */
PART_LIB* m_library; ///< Library the part belongs to if any. PART_LIB* m_library; ///< Library the part belongs to if any.
wxString m_name; ///< Symbol name. wxString m_name; ///< Symbol name.
@ -196,10 +196,10 @@ public:
timestamp_t GetDateLastEdition() const { return m_dateLastEdition; } timestamp_t GetDateLastEdition() const { return m_dateLastEdition; }
wxArrayString GetFootprints() const { return m_FootprintList; } wxArrayString GetFootprints() const { return m_footprintFilters; }
void SetFootprintFilters( const wxArrayString& aFootprintFilters ) void SetFootprintFilters( const wxArrayString& aFootprintFilters )
{ {
m_FootprintList = aFootprintFilters; m_footprintFilters = aFootprintFilters;
} }
void ViewGetLayers( int aLayers[], int& aCount ) const override; void ViewGetLayers( int aLayers[], int& aCount ) const override;

View File

@ -49,7 +49,7 @@ DIALOG_LIB_SYMBOL_PROPERTIES::LAST_LAYOUT
DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( LIB_EDIT_FRAME* aParent, DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( LIB_EDIT_FRAME* aParent,
LIB_PART* aLibEntry ) : LIB_PART* aLibEntry ) :
DIALOG_LIB_SYMBOL_PROPERTIES_BASE( aParent ), DIALOG_LIB_SYMBOL_PROPERTIES_BASE( aParent ),
m_Parent( aParent ), m_Parent( aParent ),
m_libEntry( aLibEntry ), m_libEntry( aLibEntry ),
@ -757,14 +757,7 @@ void DIALOG_LIB_SYMBOL_PROPERTIES::OnSizeGrid( wxSizeEvent& event )
void DIALOG_LIB_SYMBOL_PROPERTIES::syncControlStates( bool aIsAlias ) 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 ); bSizerLowerBasicPanel->Show( !aIsAlias );
// bButtonSize->Show( !aIsAlias );
#ifdef KICAD_SPICE #ifdef KICAD_SPICE
m_spiceFieldsButton->Show( !aIsAlias ); m_spiceFieldsButton->Show( !aIsAlias );