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:
parent
cc6e3841ae
commit
efc64e972c
|
@ -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 ) );
|
||||
|
|
Loading…
Reference in New Issue