Push current sheet handling to SCHEMATIC

Fixes https://gitlab.com/kicad/code/kicad/-/issues/4803
This commit is contained in:
Jon Evans 2020-07-04 20:48:55 -04:00
parent 06599d8d46
commit 04a51a5ba4
3 changed files with 3 additions and 5 deletions

View File

@ -340,8 +340,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
{ {
Schematic().SetRoot( pi->Load( fullFileName, &Schematic() ) ); Schematic().SetRoot( pi->Load( fullFileName, &Schematic() ) );
GetCurrentSheet().push_back( &Schematic().Root() );
if( !pi->GetError().IsEmpty() ) if( !pi->GetError().IsEmpty() )
{ {
DisplayErrorMessage( this, DisplayErrorMessage( this,
@ -810,7 +808,6 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType )
newfilename.SetName( Prj().GetProjectName() ); newfilename.SetName( Prj().GetProjectName() );
newfilename.SetExt( LegacySchematicFileExtension ); newfilename.SetExt( LegacySchematicFileExtension );
GetCurrentSheet().push_back( &Schematic().Root() );
SetScreen( GetCurrentSheet().LastScreen() ); SetScreen( GetCurrentSheet().LastScreen() );
Schematic().Root().SetFileName( newfilename.GetFullPath() ); Schematic().Root().SetFileName( newfilename.GetFullPath() );

View File

@ -436,8 +436,6 @@ void SCH_EDIT_FRAME::CreateScreens()
m_schematic->RootScreen()->SetFileName( wxEmptyString ); m_schematic->RootScreen()->SetFileName( wxEmptyString );
GetCurrentSheet().push_back( &m_schematic->Root() );
if( GetScreen() == NULL ) if( GetScreen() == NULL )
{ {
SCH_SCREEN* screen = new SCH_SCREEN( m_schematic ); SCH_SCREEN* screen = new SCH_SCREEN( m_schematic );

View File

@ -115,6 +115,9 @@ void SCHEMATIC::SetRoot( SCH_SHEET* aRootSheet )
m_rootSheet = aRootSheet; m_rootSheet = aRootSheet;
m_currentSheet->clear();
m_currentSheet->push_back( m_rootSheet );
m_connectionGraph->Reset(); m_connectionGraph->Reset();
} }