From 17bb57cc738ceb8c9807f8410cac0db1dee2facb Mon Sep 17 00:00:00 2001 From: Mike Williams Date: Wed, 30 Nov 2022 09:11:03 -0500 Subject: [PATCH] PCB: fix stale ratsnest between moves in Move Individually --- pcbnew/tools/edit_tool.cpp | 8 ++++++++ pcbnew/tools/edit_tool.h | 3 +++ pcbnew/tools/edit_tool_move_fct.cpp | 2 ++ 3 files changed, 13 insertions(+) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index af6be99c81..63bcf6eb46 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -2545,6 +2545,14 @@ int EDIT_TOOL::cutToClipboard( const TOOL_EVENT& aEvent ) } +void EDIT_TOOL::rebuildConnectivity() +{ + board()->BuildConnectivity(); + m_toolMgr->PostEvent( EVENTS::ConnectivityChangedEvent ); + canvas()->RedrawRatsnest(); +} + + void EDIT_TOOL::setTransitions() { Go( &EDIT_TOOL::GetAndPlace, PCB_ACTIONS::getAndPlace.MakeEvent() ); diff --git a/pcbnew/tools/edit_tool.h b/pcbnew/tools/edit_tool.h index 42f14b8771..0ce86be8cb 100644 --- a/pcbnew/tools/edit_tool.h +++ b/pcbnew/tools/edit_tool.h @@ -200,6 +200,9 @@ private: bool pickReferencePoint( const wxString& aTooltip, const wxString& aSuccessMessage, const wxString& aCanceledMessage, VECTOR2I& aReferencePoint ); + ///< Rebuilds the ratsnest for operations that require it outside the commit rebuild + void rebuildConnectivity(); + private: PCB_SELECTION_TOOL* m_selectionTool; std::unique_ptr m_commit; diff --git a/pcbnew/tools/edit_tool_move_fct.cpp b/pcbnew/tools/edit_tool_move_fct.cpp index 886c728ac1..9bedc8ac55 100644 --- a/pcbnew/tools/edit_tool_move_fct.cpp +++ b/pcbnew/tools/edit_tool_move_fct.cpp @@ -742,6 +742,8 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent ) if( isSkip ) orig_items[itemIdx]->SetPosition( originalPos ); + rebuildConnectivity(); + if( ++itemIdx < orig_items.size() ) { m_selectionTool->ClearSelection();