Resolve embedded text vars
Title Block text variables are embedded into the pcb file and should be used for resolving when the project file is missing
This commit is contained in:
parent
67985510a8
commit
d1bf889e71
|
@ -95,6 +95,7 @@ void TITLE_BLOCK::GetContextualTextVars( wxArrayString* aVars )
|
|||
bool TITLE_BLOCK::TextVarResolver( wxString* aToken, const PROJECT* aProject ) const
|
||||
{
|
||||
bool tokenUpdated = false;
|
||||
wxString originalToken = *aToken;
|
||||
|
||||
if( aToken->IsSameAs( wxT( "ISSUE_DATE" ) ) )
|
||||
{
|
||||
|
@ -151,6 +152,11 @@ bool TITLE_BLOCK::TextVarResolver( wxString* aToken, const PROJECT* aProject ) c
|
|||
if( tokenUpdated )
|
||||
{
|
||||
*aToken = ExpandTextVars( *aToken, aProject );
|
||||
|
||||
// This is the default fallback, so don't claim we resolved it
|
||||
if( *aToken == wxT( "${" ) + originalToken + wxT( "}" ) )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -298,13 +298,15 @@ std::vector<PCB_MARKER*> BOARD::ResolveDRCExclusions()
|
|||
|
||||
bool BOARD::ResolveTextVar( wxString* token, int aDepth ) const
|
||||
{
|
||||
wxString var = *token;
|
||||
|
||||
if( GetTitleBlock().TextVarResolver( token, m_project ) )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else if( m_properties.count( *token ) )
|
||||
else if( m_properties.count( var ) )
|
||||
{
|
||||
*token = m_properties.at( *token );
|
||||
*token = m_properties.at( var );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue