Fix passing CLIENT_SELECTION_FILTER through the tool framework

This commit is contained in:
Ian McInerney 2023-06-16 21:15:29 +01:00
parent 480223f67c
commit 3c24ddd8cc
3 changed files with 17 additions and 7 deletions

View File

@ -2020,7 +2020,8 @@ void ROUTER_TOOL::performDragging( int aMode )
}
void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector,
PCB_SELECTION_TOOL* aSelTool )
{
/*
* If the collection contains a trivial line corner (two connected segments)
@ -2077,7 +2078,8 @@ void ROUTER_TOOL::NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECT
bool ROUTER_TOOL::CanInlineDrag( int aDragMode )
{
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, NeighboringSegmentFilter );
m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( PCB_ACTIONS::selectionCursor, true,
NeighboringSegmentFilter );
const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
if( selection.Size() == 1 )
@ -2105,7 +2107,10 @@ int ROUTER_TOOL::InlineDrag( const TOOL_EVENT& aEvent )
const PCB_SELECTION& selection = m_toolMgr->GetTool<PCB_SELECTION_TOOL>()->GetSelection();
if( selection.Empty() )
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, NeighboringSegmentFilter );
{
m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( PCB_ACTIONS::selectionCursor, true,
NeighboringSegmentFilter );
}
if( selection.Size() != 1 )
return 0;

View File

@ -25,6 +25,8 @@
#include "pns_tool_base.h"
class PCB_SELECTION_TOOL;
class APIEXPORT ROUTER_TOOL : public PNS::TOOL_BASE
{
public:
@ -62,7 +64,8 @@ public:
// A filter for narrowing a collection representing a simple corner
// or a non-fanout-via to a single PCB_TRACK item.
static void NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector );
static void NeighboringSegmentFilter( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector,
PCB_SELECTION_TOOL* aSelTool );
void UpdateMessagePanel();

View File

@ -1757,12 +1757,14 @@ int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
PCB_SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<PCB_SELECTION_TOOL>();
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true, EDIT_TOOL::PadFilter );
m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( PCB_ACTIONS::selectionCursor, true,
EDIT_TOOL::PadFilter );
PCB_SELECTION& selection = selectionTool->GetSelection();
if( selection.Empty() )
{
m_toolMgr->RunAction( PCB_ACTIONS::selectionCursor, true,
m_toolMgr->RunAction<CLIENT_SELECTION_FILTER>( PCB_ACTIONS::selectionCursor, true,
EDIT_TOOL::FootprintFilter );
selection = selectionTool->GetSelection();
}