mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-15 02:33:15 +02:00
Rename SCH_SYMBOL::GetInstanceReferences() to GetInstances().
This commit is contained in:
parent
cdb99de862
commit
04d15026c5
@ -469,8 +469,6 @@ bool DIALOG_CHANGE_SYMBOLS::isMatch( SCH_SYMBOL* aSymbol, SCH_SHEET_PATH* aInsta
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int DIALOG_CHANGE_SYMBOLS::processMatchingSymbols( SCH_COMMIT* aCommit )
|
int DIALOG_CHANGE_SYMBOLS::processMatchingSymbols( SCH_COMMIT* aCommit )
|
||||||
{
|
{
|
||||||
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
|
SCH_EDIT_FRAME* frame = dynamic_cast<SCH_EDIT_FRAME*>( GetParent() );
|
||||||
@ -532,7 +530,8 @@ int DIALOG_CHANGE_SYMBOLS::processMatchingSymbols( SCH_COMMIT* aCommit )
|
|||||||
if( symbols.size() > 0 )
|
if( symbols.size() > 0 )
|
||||||
matchesProcessed += processSymbols( aCommit, symbols );
|
matchesProcessed += processSymbols( aCommit, symbols );
|
||||||
else
|
else
|
||||||
m_messagePanel->Report( _( "*** No symbols matching criteria found ***" ), RPT_SEVERITY_ERROR );
|
m_messagePanel->Report( _( "*** No symbols matching criteria found ***" ),
|
||||||
|
RPT_SEVERITY_ERROR );
|
||||||
|
|
||||||
frame->GetCurrentSheet().UpdateAllScreenReferences();
|
frame->GetCurrentSheet().UpdateAllScreenReferences();
|
||||||
|
|
||||||
@ -755,7 +754,7 @@ wxString DIALOG_CHANGE_SYMBOLS::getSymbolReferences( SCH_SYMBOL& aSymbol, const
|
|||||||
|
|
||||||
SCH_SHEET_LIST sheets = parent->Schematic().GetSheets();
|
SCH_SHEET_LIST sheets = parent->Schematic().GetSheets();
|
||||||
|
|
||||||
for( const SCH_SYMBOL_INSTANCE& instance : aSymbol.GetInstanceReferences() )
|
for( const SCH_SYMBOL_INSTANCE& instance : aSymbol.GetInstances() )
|
||||||
{
|
{
|
||||||
// Only include the symbol instances for the current project.
|
// Only include the symbol instances for the current project.
|
||||||
if( !sheets.HasPath( instance.m_Path ) )
|
if( !sheets.HasPath( instance.m_Path ) )
|
||||||
@ -769,7 +768,7 @@ wxString DIALOG_CHANGE_SYMBOLS::getSymbolReferences( SCH_SYMBOL& aSymbol, const
|
|||||||
|
|
||||||
if( m_mode == MODE::UPDATE )
|
if( m_mode == MODE::UPDATE )
|
||||||
{
|
{
|
||||||
if( aSymbol.GetInstanceReferences().size() == 1 )
|
if( aSymbol.GetInstances().size() == 1 )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Update symbol %s from '%s' to '%s'" ),
|
msg.Printf( _( "Update symbol %s from '%s' to '%s'" ),
|
||||||
references,
|
references,
|
||||||
@ -786,7 +785,7 @@ wxString DIALOG_CHANGE_SYMBOLS::getSymbolReferences( SCH_SYMBOL& aSymbol, const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( aSymbol.GetInstanceReferences().size() == 1 )
|
if( aSymbol.GetInstances().size() == 1 )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Change symbol %s from '%s' to '%s'" ),
|
msg.Printf( _( "Change symbol %s from '%s' to '%s'" ),
|
||||||
references,
|
references,
|
||||||
|
@ -961,7 +961,7 @@ void FIELDS_EDITOR_GRID_DATA_MODEL::RemoveReferences( const SCH_REFERENCE_LIST&
|
|||||||
m_symbolsList.RemoveItem( index );
|
m_symbolsList.RemoveItem( index );
|
||||||
|
|
||||||
// If we're out of instances then remove the symbol, too
|
// If we're out of instances then remove the symbol, too
|
||||||
if( ref.GetSymbol()->GetInstanceReferences().empty() )
|
if( ref.GetSymbol()->GetInstances().empty() )
|
||||||
m_dataStore.erase( ref.GetSymbol()->m_Uuid );
|
m_dataStore.erase( ref.GetSymbol()->m_Uuid );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,8 +122,8 @@ void SCH_IO_KICAD_LEGACY::checkpoint()
|
|||||||
|
|
||||||
|
|
||||||
SCH_SHEET* SCH_IO_KICAD_LEGACY::LoadSchematicFile( const wxString& aFileName, SCHEMATIC* aSchematic,
|
SCH_SHEET* SCH_IO_KICAD_LEGACY::LoadSchematicFile( const wxString& aFileName, SCHEMATIC* aSchematic,
|
||||||
SCH_SHEET* aAppendToMe,
|
SCH_SHEET* aAppendToMe,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
wxASSERT( !aFileName || aSchematic != nullptr );
|
wxASSERT( !aFileName || aSchematic != nullptr );
|
||||||
|
|
||||||
@ -1368,7 +1368,7 @@ SCH_SYMBOL* SCH_IO_KICAD_LEGACY::loadSymbol( LINE_READER& aReader )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for( const SCH_SYMBOL_INSTANCE& instance : symbol->GetInstanceReferences() )
|
for( const SCH_SYMBOL_INSTANCE& instance : symbol->GetInstances() )
|
||||||
{
|
{
|
||||||
SCH_SYMBOL_INSTANCE tmpInstance = instance;
|
SCH_SYMBOL_INSTANCE tmpInstance = instance;
|
||||||
symbol->AddHierarchicalReference( tmpInstance );
|
symbol->AddHierarchicalReference( tmpInstance );
|
||||||
@ -1428,7 +1428,7 @@ SCH_SYMBOL* SCH_IO_KICAD_LEGACY::loadSymbol( LINE_READER& aReader )
|
|||||||
|
|
||||||
|
|
||||||
std::shared_ptr<BUS_ALIAS> SCH_IO_KICAD_LEGACY::loadBusAlias( LINE_READER& aReader,
|
std::shared_ptr<BUS_ALIAS> SCH_IO_KICAD_LEGACY::loadBusAlias( LINE_READER& aReader,
|
||||||
SCH_SCREEN* aScreen )
|
SCH_SCREEN* aScreen )
|
||||||
{
|
{
|
||||||
auto busAlias = std::make_shared<BUS_ALIAS>( aScreen );
|
auto busAlias = std::make_shared<BUS_ALIAS>( aScreen );
|
||||||
const char* line = aReader.Line();
|
const char* line = aReader.Line();
|
||||||
@ -1453,8 +1453,8 @@ std::shared_ptr<BUS_ALIAS> SCH_IO_KICAD_LEGACY::loadBusAlias( LINE_READER& aRead
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_LEGACY::SaveSchematicFile( const wxString& aFileName, SCH_SHEET* aSheet,
|
void SCH_IO_KICAD_LEGACY::SaveSchematicFile( const wxString& aFileName, SCH_SHEET* aSheet,
|
||||||
SCHEMATIC* aSchematic,
|
SCHEMATIC* aSchematic,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aSheet != nullptr, "NULL SCH_SHEET object." );
|
wxCHECK_RET( aSheet != nullptr, "NULL SCH_SHEET object." );
|
||||||
wxCHECK_RET( !aFileName.IsEmpty(), "No schematic file name defined." );
|
wxCHECK_RET( !aFileName.IsEmpty(), "No schematic file name defined." );
|
||||||
@ -1629,9 +1629,9 @@ void SCH_IO_KICAD_LEGACY::saveSymbol( SCH_SYMBOL* aSymbol )
|
|||||||
static wxString delimiters( wxT( " " ) );
|
static wxString delimiters( wxT( " " ) );
|
||||||
|
|
||||||
// This is redundant with the AR entries below, but it makes the files backwards-compatible.
|
// This is redundant with the AR entries below, but it makes the files backwards-compatible.
|
||||||
if( aSymbol->GetInstanceReferences().size() > 0 )
|
if( aSymbol->GetInstances().size() > 0 )
|
||||||
{
|
{
|
||||||
const SCH_SYMBOL_INSTANCE& instance = aSymbol->GetInstanceReferences()[0];
|
const SCH_SYMBOL_INSTANCE& instance = aSymbol->GetInstances()[0];
|
||||||
name1 = toUTFTildaText( instance.m_Reference );
|
name1 = toUTFTildaText( instance.m_Reference );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1672,9 +1672,9 @@ void SCH_IO_KICAD_LEGACY::saveSymbol( SCH_SYMBOL* aSymbol )
|
|||||||
* the reference inf is already saved
|
* the reference inf is already saved
|
||||||
* this is useful for old Eeschema version compatibility
|
* this is useful for old Eeschema version compatibility
|
||||||
*/
|
*/
|
||||||
if( aSymbol->GetInstanceReferences().size() > 1 )
|
if( aSymbol->GetInstances().size() > 1 )
|
||||||
{
|
{
|
||||||
for( const SCH_SYMBOL_INSTANCE& instance : aSymbol->GetInstanceReferences() )
|
for( const SCH_SYMBOL_INSTANCE& instance : aSymbol->GetInstances() )
|
||||||
{
|
{
|
||||||
/*format:
|
/*format:
|
||||||
* AR Path="/140/2" Ref="C99" Part="1"
|
* AR Path="/140/2" Ref="C99" Part="1"
|
||||||
@ -2048,7 +2048,8 @@ void SCH_IO_KICAD_LEGACY::saveBusAlias( std::shared_ptr<BUS_ALIAS> aAlias )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_LEGACY::cacheLib( const wxString& aLibraryFileName, const STRING_UTF8_MAP* aProperties )
|
void SCH_IO_KICAD_LEGACY::cacheLib( const wxString& aLibraryFileName,
|
||||||
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
if( !m_cache || !m_cache->IsFile( aLibraryFileName ) || m_cache->IsFileChanged() )
|
if( !m_cache || !m_cache->IsFile( aLibraryFileName ) || m_cache->IsFileChanged() )
|
||||||
{
|
{
|
||||||
@ -2090,8 +2091,8 @@ int SCH_IO_KICAD_LEGACY::GetModifyHash() const
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_LEGACY::EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
void SCH_IO_KICAD_LEGACY::EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
@ -2111,7 +2112,7 @@ void SCH_IO_KICAD_LEGACY::EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_LEGACY::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
void SCH_IO_KICAD_LEGACY::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
@ -2132,8 +2133,8 @@ void SCH_IO_KICAD_LEGACY::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolL
|
|||||||
|
|
||||||
|
|
||||||
LIB_SYMBOL* SCH_IO_KICAD_LEGACY::LoadSymbol( const wxString& aLibraryPath,
|
LIB_SYMBOL* SCH_IO_KICAD_LEGACY::LoadSymbol( const wxString& aLibraryPath,
|
||||||
const wxString& aSymbolName,
|
const wxString& aSymbolName,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
@ -2149,7 +2150,7 @@ LIB_SYMBOL* SCH_IO_KICAD_LEGACY::LoadSymbol( const wxString& aLibraryPath,
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_LEGACY::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
void SCH_IO_KICAD_LEGACY::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
@ -2163,7 +2164,7 @@ void SCH_IO_KICAD_LEGACY::SaveSymbol( const wxString& aLibraryPath, const LIB_SY
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_LEGACY::DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
void SCH_IO_KICAD_LEGACY::DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
@ -2221,7 +2222,8 @@ bool SCH_IO_KICAD_LEGACY::DeleteLibrary( const wxString& aLibraryPath,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_LEGACY::SaveLibrary( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
void SCH_IO_KICAD_LEGACY::SaveLibrary( const wxString& aLibraryPath,
|
||||||
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
if( !m_cache )
|
if( !m_cache )
|
||||||
m_cache = new SCH_IO_KICAD_LEGACY_LIB_CACHE( aLibraryPath );
|
m_cache = new SCH_IO_KICAD_LEGACY_LIB_CACHE( aLibraryPath );
|
||||||
|
@ -313,7 +313,8 @@ void SCH_IO_KICAD_SEXPR::loadFile( const wxString& aFileName, SCH_SHEET* aSheet
|
|||||||
reader.Rewind();
|
reader.Rewind();
|
||||||
}
|
}
|
||||||
|
|
||||||
SCH_IO_KICAD_SEXPR_PARSER parser( &reader, m_progressReporter, lineCount, m_rootSheet, m_appending );
|
SCH_IO_KICAD_SEXPR_PARSER parser( &reader, m_progressReporter, lineCount, m_rootSheet,
|
||||||
|
m_appending );
|
||||||
|
|
||||||
parser.ParseSchematic( aSheet );
|
parser.ParseSchematic( aSheet );
|
||||||
}
|
}
|
||||||
@ -503,8 +504,8 @@ void SCH_IO_KICAD_SEXPR::Format( SCH_SHEET* aSheet )
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_SEXPR::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSelectionPath,
|
void SCH_IO_KICAD_SEXPR::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSelectionPath,
|
||||||
SCHEMATIC& aSchematic, OUTPUTFORMATTER* aFormatter,
|
SCHEMATIC& aSchematic, OUTPUTFORMATTER* aFormatter,
|
||||||
bool aForClipboard )
|
bool aForClipboard )
|
||||||
{
|
{
|
||||||
wxCHECK( aSelection && aSelectionPath && aFormatter, /* void */ );
|
wxCHECK( aSelection && aSelectionPath && aFormatter, /* void */ );
|
||||||
|
|
||||||
@ -548,7 +549,8 @@ void SCH_IO_KICAD_SEXPR::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSele
|
|||||||
m_out->Print( 0, "(lib_symbols\n" );
|
m_out->Print( 0, "(lib_symbols\n" );
|
||||||
|
|
||||||
for( const std::pair<const wxString, LIB_SYMBOL*>& libSymbol : libSymbols )
|
for( const std::pair<const wxString, LIB_SYMBOL*>& libSymbol : libSymbols )
|
||||||
SCH_IO_KICAD_SEXPR_LIB_CACHE::SaveSymbol( libSymbol.second, *m_out, 1, libSymbol.first );
|
SCH_IO_KICAD_SEXPR_LIB_CACHE::SaveSymbol( libSymbol.second, *m_out, 1,
|
||||||
|
libSymbol.first );
|
||||||
|
|
||||||
m_out->Print( 0, ")\n\n" );
|
m_out->Print( 0, ")\n\n" );
|
||||||
}
|
}
|
||||||
@ -613,8 +615,8 @@ void SCH_IO_KICAD_SEXPR::Format( EE_SELECTION* aSelection, SCH_SHEET_PATH* aSele
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSchematic,
|
void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSchematic,
|
||||||
int aNestLevel, bool aForClipboard,
|
int aNestLevel, bool aForClipboard,
|
||||||
const SCH_SHEET_PATH* aRelativePath )
|
const SCH_SHEET_PATH* aRelativePath )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aSymbol != nullptr && m_out != nullptr, "" );
|
wxCHECK_RET( aSymbol != nullptr && m_out != nullptr, "" );
|
||||||
|
|
||||||
@ -680,9 +682,9 @@ void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSche
|
|||||||
|
|
||||||
// The symbol unit is always set to the first instance regardless of the current sheet
|
// The symbol unit is always set to the first instance regardless of the current sheet
|
||||||
// instance to prevent file churn.
|
// instance to prevent file churn.
|
||||||
int unit = ( aSymbol->GetInstanceReferences().size() == 0 ) ?
|
int unit = ( aSymbol->GetInstances().size() == 0 ) ?
|
||||||
aSymbol->GetUnit() :
|
aSymbol->GetUnit() :
|
||||||
aSymbol->GetInstanceReferences()[0].m_Unit;
|
aSymbol->GetInstances()[0].m_Unit;
|
||||||
|
|
||||||
if( aForClipboard && aRelativePath )
|
if( aForClipboard && aRelativePath )
|
||||||
{
|
{
|
||||||
@ -719,13 +721,13 @@ void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSche
|
|||||||
int id = field.GetId();
|
int id = field.GetId();
|
||||||
wxString value = field.GetText();
|
wxString value = field.GetText();
|
||||||
|
|
||||||
if( !aForClipboard && aSymbol->GetInstanceReferences().size() )
|
if( !aForClipboard && aSymbol->GetInstances().size() )
|
||||||
{
|
{
|
||||||
// The instance fields are always set to the default instance regardless of the
|
// The instance fields are always set to the default instance regardless of the
|
||||||
// sheet instance to prevent file churn.
|
// sheet instance to prevent file churn.
|
||||||
if( id == REFERENCE_FIELD )
|
if( id == REFERENCE_FIELD )
|
||||||
{
|
{
|
||||||
field.SetText( aSymbol->GetInstanceReferences()[0].m_Reference );
|
field.SetText( aSymbol->GetInstances()[0].m_Reference );
|
||||||
}
|
}
|
||||||
else if( id == VALUE_FIELD )
|
else if( id == VALUE_FIELD )
|
||||||
{
|
{
|
||||||
@ -736,7 +738,7 @@ void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSche
|
|||||||
field.SetText( aSymbol->GetField( FOOTPRINT_FIELD )->GetText() );
|
field.SetText( aSymbol->GetField( FOOTPRINT_FIELD )->GetText() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( aForClipboard && aSymbol->GetInstanceReferences().size() && aRelativePath
|
else if( aForClipboard && aSymbol->GetInstances().size() && aRelativePath
|
||||||
&& ( id == REFERENCE_FIELD ) )
|
&& ( id == REFERENCE_FIELD ) )
|
||||||
{
|
{
|
||||||
SCH_SYMBOL_INSTANCE instance;
|
SCH_SYMBOL_INSTANCE instance;
|
||||||
@ -779,7 +781,7 @@ void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSche
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if( !aSymbol->GetInstanceReferences().empty() )
|
if( !aSymbol->GetInstances().empty() )
|
||||||
{
|
{
|
||||||
m_out->Print( aNestLevel + 1, "(instances\n" );
|
m_out->Print( aNestLevel + 1, "(instances\n" );
|
||||||
|
|
||||||
@ -788,10 +790,10 @@ void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSche
|
|||||||
SCH_SHEET_LIST fullHierarchy = aSchematic.GetSheets();
|
SCH_SHEET_LIST fullHierarchy = aSchematic.GetSheets();
|
||||||
bool project_open = false;
|
bool project_open = false;
|
||||||
|
|
||||||
for( size_t i = 0; i < aSymbol->GetInstanceReferences().size(); i++ )
|
for( size_t i = 0; i < aSymbol->GetInstances().size(); i++ )
|
||||||
{
|
{
|
||||||
// Zero length KIID_PATH objects are not valid and will cause a crash below.
|
// Zero length KIID_PATH objects are not valid and will cause a crash below.
|
||||||
wxCHECK2( aSymbol->GetInstanceReferences()[i].m_Path.size(), continue );
|
wxCHECK2( aSymbol->GetInstances()[i].m_Path.size(), continue );
|
||||||
|
|
||||||
// If the instance data is part of this design but no longer has an associated sheet
|
// If the instance data is part of this design but no longer has an associated sheet
|
||||||
// path, don't save it. This prevents large amounts of orphaned instance data for the
|
// path, don't save it. This prevents large amounts of orphaned instance data for the
|
||||||
@ -799,11 +801,11 @@ void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSche
|
|||||||
//
|
//
|
||||||
// Keep all instance data when copying to the clipboard. It may be needed on paste.
|
// Keep all instance data when copying to the clipboard. It may be needed on paste.
|
||||||
if( !aForClipboard
|
if( !aForClipboard
|
||||||
&& ( aSymbol->GetInstanceReferences()[i].m_Path[0] == rootSheetUuid )
|
&& ( aSymbol->GetInstances()[i].m_Path[0] == rootSheetUuid )
|
||||||
&& !fullHierarchy.GetSheetPathByKIIDPath( aSymbol->GetInstanceReferences()[i].m_Path ) )
|
&& !fullHierarchy.GetSheetPathByKIIDPath( aSymbol->GetInstances()[i].m_Path ) )
|
||||||
{
|
{
|
||||||
if( project_open && ( ( i + 1 == aSymbol->GetInstanceReferences().size() )
|
if( project_open && ( ( i + 1 == aSymbol->GetInstances().size() )
|
||||||
|| lastProjectUuid != aSymbol->GetInstanceReferences()[i+1].m_Path[0] ) )
|
|| lastProjectUuid != aSymbol->GetInstances()[i+1].m_Path[0] ) )
|
||||||
{
|
{
|
||||||
m_out->Print( aNestLevel + 2, ")\n" ); // Closes `project`.
|
m_out->Print( aNestLevel + 2, ")\n" ); // Closes `project`.
|
||||||
project_open = false;
|
project_open = false;
|
||||||
@ -812,23 +814,23 @@ void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSche
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( lastProjectUuid != aSymbol->GetInstanceReferences()[i].m_Path[0] )
|
if( lastProjectUuid != aSymbol->GetInstances()[i].m_Path[0] )
|
||||||
{
|
{
|
||||||
wxString projectName;
|
wxString projectName;
|
||||||
|
|
||||||
if( aSymbol->GetInstanceReferences()[i].m_Path[0] == rootSheetUuid )
|
if( aSymbol->GetInstances()[i].m_Path[0] == rootSheetUuid )
|
||||||
projectName = aSchematic.Prj().GetProjectName();
|
projectName = aSchematic.Prj().GetProjectName();
|
||||||
else
|
else
|
||||||
projectName = aSymbol->GetInstanceReferences()[i].m_ProjectName;
|
projectName = aSymbol->GetInstances()[i].m_ProjectName;
|
||||||
|
|
||||||
lastProjectUuid = aSymbol->GetInstanceReferences()[i].m_Path[0];
|
lastProjectUuid = aSymbol->GetInstances()[i].m_Path[0];
|
||||||
m_out->Print( aNestLevel + 2, "(project %s\n",
|
m_out->Print( aNestLevel + 2, "(project %s\n",
|
||||||
m_out->Quotew( projectName ).c_str() );
|
m_out->Quotew( projectName ).c_str() );
|
||||||
project_open = true;
|
project_open = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString path;
|
wxString path;
|
||||||
KIID_PATH tmp = aSymbol->GetInstanceReferences()[i].m_Path;
|
KIID_PATH tmp = aSymbol->GetInstances()[i].m_Path;
|
||||||
|
|
||||||
if( aForClipboard && aRelativePath )
|
if( aForClipboard && aRelativePath )
|
||||||
tmp.MakeRelativeTo( aRelativePath->Path() );
|
tmp.MakeRelativeTo( aRelativePath->Path() );
|
||||||
@ -838,12 +840,12 @@ void SCH_IO_KICAD_SEXPR::saveSymbol( SCH_SYMBOL* aSymbol, const SCHEMATIC& aSche
|
|||||||
m_out->Print( aNestLevel + 3, "(path %s\n",
|
m_out->Print( aNestLevel + 3, "(path %s\n",
|
||||||
m_out->Quotew( path ).c_str() );
|
m_out->Quotew( path ).c_str() );
|
||||||
m_out->Print( aNestLevel + 4, "(reference %s) (unit %d)\n",
|
m_out->Print( aNestLevel + 4, "(reference %s) (unit %d)\n",
|
||||||
m_out->Quotew( aSymbol->GetInstanceReferences()[i].m_Reference ).c_str(),
|
m_out->Quotew( aSymbol->GetInstances()[i].m_Reference ).c_str(),
|
||||||
aSymbol->GetInstanceReferences()[i].m_Unit );
|
aSymbol->GetInstances()[i].m_Unit );
|
||||||
m_out->Print( aNestLevel + 3, ")\n" );
|
m_out->Print( aNestLevel + 3, ")\n" );
|
||||||
|
|
||||||
if( project_open && ( ( i + 1 == aSymbol->GetInstanceReferences().size() )
|
if( project_open && ( ( i + 1 == aSymbol->GetInstances().size() )
|
||||||
|| lastProjectUuid != aSymbol->GetInstanceReferences()[i+1].m_Path[0] ) )
|
|| lastProjectUuid != aSymbol->GetInstances()[i+1].m_Path[0] ) )
|
||||||
{
|
{
|
||||||
m_out->Print( aNestLevel + 2, ")\n" ); // Closes `project`.
|
m_out->Print( aNestLevel + 2, ")\n" ); // Closes `project`.
|
||||||
project_open = false;
|
project_open = false;
|
||||||
@ -1383,7 +1385,7 @@ void SCH_IO_KICAD_SEXPR::saveBusAlias( std::shared_ptr<BUS_ALIAS> aAlias, int aN
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_SEXPR::saveInstances( const std::vector<SCH_SHEET_INSTANCE>& aInstances,
|
void SCH_IO_KICAD_SEXPR::saveInstances( const std::vector<SCH_SHEET_INSTANCE>& aInstances,
|
||||||
int aNestLevel )
|
int aNestLevel )
|
||||||
{
|
{
|
||||||
if( aInstances.size() )
|
if( aInstances.size() )
|
||||||
{
|
{
|
||||||
@ -1408,7 +1410,7 @@ void SCH_IO_KICAD_SEXPR::saveInstances( const std::vector<SCH_SHEET_INSTANCE>& a
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_SEXPR::cacheLib( const wxString& aLibraryFileName,
|
void SCH_IO_KICAD_SEXPR::cacheLib( const wxString& aLibraryFileName,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
if( !m_cache || !m_cache->IsFile( aLibraryFileName ) || m_cache->IsFileChanged() )
|
if( !m_cache || !m_cache->IsFile( aLibraryFileName ) || m_cache->IsFileChanged() )
|
||||||
{
|
{
|
||||||
@ -1439,8 +1441,8 @@ int SCH_IO_KICAD_SEXPR::GetModifyHash() const
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_SEXPR::EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
void SCH_IO_KICAD_SEXPR::EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
@ -1460,8 +1462,8 @@ void SCH_IO_KICAD_SEXPR::EnumerateSymbolLib( wxArrayString& aSymbolNameList,
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_SEXPR::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
void SCH_IO_KICAD_SEXPR::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolList,
|
||||||
const wxString& aLibraryPath,
|
const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
@ -1480,8 +1482,9 @@ void SCH_IO_KICAD_SEXPR::EnumerateSymbolLib( std::vector<LIB_SYMBOL*>& aSymbolLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
LIB_SYMBOL* SCH_IO_KICAD_SEXPR::LoadSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
LIB_SYMBOL* SCH_IO_KICAD_SEXPR::LoadSymbol( const wxString& aLibraryPath,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const wxString& aSymbolName,
|
||||||
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
@ -1508,7 +1511,7 @@ LIB_SYMBOL* SCH_IO_KICAD_SEXPR::LoadSymbol( const wxString& aLibraryPath, const
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_SEXPR::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
void SCH_IO_KICAD_SEXPR::SaveSymbol( const wxString& aLibraryPath, const LIB_SYMBOL* aSymbol,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
@ -1522,7 +1525,7 @@ void SCH_IO_KICAD_SEXPR::SaveSymbol( const wxString& aLibraryPath, const LIB_SYM
|
|||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_SEXPR::DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
void SCH_IO_KICAD_SEXPR::DeleteSymbol( const wxString& aLibraryPath, const wxString& aSymbolName,
|
||||||
const STRING_UTF8_MAP* aProperties )
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
@ -1580,7 +1583,8 @@ bool SCH_IO_KICAD_SEXPR::DeleteLibrary( const wxString& aLibraryPath,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_IO_KICAD_SEXPR::SaveLibrary( const wxString& aLibraryPath, const STRING_UTF8_MAP* aProperties )
|
void SCH_IO_KICAD_SEXPR::SaveLibrary( const wxString& aLibraryPath,
|
||||||
|
const STRING_UTF8_MAP* aProperties )
|
||||||
{
|
{
|
||||||
if( !m_cache )
|
if( !m_cache )
|
||||||
m_cache = new SCH_IO_KICAD_SEXPR_LIB_CACHE( aLibraryPath );
|
m_cache = new SCH_IO_KICAD_SEXPR_LIB_CACHE( aLibraryPath );
|
||||||
@ -1643,8 +1647,8 @@ void SCH_IO_KICAD_SEXPR::GetDefaultSymbolFields( std::vector<wxString>& aNames )
|
|||||||
|
|
||||||
|
|
||||||
std::vector<LIB_SYMBOL*> SCH_IO_KICAD_SEXPR::ParseLibSymbols( std::string& aSymbolText,
|
std::vector<LIB_SYMBOL*> SCH_IO_KICAD_SEXPR::ParseLibSymbols( std::string& aSymbolText,
|
||||||
std::string aSource,
|
std::string aSource,
|
||||||
int aFileVersion )
|
int aFileVersion )
|
||||||
{
|
{
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
LIB_SYMBOL* newSymbol = nullptr;
|
LIB_SYMBOL* newSymbol = nullptr;
|
||||||
|
@ -1587,7 +1587,7 @@ void SCH_SCREEN::SetLegacySymbolInstanceData()
|
|||||||
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
SCH_SYMBOL* symbol = static_cast<SCH_SYMBOL*>( item );
|
||||||
|
|
||||||
// Add missing value and footprint instance data for legacy schematics.
|
// Add missing value and footprint instance data for legacy schematics.
|
||||||
for( const SCH_SYMBOL_INSTANCE& instance : symbol->GetInstanceReferences() )
|
for( const SCH_SYMBOL_INSTANCE& instance : symbol->GetInstances() )
|
||||||
{
|
{
|
||||||
symbol->AddHierarchicalReference( instance.m_Path, instance.m_Reference,
|
symbol->AddHierarchicalReference( instance.m_Path, instance.m_Reference,
|
||||||
instance.m_Unit );
|
instance.m_Unit );
|
||||||
@ -1655,7 +1655,7 @@ void SCH_SCREEN::PruneOrphanedSymbolInstances( const wxString& aProjectName,
|
|||||||
wxCHECK2( symbol, continue );
|
wxCHECK2( symbol, continue );
|
||||||
|
|
||||||
std::set<KIID_PATH> pathsToPrune;
|
std::set<KIID_PATH> pathsToPrune;
|
||||||
const std::vector<SCH_SYMBOL_INSTANCE> instances = symbol->GetInstanceReferences();
|
const std::vector<SCH_SYMBOL_INSTANCE> instances = symbol->GetInstances();
|
||||||
|
|
||||||
for( const SCH_SYMBOL_INSTANCE& instance : instances )
|
for( const SCH_SYMBOL_INSTANCE& instance : instances )
|
||||||
{
|
{
|
||||||
|
@ -474,7 +474,6 @@ bool SCH_SHEET_PATH::TestForRecursion( const wxString& aSrcFileName, const wxStr
|
|||||||
if( destFn.IsRelative() )
|
if( destFn.IsRelative() )
|
||||||
destFn.MakeAbsolute( rootFn.GetPath() );
|
destFn.MakeAbsolute( rootFn.GetPath() );
|
||||||
|
|
||||||
|
|
||||||
// The source and destination sheet file names cannot be the same.
|
// The source and destination sheet file names cannot be the same.
|
||||||
if( srcFn == destFn )
|
if( srcFn == destFn )
|
||||||
{
|
{
|
||||||
@ -585,10 +584,10 @@ void SCH_SHEET_PATH::AddNewSymbolInstances( const SCH_SHEET_PATH& aPrefixSheetPa
|
|||||||
newSymbolInstance.m_Path = newSheetPath.Path();
|
newSymbolInstance.m_Path = newSheetPath.Path();
|
||||||
symbol->AddHierarchicalReference( newSymbolInstance );
|
symbol->AddHierarchicalReference( newSymbolInstance );
|
||||||
}
|
}
|
||||||
else if( !symbol->GetInstanceReferences().empty() )
|
else if( !symbol->GetInstances().empty() )
|
||||||
{
|
{
|
||||||
// Use the first symbol instance if any symbol instance data exists.
|
// Use the first symbol instance if any symbol instance data exists.
|
||||||
newSymbolInstance = symbol->GetInstanceReferences()[0];
|
newSymbolInstance = symbol->GetInstances()[0];
|
||||||
newSymbolInstance.m_Path = newSheetPath.Path();
|
newSymbolInstance.m_Path = newSheetPath.Path();
|
||||||
symbol->AddHierarchicalReference( newSymbolInstance );
|
symbol->AddHierarchicalReference( newSymbolInstance );
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool IsMissingLibSymbol() const;
|
bool IsMissingLibSymbol() const;
|
||||||
|
|
||||||
const std::vector<SCH_SYMBOL_INSTANCE>& GetInstanceReferences() const
|
const std::vector<SCH_SYMBOL_INSTANCE>& GetInstances() const
|
||||||
{
|
{
|
||||||
return m_instanceReferences;
|
return m_instanceReferences;
|
||||||
}
|
}
|
||||||
|
@ -1534,7 +1534,7 @@ void SCH_EDITOR_CONTROL::setPastedSymbolInstances( SCH_SCREENS& aScreenList )
|
|||||||
|
|
||||||
wxCHECK2( symbol, continue );
|
wxCHECK2( symbol, continue );
|
||||||
|
|
||||||
for( const SCH_SYMBOL_INSTANCE& symbolInstance : symbol->GetInstanceReferences() )
|
for( const SCH_SYMBOL_INSTANCE& symbolInstance : symbol->GetInstances() )
|
||||||
{
|
{
|
||||||
KIID_PATH pathWithSymbol = symbolInstance.m_Path;
|
KIID_PATH pathWithSymbol = symbolInstance.m_Path;
|
||||||
|
|
||||||
@ -1558,7 +1558,7 @@ void SCH_EDITOR_CONTROL::prunePastedSymbolInstances()
|
|||||||
|
|
||||||
std::vector<KIID_PATH> instancePathsToRemove;
|
std::vector<KIID_PATH> instancePathsToRemove;
|
||||||
|
|
||||||
for( const SCH_SYMBOL_INSTANCE& instance : symbol->GetInstanceReferences() )
|
for( const SCH_SYMBOL_INSTANCE& instance : symbol->GetInstances() )
|
||||||
{
|
{
|
||||||
if( ( instance.m_ProjectName != m_frame->Prj().GetProjectName() )
|
if( ( instance.m_ProjectName != m_frame->Prj().GetProjectName() )
|
||||||
|| instance.m_Path.empty() )
|
|| instance.m_Path.empty() )
|
||||||
@ -2590,12 +2590,14 @@ void SCH_EDITOR_CONTROL::setTransitions()
|
|||||||
Go( &SCH_EDITOR_CONTROL::GridFeedback, EVENTS::GridChangedByKeyEvent );
|
Go( &SCH_EDITOR_CONTROL::GridFeedback, EVENTS::GridChangedByKeyEvent );
|
||||||
|
|
||||||
Go( &SCH_EDITOR_CONTROL::EditWithSymbolEditor, EE_ACTIONS::editWithLibEdit.MakeEvent() );
|
Go( &SCH_EDITOR_CONTROL::EditWithSymbolEditor, EE_ACTIONS::editWithLibEdit.MakeEvent() );
|
||||||
Go( &SCH_EDITOR_CONTROL::EditWithSymbolEditor, EE_ACTIONS::editLibSymbolWithLibEdit.MakeEvent() );
|
Go( &SCH_EDITOR_CONTROL::EditWithSymbolEditor,
|
||||||
|
EE_ACTIONS::editLibSymbolWithLibEdit.MakeEvent() );
|
||||||
Go( &SCH_EDITOR_CONTROL::ShowCvpcb, EE_ACTIONS::assignFootprints.MakeEvent() );
|
Go( &SCH_EDITOR_CONTROL::ShowCvpcb, EE_ACTIONS::assignFootprints.MakeEvent() );
|
||||||
Go( &SCH_EDITOR_CONTROL::ImportFPAssignments, EE_ACTIONS::importFPAssignments.MakeEvent() );
|
Go( &SCH_EDITOR_CONTROL::ImportFPAssignments, EE_ACTIONS::importFPAssignments.MakeEvent() );
|
||||||
Go( &SCH_EDITOR_CONTROL::Annotate, EE_ACTIONS::annotate.MakeEvent() );
|
Go( &SCH_EDITOR_CONTROL::Annotate, EE_ACTIONS::annotate.MakeEvent() );
|
||||||
Go( &SCH_EDITOR_CONTROL::EditSymbolFields, EE_ACTIONS::editSymbolFields.MakeEvent() );
|
Go( &SCH_EDITOR_CONTROL::EditSymbolFields, EE_ACTIONS::editSymbolFields.MakeEvent() );
|
||||||
Go( &SCH_EDITOR_CONTROL::EditSymbolLibraryLinks,EE_ACTIONS::editSymbolLibraryLinks.MakeEvent() );
|
Go( &SCH_EDITOR_CONTROL::EditSymbolLibraryLinks,
|
||||||
|
EE_ACTIONS::editSymbolLibraryLinks.MakeEvent() );
|
||||||
Go( &SCH_EDITOR_CONTROL::ShowPcbNew, EE_ACTIONS::showPcbNew.MakeEvent() );
|
Go( &SCH_EDITOR_CONTROL::ShowPcbNew, EE_ACTIONS::showPcbNew.MakeEvent() );
|
||||||
Go( &SCH_EDITOR_CONTROL::UpdatePCB, ACTIONS::updatePcbFromSchematic.MakeEvent() );
|
Go( &SCH_EDITOR_CONTROL::UpdatePCB, ACTIONS::updatePcbFromSchematic.MakeEvent() );
|
||||||
Go( &SCH_EDITOR_CONTROL::UpdateFromPCB, ACTIONS::updateSchematicFromPcb.MakeEvent() );
|
Go( &SCH_EDITOR_CONTROL::UpdateFromPCB, ACTIONS::updateSchematicFromPcb.MakeEvent() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user