From 1dc78c4adc6407a0d3885dd01025dfad0f48cabd Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 21 Dec 2021 23:02:33 +0000 Subject: [PATCH] Tidy up pad & parent footprint selection corner cases. Fixes https://gitlab.com/kicad/code/kicad/issues/9923 (cherry picked from commit d9dba2edb2a13b1bd5a6be6344adf033e98c199e) --- pcbnew/tools/edit_tool.cpp | 4 ++++ pcbnew/tools/pcb_selection_tool.cpp | 12 +++--------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 436ebfd575..f951885c07 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -699,6 +699,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference ) []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool ) { sTool->FilterCollectorForMarkers( aCollector ); + sTool->FilterCollectorForHierarchy( aCollector, true ); }, // Prompt user regarding locked items if in board editor and in free-pad-mode (if // we're not in free-pad mode we delay this until the second RequestSelection()). @@ -720,6 +721,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference ) []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool ) { sTool->FilterCollectorForMarkers( aCollector ); + sTool->FilterCollectorForHierarchy( aCollector, true ); sTool->FilterCollectorForFreePads( aCollector ); }, true /* prompt user regarding locked items */ ); @@ -1068,6 +1070,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference ) m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &orig_items ); editFrame->PopTool( tool ); + editFrame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW ); return restore_state ? -1 : 0; } @@ -1419,6 +1422,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent ) PCB_SELECTION& selection = m_selectionTool->RequestSelection( []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool ) { + sTool->FilterCollectorForHierarchy( aCollector, true ); sTool->FilterCollectorForMarkers( aCollector ); }, // Prompt user regarding locked items if in board editor and in free-pad-mode (if diff --git a/pcbnew/tools/pcb_selection_tool.cpp b/pcbnew/tools/pcb_selection_tool.cpp index 86a3770ec9..c85b118f61 100644 --- a/pcbnew/tools/pcb_selection_tool.cpp +++ b/pcbnew/tools/pcb_selection_tool.cpp @@ -551,9 +551,7 @@ PCB_SELECTION& PCB_SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aCl DISPOSITION disposition = itemDisposition.second; if( disposition == BEFORE ) - { unhighlight( item, SELECTED, &m_selection ); - } } for( std::pair itemDisposition : itemDispositions ) @@ -561,14 +559,10 @@ PCB_SELECTION& PCB_SELECTION_TOOL::RequestSelection( CLIENT_SELECTION_FILTER aCl BOARD_ITEM* item = static_cast( itemDisposition.first ); DISPOSITION disposition = itemDisposition.second; - if( disposition == AFTER ) - { + // Note that we must re-highlight even previously-highlighted items + // (ie: disposition BOTH) in case we removed any of their children. + if( disposition == AFTER || disposition == BOTH ) highlight( item, SELECTED, &m_selection ); - } - else if( disposition == BOTH ) - { - // nothing to do - } } m_frame->GetCanvas()->ForceRefresh();