More RunAction specialization

This commit is contained in:
Ian McInerney 2022-12-15 00:15:40 +00:00
parent b0363023a5
commit 480223f67c
30 changed files with 70 additions and 64 deletions

View File

@ -1243,7 +1243,7 @@ void EDA_BASE_FRAME::DoWithAcceptedFiles()
for( const wxFileName& file : m_AcceptedFiles ) for( const wxFileName& file : m_AcceptedFiles )
{ {
wxString fn = file.GetFullPath(); wxString fn = file.GetFullPath();
m_toolManager->RunAction( *m_acceptedExts.at( file.GetExt() ), true, &fn ); m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( file.GetExt() ), true, &fn );
} }
} }

View File

@ -405,7 +405,7 @@ void ACTION_MENU::OnMenuEvent( wxMenuEvent& aEvent )
if( type == wxEVT_MENU_OPEN ) if( type == wxEVT_MENU_OPEN )
{ {
if( m_dirty && m_tool ) if( m_dirty && m_tool )
getToolManager()->RunAction( ACTIONS::updateMenu, true, this ); getToolManager()->RunAction<ACTION_MENU*>( ACTIONS::updateMenu, true, this );
wxMenu* parent = dynamic_cast<wxMenu*>( GetParent() ); wxMenu* parent = dynamic_cast<wxMenu*>( GetParent() );

View File

@ -313,7 +313,7 @@ void SCH_EDIT_FRAME::ConvertPart( SCH_SYMBOL* aSymbol )
// If selected make sure all the now-included pins are selected // If selected make sure all the now-included pins are selected
if( aSymbol->IsSelected() ) if( aSymbol->IsSelected() )
m_toolManager->RunAction( EE_ACTIONS::addItemToSel, true, aSymbol ); m_toolManager->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, true, aSymbol );
UpdateItem( aSymbol, false, true ); UpdateItem( aSymbol, false, true );
OnModify(); OnModify();

View File

@ -585,7 +585,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
&& *evt->GetCommandId() <= ID_POPUP_SCH_UNFOLD_BUS_END ) && *evt->GetCommandId() <= ID_POPUP_SCH_UNFOLD_BUS_END )
{ {
wxString* net = new wxString( *evt->Parameter<wxString*>() ); wxString* net = new wxString( *evt->Parameter<wxString*>() );
m_toolMgr->RunAction( EE_ACTIONS::unfoldBus, true, net ); m_toolMgr->RunAction<wxString*>( EE_ACTIONS::unfoldBus, true, net );
} }
} }
else if( evt->IsCancelInteractive() ) else if( evt->IsCancelInteractive() )
@ -907,7 +907,7 @@ bool EE_SELECTION_TOOL::selectPoint( EE_COLLECTOR& aCollector, const VECTOR2I& a
// Try to call selectionMenu via RunAction() to avoid event-loop contention // Try to call selectionMenu via RunAction() to avoid event-loop contention
// But it we cannot handle the event, then we don't have an active tool loop, so // But it we cannot handle the event, then we don't have an active tool loop, so
// handle it directly. // handle it directly.
if( !m_toolMgr->RunAction( EE_ACTIONS::selectionMenu, true, &aCollector ) ) if( !m_toolMgr->RunAction<COLLECTOR*>( EE_ACTIONS::selectionMenu, true, &aCollector ) )
{ {
if( !doSelectionMenu( &aCollector ) ) if( !doSelectionMenu( &aCollector ) )
aCollector.m_MenuCancelled = true; aCollector.m_MenuCancelled = true;

View File

@ -1269,7 +1269,7 @@ int SCH_EDIT_TOOL::RepeatDrawItem( const TOOL_EVENT& aEvent )
schIUScale.MilsToIU( cfg->m_Drawing.default_repeat_offset_y ) ) ); schIUScale.MilsToIU( cfg->m_Drawing.default_repeat_offset_y ) ) );
} }
m_toolMgr->RunAction( EE_ACTIONS::addItemToSel, true, newItem ); m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, true, newItem );
newItem->SetFlags( IS_NEW ); newItem->SetFlags( IS_NEW );
m_frame->AddToScreen( newItem, m_frame->GetScreen() ); m_frame->AddToScreen( newItem, m_frame->GetScreen() );
commit.Added( newItem, m_frame->GetScreen() ); commit.Added( newItem, m_frame->GetScreen() );
@ -1500,7 +1500,7 @@ int SCH_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false );
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent );
return 0; return 0;
} }
@ -2315,7 +2315,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
} }
if( selected ) if( selected )
m_toolMgr->RunAction( EE_ACTIONS::removeItemFromSel, true, item ); m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::removeItemFromSel, true, item );
SCH_COMMIT commit( m_toolMgr ); SCH_COMMIT commit( m_toolMgr );
@ -2331,7 +2331,7 @@ int SCH_EDIT_TOOL::ChangeTextType( const TOOL_EVENT& aEvent )
commit.Push( _( "Change Item Type" ) ); commit.Push( _( "Change Item Type" ) );
if( selected ) if( selected )
m_toolMgr->RunAction( EE_ACTIONS::addItemToSel, true, newtext ); m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, true, newtext );
// Otherwise, pointer is owned by the undo stack // Otherwise, pointer is owned by the undo stack
if( item->IsNew() ) if( item->IsNew() )

View File

@ -659,7 +659,7 @@ int SCH_EDITOR_CONTROL::SimProbe( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false );
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent );
return 0; return 0;
} }
@ -749,7 +749,7 @@ int SCH_EDITOR_CONTROL::SimTune( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false );
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent );
return 0; return 0;
} }
@ -1196,7 +1196,7 @@ int SCH_EDITOR_CONTROL::HighlightNetCursor( const TOOL_EVENT& aEvent )
return highlightNet( m_toolMgr, aPos ); return highlightNet( m_toolMgr, aPos );
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent );
return 0; return 0;
} }
@ -1855,7 +1855,7 @@ int SCH_EDITOR_CONTROL::Paste( const TOOL_EVENT& aEvent )
// Now clear the previous selection, select the pasted items, and fire up the "move" tool. // Now clear the previous selection, select the pasted items, and fire up the "move" tool.
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
m_toolMgr->RunAction( EE_ACTIONS::addItemsToSel, true, &loadedItems ); m_toolMgr->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, true, &loadedItems );
EE_SELECTION& selection = selTool->GetSelection(); EE_SELECTION& selection = selTool->GetSelection();

View File

@ -657,7 +657,7 @@ int SYMBOL_EDITOR_DRAWING_TOOLS::RepeatDrawItem( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
if( pin ) if( pin )
m_toolMgr->RunAction( EE_ACTIONS::addItemToSel, true, pin ); m_toolMgr->RunAction<EDA_ITEM*>( EE_ACTIONS::addItemToSel, true, pin );
} }
return 0; return 0;

View File

@ -402,7 +402,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false ); m_toolMgr->RunAction( EE_ACTIONS::selectionActivate, false );
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent );
return 0; return 0;
} }
@ -871,7 +871,7 @@ int SYMBOL_EDITOR_EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
} }
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true ); m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
m_toolMgr->RunAction( EE_ACTIONS::addItemsToSel, true, &newItems ); m_toolMgr->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, true, &newItems );
selection.SetReferencePoint( mapCoords( getViewControls()->GetCursorPosition( true ) ) ); selection.SetReferencePoint( mapCoords( getViewControls()->GetCursorPosition( true ) ) );
m_toolMgr->RunAction( EE_ACTIONS::move, true, &commit ); m_toolMgr->RunAction( EE_ACTIONS::move, true, &commit );

View File

@ -253,7 +253,8 @@ void HIERARCHY_PANE::onSelectSheetPath( wxTreeEvent& aEvent )
TREE_ITEM_DATA* itemData = static_cast<TREE_ITEM_DATA*>( m_tree->GetItemData( itemSel ) ); TREE_ITEM_DATA* itemData = static_cast<TREE_ITEM_DATA*>( m_tree->GetItemData( itemSel ) );
SetCursor( wxCURSOR_ARROWWAIT ); SetCursor( wxCURSOR_ARROWWAIT );
m_frame->GetToolManager()->RunAction( EE_ACTIONS::changeSheet, true, &itemData->m_SheetPath ); m_frame->GetToolManager()->RunAction<SCH_SHEET_PATH*>( EE_ACTIONS::changeSheet, true,
&itemData->m_SheetPath );
SetCursor( wxCURSOR_ARROW ); SetCursor( wxCURSOR_ARROW );
} }

View File

@ -105,7 +105,7 @@ void SCH_SEARCH_HANDLER::SelectItems( std::vector<long>& aItemRows )
} }
if( selectedItems.size() ) if( selectedItems.size() )
m_frame->GetToolManager()->RunAction( EE_ACTIONS::addItemsToSel, true, &selectedItems ); m_frame->GetToolManager()->RunAction<EDA_ITEMS*>( EE_ACTIONS::addItemsToSel, true, &selectedItems );
m_frame->GetCanvas()->Refresh( false ); m_frame->GetCanvas()->Refresh( false );
} }

View File

@ -687,7 +687,7 @@ void GERBVIEW_FRAME::DoWithAcceptedFiles()
{ {
wxString fn = file.GetFullPath(); wxString fn = file.GetFullPath();
// Open zip archive in editor // Open zip archive in editor
m_toolManager->RunAction( *m_acceptedExts.at( ArchiveFileExtension ), true, &fn ); m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( ArchiveFileExtension ), true, &fn );
} }
else else
{ {
@ -698,5 +698,5 @@ void GERBVIEW_FRAME::DoWithAcceptedFiles()
// Open files in editor // Open files in editor
if( !gerbFn.IsEmpty() ) if( !gerbFn.IsEmpty() )
m_toolManager->RunAction( *m_acceptedExts.at( GerberFileExtension ), true, &gerbFn ); m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( GerberFileExtension ), true, &gerbFn );
} }

View File

@ -440,7 +440,7 @@ void KICAD_MANAGER_FRAME::DoWithAcceptedFiles()
if( ext == ProjectFileExtension || ext == LegacyProjectFileExtension ) if( ext == ProjectFileExtension || ext == LegacyProjectFileExtension )
{ {
wxString fn = fileName.GetFullPath(); wxString fn = fileName.GetFullPath();
m_toolManager->RunAction( *m_acceptedExts.at( fileName.GetExt() ), true, &fn ); m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( fileName.GetExt() ), true, &fn );
return; return;
} }
@ -464,7 +464,7 @@ void KICAD_MANAGER_FRAME::DoWithAcceptedFiles()
else else
{ {
wxString fn = fileName.GetFullPath(); wxString fn = fileName.GetFullPath();
m_toolManager->RunAction( *m_acceptedExts.at( fileName.GetExt() ), true, &fn ); m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( fileName.GetExt() ), true, &fn );
} }
} }
@ -476,7 +476,7 @@ void KICAD_MANAGER_FRAME::DoWithAcceptedFiles()
if( wxFileExists( fullEditorName ) ) if( wxFileExists( fullEditorName ) )
{ {
wxString command = fullEditorName + " " + gerberFiles; wxString command = fullEditorName + " " + gerberFiles;
m_toolManager->RunAction( *m_acceptedExts.at( GerberFileExtension ), m_toolManager->RunAction<wxString*>( *m_acceptedExts.at( GerberFileExtension ),
true, &command ); true, &command );
} }
} }
@ -713,7 +713,7 @@ void KICAD_MANAGER_FRAME::OnOpenFileInTextEditor( wxCommandEvent& event )
wxString filename = dlg.GetPath(); wxString filename = dlg.GetPath();
if( !dlg.GetPath().IsEmpty() && !Pgm().GetTextEditor().IsEmpty() ) if( !dlg.GetPath().IsEmpty() && !Pgm().GetTextEditor().IsEmpty() )
m_toolManager->RunAction( KICAD_MANAGER_ACTIONS::openTextEditor, true, &filename ); m_toolManager->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::openTextEditor, true, &filename );
} }

View File

@ -202,7 +202,7 @@ void PROJECT_TREE_ITEM::Activate( PROJECT_TREE_PANE* aTreePrjFrame )
if( fullFileName == frame->SchFileName() || fullFileName == frame->SchLegacyFileName() ) if( fullFileName == frame->SchFileName() || fullFileName == frame->SchLegacyFileName() )
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editSchematic, true ); toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editSchematic, true );
else else
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editOtherSch, true, &fullFileName ); toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::editOtherSch, true, &fullFileName );
break; break;
@ -212,7 +212,7 @@ void PROJECT_TREE_ITEM::Activate( PROJECT_TREE_PANE* aTreePrjFrame )
if( fullFileName == frame->PcbFileName() || fullFileName == frame->PcbLegacyFileName() ) if( fullFileName == frame->PcbFileName() || fullFileName == frame->PcbLegacyFileName() )
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editPCB, true ); toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editPCB, true );
else else
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editOtherPCB, true, &fullFileName ); toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::editOtherPCB, true, &fullFileName );
break; break;
@ -221,7 +221,7 @@ void PROJECT_TREE_ITEM::Activate( PROJECT_TREE_PANE* aTreePrjFrame )
case TREE_FILE_TYPE::DRILL: case TREE_FILE_TYPE::DRILL:
case TREE_FILE_TYPE::DRILL_NC: case TREE_FILE_TYPE::DRILL_NC:
case TREE_FILE_TYPE::DRILL_XNC: case TREE_FILE_TYPE::DRILL_XNC:
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::viewGerbers, true, &fullFileName ); toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::viewGerbers, true, &fullFileName );
break; break;
case TREE_FILE_TYPE::HTML: case TREE_FILE_TYPE::HTML:
@ -236,11 +236,11 @@ void PROJECT_TREE_ITEM::Activate( PROJECT_TREE_PANE* aTreePrjFrame )
case TREE_FILE_TYPE::TXT: case TREE_FILE_TYPE::TXT:
case TREE_FILE_TYPE::MD: case TREE_FILE_TYPE::MD:
case TREE_FILE_TYPE::REPORT: case TREE_FILE_TYPE::REPORT:
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::openTextEditor, true, &fullFileName ); toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::openTextEditor, true, &fullFileName );
break; break;
case TREE_FILE_TYPE::DRAWING_SHEET: case TREE_FILE_TYPE::DRAWING_SHEET:
toolMgr->RunAction( KICAD_MANAGER_ACTIONS::editDrawingSheet, true, &fullFileName ); toolMgr->RunAction<wxString*>( KICAD_MANAGER_ACTIONS::editDrawingSheet, true, &fullFileName );
break; break;
case TREE_FILE_TYPE::FOOTPRINT_FILE: case TREE_FILE_TYPE::FOOTPRINT_FILE:

View File

@ -476,7 +476,7 @@ int PL_EDIT_TOOL::DeleteItemCursor( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( PL_ACTIONS::selectionActivate, false ); m_toolMgr->RunAction( PL_ACTIONS::selectionActivate, false );
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent );
return 0; return 0;
} }

View File

@ -73,7 +73,7 @@ void ARRAY_CREATOR::Invoke()
ARRAY_PAD_NUMBER_PROVIDER pad_number_provider( fp, *array_opts ); ARRAY_PAD_NUMBER_PROVIDER pad_number_provider( fp, *array_opts );
std::vector<EDA_ITEM*> all_added_items; EDA_ITEMS all_added_items;
// The first item in list is the original item. We do not modify it // The first item in list is the original item. We do not modify it
for( int ptN = 0; ptN < array_opts->GetArraySize(); ptN++ ) for( int ptN = 0; ptN < array_opts->GetArraySize(); ptN++ )
@ -206,7 +206,7 @@ void ARRAY_CREATOR::Invoke()
} }
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
m_toolMgr->RunAction( PCB_ACTIONS::selectItems, true, &all_added_items ); m_toolMgr->RunAction<EDA_ITEMS*>( PCB_ACTIONS::selectItems, true, &all_added_items );
commit.Push( _( "Create an array" ) ); commit.Push( _( "Create an array" ) );
} }

View File

@ -192,9 +192,9 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
bbox = footprint->GetBoundingBox( true, false ); // No invisible text in bbox calc bbox = footprint->GetBoundingBox( true, false ); // No invisible text in bbox calc
if( pad ) if( pad )
m_toolManager->RunAction( PCB_ACTIONS::highlightItem, true, pad ); m_toolManager->RunAction<BOARD_ITEM*>( PCB_ACTIONS::highlightItem, true, pad );
else else
m_toolManager->RunAction( PCB_ACTIONS::highlightItem, true, footprint ); m_toolManager->RunAction<BOARD_ITEM*>( PCB_ACTIONS::highlightItem, true, footprint );
} }
else if( netcode > 0 || multiHighlight ) else if( netcode > 0 || multiHighlight )
{ {

View File

@ -393,7 +393,7 @@ void DIALOG_FIND::search( bool aDirection )
} }
else else
{ {
m_frame->GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, *m_it ); m_frame->GetToolManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, *m_it );
msg.Printf( _( "'%s' found" ), searchString ); msg.Printf( _( "'%s' found" ), searchString );
m_frame->SetStatusText( msg ); m_frame->SetStatusText( msg );

View File

@ -115,7 +115,7 @@ bool DIALOG_GROUP_PROPERTIES::TransferDataFromWindow()
m_group->AddItem( item ); m_group->AddItem( item );
} }
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, m_group ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, m_group );
commit.Push( _( "Modified group" ) ); commit.Push( _( "Modified group" ) );
return true; return true;

View File

@ -33,6 +33,7 @@
#include <footprint.h> #include <footprint.h>
#include <pad.h> #include <pad.h>
#include <zone.h> #include <zone.h>
#include <pcb_group.h>
#include <pcb_target.h> #include <pcb_target.h>
#include <pcb_dimension.h> #include <pcb_dimension.h>
#include <pcb_textbox.h> #include <pcb_textbox.h>
@ -166,7 +167,8 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
break; break;
case PCB_GROUP_T: case PCB_GROUP_T:
m_toolManager->RunAction( PCB_ACTIONS::groupProperties, true, aItem ); m_toolManager->RunAction<PCB_GROUP*>( PCB_ACTIONS::groupProperties, true,
static_cast<PCB_GROUP*>( aItem ) );
break; break;
case PCB_MARKER_T: case PCB_MARKER_T:

View File

@ -29,6 +29,7 @@
#include <fp_lib_table.h> #include <fp_lib_table.h>
#include <functional> #include <functional>
#include <kiway_express.h> #include <kiway_express.h>
#include <pcb_group.h>
#include <pcb_marker.h> #include <pcb_marker.h>
#include <pcb_textbox.h> #include <pcb_textbox.h>
#include <pcb_shape.h> #include <pcb_shape.h>
@ -250,7 +251,8 @@ void FOOTPRINT_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
} }
case PCB_GROUP_T: case PCB_GROUP_T:
m_toolManager->RunAction( PCB_ACTIONS::groupProperties, true, aItem ); m_toolManager->RunAction<PCB_GROUP*>( PCB_ACTIONS::groupProperties, true,
static_cast<PCB_GROUP*>( aItem ) );
break; break;
case PCB_MARKER_T: case PCB_MARKER_T:

View File

@ -309,7 +309,7 @@ void MICROWAVE_TOOL::createInductorBetween( const VECTOR2I& aStart, const VECTOR
else else
{ {
// at this point, we can save the footprint // at this point, we can save the footprint
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, inductorFP.get() ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, inductorFP.get() );
BOARD_COMMIT commit( this ); BOARD_COMMIT commit( this );
commit.Add( inductorFP.release() ); commit.Add( inductorFP.release() );

View File

@ -128,7 +128,7 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aR
if( !newFootprints.empty() ) if( !newFootprints.empty() )
{ {
for( FOOTPRINT* footprint : newFootprints ) for( FOOTPRINT* footprint : newFootprints )
GetToolManager()->RunAction( PCB_ACTIONS::selectItem, true, footprint ); GetToolManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, footprint );
*aRunDragCommand = true; *aRunDragCommand = true;
} }

View File

@ -1024,7 +1024,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
{ {
m_placingFootprint = true; m_placingFootprint = true;
fp->SetPosition( cursorPos ); fp->SetPosition( cursorPos );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, fp ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, fp );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->RunAction( ACTIONS::refreshPreview );
} }
else if( aEvent.HasPosition() ) else if( aEvent.HasPosition() )
@ -1044,7 +1044,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() ); cursorPos = controls->GetCursorPosition( !evt->DisableGridSnapping() );
if( reselect && fp ) if( reselect && fp )
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, fp ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, fp );
if( evt->IsCancelInteractive() ) if( evt->IsCancelInteractive() )
{ {
@ -1128,7 +1128,7 @@ int BOARD_EDITOR_CONTROL::PlaceFootprint( const TOOL_EVENT& aEvent )
fp->GetField( FOOTPRINT_FIELD )->SetText( UnescapeString( fp->GetFPIDAsString() ) ); fp->GetField( FOOTPRINT_FIELD )->SetText( UnescapeString( fp->GetFPIDAsString() ) );
commit.Add( fp ); commit.Add( fp );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, fp ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, fp );
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->RunAction( ACTIONS::refreshPreview );
} }
@ -1592,7 +1592,7 @@ int BOARD_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
return false; // drill origin is a one-shot; don't continue with tool return false; // drill origin is a one-shot; don't continue with tool
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent );
return 0; return 0;
} }

View File

@ -1519,7 +1519,7 @@ int BOARD_INSPECTION_TOOL::HighlightItem( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
if( item ) if( item )
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, item ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, item );
} }
m_frame->m_probingSchToPcb = false; m_frame->m_probingSchToPcb = false;
@ -1815,7 +1815,7 @@ int BOARD_INSPECTION_TOOL::LocalRatsnestTool( const TOOL_EVENT& aEvent )
} }
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent );
return 0; return 0;
} }

View File

@ -410,7 +410,7 @@ int DRAWING_TOOL::DrawRectangle( const TOOL_EVENT& aEvent )
commit.Add( rect ); commit.Add( rect );
commit.Push( isTextBox ? _( "Draw a text box" ) : _( "Draw a rectangle" ) ); commit.Push( isTextBox ? _( "Draw a text box" ) : _( "Draw a rectangle" ) );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, rect ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, rect );
} }
} }
@ -458,7 +458,7 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
commit.Add( circle ); commit.Add( circle );
commit.Push( _( "Draw a circle" ) ); commit.Push( _( "Draw a circle" ) );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, circle ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, circle );
} }
circle = new PCB_SHAPE( parent ); circle = new PCB_SHAPE( parent );
@ -505,7 +505,7 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
commit.Add( arc ); commit.Add( arc );
commit.Push( _( "Draw an arc" ) ); commit.Push( _( "Draw an arc" ) );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, arc ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, arc );
} }
arc = new PCB_SHAPE( parent ); arc = new PCB_SHAPE( parent );
@ -705,7 +705,7 @@ int DRAWING_TOOL::PlaceImage( const TOOL_EVENT& aEvent )
commit.Add( image ); commit.Add( image );
commit.Push( _( "Place an image" ) ); commit.Push( _( "Place an image" ) );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, image ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, image );
image = nullptr; image = nullptr;
m_toolMgr->RunAction( ACTIONS::activatePointEditor ); m_toolMgr->RunAction( ACTIONS::activatePointEditor );
@ -934,7 +934,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
m_frame->GetCanvas()->Refresh(); m_frame->GetCanvas()->Refresh();
} }
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, text ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, text );
m_view->Update( &selection() ); m_view->Update( &selection() );
// update the cursor so it looks correct before another event // update the cursor so it looks correct before another event
@ -950,7 +950,7 @@ int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
commit.Add( text ); commit.Add( text );
commit.Push( _( "Place a text" ) ); commit.Push( _( "Place a text" ) );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, text ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, text );
text = nullptr; text = nullptr;
} }
@ -1291,7 +1291,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
m_toolMgr->RunAction( PCB_ACTIONS::properties, true, dimension ); m_toolMgr->RunAction( PCB_ACTIONS::properties, true, dimension );
} }
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, dimension ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, dimension );
break; break;
} }
@ -2020,7 +2020,7 @@ bool DRAWING_TOOL::drawShape( const TOOL_EVENT& aTool, PCB_SHAPE** aGraphic,
{ {
commit.Add( graphic ); commit.Add( graphic );
commit.Push( _( "Draw a line segment" ) ); commit.Push( _( "Draw a line segment" ) );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, graphic ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, graphic );
} }
else else
{ {

View File

@ -283,7 +283,7 @@ int EDIT_TOOL::GetAndPlace( const TOOL_EVENT& aEvent )
if( fp ) if( fp )
{ {
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, fp ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, fp );
selectionTool->GetSelection().SetReferencePoint( fp->GetPosition() ); selectionTool->GetSelection().SetReferencePoint( fp->GetPosition() );
m_toolMgr->RunAction( PCB_ACTIONS::move, false ); m_toolMgr->RunAction( PCB_ACTIONS::move, false );
@ -1857,7 +1857,7 @@ void EDIT_TOOL::DeleteItems( const PCB_SELECTION& aItems, bool aIsCut )
canvas()->Refresh(); canvas()->Refresh();
// Restore the selection on the original zone // Restore the selection on the original zone
m_toolMgr->RunAction( PCB_ACTIONS::selectItem, true, zone ); m_toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, zone );
break; break;
} }

View File

@ -200,7 +200,7 @@ int GROUP_TOOL::PickNewMember( const TOOL_EVENT& aEvent )
statusPopup.Popup(); statusPopup.Popup();
canvas()->SetStatusPopup( statusPopup.GetPanel() ); canvas()->SetStatusPopup( statusPopup.GetPanel() );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent );
while( !done ) while( !done )
{ {

View File

@ -570,7 +570,7 @@ int PCB_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
return false; // drill origin is a one-shot; don't continue with tool return false; // drill origin is a one-shot; don't continue with tool
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent );
} }
return 0; return 0;
@ -683,7 +683,7 @@ int PCB_CONTROL::DeleteItemCursor( const TOOL_EVENT& aEvent )
m_frame->GetCanvas()->Refresh(); m_frame->GetCanvas()->Refresh();
} ); } );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent );
return 0; return 0;
} }

View File

@ -219,7 +219,7 @@ int POSITION_RELATIVE_TOOL::SelectPositionRelativeItem( const TOOL_EVENT& aEvent
statusPopup.Popup(); statusPopup.Popup();
canvas()->SetStatusPopup( statusPopup.GetPanel() ); canvas()->SetStatusPopup( statusPopup.GetPanel() );
m_toolMgr->RunAction( ACTIONS::pickerTool, true, (void*) &aEvent ); m_toolMgr->RunAction( ACTIONS::pickerTool, true, &aEvent );
while( !done ) while( !done )
{ {

View File

@ -213,7 +213,7 @@ void ZONE_CREATE_HELPER::performZoneCutout( ZONE& aZone, const ZONE& aCutout )
else else
{ {
m_params.m_sourceZone = newZones[0]; m_params.m_sourceZone = newZones[0];
toolMgr->RunAction( PCB_ACTIONS::selectItem, true, newZones[0] ); toolMgr->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, newZones[0] );
} }
} }
@ -238,7 +238,8 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE> aZone )
commit.Add( aZone.get() ); commit.Add( aZone.get() );
commit.Push( _( "Add a zone" ) ); commit.Push( _( "Add a zone" ) );
m_tool.GetManager()->RunAction( PCB_ACTIONS::selectItem, true, aZone.release() ); m_tool.GetManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true,
aZone.release() );
break; break;
} }
@ -262,7 +263,7 @@ void ZONE_CREATE_HELPER::commitZone( std::unique_ptr<ZONE> aZone )
poly->SetPolyShape( *aZone->Outline() ); poly->SetPolyShape( *aZone->Outline() );
commit.Add( poly ); commit.Add( poly );
m_tool.GetManager()->RunAction( PCB_ACTIONS::selectItem, true, poly ); m_tool.GetManager()->RunAction<EDA_ITEM*>( PCB_ACTIONS::selectItem, true, poly );
commit.Push( _( "Add a graphical polygon" ) ); commit.Push( _( "Add a graphical polygon" ) );