Perform a slightly more aggressive cleanup.

Also removes the functionality that selects the newly-added item as
we don't do that with any of the other drawing tools.

Fixes https://gitlab.com/kicad/code/kicad/issues/7833
This commit is contained in:
Jeff Young 2021-03-09 21:24:03 +00:00
parent b47453a93b
commit 8be3ff5a0a
4 changed files with 14 additions and 12 deletions

View File

@ -1286,7 +1286,7 @@ void SCH_EDIT_FRAME::RecalculateConnections( SCH_CLEANUP_FLAGS aCleanupFlags )
}
else if( aCleanupFlags == GLOBAL_CLEANUP )
{
for( const auto& sheet : list )
for( const SCH_SHEET_PATH& sheet : list )
SchematicCleanUp( sheet.LastScreen() );
}

View File

@ -665,9 +665,10 @@ TOOL_ACTION EE_ACTIONS::hypertextCommand( "eeschema.NavigateTool.hypertextComman
// SCH_LINE_WIRE_BUS_TOOL
//
TOOL_ACTION EE_ACTIONS::addNeededJunctions(
"eeschema.InteractiveDrawingLineWireBus.addNeededJunctions", AS_ACTIVE, 0, "",
_( "Add Junctions to Selection where needed" ), "", nullptr, AF_ACTIVATE );
TOOL_ACTION EE_ACTIONS::addNeededJunctions( "eeschema.InteractiveDrawingLineWireBus.addNeededJunctions",
AS_ACTIVE, 0, "",
_( "Add Junctions to Selection where needed" ), "",
nullptr, AF_ACTIVATE );
const DRAW_SEGMENT_EVENT_PARAMS drawWireActionParam = { LAYER_WIRE, false };

View File

@ -949,15 +949,12 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
newItem->Move( wxPoint( Mils2iu( cfg->m_Drawing.default_repeat_offset_x ),
Mils2iu( cfg->m_Drawing.default_repeat_offset_y ) ) );
}
}
newItem->SetFlags( IS_NEW );
m_frame->AddToScreen( newItem, m_frame->GetScreen() );
m_frame->SaveCopyInUndoList( m_frame->GetScreen(), newItem, UNDO_REDO::NEWITEM, false );
m_selectionTool->AddItemToSel( newItem );
// Components need to be handled by the move tool. The move tool will handle schematic
// cleanup routines
if( performDrag )
@ -967,15 +964,19 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
if( !performDrag && newItem->IsConnectable() )
{
EE_SELECTION new_sel = m_selectionTool->GetSelection();
EE_SELECTION new_sel;
new_sel.Add( newItem );
m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &new_sel );
m_frame->SchematicCleanUp();
m_frame->RecalculateConnections( LOCAL_CLEANUP );
m_frame->TestDanglingEnds();
}
// newItem newItem, now that it has been moved, thus saving new position.
m_frame->GetCanvas()->Refresh();
m_frame->OnModify();
// Save newItem at the new position.
m_frame->SaveCopyForRepeatItem( newItem );
return 0;

View File

@ -470,7 +470,7 @@ int SCH_MOVE_TOOL::Main( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &selectionCopy );
m_frame->SchematicCleanUp();
m_frame->RecalculateConnections( LOCAL_CLEANUP );
m_frame->TestDanglingEnds();
m_frame->OnModify();
@ -843,7 +843,7 @@ int SCH_MOVE_TOOL::AlignElements( const TOOL_EVENT& aEvent )
m_toolMgr->PostEvent( EVENTS::SelectedItemsMoved );
m_toolMgr->RunAction( EE_ACTIONS::addNeededJunctions, true, &selection );
m_frame->SchematicCleanUp();
m_frame->RecalculateConnections( LOCAL_CLEANUP );
m_frame->TestDanglingEnds();
m_frame->OnModify();