A bit more Part -> Symbol.

This commit is contained in:
Jeff Young 2021-06-17 22:22:10 +01:00
parent c0ad498c4a
commit 389287e942
10 changed files with 37 additions and 32 deletions

View File

@ -289,7 +289,7 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
if( m_mode == MODE::UPDATE && symbol->GetLibId().IsValid() )
{
LIB_SYMBOL* libSymbol = frame->GetLibPart( symbol->GetLibId() );
LIB_SYMBOL* libSymbol = frame->GetLibSymbol( symbol->GetLibId() );
if( libSymbol )
{
@ -315,7 +315,7 @@ void DIALOG_CHANGE_SYMBOLS::updateFieldsList()
if( newId.IsValid() )
{
LIB_SYMBOL* libSymbol = frame->GetLibPart( newId );
LIB_SYMBOL* libSymbol = frame->GetLibSymbol( newId );
if( libSymbol )
{
@ -532,7 +532,7 @@ bool DIALOG_CHANGE_SYMBOLS::processSymbol( SCH_SYMBOL* aSymbol, const SCH_SHEET_
}
}
LIB_SYMBOL* libSymbol = frame->GetLibPart( aNewId );
LIB_SYMBOL* libSymbol = frame->GetLibSymbol( aNewId );
if( !libSymbol )
{

View File

@ -317,8 +317,8 @@ DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD( SCH_BASE_FRAME* aParent,
// be entirely accurate if the power library is missing but it's better then a segfault.
if( aField->GetParent() && aField->GetParent()->Type() == SCH_SYMBOL_T )
{
const SCH_SYMBOL* symbol = (SCH_SYMBOL*) aField->GetParent();
const LIB_SYMBOL* libSymbol = GetParent()->GetLibPart( symbol->GetLibId(), true );
const SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aField->GetParent() );
const LIB_SYMBOL* libSymbol = GetParent()->GetLibSymbol( symbol->GetLibId(), true );
if( libSymbol && libSymbol->IsPower() )
m_isPower = true;

View File

@ -659,7 +659,7 @@ bool DIALOG_SYMBOL_PROPERTIES::TransferDataFromWindow()
for( unsigned i = 0; i < m_fields->size(); ++i )
m_fields->at( i ).Offset( m_symbol->GetPosition() );
LIB_SYMBOL* entry = GetParent()->GetLibPart( m_symbol->GetLibId() );
LIB_SYMBOL* entry = GetParent()->GetLibSymbol( m_symbol->GetLibId() );
if( entry && entry->IsPower() )
m_fields->at( VALUE_FIELD ).SetText( m_symbol->GetLibId().GetLibItemName() );

View File

@ -723,7 +723,7 @@ int ERC_TESTER::TestLibSymbolIssues()
}
wxString symbolName = symbol->GetLibId().GetLibItemName();
LIB_SYMBOL* libSymbol = SchGetLibPart( symbol->GetLibId(), libTable );
LIB_SYMBOL* libSymbol = SchGetLibSymbol( symbol->GetLibId(), libTable );
if( libSymbol == nullptr )
{

View File

@ -124,7 +124,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
for( const PICKED_SYMBOL& i : aHistoryList )
{
LIB_SYMBOL* symbol = GetLibPart( i.LibId );
LIB_SYMBOL* symbol = GetLibSymbol( i.LibId );
// This can be null, for example when a symbol has been deleted from a library
if( symbol )
@ -197,7 +197,7 @@ PICKED_SYMBOL SCH_BASE_FRAME::PickSymbolFromLibTree( const SCHLIB_FILTER* aFilte
void SCH_EDIT_FRAME::SelectUnit( SCH_SYMBOL* aSymbol, int aUnit )
{
LIB_SYMBOL* symbol = GetLibPart( aSymbol->GetLibId() );
LIB_SYMBOL* symbol = GetLibSymbol( aSymbol->GetLibId() );
if( !symbol )
return;

View File

@ -83,7 +83,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
for( SCH_SCREEN* screen = screens.GetFirst(); screen; screen = screens.GetNext() )
{
for( auto aItem : screen->Items().OfType( SCH_SYMBOL_T ) )
for( SCH_ITEM* aItem : screen->Items().OfType( SCH_SYMBOL_T ) )
{
LIB_SYMBOL* libSymbol = nullptr;
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( aItem );
@ -93,7 +93,7 @@ bool SCH_EDIT_FRAME::CreateArchiveLibrary( const wxString& aFileName )
if( archLib->FindSymbol( symbol->GetLibId() ) )
continue;
libSymbol = GetLibPart( symbol->GetLibId(), true );
libSymbol = GetLibSymbol( symbol->GetLibId(), true );
}
catch( const IO_ERROR& )
{

View File

@ -394,7 +394,7 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
true );
// Get the library symbol from the symbol library table.
lib_match = SchGetLibPart( symbol_id, aRescuer.GetPrj()->SchSymbolLibTable() );
lib_match = SchGetLibSymbol( symbol_id, aRescuer.GetPrj()->SchSymbolLibTable() );
if( !cache_match && !lib_match )
continue;
@ -407,13 +407,9 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
lib_match_parent = lib_match->GetParent().lock();
if( !lib_match_parent )
{
lib_match = nullptr;
}
else
{
lib_match = lib_match_parent.get();
}
}
// Test whether there is a conflict or if the symbol can only be found in the cache.
@ -421,7 +417,9 @@ void RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::FindRescues(
{
if( cache_match && lib_match &&
!cache_match->PinsConflictWith( *lib_match, true, true, true, true, false ) )
{
continue;
}
if( !cache_match && lib_match )
continue;
@ -460,14 +458,23 @@ wxString RESCUE_SYMBOL_LIB_TABLE_CANDIDATE::GetActionDescription() const
wxString action;
if( !m_cache_candidate && !m_lib_candidate )
{
action.Printf( _( "Cannot rescue symbol %s which is not available in any library or "
"the cache." ), m_requested_id.GetLibItemName().wx_str() );
"the cache." ),
m_requested_id.GetLibItemName().wx_str() );
}
else if( m_cache_candidate && !m_lib_candidate )
{
action.Printf( _( "Rescue symbol %s found only in cache library to %s." ),
m_requested_id.Format().wx_str(), m_new_id.Format().wx_str() );
m_requested_id.Format().wx_str(),
m_new_id.Format().wx_str() );
}
else
{
action.Printf( _( "Rescue modified symbol %s to %s" ),
m_requested_id.Format().wx_str(), m_new_id.Format().wx_str() );
m_requested_id.Format().wx_str(),
m_new_id.Format().wx_str() );
}
return action;
}

View File

@ -43,8 +43,8 @@
#include <tools/ee_selection_tool.h>
LIB_SYMBOL* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable, SYMBOL_LIB* aCacheLib,
wxWindow* aParent, bool aShowErrorMsg )
LIB_SYMBOL* SchGetLibSymbol( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
SYMBOL_LIB* aCacheLib, wxWindow* aParent, bool aShowErrorMsg )
{
wxCHECK_MSG( aLibTable, nullptr, "Invalid symbol library table." );
@ -192,12 +192,12 @@ void SCH_BASE_FRAME::UpdateStatusBar()
}
LIB_SYMBOL* SCH_BASE_FRAME::GetLibPart( const LIB_ID& aLibId, bool aUseCacheLib,
bool aShowErrorMsg )
LIB_SYMBOL* SCH_BASE_FRAME::GetLibSymbol( const LIB_ID& aLibId, bool aUseCacheLib,
bool aShowErrorMsg )
{
SYMBOL_LIB* cache = ( aUseCacheLib ) ? Prj().SchLibs()->GetCacheLibrary() : NULL;
return SchGetLibPart( aLibId, Prj().SchSymbolLibTable(), cache, this, aShowErrorMsg );
return SchGetLibSymbol( aLibId, Prj().SchSymbolLibTable(), cache, this, aShowErrorMsg );
}

View File

@ -72,9 +72,9 @@ class SYMBOL_EDITOR_SETTINGS;
*
* @return The symbol found in the library or NULL if the symbol was not found.
*/
LIB_SYMBOL* SchGetLibPart( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
SYMBOL_LIB* aCacheLib = NULL, wxWindow* aParent = NULL,
bool aShowErrorMsg = false );
LIB_SYMBOL* SchGetLibSymbol( const LIB_ID& aLibId, SYMBOL_LIB_TABLE* aLibTable,
SYMBOL_LIB* aCacheLib = NULL, wxWindow* aParent = NULL,
bool aShowErrorMsg = false );
/**
* A shim class between EDA_DRAW_FRAME and several derived classes:
@ -177,10 +177,8 @@ public:
* @param aShowErrorMessage set to true to show any error messages.
* @return The symbol found in the library or NULL if the symbol was not found.
*/
LIB_SYMBOL* GetLibPart( const LIB_ID& aLibId, bool aUseCacheLib = false,
bool aShowErrorMsg = false );
LIB_SYMBOL* GetFlattenedLibPart( const LIB_ID& aLibId, bool aShowErrorMsg = false );
LIB_SYMBOL* GetLibSymbol( const LIB_ID& aLibId, bool aUseCacheLib = false,
bool aShowErrorMsg = false );
/**
* Call the library viewer to select symbol to import into schematic.

View File

@ -260,7 +260,7 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
controls->WarpCursor( canvas_area.Centre(), false );
LIB_SYMBOL* libSymbol = sel.LibId.IsValid() ?
m_frame->GetLibPart( sel.LibId ) : nullptr;
m_frame->GetLibSymbol( sel.LibId ) : nullptr;
if( !libSymbol )
continue;