From efc64e972cb757f6a8c55275485580d33017110d Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sat, 13 Nov 2021 19:43:55 +0000 Subject: [PATCH] Fix pasting into LIB_TREE search control. We have a hack for turning accelerator keys that wxWidgets turns into menu commands back in to accelerator keys -- but it requires that the corresponding menu items be enabled in order to work. --- eeschema/symbol_editor/symbol_edit_frame.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/eeschema/symbol_editor/symbol_edit_frame.cpp b/eeschema/symbol_editor/symbol_edit_frame.cpp index 1155db6826..b645256eac 100644 --- a/eeschema/symbol_editor/symbol_edit_frame.cpp +++ b/eeschema/symbol_editor/symbol_edit_frame.cpp @@ -348,6 +348,12 @@ void SYMBOL_EDIT_FRAME::setupUIConditions() #define ENABLE( x ) ACTION_CONDITIONS().Enable( x ) #define CHECK( x ) ACTION_CONDITIONS().Check( x ) + auto searchHasFocus = + [this]( const SELECTION& ) + { + return m_treePane->GetLibTree()->GetFocusTarget()->HasFocus(); + }; + auto haveSymbolCond = [this]( const SELECTION& ) { @@ -404,9 +410,10 @@ void SYMBOL_EDIT_FRAME::setupUIConditions() mgr->SetConditions( ACTIONS::inchesUnits, CHECK( cond.Units( EDA_UNITS::INCHES ) ) ); mgr->SetConditions( ACTIONS::milsUnits, CHECK( cond.Units( EDA_UNITS::MILS ) ) ); - mgr->SetConditions( ACTIONS::cut, ENABLE( isEditableCond ) ); - mgr->SetConditions( ACTIONS::copy, ENABLE( haveSymbolCond ) ); - mgr->SetConditions( ACTIONS::paste, ENABLE( isEditableCond && SELECTION_CONDITIONS::Idle ) ); + mgr->SetConditions( ACTIONS::cut, ENABLE( isEditableCond || searchHasFocus ) ); + mgr->SetConditions( ACTIONS::copy, ENABLE( haveSymbolCond || searchHasFocus ) ); + mgr->SetConditions( ACTIONS::paste, ENABLE( ( isEditableCond && SELECTION_CONDITIONS::Idle ) + || searchHasFocus ) ); mgr->SetConditions( ACTIONS::doDelete, ENABLE( isEditableCond ) ); mgr->SetConditions( ACTIONS::duplicate, ENABLE( isEditableCond ) ); mgr->SetConditions( ACTIONS::selectAll, ENABLE( haveSymbolCond ) );