Commit 082b8326 authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Fix issue when displaying net names and/or pad numbers including the...

Pcbnew: Fix issue when displaying net names and/or pad numbers including the "<" char in drc dialog, because drc dialog uses an wxHtmlWindow to display drc messages, and the "<" char has a special meaning and is not allowed in texts (now replaced by the" &lt;" sequence in messages displayed in html)
Eeschema: replace "<" and ">" by "(" and ")" in autogenerated net names, to avoid other issues in html messages.
Very minor other fixes.
parent 62764cd6
......@@ -493,6 +493,7 @@ void EDA_3D_CANVAS::InitGL()
glEnable( GL_ALPHA_TEST );
glEnable( GL_LINE_SMOOTH );
glEnable(GL_POLYGON_SMOOTH);
glShadeModel( GL_SMOOTH );
glEnable( GL_COLOR_MATERIAL );
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
......@@ -505,7 +506,6 @@ void EDA_3D_CANVAS::InitGL()
// Initialize alpha blending function.
glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
glShadeModel( GL_FLAT );
}
// set viewing projection
......
......@@ -350,11 +350,11 @@ wxString NETLIST_OBJECT::GetShortNetName() const
SCH_COMPONENT* link = m_netNameCandidate->GetComponentParent();
if( link ) // Should be always true
{
netName = wxT("Net-<");
netName = wxT("Net-(");
netName << link->GetRef( &m_netNameCandidate->m_SheetPath );
netName << wxT("-Pad")
<< LIB_PIN::ReturnPinStringNum( m_netNameCandidate->m_PinNum )
<< wxT(">");
<< wxT(")");
}
}
else
......
......@@ -940,9 +940,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
// Initialize fixed field values to default values found in library
// Note: the field texts are not modified because they are set in schematic,
// the text from libraries is most of time a dummy text
// Only VALUE and REFERENCE are re-initialized
// Perhaps the FOOTPRINT field should also be considered,
// but for most of components it is not set in library
// Only VALUE, REFERENCE , FOOTPRINT and DATASHEET are re-initialized
LIB_FIELD& refField = entry->GetReferenceField();
m_Cmp->GetField( REFERENCE )->SetTextPosition( refField.GetTextPosition() + m_Cmp->m_Pos );
m_Cmp->GetField( REFERENCE )->ImportValues( refField );
......@@ -951,6 +949,20 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
m_Cmp->GetField( VALUE )->SetTextPosition( valField.GetTextPosition() + m_Cmp->m_Pos );
m_Cmp->GetField( VALUE )->ImportValues( valField );
LIB_FIELD* field = entry->GetField(FOOTPRINT);
if( field && m_Cmp->GetField( FOOTPRINT ) )
{
m_Cmp->GetField( FOOTPRINT )->SetTextPosition( field->GetTextPosition() + m_Cmp->m_Pos );
m_Cmp->GetField( FOOTPRINT )->ImportValues( *field );
}
field = entry->GetField(DATASHEET);
if( field && m_Cmp->GetField( DATASHEET ) )
{
m_Cmp->GetField( DATASHEET )->SetTextPosition( field->GetTextPosition() + m_Cmp->m_Pos );
m_Cmp->GetField( DATASHEET )->ImportValues( *field );
}
m_Cmp->SetOrientation( CMP_NORMAL );
m_Parent->OnModify();
......
......@@ -146,31 +146,45 @@ public:
wxString ShowHtml() const
{
wxString ret;
wxString mainText = m_MainText;
// a wxHtmlWindows does not like < and > in the text to display
// because these chars have a special meaning in html
mainText.Replace( wxT("<"), wxT("&lt;") );
mainText.Replace( wxT(">"), wxT("&gt;") );
wxString errText = GetErrorText();
errText.Replace( wxT("<"), wxT("&lt;") );
errText.Replace( wxT(">"), wxT("&gt;") );
if( m_noCoordinate )
{
// omit the coordinate, a NETCLASS has no location
ret.Printf( _( "ErrType(%d): <b>%s</b><ul><li> %s </li></ul>" ),
m_ErrorCode,
GetChars( GetErrorText() ),
GetChars( m_MainText ) );
GetChars( errText ),
GetChars( mainText ) );
}
else if( m_hasSecondItem )
{
wxString auxText = m_AuxiliaryText;
auxText.Replace( wxT("<"), wxT("&lt;") );
auxText.Replace( wxT(">"), wxT("&gt;") );
// an html fragment for the entire message in the listbox. feel free
// to add color if you want:
ret.Printf( _( "ErrType(%d): <b>%s</b><ul><li> %s: %s </li><li> %s: %s </li></ul>" ),
m_ErrorCode,
GetChars( GetErrorText() ),
GetChars( ShowCoord( m_MainPosition )), GetChars( m_MainText ),
GetChars( ShowCoord( m_AuxiliaryPosition )), GetChars( m_AuxiliaryText ) );
GetChars( errText ),
GetChars( ShowCoord( m_MainPosition )), GetChars( mainText ),
GetChars( ShowCoord( m_AuxiliaryPosition )), GetChars( auxText ) );
}
else
{
ret.Printf( _( "ErrType(%d): <b>%s</b><ul><li> %s: %s </li></ul>" ),
m_ErrorCode,
GetChars( GetErrorText() ),
GetChars( ShowCoord( m_MainPosition ) ), GetChars( m_MainText ) );
GetChars( errText ),
GetChars( ShowCoord( m_MainPosition ) ), GetChars( mainText ) );
}
return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment