From 04a51a5ba42076eb008030a7412583f517b8e7a6 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Sat, 4 Jul 2020 20:48:55 -0400 Subject: [PATCH] Push current sheet handling to SCHEMATIC Fixes https://gitlab.com/kicad/code/kicad/-/issues/4803 --- eeschema/files-io.cpp | 3 --- eeschema/sch_edit_frame.cpp | 2 -- eeschema/schematic.cpp | 3 +++ 3 files changed, 3 insertions(+), 5 deletions(-) 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(); }