From ba73456d49aa7474d39049e34a3594675bb3fab7 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 25 May 2021 16:45:57 -0700 Subject: [PATCH] Allow point editor to persist After drawing a graphic, allow the control points to persist when exiting the tool. The effect of this is to make the first "Esc" press a "return-to-select-tool" event without modifying the selection or control points from within the drawing tools. The section "Esc" press, when in the selection tool will clear the selection and the control points --- pcbnew/tools/drawing_tool.cpp | 6 ++++++ pcbnew/tools/pcb_point_editor.cpp | 7 +++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/pcbnew/tools/drawing_tool.cpp b/pcbnew/tools/drawing_tool.cpp index 8e84b6634c..42f07bfcd3 100644 --- a/pcbnew/tools/drawing_tool.cpp +++ b/pcbnew/tools/drawing_tool.cpp @@ -1423,6 +1423,8 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic, if( !started ) { + // We've handled the cancel event. Don't cancel other tools + evt->SetPassEvent( false ); m_frame->PopTool( aTool ); cancelled = true; } @@ -1741,6 +1743,8 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, PCB_SHAPE** aGraphic, bool if( !firstPoint ) { + // We've handled the cancel event. Don't cancel other tools + evt->SetPassEvent( false ); m_frame->PopTool( aTool ); cancelled = true; } @@ -2060,6 +2064,8 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent ) } else { + // We've handled the cancel event. Don't cancel other tools + evt->SetPassEvent( false ); m_frame->PopTool( tool ); break; } diff --git a/pcbnew/tools/pcb_point_editor.cpp b/pcbnew/tools/pcb_point_editor.cpp index bb956003d8..a032378756 100644 --- a/pcbnew/tools/pcb_point_editor.cpp +++ b/pcbnew/tools/pcb_point_editor.cpp @@ -548,11 +548,10 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent ) inDrag = false; frame()->UndoRedoBlock( false ); } - else if( evt->IsCancelInteractive() ) - { - break; - } + // Only cancel point editor when activating a new tool + // Otherwise, allow the points to persist when moving up the + // tool stack if( evt->IsActivate() && !evt->IsMoveTool() ) break; }