|
|
@ -150,6 +150,8 @@ LIB_SYMBOL::LIB_SYMBOL( const LIB_SYMBOL& aSymbol, SYMBOL_LIB* aLibrary ) : |
|
|
m_description = aSymbol.m_description; |
|
|
m_description = aSymbol.m_description; |
|
|
m_keyWords = aSymbol.m_keyWords; |
|
|
m_keyWords = aSymbol.m_keyWords; |
|
|
|
|
|
|
|
|
|
|
|
aSymbol.CopyUnitDisplayNames( m_unitDisplayNames ); |
|
|
|
|
|
|
|
|
ClearSelected(); |
|
|
ClearSelected(); |
|
|
|
|
|
|
|
|
for( const LIB_ITEM& oldItem : aSymbol.m_drawings ) |
|
|
for( const LIB_ITEM& oldItem : aSymbol.m_drawings ) |
|
|
@ -206,6 +208,9 @@ const LIB_SYMBOL& LIB_SYMBOL::operator=( const LIB_SYMBOL& aSymbol ) |
|
|
m_description = aSymbol.m_description; |
|
|
m_description = aSymbol.m_description; |
|
|
m_keyWords = aSymbol.m_keyWords; |
|
|
m_keyWords = aSymbol.m_keyWords; |
|
|
|
|
|
|
|
|
|
|
|
m_unitDisplayNames.clear(); |
|
|
|
|
|
aSymbol.CopyUnitDisplayNames( m_unitDisplayNames ); |
|
|
|
|
|
|
|
|
m_drawings.clear(); |
|
|
m_drawings.clear(); |
|
|
|
|
|
|
|
|
for( const LIB_ITEM& oldItem : aSymbol.m_drawings ) |
|
|
for( const LIB_ITEM& oldItem : aSymbol.m_drawings ) |
|
|
@ -369,6 +374,16 @@ int LIB_SYMBOL::Compare( const LIB_SYMBOL& aRhs, int aCompareFlags ) const |
|
|
return ( m_includeOnBoard ) ? 1 : -1; |
|
|
return ( m_includeOnBoard ) ? 1 : -1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Compare unit display names
|
|
|
|
|
|
if( m_unitDisplayNames < aRhs.m_unitDisplayNames ) |
|
|
|
|
|
{ |
|
|
|
|
|
return -1; |
|
|
|
|
|
} |
|
|
|
|
|
else if( m_unitDisplayNames > aRhs.m_unitDisplayNames ) |
|
|
|
|
|
{ |
|
|
|
|
|
return 1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -379,6 +394,50 @@ wxString LIB_SYMBOL::GetUnitReference( int aUnit ) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool LIB_SYMBOL::HasUnitDisplayName( int aUnit ) |
|
|
|
|
|
{ |
|
|
|
|
|
return ( m_unitDisplayNames.count( aUnit ) == 1 ); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
wxString LIB_SYMBOL::GetUnitDisplayName( int aUnit ) |
|
|
|
|
|
{ |
|
|
|
|
|
if( HasUnitDisplayName( aUnit ) ) |
|
|
|
|
|
{ |
|
|
|
|
|
return m_unitDisplayNames[aUnit]; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
return wxString::Format( _( "Unit %s" ), GetUnitReference( aUnit ) ); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_SYMBOL::CopyUnitDisplayNames( std::map<int, wxString>& aTarget ) const |
|
|
|
|
|
{ |
|
|
|
|
|
for( const auto& it : m_unitDisplayNames ) |
|
|
|
|
|
{ |
|
|
|
|
|
aTarget[it.first] = it.second; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_SYMBOL::SetUnitDisplayName( int aUnit, const wxString& aName ) |
|
|
|
|
|
{ |
|
|
|
|
|
if( aUnit <= GetUnitCount() ) |
|
|
|
|
|
{ |
|
|
|
|
|
if( aName.Length() > 0 ) |
|
|
|
|
|
{ |
|
|
|
|
|
m_unitDisplayNames[aUnit] = aName; |
|
|
|
|
|
} |
|
|
|
|
|
else |
|
|
|
|
|
{ |
|
|
|
|
|
m_unitDisplayNames.erase( aUnit ); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void LIB_SYMBOL::SetName( const wxString& aName ) |
|
|
void LIB_SYMBOL::SetName( const wxString& aName ) |
|
|
{ |
|
|
{ |
|
|
m_name = aName; |
|
|
m_name = aName; |
|
|
|