Fix some more incorrect types in event parameters

This commit is contained in:
Ian McInerney 2022-09-28 23:42:21 +01:00
parent 55a7cfcf36
commit 6c031a4aa4
3 changed files with 15 additions and 10 deletions

View File

@ -466,7 +466,7 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
} }
else else
{ {
m_toolManager->RunAction( ACTIONS::gridPreset, true, static_cast<intptr_t>( idx ) ); m_toolManager->RunAction( ACTIONS::gridPreset, true, idx );
} }
UpdateStatusBar(); UpdateStatusBar();
@ -553,7 +553,7 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) ) if( id < 0 || !( id < (int)m_zoomSelectBox->GetCount() ) )
return; return;
m_toolManager->RunAction( ACTIONS::zoomPreset, true, static_cast<intptr_t>( id ) ); m_toolManager->RunAction( ACTIONS::zoomPreset, true, id );
UpdateStatusBar(); UpdateStatusBar();
m_canvas->Refresh(); m_canvas->Refresh();
// Needed on Windows because clicking on m_zoomSelectBox remove the focus from m_canvas // Needed on Windows because clicking on m_zoomSelectBox remove the focus from m_canvas

View File

@ -373,8 +373,10 @@ TOOL_ACTION ACTIONS::zoomTool( "common.Control.zoomTool",
_( "Zoom to Selection" ), _( "Zoom to Selection" ), _( "Zoom to Selection" ), _( "Zoom to Selection" ),
BITMAPS::zoom_area, AF_ACTIVATE ); BITMAPS::zoom_area, AF_ACTIVATE );
TOOL_ACTION ACTIONS::zoomPreset( "common.Control.zoomPreset", TOOL_ACTION ACTIONS::zoomPreset( TOOL_ACTION_ARGS()
AS_GLOBAL ); .Name( "common.Control.zoomPreset" )
.Scope( AS_GLOBAL )
.Parameter( static_cast<int>( 0 ) ) ); // Default parameter is the 0th item in the list
TOOL_ACTION ACTIONS::centerContents( "common.Control.centerContents", TOOL_ACTION ACTIONS::centerContents( "common.Control.centerContents",
AS_GLOBAL ); AS_GLOBAL );
@ -541,8 +543,10 @@ TOOL_ACTION ACTIONS::gridResetOrigin( "common.Control.gridResetOrigin",
0, LEGACY_HK_NAME( "Reset Grid Origin" ), 0, LEGACY_HK_NAME( "Reset Grid Origin" ),
_( "Reset Grid Origin" ), "" ); _( "Reset Grid Origin" ), "" );
TOOL_ACTION ACTIONS::gridPreset( "common.Control.gridPreset", TOOL_ACTION ACTIONS::gridPreset( TOOL_ACTION_ARGS()
AS_GLOBAL ); .Name( "common.Control.gridPreset" )
.Scope( AS_GLOBAL )
.Parameter( static_cast<int>( 0 ) ) ); // Default to the 1st element of the list
TOOL_ACTION ACTIONS::toggleGrid( "common.Control.toggleGrid", TOOL_ACTION ACTIONS::toggleGrid( "common.Control.toggleGrid",
AS_GLOBAL, 0, "", AS_GLOBAL, 0, "",

View File

@ -103,7 +103,8 @@ int COMMON_TOOLS::SelectionTool( const TOOL_EVENT& aEvent )
// Cursor control // Cursor control
int COMMON_TOOLS::CursorControl( const TOOL_EVENT& aEvent ) int COMMON_TOOLS::CursorControl( const TOOL_EVENT& aEvent )
{ {
long type = aEvent.Parameter<long>(); long type = static_cast<long>( aEvent.Parameter<ACTIONS::CURSOR_EVENT_TYPE>() );
bool fastMove = type & ACTIONS::CURSOR_FAST_MOVE; bool fastMove = type & ACTIONS::CURSOR_FAST_MOVE;
type &= ~ACTIONS::CURSOR_FAST_MOVE; type &= ~ACTIONS::CURSOR_FAST_MOVE;
bool mirroredX = getView()->IsMirroredX(); bool mirroredX = getView()->IsMirroredX();
@ -170,7 +171,7 @@ int COMMON_TOOLS::CursorControl( const TOOL_EVENT& aEvent )
int COMMON_TOOLS::PanControl( const TOOL_EVENT& aEvent ) int COMMON_TOOLS::PanControl( const TOOL_EVENT& aEvent )
{ {
long type = aEvent.Parameter<long>(); ACTIONS::CURSOR_EVENT_TYPE type = aEvent.Parameter<ACTIONS::CURSOR_EVENT_TYPE>();
KIGFX::VIEW* view = getView(); KIGFX::VIEW* view = getView();
VECTOR2D center = view->GetCenter(); VECTOR2D center = view->GetCenter();
VECTOR2D gridSize = getView()->GetGAL()->GetGridSize() * 10; VECTOR2D gridSize = getView()->GetGAL()->GetGridSize() * 10;
@ -383,8 +384,8 @@ int COMMON_TOOLS::CenterContents( const TOOL_EVENT& aEvent )
int COMMON_TOOLS::ZoomPreset( const TOOL_EVENT& aEvent ) int COMMON_TOOLS::ZoomPreset( const TOOL_EVENT& aEvent )
{ {
unsigned int idx = aEvent.Parameter<unsigned int>(); int idx = aEvent.Parameter<int>();
return doZoomToPreset( (int) idx, false ); return doZoomToPreset( idx, false );
} }