mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-21 10:11:39 +00:00
Start to retire "alias" in favour of "symbol" and "derived symbol".
Note: terminology changes only. No (intentional) functional changes.
This commit is contained in:
parent
aaca66351e
commit
7eb75720b5
eeschema
dialogs
eeschema_jobs_handler.cppgenerate_alias_info.cpplib_symbol.cpplib_symbol.hproject_rescue.cppsch_io
sch_painter.cppsch_view.cppsymbol_editor
symbol_library_manager.cppsymbol_library_manager.hsymbol_tree_synchronizing_adapter.cppsymbol_viewer_frame.cpptools
qa/tests/eeschema
@ -132,17 +132,17 @@ DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES( SYMBOL_EDIT_FRAME* a
|
||||
if( ( m_lastLayout == DIALOG_LIB_SYMBOL_PROPERTIES::LAST_LAYOUT::ALIAS
|
||||
&& aLibEntry->IsRoot() )
|
||||
|| ( m_lastLayout == DIALOG_LIB_SYMBOL_PROPERTIES::LAST_LAYOUT::PARENT
|
||||
&& aLibEntry->IsAlias() ) )
|
||||
&& aLibEntry->IsDerived() ) )
|
||||
{
|
||||
resetSize();
|
||||
}
|
||||
}
|
||||
|
||||
m_lastLayout = ( aLibEntry->IsAlias() ) ? DIALOG_LIB_SYMBOL_PROPERTIES::LAST_LAYOUT::ALIAS
|
||||
: DIALOG_LIB_SYMBOL_PROPERTIES::LAST_LAYOUT::PARENT;
|
||||
m_lastLayout = ( aLibEntry->IsDerived() ) ? DIALOG_LIB_SYMBOL_PROPERTIES::LAST_LAYOUT::ALIAS
|
||||
: DIALOG_LIB_SYMBOL_PROPERTIES::LAST_LAYOUT::PARENT;
|
||||
|
||||
m_grid->GetParent()->Layout();
|
||||
syncControlStates( m_libEntry->IsAlias() );
|
||||
syncControlStates( m_libEntry->IsDerived() );
|
||||
Layout();
|
||||
|
||||
finishDialogSettings();
|
||||
@ -251,7 +251,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataToWindow()
|
||||
m_FootprintFilterListBox->Append( tmp );
|
||||
|
||||
// Populate the list of root parts for inherited objects.
|
||||
if( m_libEntry->IsAlias() )
|
||||
if( m_libEntry->IsDerived() )
|
||||
{
|
||||
wxArrayString symbolNames;
|
||||
wxString libName = m_Parent->GetCurLib();
|
||||
@ -341,7 +341,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::Validate()
|
||||
}
|
||||
|
||||
// Verify that the parent name is set if the symbol is inherited
|
||||
if( m_libEntry->IsAlias() )
|
||||
if( m_libEntry->IsDerived() )
|
||||
{
|
||||
wxString parentName = m_inheritanceSelectCombo->GetValue();
|
||||
|
||||
@ -445,7 +445,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
||||
m_libEntry->SetFields( *m_fields );
|
||||
|
||||
// Update the parent for inherited symbols
|
||||
if( m_libEntry->IsAlias() )
|
||||
if( m_libEntry->IsDerived() )
|
||||
{
|
||||
wxString parentName = EscapeString( m_inheritanceSelectCombo->GetValue(), CTX_LIBID );
|
||||
|
||||
@ -453,7 +453,7 @@ bool DIALOG_LIB_SYMBOL_PROPERTIES::TransferDataFromWindow()
|
||||
wxString libName = m_Parent->GetCurLib();
|
||||
|
||||
// Get the parent from the libManager based on the name set in the inheritance combo box.
|
||||
LIB_SYMBOL* newParent = m_Parent->GetLibManager().GetAlias( parentName, libName );
|
||||
LIB_SYMBOL* newParent = m_Parent->GetLibManager().GetSymbol( parentName, libName );
|
||||
|
||||
// Verify that the requested parent exists
|
||||
wxCHECK( newParent, false );
|
||||
|
@ -853,16 +853,12 @@ int EESCHEMA_JOBS_HANDLER::doSymExportSvg( JOB_SYM_EXPORT_SVG* aSvgJob,
|
||||
LIB_SYMBOL* symbolToPlot = symbol;
|
||||
|
||||
// if the symbol is an alias, then the draw items are stored in the root symbol
|
||||
if( symbol->IsAlias() )
|
||||
if( symbol->IsDerived() )
|
||||
{
|
||||
if( LIB_SYMBOL_SPTR parent = symbol->GetRootSymbol() )
|
||||
{
|
||||
symbolToPlot = parent.get();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxCHECK( false, CLI::EXIT_CODES::ERR_UNKNOWN );
|
||||
}
|
||||
}
|
||||
|
||||
// iterate from unit 1, unit 0 would be "all units" which we don't want
|
||||
|
@ -224,11 +224,11 @@ protected:
|
||||
for( const SCH_FIELD* field: fields )
|
||||
fieldtable += GetHtmlFieldRow( *field );
|
||||
|
||||
if( m_symbol->IsAlias() )
|
||||
if( m_symbol->IsDerived() )
|
||||
{
|
||||
std::shared_ptr<LIB_SYMBOL> parent = m_symbol->GetParent().lock();
|
||||
|
||||
// Append all of the unique parent fields if this is an alias.
|
||||
// Append all of the unique parent fields if this is a derived symbol.
|
||||
if( parent )
|
||||
{
|
||||
std::vector<SCH_FIELD*> parentFields;
|
||||
|
@ -339,7 +339,7 @@ std::unique_ptr< LIB_SYMBOL > LIB_SYMBOL::Flatten() const
|
||||
{
|
||||
std::unique_ptr< LIB_SYMBOL > retv;
|
||||
|
||||
if( IsAlias() )
|
||||
if( IsDerived() )
|
||||
{
|
||||
LIB_SYMBOL_SPTR parent = m_parent.lock();
|
||||
|
||||
@ -347,7 +347,7 @@ std::unique_ptr< LIB_SYMBOL > LIB_SYMBOL::Flatten() const
|
||||
wxString::Format( "Parent of derived symbol '%s' undefined", m_name ) );
|
||||
|
||||
// Copy the parent.
|
||||
if( parent->IsAlias() )
|
||||
if( parent->IsDerived() )
|
||||
retv = parent->Flatten();
|
||||
else
|
||||
retv = std::make_unique<LIB_SYMBOL>( *parent.get() );
|
||||
|
@ -168,7 +168,7 @@ public:
|
||||
///< Gets the Description field text value */
|
||||
wxString GetDescription() const override
|
||||
{
|
||||
if( GetDescriptionField().GetText().IsEmpty() && IsAlias() )
|
||||
if( GetDescriptionField().GetText().IsEmpty() && IsDerived() )
|
||||
{
|
||||
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
|
||||
return parent->GetDescription();
|
||||
@ -181,7 +181,7 @@ public:
|
||||
|
||||
wxString GetKeyWords() const override
|
||||
{
|
||||
if( m_keyWords.IsEmpty() && IsAlias() )
|
||||
if( m_keyWords.IsEmpty() && IsDerived() )
|
||||
{
|
||||
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
|
||||
return parent->GetKeyWords();
|
||||
@ -203,7 +203,7 @@ public:
|
||||
* For symbols derived from other symbols, IsRoot() indicates no derivation.
|
||||
*/
|
||||
bool IsRoot() const override { return m_parent.use_count() == 0; }
|
||||
bool IsAlias() const { return !m_parent.expired() && m_parent.use_count() > 0; }
|
||||
bool IsDerived() const { return !m_parent.expired() && m_parent.use_count() > 0; }
|
||||
|
||||
const wxString GetLibraryName() const;
|
||||
|
||||
@ -216,7 +216,7 @@ public:
|
||||
|
||||
wxArrayString GetFPFilters() const
|
||||
{
|
||||
if( m_fpFilters.IsEmpty() && IsAlias() )
|
||||
if( m_fpFilters.IsEmpty() && IsDerived() )
|
||||
{
|
||||
if( LIB_SYMBOL_SPTR parent = m_parent.lock() )
|
||||
return parent->GetFPFilters();
|
||||
|
@ -428,8 +428,8 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues( RESCUER& aRescuer,
|
||||
|
||||
LIB_SYMBOL_SPTR lib_match_parent;
|
||||
|
||||
// If it's a derive symbol, use the parent symbol to perform the pin test.
|
||||
if( lib_match && lib_match->IsAlias() )
|
||||
// If it's a derived symbol, use the parent symbol to perform the pin test.
|
||||
if( lib_match && lib_match->IsDerived() )
|
||||
{
|
||||
lib_match_parent = lib_match->GetRootSymbol();
|
||||
|
||||
|
@ -1498,7 +1498,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::SaveSymbol( LIB_SYMBOL* aSymbol, OUTPUTFORMA
|
||||
{
|
||||
LIB_SYMBOL* symbol = entry.second;
|
||||
|
||||
if( symbol->IsAlias() && symbol->GetParent().lock() == aSymbol->SharedPtr() )
|
||||
if( symbol->IsDerived() && symbol->GetParent().lock() == aSymbol->SharedPtr() )
|
||||
aliasNames.Add( symbol->GetName() );
|
||||
}
|
||||
}
|
||||
@ -1976,7 +1976,7 @@ void SCH_IO_KICAD_LEGACY_LIB_CACHE::DeleteSymbol( const wxString& aSymbolName )
|
||||
|
||||
while( it1 != m_symbols.end() )
|
||||
{
|
||||
if( it1->second->IsAlias()
|
||||
if( it1->second->IsDerived()
|
||||
&& it1->second->GetParent().lock() == rootSymbol->SharedPtr() )
|
||||
{
|
||||
delete it1->second;
|
||||
|
@ -551,7 +551,7 @@ void SCH_IO_KICAD_SEXPR_LIB_CACHE::DeleteSymbol( const wxString& aSymbolName )
|
||||
|
||||
while( it1 != m_symbols.end() )
|
||||
{
|
||||
if( it1->second->IsAlias()
|
||||
if( it1->second->IsDerived()
|
||||
&& it1->second->GetParent().lock() == rootSymbol->SharedPtr() )
|
||||
{
|
||||
delete it1->second;
|
||||
|
@ -107,13 +107,13 @@ LIB_SYMBOL* SCH_IO_LIB_CACHE::removeSymbol( LIB_SYMBOL* aSymbol )
|
||||
"Pointer mismatch while attempting to remove alias entry <" + aSymbol->GetName() +
|
||||
"> from library cache <" + m_libFileName.GetName() + ">." );
|
||||
|
||||
// If the symbol is a root symbol used by other symbols find the first alias that uses
|
||||
// If the symbol is a root symbol used by other symbols find the first derived symbol that uses
|
||||
// the root symbol and make it the new root.
|
||||
if( aSymbol->IsRoot() )
|
||||
{
|
||||
for( const std::pair<const wxString, LIB_SYMBOL*>& entry : m_symbols )
|
||||
{
|
||||
if( entry.second->IsAlias()
|
||||
if( entry.second->IsDerived()
|
||||
&& entry.second->GetParent().lock() == aSymbol->SharedPtr() )
|
||||
{
|
||||
firstChild = entry.second;
|
||||
@ -138,10 +138,10 @@ LIB_SYMBOL* SCH_IO_LIB_CACHE::removeSymbol( LIB_SYMBOL* aSymbol )
|
||||
firstChild->AddDrawItem( newItem );
|
||||
}
|
||||
|
||||
// Reparent the remaining aliases.
|
||||
// Reparent the remaining derived symbols.
|
||||
for( const std::pair<const wxString, LIB_SYMBOL*>& entry : m_symbols )
|
||||
{
|
||||
if( entry.second->IsAlias()
|
||||
if( entry.second->IsDerived()
|
||||
&& entry.second->GetParent().lock() == aSymbol->SharedPtr() )
|
||||
{
|
||||
entry.second->SetParent( firstChild );
|
||||
|
@ -206,10 +206,10 @@ bool SCH_IO_MGR::ConvertLibrary( std::map<std::string, UTF8>* aOldFileProps, con
|
||||
{
|
||||
oldFilePI->EnumerateSymbolLib( symbols, aOldFilePath, aOldFileProps );
|
||||
|
||||
// Copy non-aliases first, so we can build a map from symbols to newSymbols
|
||||
// Copy non-derived symbols first, so we can build a map from symbols to newSymbols
|
||||
for( LIB_SYMBOL* symbol : symbols )
|
||||
{
|
||||
if( symbol->IsAlias() )
|
||||
if( symbol->IsDerived() )
|
||||
continue;
|
||||
|
||||
symbol->SetName( EscapeString( symbol->GetName(), CTX_LIBID ) );
|
||||
@ -218,10 +218,10 @@ bool SCH_IO_MGR::ConvertLibrary( std::map<std::string, UTF8>* aOldFileProps, con
|
||||
symbolMap[symbol] = newSymbols.back();
|
||||
}
|
||||
|
||||
// Now do the aliases using the map to hook them up to their newSymbol parents
|
||||
// Now do the derived symbols using the map to hook them up to their newSymbol parents
|
||||
for( LIB_SYMBOL* symbol : symbols )
|
||||
{
|
||||
if( !symbol->IsAlias() )
|
||||
if( !symbol->IsDerived() )
|
||||
continue;
|
||||
|
||||
symbol->SetName( EscapeString( symbol->GetName(), CTX_LIBID ) );
|
||||
|
@ -683,7 +683,7 @@ void SCH_PAINTER::draw( const LIB_SYMBOL* aSymbol, int aLayer, bool aDrawFields,
|
||||
std::unique_ptr< LIB_SYMBOL > tmpSymbol;
|
||||
const LIB_SYMBOL* drawnSymbol = aSymbol;
|
||||
|
||||
if( aSymbol->IsAlias() )
|
||||
if( aSymbol->IsDerived() )
|
||||
{
|
||||
tmpSymbol = aSymbol->Flatten();
|
||||
drawnSymbol = tmpSymbol.get();
|
||||
|
@ -152,7 +152,7 @@ void SCH_VIEW::DisplaySymbol( LIB_SYMBOL* aSymbol )
|
||||
LIB_SYMBOL* drawnSymbol = aSymbol;
|
||||
|
||||
// Draw the parent items if the symbol is inherited from another symbol.
|
||||
if( aSymbol->IsAlias() )
|
||||
if( aSymbol->IsDerived() )
|
||||
{
|
||||
if( std::shared_ptr< LIB_SYMBOL > parent = aSymbol->GetRootSymbol() )
|
||||
drawnSymbol = parent.get();
|
||||
|
@ -1162,7 +1162,7 @@ LIB_SYMBOL* SYMBOL_EDIT_FRAME::getTargetSymbol() const
|
||||
LIB_ID libId = GetTreeLIBID();
|
||||
|
||||
if( libId.IsValid() )
|
||||
return m_libMgr->GetAlias( libId.GetLibItemName(), libId.GetLibNickname() );
|
||||
return m_libMgr->GetSymbol( libId.GetLibItemName(), libId.GetLibNickname() );
|
||||
}
|
||||
|
||||
return m_symbol;
|
||||
|
@ -447,12 +447,12 @@ private:
|
||||
* Load a symbol from the current active library, optionally setting the selected unit
|
||||
* and convert.
|
||||
*
|
||||
* @param aAliasName The symbol alias name to load from the current library.
|
||||
* @param aSymbolName The symbol alias name to load from the current library.
|
||||
* @param aUnit Unit to be selected
|
||||
* @param aBodyStyle Convert to be selected
|
||||
* @return true if the symbol loaded correctly.
|
||||
*/
|
||||
bool LoadSymbolFromCurrentLib( const wxString& aAliasName, int aUnit = 0, int aBodyStyle = 0 );
|
||||
bool LoadSymbolFromCurrentLib( const wxString& aSymbolName, int aUnit = 0, int aBodyStyle = 0 );
|
||||
|
||||
/**
|
||||
* Create a copy of \a aLibEntry into memory.
|
||||
|
@ -221,27 +221,27 @@ void SYMBOL_EDIT_FRAME::centerItemIdleHandler( wxIdleEvent& aEvent )
|
||||
}
|
||||
|
||||
|
||||
bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aAliasName, int aUnit,
|
||||
bool SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib( const wxString& aSymbolName, int aUnit,
|
||||
int aBodyStyle )
|
||||
{
|
||||
LIB_SYMBOL* alias = nullptr;
|
||||
LIB_SYMBOL* symbol = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
alias = PROJECT_SCH::SchSymbolLibTable( &Prj() )->LoadSymbol( GetCurLib(), aAliasName );
|
||||
symbol = PROJECT_SCH::SchSymbolLibTable( &Prj() )->LoadSymbol( GetCurLib(), aSymbolName );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
msg.Printf( _( "Error loading symbol %s from library '%s'." ),
|
||||
aAliasName,
|
||||
aSymbolName,
|
||||
GetCurLib() );
|
||||
DisplayErrorMessage( this, msg, ioe.What() );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !alias || !LoadOneLibrarySymbolAux( alias, GetCurLib(), aUnit, aBodyStyle ) )
|
||||
if( !symbol || !LoadOneLibrarySymbolAux( symbol, GetCurLib(), aUnit, aBodyStyle ) )
|
||||
return false;
|
||||
|
||||
// Enable synchronized pin edit mode for symbols with interchangeable units
|
||||
@ -434,7 +434,7 @@ void SYMBOL_EDIT_FRAME::CreateNewSymbol( const wxString& aInheritFrom )
|
||||
}
|
||||
else
|
||||
{
|
||||
LIB_SYMBOL* parent = m_libMgr->GetAlias( parentSymbolName, lib );
|
||||
LIB_SYMBOL* parent = m_libMgr->GetSymbol( parentSymbolName, lib );
|
||||
wxCHECK( parent, /* void */ );
|
||||
new_symbol.SetParent( parent );
|
||||
|
||||
@ -552,7 +552,7 @@ static std::vector<LIB_SYMBOL_SPTR> GetParentChain( const LIB_SYMBOL& aSymbol )
|
||||
{
|
||||
std::vector<LIB_SYMBOL_SPTR> chain( { aSymbol.SharedPtr() } );
|
||||
|
||||
while( chain.back()->IsAlias() )
|
||||
while( chain.back()->IsDerived() )
|
||||
{
|
||||
LIB_SYMBOL_SPTR parent = chain.back()->GetParent().lock();
|
||||
chain.push_back( parent );
|
||||
@ -605,7 +605,7 @@ static std::pair<bool, bool> CheckSavingIntoOwnInheritance( LIB_SYMBOL_LIBRARY_M
|
||||
}
|
||||
|
||||
{
|
||||
LIB_SYMBOL* targetSymbol = aLibMgr.GetAlias( aNewSymbolName, aNewLibraryName );
|
||||
LIB_SYMBOL* targetSymbol = aLibMgr.GetSymbol( aNewSymbolName, aNewLibraryName );
|
||||
const std::vector<LIB_SYMBOL_SPTR> parentChainFromTarget = GetParentChain( *targetSymbol );
|
||||
const wxString oldSymbolName = aSymbol.GetName();
|
||||
|
||||
@ -744,7 +744,7 @@ public:
|
||||
else
|
||||
{
|
||||
// Get the buffered new copy in the new library (with the name we gave it)
|
||||
LIB_SYMBOL* newParent = m_libMgr.GetAlias( newNames.back(), aNewLibName );
|
||||
LIB_SYMBOL* newParent = m_libMgr.GetSymbol( newNames.back(), aNewLibName );
|
||||
|
||||
// We should have stored this already, why didn't we get it back?
|
||||
wxASSERT( newParent );
|
||||
@ -1239,7 +1239,7 @@ void SYMBOL_EDIT_FRAME::DuplicateSymbol( bool aFromClipboard )
|
||||
newSymbols.emplace_back( new LIB_SYMBOL( *srcSymbol ) );
|
||||
|
||||
// Derive from same parent.
|
||||
if( srcSymbol->IsAlias() )
|
||||
if( srcSymbol->IsDerived() )
|
||||
{
|
||||
if( std::shared_ptr<LIB_SYMBOL> srcParent = srcSymbol->GetParent().lock() )
|
||||
newSymbols.back()->SetParent( srcParent.get() );
|
||||
@ -1598,7 +1598,7 @@ void SYMBOL_EDIT_FRAME::UpdateSymbolMsgPanelInfo()
|
||||
|
||||
AppendMsgPanel( _( "Name" ), UnescapeString( msg ), 8 );
|
||||
|
||||
if( m_symbol->IsAlias() )
|
||||
if( m_symbol->IsDerived() )
|
||||
{
|
||||
LIB_SYMBOL_SPTR parent = m_symbol->GetParent().lock();
|
||||
|
||||
|
@ -228,7 +228,7 @@ bool SYMBOL_LIBRARY_MANAGER::SaveLibrary( const wxString& aLibrary, const wxStri
|
||||
|
||||
try
|
||||
{
|
||||
if( symbol->IsAlias() )
|
||||
if( symbol->IsDerived() )
|
||||
{
|
||||
std::shared_ptr< LIB_SYMBOL > oldParent = symbol->GetParent().lock();
|
||||
|
||||
@ -285,7 +285,7 @@ bool SYMBOL_LIBRARY_MANAGER::IsLibraryModified( const wxString& aLibrary ) const
|
||||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::IsSymbolModified( const wxString& aAlias,
|
||||
bool SYMBOL_LIBRARY_MANAGER::IsSymbolModified( const wxString& aSymbolName,
|
||||
const wxString& aLibrary ) const
|
||||
{
|
||||
auto libIt = m_libs.find( aLibrary );
|
||||
@ -294,13 +294,14 @@ bool SYMBOL_LIBRARY_MANAGER::IsSymbolModified( const wxString& aAlias,
|
||||
return false;
|
||||
|
||||
const LIB_BUFFER& buf = libIt->second;
|
||||
const std::shared_ptr<SYMBOL_BUFFER> symbolBuf = buf.GetBuffer( aAlias );
|
||||
const std::shared_ptr<SYMBOL_BUFFER> symbolBuf = buf.GetBuffer( aSymbolName );
|
||||
|
||||
return symbolBuf ? symbolBuf->IsModified() : false;
|
||||
}
|
||||
|
||||
|
||||
void SYMBOL_LIBRARY_MANAGER::SetSymbolModified( const wxString& aAlias, const wxString& aLibrary )
|
||||
void SYMBOL_LIBRARY_MANAGER::SetSymbolModified( const wxString& aSymbolName,
|
||||
const wxString& aLibrary )
|
||||
{
|
||||
auto libIt = m_libs.find( aLibrary );
|
||||
|
||||
@ -308,7 +309,7 @@ void SYMBOL_LIBRARY_MANAGER::SetSymbolModified( const wxString& aAlias, const wx
|
||||
return;
|
||||
|
||||
const LIB_BUFFER& buf = libIt->second;
|
||||
std::shared_ptr<SYMBOL_BUFFER> symbolBuf = buf.GetBuffer( aAlias );
|
||||
std::shared_ptr<SYMBOL_BUFFER> symbolBuf = buf.GetBuffer( aSymbolName );
|
||||
|
||||
wxCHECK( symbolBuf, /* void */ );
|
||||
|
||||
@ -335,7 +336,7 @@ bool SYMBOL_LIBRARY_MANAGER::ClearLibraryModified( const wxString& aLibrary ) co
|
||||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::ClearSymbolModified( const wxString& aAlias,
|
||||
bool SYMBOL_LIBRARY_MANAGER::ClearSymbolModified( const wxString& aSymbolName,
|
||||
const wxString& aLibrary ) const
|
||||
{
|
||||
auto libIt = m_libs.find( aLibrary );
|
||||
@ -343,7 +344,7 @@ bool SYMBOL_LIBRARY_MANAGER::ClearSymbolModified( const wxString& aAlias,
|
||||
if( libIt == m_libs.end() )
|
||||
return false;
|
||||
|
||||
auto symbolBuf = libIt->second.GetBuffer( aAlias );
|
||||
auto symbolBuf = libIt->second.GetBuffer( aSymbolName );
|
||||
wxCHECK( symbolBuf, false );
|
||||
|
||||
symbolBuf->GetScreen()->SetContentModified( false );
|
||||
@ -369,7 +370,7 @@ bool SYMBOL_LIBRARY_MANAGER::IsLibraryLoaded( const wxString& aLibrary ) const
|
||||
}
|
||||
|
||||
|
||||
std::list<LIB_SYMBOL*> SYMBOL_LIBRARY_MANAGER::GetAliases( const wxString& aLibrary ) const
|
||||
std::list<LIB_SYMBOL*> SYMBOL_LIBRARY_MANAGER::EnumerateSymbols( const wxString& aLibrary ) const
|
||||
{
|
||||
std::list<LIB_SYMBOL*> ret;
|
||||
wxCHECK_MSG( LibraryExists( aLibrary ), ret,
|
||||
@ -384,40 +385,40 @@ std::list<LIB_SYMBOL*> SYMBOL_LIBRARY_MANAGER::GetAliases( const wxString& aLibr
|
||||
}
|
||||
else
|
||||
{
|
||||
std::vector<LIB_SYMBOL*> aliases;
|
||||
std::vector<LIB_SYMBOL*> symbols;
|
||||
|
||||
try
|
||||
{
|
||||
symTable()->LoadSymbolLib( aliases, aLibrary );
|
||||
symTable()->LoadSymbolLib( symbols, aLibrary );
|
||||
}
|
||||
catch( const IO_ERROR& e )
|
||||
{
|
||||
wxLogWarning( e.Problem() );
|
||||
}
|
||||
|
||||
std::copy( aliases.begin(), aliases.end(), std::back_inserter( ret ) );
|
||||
std::copy( symbols.begin(), symbols.end(), std::back_inserter( ret ) );
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol( const wxString& aAlias,
|
||||
LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol( const wxString& aSymbolName,
|
||||
const wxString& aLibrary )
|
||||
{
|
||||
wxCHECK_MSG( LibraryExists( aLibrary ), nullptr,
|
||||
wxString::Format( "Library missing: %s, for alias %s", aLibrary, aAlias ) );
|
||||
wxString::Format( "Library missing: %s, for symbol %s", aLibrary, aSymbolName ) );
|
||||
|
||||
// try the library buffers first
|
||||
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
||||
LIB_SYMBOL* bufferedSymbol = libBuf.GetSymbol( aAlias );
|
||||
LIB_SYMBOL* bufferedSymbol = libBuf.GetSymbol( aSymbolName );
|
||||
|
||||
if( !bufferedSymbol ) // no buffer symbol found
|
||||
{
|
||||
// create a copy of the symbol
|
||||
try
|
||||
{
|
||||
LIB_SYMBOL* symbol = symTable()->LoadSymbol( aLibrary, aAlias );
|
||||
LIB_SYMBOL* symbol = symTable()->LoadSymbol( aLibrary, aSymbolName );
|
||||
|
||||
if( symbol == nullptr )
|
||||
THROW_IO_ERROR( _( "Symbol not found." ) );
|
||||
@ -425,7 +426,7 @@ LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol( const wxString& aAlias,
|
||||
LIB_SYMBOL* bufferedParent = nullptr;
|
||||
|
||||
// Create parent symbols on demand so parent symbol can be set.
|
||||
if( symbol->IsAlias() )
|
||||
if( symbol->IsDerived() )
|
||||
{
|
||||
std::shared_ptr<LIB_SYMBOL> parent = symbol->GetParent().lock();
|
||||
wxCHECK_MSG( parent, nullptr,
|
||||
@ -455,7 +456,9 @@ LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol( const wxString& aAlias,
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
msg.Printf( _( "Error loading symbol %s from library '%s'." ), aAlias, aLibrary );
|
||||
msg.Printf( _( "Error loading symbol %s from library '%s'." ),
|
||||
aSymbolName,
|
||||
aLibrary );
|
||||
DisplayErrorMessage( &m_frame, msg, e.What() );
|
||||
bufferedSymbol = nullptr;
|
||||
}
|
||||
@ -465,17 +468,18 @@ LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetBufferedSymbol( const wxString& aAlias,
|
||||
}
|
||||
|
||||
|
||||
SCH_SCREEN* SYMBOL_LIBRARY_MANAGER::GetScreen( const wxString& aAlias, const wxString& aLibrary )
|
||||
SCH_SCREEN* SYMBOL_LIBRARY_MANAGER::GetScreen( const wxString& aSymbolName,
|
||||
const wxString& aLibrary )
|
||||
{
|
||||
wxCHECK_MSG( LibraryExists( aLibrary ), nullptr,
|
||||
wxString::Format( "Library missing: %s, for alias %s", aLibrary, aAlias ) );
|
||||
wxCHECK_MSG( !aAlias.IsEmpty(), nullptr,
|
||||
wxString::Format( "Alias missing in library: %s", aLibrary ) );
|
||||
wxString::Format( "Library missing: %s, for symbol %s", aLibrary, aSymbolName ) );
|
||||
wxCHECK_MSG( !aSymbolName.IsEmpty(), nullptr,
|
||||
wxString::Format( "Symbol missing in library: %s", aLibrary ) );
|
||||
auto it = m_libs.find( aLibrary );
|
||||
wxCHECK( it != m_libs.end(), nullptr );
|
||||
|
||||
LIB_BUFFER& buf = it->second;
|
||||
std::shared_ptr<SYMBOL_BUFFER> symbolBuf = buf.GetBuffer( aAlias );
|
||||
std::shared_ptr<SYMBOL_BUFFER> symbolBuf = buf.GetBuffer( aSymbolName );
|
||||
|
||||
return symbolBuf ? symbolBuf->GetScreen() : nullptr;
|
||||
}
|
||||
@ -533,20 +537,20 @@ bool SYMBOL_LIBRARY_MANAGER::UpdateSymbolAfterRename( LIB_SYMBOL* aSymbol, const
|
||||
}
|
||||
|
||||
|
||||
LIB_ID SYMBOL_LIBRARY_MANAGER::RevertSymbol( const wxString& aAlias, const wxString& aLibrary )
|
||||
LIB_ID SYMBOL_LIBRARY_MANAGER::RevertSymbol( const wxString& aSymbolName, const wxString& aLibrary )
|
||||
{
|
||||
auto it = m_libs.find( aLibrary );
|
||||
|
||||
if( it == m_libs.end() ) // no items to flush
|
||||
return LIB_ID( aLibrary, aAlias );
|
||||
return LIB_ID( aLibrary, aSymbolName );
|
||||
|
||||
std::shared_ptr<SYMBOL_BUFFER> symbolBuf = it->second.GetBuffer( aAlias );
|
||||
wxCHECK( symbolBuf, LIB_ID( aLibrary, aAlias ) );
|
||||
std::shared_ptr<SYMBOL_BUFFER> symbolBuf = it->second.GetBuffer( aSymbolName );
|
||||
wxCHECK( symbolBuf, LIB_ID( aLibrary, aSymbolName ) );
|
||||
LIB_SYMBOL original( symbolBuf->GetOriginal() );
|
||||
|
||||
if( original.GetName() != aAlias )
|
||||
if( original.GetName() != aSymbolName )
|
||||
{
|
||||
UpdateSymbolAfterRename( &original, aAlias, aLibrary );
|
||||
UpdateSymbolAfterRename( &original, aSymbolName, aLibrary );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -599,10 +603,10 @@ bool SYMBOL_LIBRARY_MANAGER::RevertAll()
|
||||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::RemoveSymbol( const wxString& aAlias, const wxString& aLibrary )
|
||||
bool SYMBOL_LIBRARY_MANAGER::RemoveSymbol( const wxString& aSymbolName, const wxString& aLibrary )
|
||||
{
|
||||
LIB_BUFFER& libBuf = getLibraryBuffer( aLibrary );
|
||||
std::shared_ptr<SYMBOL_BUFFER> symbolBuf = libBuf.GetBuffer( aAlias );
|
||||
std::shared_ptr<SYMBOL_BUFFER> symbolBuf = libBuf.GetBuffer( aSymbolName );
|
||||
wxCHECK( symbolBuf, false );
|
||||
|
||||
bool retv = true;
|
||||
@ -614,57 +618,60 @@ bool SYMBOL_LIBRARY_MANAGER::RemoveSymbol( const wxString& aAlias, const wxStrin
|
||||
}
|
||||
|
||||
|
||||
LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetAlias( const wxString& aAlias,
|
||||
const wxString& aLibrary ) const
|
||||
LIB_SYMBOL* SYMBOL_LIBRARY_MANAGER::GetSymbol( const wxString& aSymbolName,
|
||||
const wxString& aLibrary ) const
|
||||
{
|
||||
// Try the library buffers first
|
||||
auto libIt = m_libs.find( aLibrary );
|
||||
|
||||
if( libIt != m_libs.end() )
|
||||
{
|
||||
LIB_SYMBOL* symbol = libIt->second.GetSymbol( aAlias );
|
||||
LIB_SYMBOL* symbol = libIt->second.GetSymbol( aSymbolName );
|
||||
|
||||
if( symbol )
|
||||
return symbol;
|
||||
}
|
||||
|
||||
// Get the original symbol
|
||||
LIB_SYMBOL* alias = nullptr;
|
||||
LIB_SYMBOL* symbol = nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
alias = symTable()->LoadSymbol( aLibrary, aAlias );
|
||||
symbol = symTable()->LoadSymbol( aLibrary, aSymbolName );
|
||||
}
|
||||
catch( const IO_ERROR& e )
|
||||
{
|
||||
wxString msg;
|
||||
|
||||
msg.Printf( _( "Cannot load symbol '%s' from library '%s'." ), aAlias, aLibrary );
|
||||
msg.Printf( _( "Cannot load symbol '%s' from library '%s'." ),
|
||||
aSymbolName,
|
||||
aLibrary );
|
||||
DisplayErrorMessage( &m_frame, msg, e.What() );
|
||||
}
|
||||
|
||||
return alias;
|
||||
return symbol;
|
||||
}
|
||||
|
||||
|
||||
bool SYMBOL_LIBRARY_MANAGER::SymbolExists( const wxString& aAlias, const wxString& aLibrary ) const
|
||||
bool SYMBOL_LIBRARY_MANAGER::SymbolExists( const wxString& aSymbolName,
|
||||
const wxString& aLibrary ) const
|
||||
{
|
||||
auto libBufIt = m_libs.find( aLibrary );
|
||||
LIB_SYMBOL* alias = nullptr;
|
||||
auto libBufIt = m_libs.find( aLibrary );
|
||||
LIB_SYMBOL* symbol = nullptr;
|
||||
|
||||
if( libBufIt != m_libs.end() )
|
||||
return !!libBufIt->second.GetBuffer( aAlias );
|
||||
return libBufIt->second.GetBuffer( aSymbolName ) != nullptr;
|
||||
|
||||
try
|
||||
{
|
||||
alias = symTable()->LoadSymbol( aLibrary, aAlias );
|
||||
symbol = symTable()->LoadSymbol( aLibrary, aSymbolName );
|
||||
}
|
||||
catch( IO_ERROR& )
|
||||
{
|
||||
// checking if certain symbol exists, so its absence is perfectly fine
|
||||
}
|
||||
|
||||
return alias != nullptr;
|
||||
return symbol != nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -800,13 +807,13 @@ std::set<LIB_SYMBOL*> SYMBOL_LIBRARY_MANAGER::getOriginalSymbols( const wxString
|
||||
|
||||
try
|
||||
{
|
||||
wxArrayString aliases;
|
||||
symTable()->EnumerateSymbolLib( aLibrary, aliases );
|
||||
wxArrayString symbolNames;
|
||||
symTable()->EnumerateSymbolLib( aLibrary, symbolNames );
|
||||
|
||||
for( const auto& aliasName : aliases )
|
||||
for( const auto& symbolName : symbolNames )
|
||||
{
|
||||
LIB_SYMBOL* alias = symTable()->LoadSymbol( aLibrary, aliasName );
|
||||
symbols.insert( alias );
|
||||
LIB_SYMBOL* symbol = symTable()->LoadSymbol( aLibrary, symbolName );
|
||||
symbols.insert( symbol );
|
||||
}
|
||||
}
|
||||
catch( const IO_ERROR& e )
|
||||
@ -834,7 +841,7 @@ LIB_BUFFER& SYMBOL_LIBRARY_MANAGER::getLibraryBuffer( const wxString& aLibrary )
|
||||
|
||||
for( LIB_SYMBOL* symbol : getOriginalSymbols( aLibrary ) )
|
||||
{
|
||||
if( symbol->IsAlias() )
|
||||
if( symbol->IsDerived() )
|
||||
{
|
||||
std::shared_ptr<LIB_SYMBOL> oldParent = symbol->GetParent().lock();
|
||||
|
||||
@ -1052,7 +1059,7 @@ bool LIB_BUFFER::SaveBuffer( SYMBOL_BUFFER& aSymbolBuf, const wxString& aFileNam
|
||||
|
||||
LIB_SYMBOL* parentSymbol = nullptr;
|
||||
|
||||
if( libSymbol.IsAlias() )
|
||||
if( libSymbol.IsDerived() )
|
||||
{
|
||||
LIB_SYMBOL* newCachedSymbol = new LIB_SYMBOL( libSymbol );
|
||||
std::shared_ptr<LIB_SYMBOL> bufferedParent = libSymbol.GetParent().lock();
|
||||
@ -1180,11 +1187,11 @@ bool LIB_BUFFER::SaveBuffer( SYMBOL_BUFFER& aSymbolBuf, const wxString& aFileNam
|
||||
}
|
||||
|
||||
|
||||
std::shared_ptr<SYMBOL_BUFFER> LIB_BUFFER::GetBuffer( const wxString& aAlias ) const
|
||||
std::shared_ptr<SYMBOL_BUFFER> LIB_BUFFER::GetBuffer( const wxString& aSymbolName ) const
|
||||
{
|
||||
for( std::shared_ptr<SYMBOL_BUFFER> entry : m_symbols )
|
||||
{
|
||||
if( entry->GetSymbol().GetName() == aAlias )
|
||||
if( entry->GetSymbol().GetName() == aSymbolName )
|
||||
return entry;
|
||||
}
|
||||
|
||||
@ -1196,7 +1203,7 @@ bool LIB_BUFFER::HasDerivedSymbols( const wxString& aParentName ) const
|
||||
{
|
||||
for( const std::shared_ptr<SYMBOL_BUFFER>& entry : m_symbols )
|
||||
{
|
||||
if( entry->GetSymbol().IsAlias() )
|
||||
if( entry->GetSymbol().IsDerived() )
|
||||
{
|
||||
LIB_SYMBOL_SPTR parent = entry->GetSymbol().GetParent().lock();
|
||||
|
||||
@ -1217,7 +1224,7 @@ void LIB_BUFFER::GetSymbolNames( wxArrayString& aSymbolNames, SYMBOL_NAME_FILTER
|
||||
for( std::shared_ptr<SYMBOL_BUFFER>& entry : m_symbols )
|
||||
{
|
||||
const LIB_SYMBOL& symbol = entry->GetSymbol();
|
||||
if( ( symbol.IsAlias() && ( aFilter == SYMBOL_NAME_FILTER::ROOT_ONLY ) )
|
||||
if( ( symbol.IsDerived() && ( aFilter == SYMBOL_NAME_FILTER::ROOT_ONLY ) )
|
||||
|| ( symbol.IsRoot() && ( aFilter == SYMBOL_NAME_FILTER::DERIVED_ONLY ) ) )
|
||||
{
|
||||
continue;
|
||||
@ -1234,7 +1241,7 @@ size_t LIB_BUFFER::GetDerivedSymbolNames( const wxString& aSymbolName, wxArraySt
|
||||
for( std::shared_ptr<SYMBOL_BUFFER>& entry : m_symbols )
|
||||
{
|
||||
const LIB_SYMBOL& symbol = entry->GetSymbol();
|
||||
if( symbol.IsAlias() )
|
||||
if( symbol.IsDerived() )
|
||||
{
|
||||
LIB_SYMBOL_SPTR parent = symbol.GetParent().lock();
|
||||
|
||||
|
@ -216,7 +216,7 @@ public:
|
||||
*/
|
||||
SYMBOL_LIB_TABLE_ROW* GetLibrary( const wxString& aLibrary ) const;
|
||||
|
||||
std::list<LIB_SYMBOL*> GetAliases( const wxString& aLibrary ) const;
|
||||
std::list<LIB_SYMBOL*> EnumerateSymbols( const wxString& aLibrary ) const;
|
||||
|
||||
/**
|
||||
* Create an empty library and adds it to the library table.
|
||||
@ -252,7 +252,7 @@ public:
|
||||
*
|
||||
* The old library buffer will be deleted and a new one created with the new name.
|
||||
*/
|
||||
bool UpdateSymbolAfterRename( LIB_SYMBOL* aSymbol, const wxString& oldAlias,
|
||||
bool UpdateSymbolAfterRename( LIB_SYMBOL* aSymbol, const wxString& aOldSymbolName,
|
||||
const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
@ -265,13 +265,13 @@ public:
|
||||
*
|
||||
* It is required to save the library to have the symbol removed in the schematic editor.
|
||||
*/
|
||||
bool RemoveSymbol( const wxString& aName, const wxString& aLibrary );
|
||||
bool RemoveSymbol( const wxString& aSymbolName, const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
* Return either an alias of a working LIB_SYMBOL copy, or alias of the original symbol if there
|
||||
* is no working copy.
|
||||
*/
|
||||
LIB_SYMBOL* GetAlias( const wxString& aAlias, const wxString& aLibrary ) const;
|
||||
LIB_SYMBOL* GetSymbol( const wxString& aSymbolName, const wxString& aLibrary ) const;
|
||||
|
||||
/**
|
||||
* Return the symbol copy from the buffer.
|
||||
@ -279,19 +279,19 @@ public:
|
||||
* In case it does not exist yet, the copy is created. #SYMBOL_LIBRARY_MANAGER retains
|
||||
* the ownership.
|
||||
*/
|
||||
LIB_SYMBOL* GetBufferedSymbol( const wxString& aAlias, const wxString& aLibrary );
|
||||
LIB_SYMBOL* GetBufferedSymbol( const wxString& aSymbolName, const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
* Return the screen used to edit a specific symbol. #SYMBOL_LIBRARY_MANAGER retains the
|
||||
* ownership.
|
||||
*/
|
||||
SCH_SCREEN* GetScreen( const wxString& aAlias, const wxString& aLibrary );
|
||||
SCH_SCREEN* GetScreen( const wxString& aSymbolName, const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
* Return true if symbol with a specific alias exists in library (either original one or
|
||||
* buffered).
|
||||
*/
|
||||
bool SymbolExists( const wxString& aAlias, const wxString& aLibrary ) const;
|
||||
bool SymbolExists( const wxString& aSymbolName, const wxString& aLibrary ) const;
|
||||
|
||||
/**
|
||||
* Return true if the symbol name is already in use in the specified library.
|
||||
@ -318,9 +318,9 @@ public:
|
||||
/**
|
||||
* Return true if symbol has unsaved modifications.
|
||||
*/
|
||||
bool IsSymbolModified( const wxString& aAlias, const wxString& aLibrary ) const;
|
||||
bool IsSymbolModified( const wxString& aSymbolName, const wxString& aLibrary ) const;
|
||||
|
||||
void SetSymbolModified( const wxString& aAlias, const wxString& aLibrary );
|
||||
void SetSymbolModified( const wxString& aSymbolName, const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
* Clear the modified flag for all symbols in a library.
|
||||
@ -330,7 +330,7 @@ public:
|
||||
/**
|
||||
* Clear the modified flag for a symbol.
|
||||
*/
|
||||
bool ClearSymbolModified( const wxString& aAlias, const wxString& aLibrary ) const;
|
||||
bool ClearSymbolModified( const wxString& aSymbolName, const wxString& aLibrary ) const;
|
||||
|
||||
/**
|
||||
* Return true if the library is stored in a read-only file.
|
||||
@ -355,7 +355,7 @@ public:
|
||||
* @return The LIB_ID of the reverted symbol (which may be different in the case
|
||||
* of a rename)
|
||||
*/
|
||||
LIB_ID RevertSymbol( const wxString& aAlias, const wxString& aLibrary );
|
||||
LIB_ID RevertSymbol( const wxString& aSymbolName, const wxString& aLibrary );
|
||||
|
||||
/**
|
||||
* Revert unsaved changes for a symbol library.
|
||||
|
@ -161,29 +161,29 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary( LIB_TREE_NODE_LIBRARY& aL
|
||||
if( hashIt == m_libHashes.end() )
|
||||
{
|
||||
// add a new library
|
||||
for( LIB_SYMBOL* alias : m_libMgr->GetAliases( aLibNode.m_Name ) )
|
||||
aLibNode.AddItem( alias );
|
||||
for( LIB_SYMBOL* symbol : m_libMgr->EnumerateSymbols( aLibNode.m_Name ) )
|
||||
aLibNode.AddItem( symbol );
|
||||
}
|
||||
else if( hashIt->second != m_libMgr->GetLibraryHash( aLibNode.m_Name ) )
|
||||
{
|
||||
// update an existing library
|
||||
std::list<LIB_SYMBOL*> aliases = m_libMgr->GetAliases( aLibNode.m_Name );
|
||||
std::list<LIB_SYMBOL*> symbols = m_libMgr->EnumerateSymbols( aLibNode.m_Name );
|
||||
|
||||
// remove the common part from the aliases list
|
||||
for( auto nodeIt = aLibNode.m_Children.begin(); nodeIt != aLibNode.m_Children.end(); /**/ )
|
||||
{
|
||||
auto aliasIt = std::find_if( aliases.begin(), aliases.end(),
|
||||
auto symbolIt = std::find_if( symbols.begin(), symbols.end(),
|
||||
[&] ( const LIB_SYMBOL* a )
|
||||
{
|
||||
return a->GetName() == (*nodeIt)->m_LibId.GetLibItemName().wx_str();
|
||||
} );
|
||||
|
||||
if( aliasIt != aliases.end() )
|
||||
if( symbolIt != symbols.end() )
|
||||
{
|
||||
// alias exists both in the symbol tree and the library manager,
|
||||
// update only the node data.
|
||||
static_cast<LIB_TREE_NODE_ITEM*>( nodeIt->get() )->Update( *aliasIt );
|
||||
aliases.erase( aliasIt );
|
||||
static_cast<LIB_TREE_NODE_ITEM*>( nodeIt->get() )->Update( *symbolIt );
|
||||
symbols.erase( symbolIt );
|
||||
++nodeIt;
|
||||
}
|
||||
else
|
||||
@ -194,8 +194,8 @@ void SYMBOL_TREE_SYNCHRONIZING_ADAPTER::updateLibrary( LIB_TREE_NODE_LIBRARY& aL
|
||||
}
|
||||
|
||||
// now the aliases list contains only new aliases that need to be added to the tree
|
||||
for( LIB_SYMBOL* alias : aliases )
|
||||
aLibNode.AddItem( alias );
|
||||
for( LIB_SYMBOL* symbol : symbols )
|
||||
aLibNode.AddItem( symbol );
|
||||
}
|
||||
|
||||
aLibNode.AssignIntrinsicRanks();
|
||||
|
@ -957,8 +957,8 @@ const BOX2I SYMBOL_VIEWER_FRAME::GetDocumentExtents( bool aIncludeAllVisible ) c
|
||||
}
|
||||
else
|
||||
{
|
||||
std::shared_ptr<LIB_SYMBOL> tmp = symbol->IsAlias() ? symbol->GetParent().lock()
|
||||
: symbol->SharedPtr();
|
||||
std::shared_ptr<LIB_SYMBOL> tmp = symbol->IsDerived() ? symbol->GetParent().lock()
|
||||
: symbol->SharedPtr();
|
||||
|
||||
wxCHECK( tmp, BOX2I( VECTOR2I( -200, -200 ), VECTOR2I( 400, 400 ) ) );
|
||||
|
||||
|
@ -791,7 +791,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::UpdateSymbolFields( const TOOL_EVENT& aEvent )
|
||||
if( !symbol )
|
||||
return 0;
|
||||
|
||||
if( !symbol->IsAlias() )
|
||||
if( !symbol->IsDerived() )
|
||||
{
|
||||
m_frame->ShowInfoBarError( _( "Symbol is not derived from another symbol." ) );
|
||||
}
|
||||
@ -952,7 +952,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Paste( const TOOL_EVENT& aEvent )
|
||||
LIB_SYMBOL* symbol = m_frame->GetCurSymbol();
|
||||
LIB_SYMBOL* newPart = nullptr;
|
||||
|
||||
if( !symbol || symbol->IsAlias() )
|
||||
if( !symbol || symbol->IsDerived() )
|
||||
return 0;
|
||||
|
||||
std::string clipboardData = GetClipboardUTF8();
|
||||
|
@ -67,7 +67,7 @@ BOOST_AUTO_TEST_CASE( DefaultProperties )
|
||||
|
||||
// only get the root
|
||||
BOOST_CHECK_EQUAL( m_part_no_data.IsRoot(), true );
|
||||
BOOST_CHECK_EQUAL( m_part_no_data.IsAlias(), false );
|
||||
BOOST_CHECK_EQUAL( m_part_no_data.IsDerived(), false );
|
||||
BOOST_CHECK_EQUAL( m_part_no_data.SharedPtr().use_count(), 2 );
|
||||
|
||||
// no sub units
|
||||
@ -595,12 +595,12 @@ BOOST_AUTO_TEST_CASE( Inheritance )
|
||||
std::unique_ptr<LIB_SYMBOL> ref = std::make_unique<LIB_SYMBOL>( *parent );
|
||||
|
||||
std::unique_ptr<LIB_SYMBOL> child = std::make_unique<LIB_SYMBOL>( "child", parent.get() );
|
||||
BOOST_CHECK( child->IsAlias() );
|
||||
BOOST_CHECK( child->IsDerived() );
|
||||
BOOST_CHECK_EQUAL( child->GetInheritanceDepth(), 1 );
|
||||
|
||||
std::unique_ptr<LIB_SYMBOL> grandChild = std::make_unique<LIB_SYMBOL>( "grandchild",
|
||||
child.get() );
|
||||
BOOST_CHECK( grandChild->IsAlias() );
|
||||
BOOST_CHECK( grandChild->IsDerived() );
|
||||
BOOST_CHECK_EQUAL( grandChild->GetInheritanceDepth(), 2 );
|
||||
|
||||
BOOST_CHECK( parent->GetRootSymbol().get() == parent.get() );
|
||||
|
Loading…
Reference in New Issue
Block a user