From e5bad195b6d1f0ec9b3812e6a7e9648aba55245b Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 4 Jun 2024 12:46:34 +0100 Subject: [PATCH] Fix a bunch of failures to resolve text variables. --- eeschema/connection_graph.cpp | 13 +++++++------ eeschema/erc/erc.cpp | 2 +- .../netlist_exporter_spice_model.cpp | 8 ++++---- eeschema/tools/ee_inspection_tool.cpp | 3 ++- eeschema/tools/ee_selection_tool.cpp | 2 +- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/eeschema/connection_graph.cpp b/eeschema/connection_graph.cpp index 6f5cf2e60f..fa9585aa1b 100644 --- a/eeschema/connection_graph.cpp +++ b/eeschema/connection_graph.cpp @@ -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* 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( item ); - if( label->GetText() == pinText ) + if( label->GetShownText( &subgraph->m_sheet, false ) == pinText ) { SCH_SHEET_PATH path = subgraph->m_sheet; path.push_back( sheet ); diff --git a/eeschema/erc/erc.cpp b/eeschema/erc/erc.cpp index dd114f43a2..a8975e77ba 100644 --- a/eeschema/erc/erc.cpp +++ b/eeschema/erc/erc.cpp @@ -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 ) diff --git a/eeschema/netlist_exporters/netlist_exporter_spice_model.cpp b/eeschema/netlist_exporters/netlist_exporter_spice_model.cpp index f9b7923f99..74a1053b51 100644 --- a/eeschema/netlist_exporters/netlist_exporter_spice_model.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_spice_model.cpp @@ -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() } } ); } } diff --git a/eeschema/tools/ee_inspection_tool.cpp b/eeschema/tools/ee_inspection_tool.cpp index 2e588238b1..1c6e7ab3e3 100644 --- a/eeschema/tools/ee_inspection_tool.cpp +++ b/eeschema/tools/ee_inspection_tool.cpp @@ -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( "~" ) ) diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 6c17176a1b..a542d66c3c 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -1033,7 +1033,7 @@ OPT_TOOL_EVENT EE_SELECTION_TOOL::autostartEvent( TOOL_EVENT* aEvent, EE_GRID_HE { SCH_LABEL_BASE* label = static_cast( aItem ); SCH_CONNECTION possibleConnection( label->Schematic()->ConnectionGraph() ); - possibleConnection.ConfigureFromLabel( label->GetText() ); + possibleConnection.ConfigureFromLabel( label->GetShownText( false ) ); if( possibleConnection.IsBus() ) newEvt = EE_ACTIONS::drawBus.MakeEvent();