Fix a bunch of failures to resolve text variables.

This commit is contained in:
Jeff Young 2024-06-04 12:46:34 +01:00
parent 26fc2bd071
commit e5bad195b6
5 changed files with 15 additions and 13 deletions

View File

@ -469,10 +469,10 @@ CONNECTION_SUBGRAPH::GetNetclassesForDriver( SCH_ITEM* aItem, bool returnAll ) c
if( field->GetCanonicalName() == wxT( "Netclass" ) )
{
wxString netclass = field->GetText();
wxString netclass = field->GetShownText( &m_sheet, false );
if( netclass != wxEmptyString )
foundNetclasses.push_back( { field->GetText(), aItem } );
foundNetclasses.push_back( { netclass, aItem } );
return returnAll;
}
@ -1602,9 +1602,10 @@ void CONNECTION_GRAPH::generateBusAliasMembers()
SCH_CONNECTION dummy( item, subgraph->m_sheet );
dummy.SetGraph( this );
dummy.ConfigureFromLabel( label->GetText() );
dummy.ConfigureFromLabel( label->GetShownText( &subgraph->m_sheet, false ) );
wxLogTrace( ConnTrace, wxS( "new bus label (%s)" ), label->GetText() );
wxLogTrace( ConnTrace, wxS( "new bus label (%s)" ),
label->GetShownText( &subgraph->m_sheet, false ) );
for( const auto& conn : dummy.Members() )
{
@ -2317,14 +2318,14 @@ void CONNECTION_GRAPH::buildConnectionGraph( std::function<void( SCH_ITEM* )>* a
if( SCH_SHEET* sheet = pin->GetParent() )
{
wxString pinText = pin->GetText();
wxString pinText = pin->GetShownText( false );
SCH_SCREEN* screen = sheet->GetScreen();
for( SCH_ITEM* item : screen->Items().OfType( SCH_HIER_LABEL_T ) )
{
SCH_HIERLABEL* label = static_cast<SCH_HIERLABEL*>( item );
if( label->GetText() == pinText )
if( label->GetShownText( &subgraph->m_sheet, false ) == pinText )
{
SCH_SHEET_PATH path = subgraph->m_sheet;
path.push_back( sheet );

View File

@ -591,7 +591,7 @@ int ERC_TESTER::TestMissingNetclasses()
if( field->GetCanonicalName() == wxT( "Netclass" ) )
{
wxString netclass = field->GetText();
wxString netclass = field->GetShownText( &sheet, false );
if( !netclass.IsSameAs( defaultNetclass )
&& settings->m_NetClasses.count( netclass ) == 0 )

View File

@ -97,10 +97,10 @@ void NETLIST_EXPORTER_SPICE_MODEL::readPorts( unsigned aNetlistOptions )
if( SCH_CONNECTION* conn = label->Connection( &sheet ) )
{
m_ports.insert( { std::string( conn->Name().ToUTF8() ),
PORT_INFO{ std::string( label->GetText().ToUTF8() ),
label->GetShape()
}
wxString labelText = label->GetShownText( &sheet, false );
m_ports.insert( {
std::string( conn->Name().ToUTF8() ),
PORT_INFO{ std::string( labelText.ToUTF8() ), label->GetShape() }
} );
}
}

View File

@ -523,10 +523,11 @@ int EE_INSPECTION_TOOL::ShowDatasheet( const TOOL_EVENT& aEvent )
return 0;
SCH_SYMBOL* symbol = (SCH_SYMBOL*) selection.Front();
SCH_FIELD* field = symbol->GetField( DATASHEET_FIELD );
// Use GetShownText() to resolve any text variables, but don't allow adding extra text
// (ie: the field name)
datasheet = symbol->GetField( DATASHEET_FIELD )->GetShownText( false );
datasheet = field->GetShownText( &symbol->Schematic()->CurrentSheet(), false );
}
if( datasheet.IsEmpty() || datasheet == wxS( "~" ) )

View File

@ -1033,7 +1033,7 @@ OPT_TOOL_EVENT EE_SELECTION_TOOL::autostartEvent( TOOL_EVENT* aEvent, EE_GRID_HE
{
SCH_LABEL_BASE* label = static_cast<SCH_LABEL_BASE*>( aItem );
SCH_CONNECTION possibleConnection( label->Schematic()->ConnectionGraph() );
possibleConnection.ConfigureFromLabel( label->GetText() );
possibleConnection.ConfigureFromLabel( label->GetShownText( false ) );
if( possibleConnection.IsBus() )
newEvt = EE_ACTIONS::drawBus.MakeEvent();