diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp index 1b4604f43a..b4a3bc49de 100644 --- a/eeschema/cross-probing.cpp +++ b/eeschema/cross-probing.cpp @@ -431,10 +431,10 @@ std::string FormatProbeItem( EDA_ITEM* aItem, SCH_SYMBOL* aSymbol ) SCH_PIN* pin = (SCH_PIN*) aItem; aSymbol = pin->GetParentSymbol(); - if( !pin->GetNumber().IsEmpty() ) + if( !pin->GetShownNumber().IsEmpty() ) { return StrPrintf( "$PIN: \"%s\" $PART: \"%s\"", - TO_UTF8( pin->GetNumber() ), + TO_UTF8( pin->GetShownNumber() ), TO_UTF8( aSymbol->GetField( REFERENCE_FIELD )->GetText() ) ); } else diff --git a/eeschema/erc.cpp b/eeschema/erc.cpp index 3c2b5dab74..c4439f3cda 100644 --- a/eeschema/erc.cpp +++ b/eeschema/erc.cpp @@ -584,7 +584,7 @@ int ERC_TESTER::TestMultUnitPinConflicts() continue; wxString name = pin->GetParentSymbol()->GetRef( &subgraph->m_sheet ) + - + ":" + pin->GetNumber(); + + ":" + pin->GetShownNumber(); if( !pinToNetMap.count( name ) ) { @@ -597,7 +597,9 @@ int ERC_TESTER::TestMultUnitPinConflicts() ercItem->SetErrorMessage( wxString::Format( _( "Pin %s is connected to both %s and %s" ), - pin->GetNumber(), netName, pinToNetMap[name].first ) ); + pin->GetShownNumber(), + netName, + pinToNetMap[name].first ) ); ercItem->SetItems( pin, pinToNetMap[name].second ); ercItem->SetIsSheetSpecific(); diff --git a/eeschema/netlist_exporters/netlist_exporter_base.cpp b/eeschema/netlist_exporters/netlist_exporter_base.cpp index e633e97561..38a58d7f85 100644 --- a/eeschema/netlist_exporters/netlist_exporter_base.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_base.cpp @@ -168,7 +168,7 @@ void NETLIST_EXPORTER_BASE::CreatePinList( SCH_SYMBOL* aSymbol, continue; } - m_sortedSymbolPinList.emplace_back( pin->GetNumber(), netName ); + m_sortedSymbolPinList.emplace_back( pin->GetShownNumber(), netName ); } } } @@ -254,7 +254,7 @@ void NETLIST_EXPORTER_BASE::findAllUnitsOfSymbol( SCH_SYMBOL* aSchSymbol, LIB_SY continue; } - m_sortedSymbolPinList.emplace_back( pin->GetNumber(), netName ); + m_sortedSymbolPinList.emplace_back( pin->GetShownNumber(), netName ); } } } diff --git a/eeschema/netlist_exporters/netlist_exporter_cadstar.cpp b/eeschema/netlist_exporters/netlist_exporter_cadstar.cpp index 425e18af86..3f3c22283e 100644 --- a/eeschema/netlist_exporters/netlist_exporter_cadstar.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_cadstar.cpp @@ -144,7 +144,7 @@ bool NETLIST_EXPORTER_CADSTAR::writeListOfNets( FILE* f ) wxString ref_b = b.first->GetParentSymbol()->GetRef( &b.second ); if( ref_a == ref_b ) - return a.first->GetNumber() < b.first->GetNumber(); + return a.first->GetShownNumber() < b.first->GetShownNumber(); return ref_a < ref_b; } ); @@ -158,7 +158,7 @@ bool NETLIST_EXPORTER_CADSTAR::writeListOfNets( FILE* f ) wxString ref_a = a.first->GetParentSymbol()->GetRef( &a.second ); wxString ref_b = b.first->GetParentSymbol()->GetRef( &b.second ); - return ref_a == ref_b && a.first->GetNumber() == b.first->GetNumber(); + return ref_a == ref_b && a.first->GetShownNumber() == b.first->GetShownNumber(); } ), sorted_items.end() ); @@ -170,7 +170,7 @@ bool NETLIST_EXPORTER_CADSTAR::writeListOfNets( FILE* f ) SCH_SHEET_PATH sheet = pair.second; wxString refText = pin->GetParentSymbol()->GetRef( &sheet ); - wxString pinText = pin->GetNumber(); + wxString pinText = pin->GetShownNumber(); // Skip power symbols and virtual symbols if( refText[0] == wxChar( '#' ) ) diff --git a/eeschema/netlist_exporters/netlist_exporter_xml.cpp b/eeschema/netlist_exporters/netlist_exporter_xml.cpp index e03afca13f..41e1ac7598 100644 --- a/eeschema/netlist_exporters/netlist_exporter_xml.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_xml.cpp @@ -695,7 +695,7 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl ) wxString refB = b.m_Pin->GetParentSymbol()->GetRef( &b.m_Sheet ); if( refA == refB ) - return a.m_Pin->GetNumber() < b.m_Pin->GetNumber(); + return a.m_Pin->GetShownNumber() < b.m_Pin->GetShownNumber(); return refA < refB; } ); @@ -710,14 +710,15 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl ) wxString refA = a.m_Pin->GetParentSymbol()->GetRef( &a.m_Sheet ); wxString refB = b.m_Pin->GetParentSymbol()->GetRef( &b.m_Sheet ); - return refA == refB && a.m_Pin->GetNumber() == b.m_Pin->GetNumber(); + return refA == refB + && a.m_Pin->GetShownNumber() == b.m_Pin->GetShownNumber(); } ), net_record->m_Nodes.end() ); for( const NET_NODE& netNode : net_record->m_Nodes ) { wxString refText = netNode.m_Pin->GetParentSymbol()->GetRef( &netNode.m_Sheet ); - wxString pinText = netNode.m_Pin->GetNumber(); + wxString pinText = netNode.m_Pin->GetShownNumber(); // Skip power symbols and virtual symbols if( refText[0] == wxChar( '#' ) ) @@ -741,8 +742,7 @@ XNODE* NETLIST_EXPORTER_XML::makeListOfNets( unsigned aCtl ) wxString pinName = netNode.m_Pin->GetShownName(); wxString pinType = netNode.m_Pin->GetCanonicalElectricalTypeName(); - // ~ is a char used to code empty strings in libs. - if( pinName != "~" && !pinName.IsEmpty() ) + if( !pinName.IsEmpty() ) xnode->AddAttribute( "pinfunction", pinName ); if( netNode.m_NoConnect ) @@ -774,5 +774,5 @@ XNODE* NETLIST_EXPORTER_XML::node( const wxString& aName, static bool sortPinsByNumber( LIB_PIN* aPin1, LIB_PIN* aPin2 ) { // return "lhs < rhs" - return UTIL::RefDesStringCompare( aPin1->GetNumber(), aPin2->GetNumber() ) < 0; + return UTIL::RefDesStringCompare( aPin1->GetShownNumber(), aPin2->GetShownNumber() ) < 0; } diff --git a/eeschema/sch_pin.cpp b/eeschema/sch_pin.cpp index b090cb3b04..19f044395b 100644 --- a/eeschema/sch_pin.cpp +++ b/eeschema/sch_pin.cpp @@ -87,10 +87,24 @@ wxString SCH_PIN::GetName() const wxString SCH_PIN::GetShownName() const { - if( !m_alt.IsEmpty() ) - return m_alt; + wxString name = m_libPin->GetName(); - return m_libPin->GetShownName(); + if( !m_alt.IsEmpty() ) + name = m_alt; + + if( name == "~" ) + return wxEmptyString; + else + return name; +} + + +wxString SCH_PIN::GetShownNumber() const +{ + if( m_number == "~" ) + return wxEmptyString; + else + return m_number; } @@ -184,8 +198,7 @@ void SCH_PIN::GetMsgPanelInfo( EDA_DRAW_FRAME* aFrame, MSG_PANEL_ITEMS& aList ) aList.push_back( MSG_PANEL_ITEM( _( "Converted" ), msg ) ); aList.push_back( MSG_PANEL_ITEM( _( "Name" ), GetShownName() ) ); - msg = GetNumber().IsEmpty() ? wxT( "?" ) : GetShownNumber(); - aList.push_back( MSG_PANEL_ITEM( _( "Number" ), msg ) ); + aList.push_back( MSG_PANEL_ITEM( _( "Number" ), GetShownNumber() ) ); aList.push_back( MSG_PANEL_ITEM( _( "Type" ), ElectricalPinTypeGetText( GetType() ) ) ); msg = PinShapeGetText( GetShape() ); diff --git a/eeschema/sch_pin.h b/eeschema/sch_pin.h index 2d6a303798..6e888c8769 100644 --- a/eeschema/sch_pin.h +++ b/eeschema/sch_pin.h @@ -106,7 +106,7 @@ public: wxString GetShownName() const; wxString GetNumber() const { return m_number; } - wxString GetShownNumber() const { return m_number; } + wxString GetShownNumber() const; void SetNumber( const wxString& aNumber ) { m_number = aNumber; } diff --git a/eeschema/tools/backannotate.cpp b/eeschema/tools/backannotate.cpp index 1fef14f2e9..b1a3ea96be 100644 --- a/eeschema/tools/backannotate.cpp +++ b/eeschema/tools/backannotate.cpp @@ -531,7 +531,7 @@ void BACK_ANNOTATE::processNetNameChange( const wxString& aRef, SCH_PIN* aPin, msg.Printf( _( "Change %s pin %s net label from '%s' to '%s'." ), aRef, - aPin->GetNumber(), + aPin->GetShownNumber(), aOldName, aNewName ); @@ -554,15 +554,19 @@ void BACK_ANNOTATE::processNetNameChange( const wxString& aRef, SCH_PIN* aPin, if( schPin->IsPowerConnection() ) { - msg.Printf( _( "Net %s cannot be changed to '%s' because it is driven by a power " - "pin." ), aOldName, aNewName ); + msg.Printf( _( "Net %s cannot be changed to %s because it is driven by a power pin." ), + aOldName, + aNewName ); m_reporter.ReportHead( msg, RPT_SEVERITY_ERROR ); break; } ++m_changesCount; - msg.Printf( _( "Add label '%s' to %s pin %s net." ), aNewName, aRef, aPin->GetNumber() ); + msg.Printf( _( "Add label '%s' to %s pin %s net." ), + aNewName, + aRef, + aPin->GetShownNumber() ); if( !m_dryRun ) {