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.
This commit is contained in:
Jeff Young 2021-11-13 19:43:55 +00:00
parent cc6e3841ae
commit efc64e972c
1 changed files with 10 additions and 3 deletions

View File

@ -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 ) );