From a4ff339a1e9f2d2289d92a4f6564e947b500b777 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 24 Aug 2020 19:28:26 +0100 Subject: [PATCH] Clear toolstack after cancel. Fixes https://gitlab.com/kicad/code/kicad/issues/5336 --- common/tool/tools_holder.cpp | 7 +++++++ include/tool/tools_holder.h | 2 ++ pcbnew/tools/edit_tool.cpp | 4 ++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/common/tool/tools_holder.cpp b/common/tool/tools_holder.cpp index 2658ab5791..49d31e9224 100644 --- a/common/tool/tools_holder.cpp +++ b/common/tool/tools_holder.cpp @@ -96,6 +96,13 @@ void TOOLS_HOLDER::PopTool( const std::string& actionName ) } +void TOOLS_HOLDER::ClearToolStack() +{ + m_toolStack.clear(); + DisplayToolMsg( ACTIONS::selectionTool.GetLabel() ); +} + + std::string TOOLS_HOLDER::CurrentToolName() const { if( m_toolStack.empty() ) diff --git a/include/tool/tools_holder.h b/include/tool/tools_holder.h index 159a71c4ff..be80414fe4 100644 --- a/include/tool/tools_holder.h +++ b/include/tool/tools_holder.h @@ -114,6 +114,8 @@ public: virtual void PushTool( const std::string& actionName ); virtual void PopTool( const std::string& actionName ); + void ClearToolStack(); + bool ToolStackIsEmpty() { return m_toolStack.empty(); } std::string CurrentToolName() const; diff --git a/pcbnew/tools/edit_tool.cpp b/pcbnew/tools/edit_tool.cpp index 15b7b1c7fb..77eb5120f3 100644 --- a/pcbnew/tools/edit_tool.cpp +++ b/pcbnew/tools/edit_tool.cpp @@ -381,7 +381,7 @@ int EDIT_TOOL::doMoveSelection( TOOL_EVENT aEvent, bool aPickReference ) if( unselect ) m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true ); - editFrame->PopTool( tool ); + editFrame->ClearToolStack(); return 0; } @@ -1656,7 +1656,7 @@ int EDIT_TOOL::copyToClipboard( const TOOL_EVENT& aEvent ) VECTOR2I refPoint; bool rv = pickReferencePoint( _( "Select reference point for the copy..." ), - _( "Selection copied." ), _( "Copy cancelled." ), refPoint ); + _( "Selection copied." ), _( "Copy cancelled." ), refPoint ); frame()->SetMsgPanel( board() ); if( !rv )