Eeschema: fix incorrect display of pin number in ERC messages and marquers.

This commit is contained in:
jean-pierre charras 2017-11-21 18:39:59 +01:00
parent 656d4d0dff
commit 945325d63a
1 changed files with 6 additions and 14 deletions

View File

@ -281,12 +281,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
ii = aNetItemRef->m_ElectricalPinType; ii = aNetItemRef->m_ElectricalPinType;
wxString string_pinnum, cmp_ref; wxString cmp_ref( "?" );
char ascii_buf[5];
ascii_buf[4] = 0;
memcpy( ascii_buf, &aNetItemRef->m_PinNum, 4 );
string_pinnum = FROM_UTF8( ascii_buf );
cmp_ref = wxT( "?" );
if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link ) if( aNetItemRef->m_Type == NET_PIN && aNetItemRef->m_Link )
cmp_ref = aNetItemRef->GetComponentParent()->GetRef( &aNetItemRef->m_SheetPath ); cmp_ref = aNetItemRef->GetComponentParent()->GetRef( &aNetItemRef->m_SheetPath );
@ -296,7 +291,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
if( aMinConn == NOC ) /* Only 1 element in the net. */ if( aMinConn == NOC ) /* Only 1 element in the net. */
{ {
msg.Printf( _( "Pin %s (%s) of component %s is unconnected." ), msg.Printf( _( "Pin %s (%s) of component %s is unconnected." ),
GetChars( string_pinnum ), aNetItemRef->m_PinNum,
GetChars( GetText( ii ) ), GetChars( GetText( ii ) ),
GetChars( cmp_ref ) ); GetChars( cmp_ref ) );
marker->SetData( ERCE_PIN_NOT_CONNECTED, marker->SetData( ERCE_PIN_NOT_CONNECTED,
@ -313,7 +308,7 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
&aNetItemRef->m_SheetPath ); &aNetItemRef->m_SheetPath );
msg.Printf( _( "Pin %s (%s) of component %s is not driven (Net %d)." ), msg.Printf( _( "Pin %s (%s) of component %s is not driven (Net %d)." ),
GetChars( string_pinnum ), aNetItemRef->m_PinNum,
GetChars( GetText( ii ) ), GetChars( GetText( ii ) ),
GetChars( cmp_ref ), GetChars( cmp_ref ),
aNetItemRef->GetNet() ); aNetItemRef->GetNet() );
@ -346,21 +341,18 @@ void Diagnose( NETLIST_OBJECT* aNetItemRef, NETLIST_OBJECT* aNetItemTst,
errortype = ERCE_PIN_TO_PIN_ERROR; errortype = ERCE_PIN_TO_PIN_ERROR;
} }
wxString alt_string_pinnum, alt_cmp; wxString alt_cmp( "?" );
memcpy( ascii_buf, &aNetItemTst->m_PinNum, 4 );
alt_string_pinnum = FROM_UTF8( ascii_buf );
alt_cmp = wxT( "?" );
if( aNetItemTst->m_Type == NET_PIN && aNetItemTst->m_Link ) if( aNetItemTst->m_Type == NET_PIN && aNetItemTst->m_Link )
alt_cmp = aNetItemTst->GetComponentParent()->GetRef( &aNetItemTst->m_SheetPath ); alt_cmp = aNetItemTst->GetComponentParent()->GetRef( &aNetItemTst->m_SheetPath );
msg.Printf( _( "Pin %s (%s) of component %s is connected to " ), msg.Printf( _( "Pin %s (%s) of component %s is connected to " ),
GetChars( string_pinnum ), aNetItemRef->m_PinNum,
GetChars( GetText( ii ) ), GetChars( GetText( ii ) ),
GetChars( cmp_ref ) ); GetChars( cmp_ref ) );
marker->SetData( errortype, aNetItemRef->m_Start, msg, aNetItemRef->m_Start ); marker->SetData( errortype, aNetItemRef->m_Start, msg, aNetItemRef->m_Start );
msg.Printf( _( "pin %s (%s) of component %s (net %d)." ), msg.Printf( _( "pin %s (%s) of component %s (net %d)." ),
GetChars( alt_string_pinnum ), aNetItemTst->m_PinNum,
GetChars( GetText( jj ) ), GetChars( GetText( jj ) ),
GetChars( alt_cmp ), GetChars( alt_cmp ),
aNetItemRef->GetNet() ); aNetItemRef->GetNet() );