Handle nested text variable references in title block.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/16919
This commit is contained in:
parent
91e15634fc
commit
33d93b79a3
|
@ -115,7 +115,7 @@ void DS_DRAW_ITEM_LIST::GetTextVars( wxArrayString* aVars )
|
||||||
wxString DS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
wxString DS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
||||||
{
|
{
|
||||||
std::function<bool( wxString* )> wsResolver =
|
std::function<bool( wxString* )> wsResolver =
|
||||||
[ this ]( wxString* token ) -> bool
|
[&]( wxString* token ) -> bool
|
||||||
{
|
{
|
||||||
bool tokenUpdated = false;
|
bool tokenUpdated = false;
|
||||||
|
|
||||||
|
@ -173,10 +173,24 @@ wxString DS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
||||||
}
|
}
|
||||||
else if( m_titleBlock )
|
else if( m_titleBlock )
|
||||||
{
|
{
|
||||||
// no need for tokenUpdated; TITLE_BLOCK::TextVarResolver() does a full
|
|
||||||
// resolve
|
|
||||||
if( m_titleBlock->TextVarResolver( token, m_project ) )
|
if( m_titleBlock->TextVarResolver( token, m_project ) )
|
||||||
|
{
|
||||||
|
// No need for tokenUpdated; TITLE_BLOCK::TextVarResolver() already goes
|
||||||
|
// up to the project.
|
||||||
|
//
|
||||||
|
// However, the title block may have variables in it itself, so we need
|
||||||
|
// to run the worksheet resolver again.
|
||||||
|
//
|
||||||
|
const TITLE_BLOCK* savedTitleBlock = m_titleBlock;
|
||||||
|
|
||||||
|
m_titleBlock = nullptr;
|
||||||
|
{
|
||||||
|
*token = ExpandTextVars( *token, &wsResolver );
|
||||||
|
}
|
||||||
|
m_titleBlock = savedTitleBlock;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( m_properties && m_properties->count( *token ) )
|
else if( m_properties && m_properties->count( *token ) )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue