Do not modify LIB_ID in LIB_PART::SetLib()
This commit is a partial revert ofaa81f5b9
&445ac505
. LIB_ID should not be modified when a library is assigned to its part, as the library nickname cannot be evaluated during the assignment and might be different than its filename.
This commit is contained in:
parent
f5f7ba4746
commit
6e65049a56
|
@ -1203,15 +1203,6 @@ void LIB_PART::SetConversion( bool aSetConvert )
|
|||
}
|
||||
|
||||
|
||||
void LIB_PART::SetLib( PART_LIB* aLibrary )
|
||||
{
|
||||
m_library = aLibrary;
|
||||
|
||||
if( aLibrary )
|
||||
m_libId.SetLibNickname( aLibrary->GetName() );
|
||||
}
|
||||
|
||||
|
||||
wxArrayString LIB_PART::GetAliasNames( bool aIncludeRoot ) const
|
||||
{
|
||||
wxArrayString names;
|
||||
|
|
|
@ -265,12 +265,13 @@ public:
|
|||
const wxString& GetName() const;
|
||||
|
||||
const LIB_ID& GetLibId() const { return m_libId; }
|
||||
void SetLibId( const LIB_ID& aLibId ) { m_libId = aLibId; }
|
||||
|
||||
const wxString GetLibraryName();
|
||||
|
||||
PART_LIB* GetLib() { return m_library; }
|
||||
|
||||
void SetLib( PART_LIB* aLibrary );
|
||||
void SetLib( PART_LIB* aLibrary ) { m_library = aLibrary; }
|
||||
|
||||
wxArrayString GetAliasNames( bool aIncludeRoot = true ) const;
|
||||
|
||||
|
|
|
@ -437,6 +437,7 @@ bool RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::PerformAction( RESCUER* aRescuer )
|
|||
wxCHECK_MSG( tmp, false, "Both cache and library symbols undefined." );
|
||||
|
||||
LIB_PART new_part( *tmp );
|
||||
new_part.SetLibId( m_new_id );
|
||||
new_part.SetName( m_new_id.GetLibItemName() );
|
||||
new_part.RemoveAllAliases();
|
||||
aRescuer->AddPart( &new_part );
|
||||
|
|
|
@ -2515,6 +2515,9 @@ LIB_PART* SCH_LEGACY_PLUGIN_CACHE::loadPart( FILE_LINE_READER& aReader )
|
|||
part->GetValueField().SetVisible( false );
|
||||
}
|
||||
|
||||
// Don't set the library alias, this is determined by the symbol library table.
|
||||
part->SetLibId( LIB_ID( wxEmptyString, part->GetName() ) );
|
||||
|
||||
// There are some code paths in SetText() that do not set the root alias to the
|
||||
// alias list so add it here if it didn't get added by SetText().
|
||||
if( !part->HasAlias( part->GetName() ) )
|
||||
|
|
Loading…
Reference in New Issue