Don't use TOOL_EVENT parameters for line modes.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15053
This commit is contained in:
Jeff Young 2023-06-25 11:06:32 +01:00
parent 493828cc6b
commit 84a63f7daa
2 changed files with 22 additions and 27 deletions

View File

@ -889,32 +889,22 @@ TOOL_ACTION EE_ACTIONS::toggleOPCurrents( "eeschema.EditorControl.showOperatingP
_( "Show OP Currents" ), _( "Show OP Currents" ),
_( "Show operating point current data from simulation" ) ); _( "Show operating point current data from simulation" ) );
TOOL_ACTION EE_ACTIONS::lineModeFree( TOOL_ACTION_ARGS() TOOL_ACTION EE_ACTIONS::lineModeFree( "eeschema.EditorControl.lineModeFree",
.Name( "eeschema.EditorControl.lineModeFree" ) AS_GLOBAL, 0, "",
.Scope( AS_GLOBAL ) _( "Line Mode for Wires and Buses" ), _( "Draw and drag at any angle" ),
.MenuText( _( "Line Mode for Wires and Buses" ) ) BITMAPS::lines_any );
.Tooltip( _( "Draw and drag at any angle" ) )
.Icon( BITMAPS::lines_any )
.Flags( AF_NONE )
.Parameter( LINE_MODE::LINE_MODE_FREE ) );
TOOL_ACTION EE_ACTIONS::lineMode90( TOOL_ACTION_ARGS() TOOL_ACTION EE_ACTIONS::lineMode90( "eeschema.EditorControl.lineModeOrthonal",
.Name( "eeschema.EditorControl.lineModeOrthonal" ) AS_GLOBAL, 0, "",
.Scope( AS_GLOBAL ) _( "Line Mode for Wires and Buses" ),
.MenuText( _( "Line Mode for Wires and Buses" ) ) _( "Constrain drawing and dragging to horizontal or vertical motions" ),
.Tooltip( _( "Constrain drawing and dragging to horizontal or vertical motions" ) ) BITMAPS::lines90 );
.Icon( BITMAPS::lines90 )
.Flags( AF_NONE )
.Parameter( LINE_MODE::LINE_MODE_90) );
TOOL_ACTION EE_ACTIONS::lineMode45( TOOL_ACTION_ARGS() TOOL_ACTION EE_ACTIONS::lineMode45( "eeschema.EditorControl.lineMode45",
.Name( "eeschema.EditorControl.lineMode45" ) AS_GLOBAL, 0, "",
.Scope( AS_GLOBAL ) _( "Line Mode for Wires and Buses" ),
.MenuText( _( "Line Mode for Wires and Buses" ) ) _( "Constrain drawing and dragging to horizontal, vertical, or 45-degree angle motions" ),
.Tooltip( _( "Constrain drawing and dragging to horizontal, vertical, or 45-degree angle motions" ) ) BITMAPS::hv45mode );
.Icon( BITMAPS::hv45mode )
.Flags( AF_NONE )
.Parameter( LINE_MODE::LINE_MODE_45 ) );
TOOL_ACTION EE_ACTIONS::lineModeNext( "eeschema.EditorControl.lineModeNext", TOOL_ACTION EE_ACTIONS::lineModeNext( "eeschema.EditorControl.lineModeNext",
AS_GLOBAL, MD_SHIFT + WXK_SPACE, "", AS_GLOBAL, MD_SHIFT + WXK_SPACE, "",
@ -1022,7 +1012,7 @@ TOOL_ACTION EE_ACTIONS::unfoldBus( "eeschema.InteractiveDrawingLineWireBus.unfol
AS_GLOBAL, AS_GLOBAL,
'C', LEGACY_HK_NAME( "Unfold from Bus" ), 'C', LEGACY_HK_NAME( "Unfold from Bus" ),
_( "Unfold from Bus" ), _( "Break a wire out of a bus" ), _( "Unfold from Bus" ), _( "Break a wire out of a bus" ),
BITMAPS::INVALID_BITMAP, AF_ACTIVATE ); BITMAPS::INVALID_BITMAP, AF_ACTIVATE );
const DRAW_SEGMENT_EVENT_PARAMS drawLinesActionParam = { LAYER_NOTES, false, nullptr }; const DRAW_SEGMENT_EVENT_PARAMS drawLinesActionParam = { LAYER_NOTES, false, nullptr };
TOOL_ACTION EE_ACTIONS::drawLines( TOOL_ACTION_ARGS() TOOL_ACTION EE_ACTIONS::drawLines( TOOL_ACTION_ARGS()

View File

@ -2231,7 +2231,13 @@ int SCH_EDITOR_CONTROL::ToggleOPCurrents( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::ChangeLineMode( const TOOL_EVENT& aEvent ) int SCH_EDITOR_CONTROL::ChangeLineMode( const TOOL_EVENT& aEvent )
{ {
m_frame->eeconfig()->m_Drawing.line_mode = aEvent.Parameter<int>(); if( aEvent.IsAction( &EE_ACTIONS::lineModeFree ) )
m_frame->eeconfig()->m_Drawing.line_mode = LINE_MODE::LINE_MODE_FREE;
else if( aEvent.IsAction( &EE_ACTIONS::lineMode45 ) )
m_frame->eeconfig()->m_Drawing.line_mode = LINE_MODE::LINE_MODE_45;
else
m_frame->eeconfig()->m_Drawing.line_mode = LINE_MODE::LINE_MODE_90;
m_toolMgr->RunAction( ACTIONS::refreshPreview ); m_toolMgr->RunAction( ACTIONS::refreshPreview );
return 0; return 0;
} }
@ -2264,7 +2270,6 @@ int SCH_EDITOR_CONTROL::ToggleAnnotateRecursive( const TOOL_EVENT& aEvent )
int SCH_EDITOR_CONTROL::TogglePythonConsole( const TOOL_EVENT& aEvent ) int SCH_EDITOR_CONTROL::TogglePythonConsole( const TOOL_EVENT& aEvent )
{ {
m_frame->ScriptingConsoleEnableDisable(); m_frame->ScriptingConsoleEnableDisable();
return 0; return 0;
} }