fixup! Whittle down library tree context menus to be more contextual.

This commit is contained in:
Jeff Young 2021-02-19 19:04:44 +00:00
parent 57e043e0e6
commit 26cb05051b
2 changed files with 11 additions and 1 deletions

View File

@ -173,7 +173,7 @@ bool EE_SELECTION_TOOL::Init()
if( m_isSymbolEditor || m_isSymbolViewer )
return false;
return ( E_C::Empty( aSel ) || sheetSelection( aSel ) );
return E_C::LessThan( 2 )( aSel ) && E_C::OnlyType( SCH_SHEET_T )( aSel );
};
auto schEditCondition =

View File

@ -41,6 +41,7 @@ SELECTION_CONDITION operator||( const SELECTION_CONDITION& aConditionA,
SELECTION_CONDITION operator&&( const SELECTION_CONDITION& aConditionA,
const SELECTION_CONDITION& aConditionB );
SELECTION_CONDITION operator!( const SELECTION_CONDITION& aCondition );
/// Signature for a reference to a function that takes a SELECTION and returns
@ -61,6 +62,15 @@ SELECTION_CONDITION operator&&( const SELECTION_CONDITION& aConditionA,
SELECTION_CONDITION operator&&( SELECTION_BOOL aConditionA,
const SELECTION_CONDITION& aConditionB );
// We don't use uninitialized SELECTION_CONDITIONs, so casting to bool is probably
// a programming error.
template<> SELECTION_CONDITION::operator bool() const noexcept
{
wxASSERT( "Incorrect use of SELECTION_CONDITION" );
return false;
};
/**
* Class that groups generic conditions for selected items.
*/