Don't remove IS_MOVED flag too early.

Fixes https://gitlab.com/kicad/code/kicad/issues/8056
This commit is contained in:
Jeff Young 2021-03-28 20:04:58 +01:00
parent c32932a311
commit 0561ce903e
1 changed files with 11 additions and 8 deletions

View File

@ -119,15 +119,16 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
auto addSymbol = auto addSymbol =
[&]( SCH_COMPONENT* aSymbol ) [&]( 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->SaveCopyForRepeatItem( aSymbol );
m_frame->AddItemToScreenAndUndoList( m_frame->GetScreen(), aSymbol, false ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
m_selectionTool->AddItemToSel( aSymbol ); 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 ); m_toolMgr->RunAction( ACTIONS::refreshPreview );
}; };
@ -229,17 +230,19 @@ int SCH_DRAWING_TOOLS::PlaceSymbol( const TOOL_EVENT& aEvent )
} }
else else
{ {
SCH_COMPONENT* nextSymbol = nullptr;
if( m_frame->eeconfig()->m_AutoplaceFields.enable ) if( m_frame->eeconfig()->m_AutoplaceFields.enable )
symbol->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false ); symbol->AutoplaceFields( /* aScreen */ NULL, /* aManual */ false );
symbol->ClearEditFlags();
m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true,
&m_selectionTool->GetSelection() ); &m_selectionTool->GetSelection() );
m_view->Update( symbol ); m_view->Update( symbol );
m_frame->OnModify(); m_frame->OnModify();
SCH_COMPONENT* nextSymbol = nullptr;
if( m_frame->eeconfig()->m_SymChooserPanel.place_all_units if( m_frame->eeconfig()->m_SymChooserPanel.place_all_units
|| m_frame->eeconfig()->m_SymChooserPanel.keep_symbol ) || m_frame->eeconfig()->m_SymChooserPanel.keep_symbol )
{ {