diff --git a/common/tool/actions.cpp b/common/tool/actions.cpp index a4e73b4eac..0694478abd 100644 --- a/common/tool/actions.cpp +++ b/common/tool/actions.cpp @@ -376,7 +376,7 @@ TOOL_ACTION ACTIONS::zoomTool( "common.Control.zoomTool", TOOL_ACTION ACTIONS::zoomPreset( TOOL_ACTION_ARGS() .Name( "common.Control.zoomPreset" ) .Scope( AS_GLOBAL ) - .Parameter( static_cast( 0 ) ) ); // Default parameter is the 0th item in the list + .Parameter( 0 ) ); // Default parameter is the 0th item in the list TOOL_ACTION ACTIONS::centerContents( "common.Control.centerContents", AS_GLOBAL ); @@ -546,7 +546,7 @@ TOOL_ACTION ACTIONS::gridResetOrigin( "common.Control.gridResetOrigin", TOOL_ACTION ACTIONS::gridPreset( TOOL_ACTION_ARGS() .Name( "common.Control.gridPreset" ) .Scope( AS_GLOBAL ) - .Parameter( static_cast( 0 ) ) ); // Default to the 1st element of the list + .Parameter( 0 ) ); // Default to the 1st element of the list TOOL_ACTION ACTIONS::toggleGrid( "common.Control.toggleGrid", AS_GLOBAL, 0, "", diff --git a/common/tool/grid_menu.cpp b/common/tool/grid_menu.cpp index b1c6129184..b545049904 100644 --- a/common/tool/grid_menu.cpp +++ b/common/tool/grid_menu.cpp @@ -54,7 +54,7 @@ GRID_MENU::GRID_MENU( EDA_DRAW_FRAME* aParent ) : OPT_TOOL_EVENT GRID_MENU::eventHandler( const wxMenuEvent& aEvent ) { OPT_TOOL_EVENT event( ACTIONS::gridPreset.MakeEvent() ); - event->SetParameter( aEvent.GetId() - ID_POPUP_GRID_START ); + event->SetParameter( aEvent.GetId() - ID_POPUP_GRID_START ); return event; } diff --git a/common/tool/zoom_menu.cpp b/common/tool/zoom_menu.cpp index b93df5b7fb..e3c51174cd 100644 --- a/common/tool/zoom_menu.cpp +++ b/common/tool/zoom_menu.cpp @@ -46,7 +46,7 @@ ZOOM_MENU::ZOOM_MENU( EDA_DRAW_FRAME* aParent ) : OPT_TOOL_EVENT ZOOM_MENU::eventHandler( const wxMenuEvent& aEvent ) { OPT_TOOL_EVENT event( ACTIONS::zoomPreset.MakeEvent() ); - event->SetParameter( aEvent.GetId() - ID_POPUP_ZOOM_LEVEL_START ); + event->SetParameter( aEvent.GetId() - ID_POPUP_ZOOM_LEVEL_START ); return event; } diff --git a/include/tool/tool_action.h b/include/tool/tool_action.h index 5d5c48641f..9de8c57be7 100644 --- a/include/tool/tool_action.h +++ b/include/tool/tool_action.h @@ -143,7 +143,8 @@ public: /** * Custom parameter to pass information to the tool. */ - TOOL_ACTION_ARGS& Parameter( std::any aParam ) + template + TOOL_ACTION_ARGS& Parameter( T aParam ) { m_param = aParam; return *this; diff --git a/include/tool/tool_event.h b/include/tool/tool_event.h index 5e5e7145b8..4b8a92a925 100644 --- a/include/tool/tool_event.h +++ b/include/tool/tool_event.h @@ -470,7 +470,8 @@ public: * * @param aParam is the new parameter. */ - void SetParameter(const std::any& aParam) + template + void SetParameter(T aParam) { m_param = aParam; } diff --git a/pcbnew/tools/pcb_actions.cpp b/pcbnew/tools/pcb_actions.cpp index 98fcb74e97..717a26143a 100644 --- a/pcbnew/tools/pcb_actions.cpp +++ b/pcbnew/tools/pcb_actions.cpp @@ -878,7 +878,7 @@ TOOL_ACTION PCB_ACTIONS::hideNetInRatsnest( TOOL_ACTION_ARGS() .MenuText( _( "Hide Net in Ratsnest" ) ) .Tooltip( _( "Hide the selected net in the ratsnest of unconnected net lines/arcs" ) ) .Icon( BITMAPS::hide_ratsnest ) - .Parameter( static_cast( 0 ) ) ); // Default to hiding selected net + .Parameter( 0 ) ); // Default to hiding selected net TOOL_ACTION PCB_ACTIONS::showNetInRatsnest( TOOL_ACTION_ARGS() .Name( "pcbnew.EditorControl.showNet" ) @@ -886,7 +886,7 @@ TOOL_ACTION PCB_ACTIONS::showNetInRatsnest( TOOL_ACTION_ARGS() .MenuText( _( "Show Net in Ratsnest" ) ) .Tooltip( _( "Show the selected net in the ratsnest of unconnected net lines/arcs" ) ) .Icon( BITMAPS::show_ratsnest ) - .Parameter( static_cast( 0 ) ) ); // Default to showing selected net + .Parameter( 0 ) ); // Default to showing selected net TOOL_ACTION PCB_ACTIONS::showEeschema( "pcbnew.EditorControl.showEeschema", AS_GLOBAL, 0, "",