Implement variant processing for text var resolution.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/23355
This commit is contained in:
@@ -226,7 +226,9 @@ wxString SCH_FIELD::GetShownText( bool aAllowExtraText, int aDepth ) const
|
||||
return GetShownText( ¤tSheet, aAllowExtraText, aDepth, variantName );
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetShownText( nullptr, aAllowExtraText, aDepth );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -794,6 +794,8 @@ bool SCH_LABEL_BASE::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* toke
|
||||
if( !schematic )
|
||||
return false;
|
||||
|
||||
wxString variant = schematic->GetCurrentVariant();
|
||||
|
||||
if( operatingPoint.Matches( *token ) )
|
||||
{
|
||||
int precision = 3;
|
||||
@@ -865,7 +867,7 @@ bool SCH_LABEL_BASE::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* toke
|
||||
|
||||
for( SCH_RULE_AREA* ruleArea : directive->GetConnectedRuleAreas() )
|
||||
{
|
||||
if( ruleArea->GetExcludedFromBOM() )
|
||||
if( ruleArea->GetExcludedFromBOM( aPath, variant ) )
|
||||
*token = _( "Excluded from BOM" );
|
||||
}
|
||||
|
||||
@@ -878,7 +880,7 @@ bool SCH_LABEL_BASE::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* toke
|
||||
|
||||
for( SCH_RULE_AREA* ruleArea : directive->GetConnectedRuleAreas() )
|
||||
{
|
||||
if( ruleArea->GetExcludedFromBoard() )
|
||||
if( ruleArea->GetExcludedFromBoard( aPath, variant ) )
|
||||
*token = _( "Excluded from board" );
|
||||
}
|
||||
|
||||
@@ -891,7 +893,7 @@ bool SCH_LABEL_BASE::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* toke
|
||||
|
||||
for( SCH_RULE_AREA* ruleArea : directive->GetConnectedRuleAreas() )
|
||||
{
|
||||
if( ruleArea->GetExcludedFromSim() )
|
||||
if( ruleArea->GetExcludedFromSim( aPath, variant ) )
|
||||
*token = _( "Excluded from simulation" );
|
||||
}
|
||||
|
||||
@@ -904,7 +906,7 @@ bool SCH_LABEL_BASE::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* toke
|
||||
|
||||
for( SCH_RULE_AREA* ruleArea : directive->GetConnectedRuleAreas() )
|
||||
{
|
||||
if( ruleArea->GetDNP() )
|
||||
if( ruleArea->GetDNP( aPath, variant ) )
|
||||
*token = _( "DNP" );
|
||||
}
|
||||
|
||||
|
||||
@@ -259,6 +259,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
|
||||
}
|
||||
|
||||
PROJECT* project = &schematic->Project();
|
||||
wxString variant = schematic->GetCurrentVariant();
|
||||
|
||||
// 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
|
||||
@@ -286,7 +287,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
|
||||
{
|
||||
*token = wxEmptyString;
|
||||
|
||||
if( aPath->GetExcludedFromBOM() || this->ResolveExcludedFromBOM() )
|
||||
if( aPath->GetExcludedFromBOM( variant ) || this->ResolveExcludedFromBOM( aPath, variant ) )
|
||||
*token = _( "Excluded from BOM" );
|
||||
|
||||
return true;
|
||||
@@ -295,7 +296,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
|
||||
{
|
||||
*token = wxEmptyString;
|
||||
|
||||
if( aPath->GetExcludedFromBoard() || this->ResolveExcludedFromBoard() )
|
||||
if( aPath->GetExcludedFromBoard( variant ) || this->ResolveExcludedFromBoard( aPath, variant ) )
|
||||
*token = _( "Excluded from board" );
|
||||
|
||||
return true;
|
||||
@@ -304,7 +305,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
|
||||
{
|
||||
*token = wxEmptyString;
|
||||
|
||||
if( aPath->GetExcludedFromSim() || this->ResolveExcludedFromSim() )
|
||||
if( aPath->GetExcludedFromSim( variant ) || this->ResolveExcludedFromSim( aPath, variant ) )
|
||||
*token = _( "Excluded from simulation" );
|
||||
|
||||
return true;
|
||||
@@ -313,7 +314,7 @@ bool SCH_SHEET::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token, in
|
||||
{
|
||||
*token = wxEmptyString;
|
||||
|
||||
if( aPath->GetDNP() || this->ResolveDNP() )
|
||||
if( aPath->GetDNP( variant ) || this->ResolveDNP( aPath, variant ) )
|
||||
*token = _( "DNP" );
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1797,6 +1797,8 @@ bool SCH_SYMBOL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token,
|
||||
if( !schematic )
|
||||
return false;
|
||||
|
||||
wxString variant = aVariantName.IsEmpty() ? schematic->GetCurrentVariant() : aVariantName;
|
||||
|
||||
if( operatingPoint.Matches( *token ) )
|
||||
{
|
||||
wxString pin( operatingPoint.GetMatch( *token, 1 ).Lower() );
|
||||
@@ -1991,7 +1993,7 @@ bool SCH_SYMBOL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token,
|
||||
{
|
||||
*token = wxEmptyString;
|
||||
|
||||
if( aPath->GetExcludedFromBOM() || this->ResolveExcludedFromBOM() )
|
||||
if( aPath->GetExcludedFromBOM( variant ) || this->ResolveExcludedFromBOM( aPath, variant ) )
|
||||
*token = _( "Excluded from BOM" );
|
||||
|
||||
return true;
|
||||
@@ -2000,7 +2002,7 @@ bool SCH_SYMBOL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token,
|
||||
{
|
||||
*token = wxEmptyString;
|
||||
|
||||
if( aPath->GetExcludedFromBoard() || this->ResolveExcludedFromBoard() )
|
||||
if( aPath->GetExcludedFromBoard( variant ) || this->ResolveExcludedFromBoard( aPath, variant ) )
|
||||
*token = _( "Excluded from board" );
|
||||
|
||||
return true;
|
||||
@@ -2009,7 +2011,7 @@ bool SCH_SYMBOL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token,
|
||||
{
|
||||
*token = wxEmptyString;
|
||||
|
||||
if( aPath->GetExcludedFromSim() || this->ResolveExcludedFromSim() )
|
||||
if( aPath->GetExcludedFromSim( variant ) || this->ResolveExcludedFromSim( aPath, variant ) )
|
||||
*token = _( "Excluded from simulation" );
|
||||
|
||||
return true;
|
||||
@@ -2018,9 +2020,7 @@ bool SCH_SYMBOL::ResolveTextVar( const SCH_SHEET_PATH* aPath, wxString* token,
|
||||
{
|
||||
*token = wxEmptyString;
|
||||
|
||||
wxString variant = aVariantName.IsEmpty() ? schematic->GetCurrentVariant() : aVariantName;
|
||||
|
||||
if( aPath->GetDNP() || this->ResolveDNP( aPath, variant ) )
|
||||
if( aPath->GetDNP( variant ) || this->ResolveDNP( aPath, variant ) )
|
||||
*token = _( "DNP" );
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user