diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index a3a99d3c4c..7779f258b7 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -340,8 +340,6 @@ bool SCH_EDIT_FRAME::OpenProjectFiles( const std::vector& aFileSet, in { Schematic().SetRoot( pi->Load( fullFileName, &Schematic() ) ); - GetCurrentSheet().push_back( &Schematic().Root() ); - if( !pi->GetError().IsEmpty() ) { DisplayErrorMessage( this, @@ -810,7 +808,6 @@ bool SCH_EDIT_FRAME::importFile( const wxString& aFileName, int aFileType ) newfilename.SetName( Prj().GetProjectName() ); newfilename.SetExt( LegacySchematicFileExtension ); - GetCurrentSheet().push_back( &Schematic().Root() ); SetScreen( GetCurrentSheet().LastScreen() ); Schematic().Root().SetFileName( newfilename.GetFullPath() ); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 42d263a793..257f9af0a2 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -436,8 +436,6 @@ void SCH_EDIT_FRAME::CreateScreens() m_schematic->RootScreen()->SetFileName( wxEmptyString ); - GetCurrentSheet().push_back( &m_schematic->Root() ); - if( GetScreen() == NULL ) { SCH_SCREEN* screen = new SCH_SCREEN( m_schematic ); diff --git a/eeschema/schematic.cpp b/eeschema/schematic.cpp index 3542c97257..b27df4a090 100644 --- a/eeschema/schematic.cpp +++ b/eeschema/schematic.cpp @@ -115,6 +115,9 @@ void SCHEMATIC::SetRoot( SCH_SHEET* aRootSheet ) m_rootSheet = aRootSheet; + m_currentSheet->clear(); + m_currentSheet->push_back( m_rootSheet ); + m_connectionGraph->Reset(); }