From 0561ce903e15349ad79b7092ce7266be2386cecd Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 28 Mar 2021 20:04:58 +0100 Subject: [PATCH] Don't remove IS_MOVED flag too early. Fixes https://gitlab.com/kicad/code/kicad/issues/8056 --- eeschema/tools/sch_drawing_tools.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index cc0b492283..9ad3c641d7 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -119,15 +119,16 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent ) auto addSymbol = [&]( SCH_COMPONENT* aSymbol ) { - m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); - - aSymbol->SetParent( m_frame->GetScreen() ); - aSymbol->SetFlags( IS_NEW | IS_MOVED ); - m_frame->SaveCopyForRepeatItem( aSymbol ); - m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), aSymbol, false ); + m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_selectionTool->AddItemToSel( aSymbol ); + + aSymbol->SetParent( m_frame->GetScreen() ); + aSymbol->SetFlags( IS_NEW ); + m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), aSymbol, false ); + + aSymbol->SetFlags( IS_MOVED ); m_toolMgr->RunAction( ACTIONS::refreshPreview ); }; @@ -229,17 +230,19 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent ) } else { - SCH_COMPONENT* nextSymbol = nullptr; - if( m_frame->eeconfig()->m_AutoplaceFields.enable ) symbol->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false ); + symbol->ClearEditFlags(); + m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &m_selectionTool->GetSelection() ); m_view->Update( symbol ); m_frame->OnModify(); + SCH_COMPONENT* nextSymbol = nullptr; + if( m_frame->eeconfig()->m_SymChooserPanel.place_all_units || m_frame->eeconfig()->m_SymChooserPanel.keep_symbol ) {