Fix a couple of issues with text var autocomplete.

Fixes https://gitlab.com/kicad/code/kicad/issues/4190
This commit is contained in:
Jeff Young 2020-05-28 19:59:25 +01:00
parent 8f533e1833
commit 8d92a95cb8
2 changed files with 5 additions and 2 deletions

View File

@ -785,7 +785,10 @@ void SCH_COMPONENT::SwapData( SCH_ITEM* aItem )
void SCH_COMPONENT::GetContextualTextVars( wxArrayString* aVars ) const void SCH_COMPONENT::GetContextualTextVars( wxArrayString* aVars ) const
{ {
for( int i = 0; i < MANDATORY_FIELDS; ++i ) for( int i = 0; i < MANDATORY_FIELDS; ++i )
aVars->push_back( m_Fields[i].GetCanonicalName() ); aVars->push_back( m_Fields[i].GetCanonicalName().Upper() );
for( size_t i = MANDATORY_FIELDS; i < m_Fields.size(); ++i )
aVars->push_back( m_Fields[i].GetName() );
aVars->push_back( wxT( "FOOTPRINT_LIBRARY" ) ); aVars->push_back( wxT( "FOOTPRINT_LIBRARY" ) );
aVars->push_back( wxT( "FOOTPRINT_NAME" ) ); aVars->push_back( wxT( "FOOTPRINT_NAME" ) );

View File

@ -80,7 +80,7 @@ SCH_FIELD_VALIDATOR::SCH_FIELD_VALIDATOR( const SCH_FIELD_VALIDATOR& aValidator
bool SCH_FIELD_VALIDATOR::Validate( wxWindow *aParent ) bool SCH_FIELD_VALIDATOR::Validate( wxWindow *aParent )
{ {
// If window is disabled, simply return // If window is disabled, simply return
if( !m_validatorWindow->IsEnabled() ) if( !m_validatorWindow->IsEnabled() || !m_validatorWindow->IsShown() )
return true; return true;
wxTextEntry * const text = GetTextEntry(); wxTextEntry * const text = GetTextEntry();