Fix yet another symbol instance issue when loading legacy schematics.
This commit is contained in:
parent
254dff2813
commit
f782323960
|
@ -431,7 +431,7 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
// Legacy schematic can have duplicate time stamps so fix that before converting
|
||||
// to the s-expression format.
|
||||
schematic.ReplaceDuplicateTimeStamps();
|
||||
schematic.SetLegacySymbolInstanceData();
|
||||
// schematic.SetLegacySymbolInstanceData();
|
||||
|
||||
// Allow the schematic to be saved to new file format without making any edits.
|
||||
OnModify();
|
||||
|
|
|
@ -679,12 +679,15 @@ void SCH_EDIT_FRAME::CreateScreens()
|
|||
m_schematic->Reset();
|
||||
m_schematic->SetProject( &Prj() );
|
||||
|
||||
m_schematic->SetRoot( new SCH_SHEET( m_schematic ) );
|
||||
SCH_SHEET* rootSheet = new SCH_SHEET( m_schematic );
|
||||
m_schematic->SetRoot( rootSheet );
|
||||
|
||||
SCH_SCREEN* rootScreen = new SCH_SCREEN( m_schematic );
|
||||
const_cast<KIID&>( rootSheet->m_Uuid ) = rootScreen->GetUuid();
|
||||
m_schematic->Root().SetScreen( rootScreen );
|
||||
SetScreen( Schematic().RootScreen() );
|
||||
|
||||
|
||||
m_schematic->RootScreen()->SetFileName( wxEmptyString );
|
||||
|
||||
// Don't leave root page number empty
|
||||
|
|
|
@ -194,6 +194,8 @@ void SCH_LEGACY_PLUGIN::loadHierarchy( SCH_SHEET* aSheet )
|
|||
{
|
||||
SCH_SCREEN* screen = nullptr;
|
||||
|
||||
m_currentSheet = aSheet;
|
||||
|
||||
if( !aSheet->GetScreen() )
|
||||
{
|
||||
// SCH_SCREEN objects store the full path and file name where the SCH_SHEET object only
|
||||
|
@ -226,6 +228,9 @@ void SCH_LEGACY_PLUGIN::loadHierarchy( SCH_SHEET* aSheet )
|
|||
aSheet->SetScreen( new SCH_SCREEN( m_schematic ) );
|
||||
aSheet->GetScreen()->SetFileName( fileName.GetFullPath() );
|
||||
|
||||
if( aSheet == m_rootSheet )
|
||||
const_cast<KIID&>( aSheet->m_Uuid ) = aSheet->GetScreen()->GetUuid();
|
||||
|
||||
try
|
||||
{
|
||||
loadFile( fileName.GetFullPath(), aSheet->GetScreen() );
|
||||
|
@ -1338,6 +1343,15 @@ SCH_SYMBOL* SCH_LEGACY_PLUGIN::loadSymbol( LINE_READER& aReader )
|
|||
}
|
||||
else if( strCompare( "$EndComp", line ) )
|
||||
{
|
||||
if( !m_appending && ( m_currentSheet == m_rootSheet ) )
|
||||
{
|
||||
KIID_PATH path;
|
||||
path.push_back( m_rootSheet->GetScreen()->GetUuid() );
|
||||
symbol->AddHierarchicalReference( path,
|
||||
symbol->GetField( REFERENCE_FIELD )->GetText(),
|
||||
symbol->GetUnit() );
|
||||
}
|
||||
|
||||
// Ensure all flags (some are set by previous initializations) are reset:
|
||||
symbol->ClearFlags();
|
||||
return symbol.release();
|
||||
|
|
|
@ -191,6 +191,7 @@ protected:
|
|||
wxString m_path; ///< Root project path for loading child sheets.
|
||||
std::stack<wxString> m_currentPath; ///< Stack to maintain nested sheet paths
|
||||
SCH_SHEET* m_rootSheet; ///< The root sheet of the schematic being loaded.
|
||||
SCH_SHEET* m_currentSheet; ///< The sheet currently being loaded.
|
||||
OUTPUTFORMATTER* m_out; ///< The formatter for saving SCH_SCREEN objects.
|
||||
SCH_LEGACY_PLUGIN_CACHE* m_cache;
|
||||
SCHEMATIC* m_schematic;
|
||||
|
|
Loading…
Reference in New Issue