From 84a63f7daab966071985bbd65eddbb0c971c2d96 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 25 Jun 2023 11:06:32 +0100 Subject: [PATCH] Don't use TOOL_EVENT parameters for line modes. Fixes https://gitlab.com/kicad/code/kicad/-/issues/15053 --- eeschema/tools/ee_actions.cpp | 40 ++++++++++----------------- eeschema/tools/sch_editor_control.cpp | 9 ++++-- 2 files changed, 22 insertions(+), 27 deletions(-) diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp index 74155ec2ea..1007758ff9 100644 --- a/eeschema/tools/ee_actions.cpp +++ b/eeschema/tools/ee_actions.cpp @@ -889,32 +889,22 @@ TOOL_ACTION EE_ACTIONS::toggleOPCurrents( "eeschema.EditorControl.showOperatingP _( "Show OP Currents" ), _( "Show operating point current data from simulation" ) ); -TOOL_ACTION EE_ACTIONS::lineModeFree( TOOL_ACTION_ARGS() - .Name( "eeschema.EditorControl.lineModeFree" ) - .Scope( AS_GLOBAL ) - .MenuText( _( "Line Mode for Wires and Buses" ) ) - .Tooltip( _( "Draw and drag at any angle" ) ) - .Icon( BITMAPS::lines_any ) - .Flags( AF_NONE ) - .Parameter( LINE_MODE::LINE_MODE_FREE ) ); +TOOL_ACTION EE_ACTIONS::lineModeFree( "eeschema.EditorControl.lineModeFree", + AS_GLOBAL, 0, "", + _( "Line Mode for Wires and Buses" ), _( "Draw and drag at any angle" ), + BITMAPS::lines_any ); -TOOL_ACTION EE_ACTIONS::lineMode90( TOOL_ACTION_ARGS() - .Name( "eeschema.EditorControl.lineModeOrthonal" ) - .Scope( AS_GLOBAL ) - .MenuText( _( "Line Mode for Wires and Buses" ) ) - .Tooltip( _( "Constrain drawing and dragging to horizontal or vertical motions" ) ) - .Icon( BITMAPS::lines90 ) - .Flags( AF_NONE ) - .Parameter( LINE_MODE::LINE_MODE_90) ); +TOOL_ACTION EE_ACTIONS::lineMode90( "eeschema.EditorControl.lineModeOrthonal", + AS_GLOBAL, 0, "", + _( "Line Mode for Wires and Buses" ), + _( "Constrain drawing and dragging to horizontal or vertical motions" ), + BITMAPS::lines90 ); -TOOL_ACTION EE_ACTIONS::lineMode45( TOOL_ACTION_ARGS() - .Name( "eeschema.EditorControl.lineMode45" ) - .Scope( AS_GLOBAL ) - .MenuText( _( "Line Mode for Wires and Buses" ) ) - .Tooltip( _( "Constrain drawing and dragging to horizontal, vertical, or 45-degree angle motions" ) ) - .Icon( BITMAPS::hv45mode ) - .Flags( AF_NONE ) - .Parameter( LINE_MODE::LINE_MODE_45 ) ); +TOOL_ACTION EE_ACTIONS::lineMode45( "eeschema.EditorControl.lineMode45", + AS_GLOBAL, 0, "", + _( "Line Mode for Wires and Buses" ), + _( "Constrain drawing and dragging to horizontal, vertical, or 45-degree angle motions" ), + BITMAPS::hv45mode ); TOOL_ACTION EE_ACTIONS::lineModeNext( "eeschema.EditorControl.lineModeNext", AS_GLOBAL, MD_SHIFT + WXK_SPACE, "", @@ -1022,7 +1012,7 @@ TOOL_ACTION EE_ACTIONS::unfoldBus( "eeschema.InteractiveDrawingLineWireBus.unfol AS_GLOBAL, 'C', LEGACY_HK_NAME( "Unfold from 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 }; TOOL_ACTION EE_ACTIONS::drawLines( TOOL_ACTION_ARGS() diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index 8bbecba393..3e83a16dc1 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -2231,7 +2231,13 @@ int SCH_EDITOR_CONTROL::ToggleOPCurrents( const TOOL_EVENT& aEvent ) int SCH_EDITOR_CONTROL::ChangeLineMode( const TOOL_EVENT& aEvent ) { - m_frame->eeconfig()->m_Drawing.line_mode = aEvent.Parameter(); + 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 ); return 0; } @@ -2264,7 +2270,6 @@ int SCH_EDITOR_CONTROL::ToggleAnnotateRecursive( const TOOL_EVENT& aEvent ) int SCH_EDITOR_CONTROL::TogglePythonConsole( const TOOL_EVENT& aEvent ) { - m_frame->ScriptingConsoleEnableDisable(); return 0; }