ADDED ${SYMBOL_DESCRIPTION} and ${SYMBOL_KEYWORDS}.

Fixes https://gitlab.com/kicad/code/kicad/issues/9783
This commit is contained in:
Jeff Young 2022-09-02 22:32:50 +01:00
parent 72651dffe8
commit b1e5cb5a56
2 changed files with 27 additions and 1 deletions

View File

@ -315,6 +315,15 @@ wxString SCH_SYMBOL::GetDescription() const
}
wxString SCH_SYMBOL::GetKeyWords() const
{
if( m_part )
return m_part->GetKeyWords();
return wxEmptyString;
}
wxString SCH_SYMBOL::GetDatasheet() const
{
if( m_part )
@ -1022,6 +1031,8 @@ void SCH_SYMBOL::GetContextualTextVars( wxArrayString* aVars ) const
aVars->push_back( wxT( "UNIT" ) );
aVars->push_back( wxT( "SYMBOL_LIBRARY" ) );
aVars->push_back( wxT( "SYMBOL_NAME" ) );
aVars->push_back( wxT( "SYMBOL_DESCRIPTION" ) );
aVars->push_back( wxT( "SYMBOL_KEYWORDS" ) );
}
@ -1114,6 +1125,16 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth ) const
*token = m_lib_id.GetLibItemName();
return true;
}
else if( token->IsSameAs( wxT( "SYMBOL_DESCRIPTION" ) ) )
{
*token = GetDescription();
return true;
}
else if( token->IsSameAs( wxT( "SYMBOL_KEYWORDS" ) ) )
{
*token = GetKeyWords();
return true;
}
return false;
}

View File

@ -208,10 +208,15 @@ public:
void SetLibSymbol( LIB_SYMBOL* aLibSymbol );
/**
* Return information about the aliased parts
* @return the associated LIB_SYMBOL's description field (or wxEmptyString).
*/
wxString GetDescription() const;
/**
* @return the associated LIB_SYMBOL's keywords field (or wxEmptyString).
*/
wxString GetKeyWords() const;
/**
* Return the documentation text for the given part alias
*/