Schematic Sheet Variables: more SCH_SHEET_PATH plumbing

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/14239
This commit is contained in:
Mike Williams 2023-03-10 09:16:05 -05:00
parent bb27717dda
commit ade29c8577
4 changed files with 10 additions and 6 deletions

View File

@ -234,7 +234,7 @@ void SCH_SHEET::GetContextualTextVars( wxArrayString* aVars ) const
}
bool SCH_SHEET::ResolveTextVar( wxString* token, int aDepth ) const
bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth ) const
{
if( !Schematic() )
return false;
@ -291,13 +291,13 @@ bool SCH_SHEET::ResolveTextVar( wxString* token, int aDepth ) const
// See if parent can resolve it (these will recurse to ancestors)
SCH_SHEET_PATH sheetPath = findSelf();
SCH_SHEET_PATH sheetPath = aPath ? *aPath : findSelf();
if( sheetPath.size() >= 2 )
{
sheetPath.pop_back();
if( sheetPath.Last()->ResolveTextVar( token, aDepth + 1 ) )
if( sheetPath.Last()->ResolveTextVar( aPath, token, aDepth + 1 ) )
return true;
}
else

View File

@ -153,7 +153,11 @@ public:
*
* @param aDepth is a counter to limit recursion and circular references.
*/
bool ResolveTextVar( wxString* token, int aDepth = 0 ) const;
bool ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, int aDepth = 0 ) const;
bool ResolveTextVar( wxString* token, int aDepth = 0 )
{
return ResolveTextVar( nullptr, token, aDepth );
}
void GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, std::vector<MSG_PANEL_ITEM>& aList ) override;

View File

@ -1313,7 +1313,7 @@ bool SCH_SYMBOL::ResolveTextVar( wxString* token, int aDepth, const SCH_SHEET_PA
if( sheet )
{
if( sheet->ResolveTextVar( token, aDepth + 1 ) )
if( sheet->ResolveTextVar( aPath, token, aDepth + 1 ) )
return true;
}

View File

@ -353,7 +353,7 @@ wxString SCH_TEXT::GetShownText( const SCH_SHEET_PATH* aPath, int aDepth, bool a
{
if( sheet )
{
if( sheet->ResolveTextVar( token, aDepth + 1 ) )
if( sheet->ResolveTextVar( aPath, token, aDepth + 1 ) )
return true;
}