Less repetition in pin numbers.

This commit is contained in:
Jeff Young 2022-10-28 12:21:40 +01:00
parent d1e2acd3d8
commit a42c60d493
1 changed files with 13 additions and 13 deletions

View File

@ -893,21 +893,19 @@ template <typename T>
wxString DIALOG_SIM_MODEL<T>::getSymbolPinString( int symbolPinIndex ) const
{
LIB_PIN* pin = m_sortedSymbolPins.at( symbolPinIndex );
wxString number;
wxString name;
wxString pinNumber;
wxString pinName;
if( pin )
{
number = pin->GetShownNumber();
name = pin->GetShownName();
pinNumber = pin->GetShownNumber();
pinName = pin->GetShownName();
}
LOCALE_IO toggle;
if( !pinName.IsEmpty() && pinName != pinNumber )
pinNumber += wxString::Format( wxT( " (%s)" ), pinName );
if( name == "" )
return wxString::Format( "%s", number );
else
return wxString::Format( "%s (%s)", number, name );
return pinNumber;
}
@ -918,10 +916,12 @@ wxString DIALOG_SIM_MODEL<T>::getModelPinString( int aModelPinIndex ) const
LOCALE_IO toggle;
if( pinName == "" )
return wxString::Format( "%d", aModelPinIndex + 1, pinName );
else
return wxString::Format( "%d (%s)", aModelPinIndex + 1, pinName );
wxString pinNumber = wxString::Format( "%d", aModelPinIndex + 1 );
if( !pinName.IsEmpty() && pinName != pinNumber )
pinNumber += wxString::Format( wxT( " (%s)" ), pinName );
return pinNumber;
}