Browse Source

Schematic Sheet Variables: more SCH_SHEET_PATH plumbing

Fixes: https://gitlab.com/kicad/code/kicad/-/issues/14239
newinvert
Mike Williams 3 years ago
parent
commit
ade29c8577
  1. 6
      eeschema/sch_sheet.cpp
  2. 6
      eeschema/sch_sheet.h
  3. 2
      eeschema/sch_symbol.cpp
  4. 2
      eeschema/sch_text.cpp

6
eeschema/sch_sheet.cpp

@ -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

6
eeschema/sch_sheet.h

@ -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;

2
eeschema/sch_symbol.cpp

@ -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;
}

2
eeschema/sch_text.cpp

@ -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;
}

Loading…
Cancel
Save