Convert selection vector to EDA_ITEMS for base tool call

The base tool expects a generic EDA_ITEMS, but the existing vector
doesn't easily cast, so add a temporary one.
This commit is contained in:
Ian McInerney 2023-06-16 22:28:15 +01:00
parent f899d9676f
commit f14feafc6b
6 changed files with 24 additions and 8 deletions

View File

@ -1553,7 +1553,9 @@ int DRAWING_TOOL::PlaceImportedGraphics( const TOOL_EVENT& aEvent )
// Clear the current selection then select the drawings so that edit tools work on them
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &selectedItems );
EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() );
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, true, &selItems );
m_frame->PushTool( aEvent );

View File

@ -2229,7 +2229,8 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
// Select the new items
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &new_items );
EDA_ITEMS nItems( new_items.begin(), new_items.end() );
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, true, &nItems );
// record the new items as added
if( !selection.Empty() )

View File

@ -816,7 +816,9 @@ int EDIT_TOOL::doMoveSelection( const TOOL_EVENT& aEvent, const wxString& aCommi
else
{
m_commit->Push( aCommitMessage );
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &orig_items );
EDA_ITEMS oItems( orig_items.begin(), orig_items.end() );
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, true, &oItems );
}
m_toolMgr->GetTool<DRAWING_TOOL>()->UpdateStatusBar();

View File

@ -357,7 +357,8 @@ int GROUP_TOOL::Ungroup( const TOOL_EVENT& aEvent )
}
}
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &members );
EDA_ITEMS mem( members.begin(), members.end() );
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, true, &mem );
m_toolMgr->PostEvent( EVENTS::SelectedItemsModified );
m_frame->OnModify();

View File

@ -1152,7 +1152,8 @@ int PCB_CONTROL::placeBoardItems( std::vector<BOARD_ITEM*>& aItems, bool aIsNew,
}
// Select the items that should be selected
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &itemsToSel );
EDA_ITEMS toSel( itemsToSel.begin(), itemsToSel.end() );
m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, true, &toSel );
// Reannotate duplicate footprints (make sense only in board editor )
if( aReannotateDuplicates && m_isBoardEditor )

View File

@ -116,7 +116,10 @@ void FOOTPRINT_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
if( selectedItems.size() )
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, true, &selectedItems );
{
EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() );
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, true, &selItems );
}
m_frame->GetCanvas()->Refresh( false );
}
@ -202,7 +205,10 @@ void ZONE_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
if( selectedItems.size() )
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, true, &selectedItems );
{
EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() );
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, true, &selItems );
}
m_frame->GetCanvas()->Refresh( false );
}
@ -290,7 +296,10 @@ void TEXT_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectionClear, true );
if( selectedItems.size() )
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, true, &selectedItems );
{
EDA_ITEMS selItems( selectedItems.begin(), selectedItems.end() );
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItems, true, &selItems );
}
m_frame->GetCanvas()->Refresh( false );
}