Schematic: correctly resolve label nets using sheet variables
This commit is contained in:
parent
c8fdac7abe
commit
bf59f1246b
|
@ -292,7 +292,8 @@ wxString CONNECTION_SUBGRAPH::driverName( SCH_ITEM* aItem ) const
|
||||||
case SCH_HIER_LABEL_T:
|
case SCH_HIER_LABEL_T:
|
||||||
case SCH_SHEET_PIN_T:
|
case SCH_SHEET_PIN_T:
|
||||||
{
|
{
|
||||||
return EscapeString( static_cast<SCH_TEXT*>( aItem )->GetShownText(), CTX_NETNAME );
|
return EscapeString( static_cast<SCH_TEXT*>( aItem )->GetShownText( &m_sheet ),
|
||||||
|
CTX_NETNAME );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -339,12 +339,19 @@ const BOX2I SCH_TEXT::GetBoundingBox() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString SCH_TEXT::GetShownText( int aDepth, bool aAllowExtraText ) const
|
wxString SCH_TEXT::GetShownText( const SCH_SHEET_PATH* aPath, int aDepth, bool aAllowExtraText ) const
|
||||||
{
|
{
|
||||||
|
SCH_SHEET* sheet = nullptr;
|
||||||
|
|
||||||
|
if( aPath )
|
||||||
|
sheet = aPath->Last();
|
||||||
|
else if( Schematic() )
|
||||||
|
sheet = Schematic()->CurrentSheet().Last();
|
||||||
|
|
||||||
std::function<bool( wxString* )> textResolver =
|
std::function<bool( wxString* )> textResolver =
|
||||||
[&]( wxString* token ) -> bool
|
[&]( wxString* token ) -> bool
|
||||||
{
|
{
|
||||||
if( SCH_SHEET* sheet = Schematic()->CurrentSheet().Last() )
|
if( sheet )
|
||||||
{
|
{
|
||||||
if( sheet->ResolveTextVar( token, aDepth + 1 ) )
|
if( sheet->ResolveTextVar( token, aDepth + 1 ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -128,7 +128,12 @@ public:
|
||||||
return wxT( "SCH_TEXT" );
|
return wxT( "SCH_TEXT" );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override;
|
wxString GetShownText( const SCH_SHEET_PATH* aPath, int aDepth = 0,
|
||||||
|
bool aAllowExtraText = true ) const;
|
||||||
|
wxString GetShownText( int aDepth = 0, bool aAllowExtraText = true ) const override
|
||||||
|
{
|
||||||
|
return GetShownText( nullptr, aDepth, aAllowExtraText );
|
||||||
|
}
|
||||||
|
|
||||||
bool IsHypertext() const override
|
bool IsHypertext() const override
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue