From 4e2e280bf48021f326e0c4373bde706d9f72a22d Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 19 May 2020 13:24:57 -0400 Subject: [PATCH] Fix part adding --- eeschema/sch_edit_frame.cpp | 1 + eeschema/tools/lib_control.cpp | 2 ++ eeschema/tools/sch_drawing_tools.cpp | 1 + 3 files changed, 4 insertions(+) diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 2418798546..b76782d7f9 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -420,6 +420,7 @@ void SCH_EDIT_FRAME::CreateScreens() m_schematic->SetRoot( new SCH_SHEET( m_schematic ) ); SCH_SCREEN* rootScreen = new SCH_SCREEN( &Kiway() ); + rootScreen->SetParent( m_schematic ); rootScreen->SetMaxUndoItems( m_UndoRedoCountMax ); m_schematic->Root().SetScreen( rootScreen ); SetScreen( Schematic().RootScreen() ); diff --git a/eeschema/tools/lib_control.cpp b/eeschema/tools/lib_control.cpp index 69407fd659..da14841db5 100644 --- a/eeschema/tools/lib_control.cpp +++ b/eeschema/tools/lib_control.cpp @@ -445,6 +445,8 @@ int LIB_CONTROL::AddSymbolToSchematic( const TOOL_EVENT& aEvent ) SCH_COMPONENT* comp = new SCH_COMPONENT( *part, libId, &schframe->GetCurrentSheet(), unit, convert ); + comp->SetParent( schframe->GetCurrentSheet().LastScreen() ); + if( schframe->eeconfig()->m_AutoplaceFields.enable ) comp->AutoplaceFields( /* aScreen */ nullptr, /* aManual */ false ); diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index 54df760162..2036d8147a 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -176,6 +176,7 @@ int SCH_DRAWING_TOOLS::PlaceComponent( const TOOL_EVENT& aEvent ) component = new SCH_COMPONENT( *part, &m_frame->GetCurrentSheet(), sel, (wxPoint) cursorPos ); + component->SetParent( m_frame->GetCurrentSheet().LastScreen() ); component->SetFlags( IS_NEW | IS_MOVED ); if( m_frame->eeconfig()->m_AutoplaceFields.enable )