Use correct sheetpath when we have it.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/15870
This commit is contained in:
parent
75e0bf0cba
commit
bdead1d0b1
|
@ -262,7 +262,8 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PROJECT *project = &Schematic()->Prj();
|
SCH_SHEET_PATH sheetPath = aPath ? *aPath : findSelf();
|
||||||
|
PROJECT* project = &Schematic()->Prj();
|
||||||
|
|
||||||
// We cannot resolve text variables initially on load as we need to first load the screen and
|
// We cannot resolve text variables initially on load as we need to first load the screen and
|
||||||
// then parse the hierarchy. So skip the resolution if the screen isn't set yet
|
// then parse the hierarchy. So skip the resolution if the screen isn't set yet
|
||||||
|
@ -273,7 +274,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
|
||||||
|
|
||||||
if( token->IsSameAs( wxT( "#" ) ) )
|
if( token->IsSameAs( wxT( "#" ) ) )
|
||||||
{
|
{
|
||||||
*token = wxString::Format( "%s", findSelf().GetPageNumber() );
|
*token = wxString::Format( "%s", sheetPath.GetPageNumber() );
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if( token->IsSameAs( wxT( "##" ) ) )
|
else if( token->IsSameAs( wxT( "##" ) ) )
|
||||||
|
@ -284,14 +285,12 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
|
||||||
}
|
}
|
||||||
else if( token->IsSameAs( wxT( "SHEETPATH" ) ) )
|
else if( token->IsSameAs( wxT( "SHEETPATH" ) ) )
|
||||||
{
|
{
|
||||||
*token = findSelf().PathHumanReadable();
|
*token = sheetPath.PathHumanReadable();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// See if parent can resolve it (these will recurse to ancestors)
|
// See if parent can resolve it (these will recurse to ancestors)
|
||||||
|
|
||||||
SCH_SHEET_PATH sheetPath = aPath ? *aPath : findSelf();
|
|
||||||
|
|
||||||
if( sheetPath.size() >= 2 )
|
if( sheetPath.size() >= 2 )
|
||||||
{
|
{
|
||||||
sheetPath.pop_back();
|
sheetPath.pop_back();
|
||||||
|
|
Loading…
Reference in New Issue