Recurse into title block fields when resovling text vars.
Fixes https://gitlab.com/kicad/code/kicad/issues/4554
This commit is contained in:
parent
9f2be3714f
commit
2c0f3c8088
|
@ -92,64 +92,66 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
|||
std::function<bool( wxString* )> wsResolver =
|
||||
[ this ]( wxString* token ) -> bool
|
||||
{
|
||||
bool tokenUpdated = false;
|
||||
|
||||
if( token->IsSameAs( wxT( "KICAD_VERSION" ) ) )
|
||||
{
|
||||
*token = wxString::Format( wxT( "%s%s %s" ),
|
||||
productName,
|
||||
Pgm().App().GetAppName(),
|
||||
GetBuildVersion() );
|
||||
return true;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "#" ) ) )
|
||||
{
|
||||
*token = wxString::Format( wxT( "%d" ), m_sheetNumber );
|
||||
return true;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "##" ) ) )
|
||||
{
|
||||
*token = wxString::Format( wxT( "%d" ), m_sheetCount );
|
||||
return true;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "SHEETNAME" ) ) )
|
||||
{
|
||||
*token = m_sheetFullName;
|
||||
return true;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "FILENAME" ) ) )
|
||||
{
|
||||
wxFileName fn( m_fileName );
|
||||
*token = fn.GetFullName();
|
||||
return true;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "PAPER" ) ) )
|
||||
{
|
||||
*token = m_paperFormat ? *m_paperFormat : wxString( "" );
|
||||
return true;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "LAYER" ) ) )
|
||||
{
|
||||
*token = m_sheetLayer ? *m_sheetLayer : wxString( "" );
|
||||
return true;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "ISSUE_DATE" ) ) )
|
||||
{
|
||||
*token = m_titleBlock ? m_titleBlock->GetDate() : wxString( "" );
|
||||
return true;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "REVISION" ) ) )
|
||||
{
|
||||
*token = m_titleBlock ? m_titleBlock->GetRevision() : wxString( "" );
|
||||
return true;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "TITLE" ) ) )
|
||||
{
|
||||
*token = m_titleBlock ? m_titleBlock->GetTitle() : wxString( "" );
|
||||
return true;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->IsSameAs( wxT( "COMPANY" ) ) )
|
||||
{
|
||||
*token = m_titleBlock ? m_titleBlock->GetCompany() : wxString( "" );
|
||||
return true;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
else if( token->Left( token->Len() - 1 ).IsSameAs( wxT( "COMMENT" ) ) )
|
||||
{
|
||||
|
@ -169,10 +171,16 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
|||
case '9':
|
||||
*token = m_titleBlock ? m_titleBlock->GetComment( c - '0' )
|
||||
: wxString( "" );
|
||||
return true;
|
||||
tokenUpdated = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( tokenUpdated )
|
||||
{
|
||||
*token = ExpandTextVars( *token, nullptr, m_project );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue