Escape slashes in labels and netnames.
Also re-allows spaces, as they can already come in through sheet names. Fixes: lp:1798621 * https://bugs.launchpad.net/kicad/+bug/1798621
This commit is contained in:
parent
97063440bb
commit
684bb62fd8
|
@ -40,78 +40,107 @@
|
||||||
static const char illegalFileNameChars[] = "\\/:\"<>|";
|
static const char illegalFileNameChars[] = "\\/:\"<>|";
|
||||||
|
|
||||||
|
|
||||||
wxString EscapeString( const wxString& aSource )
|
/**
|
||||||
|
* These Escape/Unescape routines use HTML-entity-reference-style encoding to handle
|
||||||
|
* characters which are:
|
||||||
|
* (a) not legal in filenames
|
||||||
|
* (b) used as control characters in LIB_IDs
|
||||||
|
* (c) used to delineate hierarchical paths
|
||||||
|
*/
|
||||||
|
wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
return aSource;
|
|
||||||
#else
|
|
||||||
wxString converted;
|
wxString converted;
|
||||||
|
|
||||||
for( wxUniChar c: aSource )
|
for( wxUniChar c: aSource )
|
||||||
{
|
{
|
||||||
if( c == '\"' )
|
if( c == '{' )
|
||||||
converted += """;
|
{
|
||||||
else if( c == '\'' )
|
converted += "{brace}";
|
||||||
converted += "'";
|
}
|
||||||
else if( c == '&' )
|
else if( aContext == CTX_NETNAME )
|
||||||
converted += "&";
|
{
|
||||||
else if( c == '<' )
|
if( c == '/' )
|
||||||
converted += "<";
|
converted += "{slash}";
|
||||||
else if( c == '>' )
|
else
|
||||||
converted += ">";
|
converted += c;
|
||||||
else if( c == '\\' )
|
}
|
||||||
converted += "∖";
|
else if( aContext == CTX_LIBID )
|
||||||
else if( c == '/' )
|
{
|
||||||
converted += "⁄";
|
if( c == ':' )
|
||||||
else if( c == '|' )
|
converted += "{colon}";
|
||||||
converted += "|";
|
else
|
||||||
else if( c == ':' )
|
converted += c;
|
||||||
converted += ":";
|
}
|
||||||
else if( c == ' ' )
|
else if( aContext == CTX_QUOTED_STR )
|
||||||
converted += " ";
|
{
|
||||||
else if( c == '%' )
|
if( c == '\"' )
|
||||||
converted += "%";
|
converted += "{dblquote}";
|
||||||
else if( c == '$' )
|
else
|
||||||
converted += "$";
|
converted += c;
|
||||||
else if( c == '\t' )
|
}
|
||||||
converted += "&tab;";
|
else if( aContext == CTX_DELIMITED_STR )
|
||||||
else if( c == '\n' || c == '\r' )
|
{
|
||||||
converted += "&Newline;";
|
if( c == ' ' )
|
||||||
|
converted += "{space}";
|
||||||
|
else if( c == '\t' )
|
||||||
|
converted += "{tab}";
|
||||||
|
else if( c == '\n' || c == '\r' )
|
||||||
|
converted += "{return}";
|
||||||
|
else
|
||||||
|
converted += c;
|
||||||
|
}
|
||||||
|
else if( aContext == CTX_FILENAME )
|
||||||
|
{
|
||||||
|
if( c == '/' )
|
||||||
|
converted += "{slash}";
|
||||||
|
else if( c == '\\' )
|
||||||
|
converted += "{backslash}";
|
||||||
|
else if( c == '\"' )
|
||||||
|
converted += "{dblquote}";
|
||||||
|
else if( c == '<' )
|
||||||
|
converted += "{lt}";
|
||||||
|
else if( c == '>' )
|
||||||
|
converted += "{gt}";
|
||||||
|
else if( c == '|' )
|
||||||
|
converted += "{bar}";
|
||||||
|
else if( c == ':' )
|
||||||
|
converted += "{colon}";
|
||||||
|
else if( c == '\t' )
|
||||||
|
converted += "{tab}";
|
||||||
|
else if( c == '\n' || c == '\r' )
|
||||||
|
converted += "{return}";
|
||||||
|
else
|
||||||
|
converted += c;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
converted += c;
|
converted += c;
|
||||||
}
|
}
|
||||||
|
|
||||||
return converted;
|
return converted;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString UnescapeString( const wxString& aSource )
|
wxString UnescapeString( const wxString& aSource )
|
||||||
{
|
{
|
||||||
#if 1
|
|
||||||
return aSource;
|
|
||||||
#else
|
|
||||||
wxString converted = aSource;
|
wxString converted = aSource;
|
||||||
|
|
||||||
converted.Replace( """, "\"" );
|
converted.Replace( "{dblquote}", "\"" );
|
||||||
converted.Replace( "'", "'" );
|
converted.Replace( "{quote}", "'" );
|
||||||
converted.Replace( "<", "<" );
|
converted.Replace( "{lt}", "<" );
|
||||||
converted.Replace( ">", ">" );
|
converted.Replace( "{gt}", ">" );
|
||||||
converted.Replace( "∖", "\\" );
|
converted.Replace( "{backslash}", "\\" );
|
||||||
converted.Replace( "⁄", "/" );
|
converted.Replace( "{slash}", "/" );
|
||||||
converted.Replace( "|", "|" );
|
converted.Replace( "{bar}", "|" );
|
||||||
converted.Replace( ":", ":" );
|
converted.Replace( "{colon}", ":" );
|
||||||
converted.Replace( " ", " " );
|
converted.Replace( "{space}", " " );
|
||||||
converted.Replace( "%", "%" );
|
converted.Replace( "{dollar}", "$" );
|
||||||
converted.Replace( "$", "$" );
|
converted.Replace( "{tab}", "\t" );
|
||||||
converted.Replace( "&tab;", "\t" );
|
converted.Replace( "{return}", "\n" );
|
||||||
converted.Replace( "&Newline;", "\n" );
|
|
||||||
|
|
||||||
// must be done last
|
// must be done last
|
||||||
converted.Replace( "&", "&" );
|
converted.Replace( "{brace}", "{" );
|
||||||
|
|
||||||
return converted;
|
return converted;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -189,8 +189,19 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_selectedNetcode = m_netinfoList->GetNetItem( selectedNetName )->GetNet();
|
wxString netname = EscapeString( selectedNetName, CTX_NETNAME );
|
||||||
GetComboCtrl()->SetValue( selectedNetName );
|
NETINFO_ITEM* netInfo = m_netinfoList->GetNetItem( netname );
|
||||||
|
|
||||||
|
if( netInfo == nullptr || netInfo->GetNet() == 0 )
|
||||||
|
{
|
||||||
|
m_selectedNetcode = 0;
|
||||||
|
GetComboCtrl()->SetValue( NO_NET );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_selectedNetcode = netInfo->GetNet();
|
||||||
|
GetComboCtrl()->SetValue( selectedNetName );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCommandEvent changeEvent( NET_SELECTED );
|
wxCommandEvent changeEvent( NET_SELECTED );
|
||||||
|
@ -241,8 +252,10 @@ protected:
|
||||||
{
|
{
|
||||||
if( netinfo->GetNet() > 0 && netinfo->IsCurrent() )
|
if( netinfo->GetNet() > 0 && netinfo->IsCurrent() )
|
||||||
{
|
{
|
||||||
if( filter.IsEmpty() || wxString( netinfo->GetNetname() ).MakeLower().Matches( filter ) )
|
wxString netname = UnescapeString( netinfo->GetNetname() );
|
||||||
netNames.push_back( netinfo->GetNetname() );
|
|
||||||
|
if( filter.IsEmpty() || wxString( netname ).MakeLower().Matches( filter ) )
|
||||||
|
netNames.push_back( netname );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::sort( netNames.begin(), netNames.end() );
|
std::sort( netNames.begin(), netNames.end() );
|
||||||
|
|
|
@ -34,7 +34,7 @@ void XNODE::Format( OUTPUTFORMATTER* out, int nestLevel )
|
||||||
switch( GetType() )
|
switch( GetType() )
|
||||||
{
|
{
|
||||||
case wxXML_ELEMENT_NODE:
|
case wxXML_ELEMENT_NODE:
|
||||||
out->Print( nestLevel, "(%s", out->Quotew( GetName() ).c_str() );
|
out->Print( nestLevel, "(%s", TO_UTF8( GetName() ) );
|
||||||
FormatContents( out, nestLevel );
|
FormatContents( out, nestLevel );
|
||||||
if( GetNext() )
|
if( GetNext() )
|
||||||
out->Print( 0, ")\n" );
|
out->Print( 0, ")\n" );
|
||||||
|
@ -54,10 +54,8 @@ void XNODE::FormatContents( OUTPUTFORMATTER* out, int nestLevel )
|
||||||
for( XATTR* attr = (XATTR*) GetAttributes(); attr; attr = (XATTR*) attr->GetNext() )
|
for( XATTR* attr = (XATTR*) GetAttributes(); attr; attr = (XATTR*) attr->GetNext() )
|
||||||
{
|
{
|
||||||
out->Print( 0, " (%s %s)",
|
out->Print( 0, " (%s %s)",
|
||||||
// attr names should never need quoting, no spaces, we designed the file.
|
TO_UTF8( attr->GetName() ),
|
||||||
out->Quotew( attr->GetName() ).c_str(),
|
out->Quotew( attr->GetValue() ).c_str() );
|
||||||
out->Quotew( attr->GetValue() ).c_str()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// we only expect to have used one of two types here:
|
// we only expect to have used one of two types here:
|
||||||
|
|
|
@ -82,7 +82,7 @@ void SCH_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
|
||||||
{
|
{
|
||||||
m_SelectedNetName = FROM_UTF8( text );
|
m_SelectedNetName = FROM_UTF8( text );
|
||||||
|
|
||||||
SetStatusText( _( "Selected net: " ) + m_SelectedNetName );
|
SetStatusText( _( "Selected net: " ) + UnescapeString( m_SelectedNetName ) );
|
||||||
std::vector<EDA_ITEM*> itemsToRedraw;
|
std::vector<EDA_ITEM*> itemsToRedraw;
|
||||||
SetCurrentSheetHighlightFlags( &itemsToRedraw );
|
SetCurrentSheetHighlightFlags( &itemsToRedraw );
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include <widgets/unit_binder.h>
|
#include <widgets/unit_binder.h>
|
||||||
|
|
||||||
#include <dialog_edit_label_base.h>
|
#include <dialog_edit_label_base.h>
|
||||||
|
#include <kicad_string.h>
|
||||||
|
|
||||||
class SCH_EDIT_FRAME;
|
class SCH_EDIT_FRAME;
|
||||||
class SCH_TEXT;
|
class SCH_TEXT;
|
||||||
|
@ -153,10 +154,6 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
|
||||||
|
|
||||||
SetInitialFocus( m_activeTextCtrl );
|
SetInitialFocus( m_activeTextCtrl );
|
||||||
|
|
||||||
// Enable validator for net names
|
|
||||||
if( m_CurrentText->Type() != SCH_TEXT_T )
|
|
||||||
m_activeTextCtrl->SetValidator( m_netNameValidator );
|
|
||||||
|
|
||||||
m_TextShape->Show( m_CurrentText->Type() == SCH_GLOBAL_LABEL_T ||
|
m_TextShape->Show( m_CurrentText->Type() == SCH_GLOBAL_LABEL_T ||
|
||||||
m_CurrentText->Type() == SCH_HIERARCHICAL_LABEL_T );
|
m_CurrentText->Type() == SCH_HIERARCHICAL_LABEL_T );
|
||||||
|
|
||||||
|
@ -209,7 +206,7 @@ bool DIALOG_LABEL_EDITOR::TransferDataToWindow()
|
||||||
if( !wxDialog::TransferDataToWindow() )
|
if( !wxDialog::TransferDataToWindow() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_activeTextEntry->SetValue( m_CurrentText->GetText() );
|
m_activeTextEntry->SetValue( UnescapeString( m_CurrentText->GetText() ) );
|
||||||
|
|
||||||
if( m_valueCombo->IsShown() )
|
if( m_valueCombo->IsShown() )
|
||||||
{
|
{
|
||||||
|
@ -220,7 +217,10 @@ bool DIALOG_LABEL_EDITOR::TransferDataToWindow()
|
||||||
for( SCH_SCREEN* screen = allScreens.GetFirst(); screen; screen = allScreens.GetNext() )
|
for( SCH_SCREEN* screen = allScreens.GetFirst(); screen; screen = allScreens.GetNext() )
|
||||||
for( SCH_ITEM* item = screen->GetDrawItems(); item; item = item->Next() )
|
for( SCH_ITEM* item = screen->GetDrawItems(); item; item = item->Next() )
|
||||||
if( item->Type() == m_CurrentText->Type() )
|
if( item->Type() == m_CurrentText->Type() )
|
||||||
existingLabels.insert( static_cast<SCH_TEXT*>( item )->GetText() );
|
{
|
||||||
|
auto textItem = static_cast<SCH_TEXT*>( item );
|
||||||
|
existingLabels.insert( UnescapeString( textItem->GetText() ) );
|
||||||
|
}
|
||||||
|
|
||||||
wxArrayString existingLabelArray;
|
wxArrayString existingLabelArray;
|
||||||
|
|
||||||
|
@ -307,7 +307,7 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
|
||||||
|
|
||||||
m_Parent->GetCanvas()->Refresh();
|
m_Parent->GetCanvas()->Refresh();
|
||||||
|
|
||||||
text = m_activeTextEntry->GetValue();
|
text = EscapeString( m_activeTextEntry->GetValue(), CTX_NETNAME );
|
||||||
|
|
||||||
if( !text.IsEmpty() )
|
if( !text.IsEmpty() )
|
||||||
m_CurrentText->SetText( text );
|
m_CurrentText->SetText( text );
|
||||||
|
|
|
@ -162,7 +162,7 @@ void DIALOG_EDIT_ONE_FIELD::OnSetFocusText( wxFocusEvent& event )
|
||||||
|
|
||||||
bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
|
bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
|
||||||
{
|
{
|
||||||
m_TextValue->SetValue( UnescapeString( m_text ) );
|
m_TextValue->SetValue( m_text );
|
||||||
|
|
||||||
m_posX.SetValue( m_position.x );
|
m_posX.SetValue( m_position.x );
|
||||||
m_posY.SetValue( m_position.y );
|
m_posY.SetValue( m_position.y );
|
||||||
|
@ -180,7 +180,7 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
|
||||||
|
|
||||||
bool DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow()
|
bool DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow()
|
||||||
{
|
{
|
||||||
m_text = EscapeString( m_TextValue->GetValue() );
|
m_text = m_TextValue->GetValue();
|
||||||
|
|
||||||
if( m_fieldId == REFERENCE )
|
if( m_fieldId == REFERENCE )
|
||||||
{
|
{
|
||||||
|
|
|
@ -316,7 +316,7 @@ public:
|
||||||
fieldValue = wxString::Format( wxT( "%d" ), ( int )references.size() );
|
fieldValue = wxString::Format( wxT( "%d" ), ( int )references.size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return UnescapeString( fieldValue );
|
return fieldValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,7 +325,7 @@ public:
|
||||||
if( aCol == REFERENCE || aCol == QUANTITY_COLUMN )
|
if( aCol == REFERENCE || aCol == QUANTITY_COLUMN )
|
||||||
return; // Can't modify references or quantity
|
return; // Can't modify references or quantity
|
||||||
|
|
||||||
wxString value = EscapeString( aValue );
|
wxString value = aValue;
|
||||||
|
|
||||||
DATA_MODEL_ROW& rowGroup = m_rows[ aRow ];
|
DATA_MODEL_ROW& rowGroup = m_rows[ aRow ];
|
||||||
wxString fieldName = m_fieldNames[ aCol ];
|
wxString fieldName = m_fieldNames[ aCol ];
|
||||||
|
|
|
@ -72,7 +72,7 @@ bool SCH_EDIT_FRAME::HighlightConnectionAtPosition( wxPoint aPosition )
|
||||||
}
|
}
|
||||||
|
|
||||||
SendCrossProbeNetName( m_SelectedNetName );
|
SendCrossProbeNetName( m_SelectedNetName );
|
||||||
SetStatusText( _( "Selected net: " ) + m_SelectedNetName );
|
SetStatusText( _( "Selected net: " ) + UnescapeString( m_SelectedNetName ) );
|
||||||
SetCurrentSheetHighlightFlags( &itemsToRedraw );
|
SetCurrentSheetHighlightFlags( &itemsToRedraw );
|
||||||
|
|
||||||
// Be sure hightlight change will be redrawn
|
// Be sure hightlight change will be redrawn
|
||||||
|
|
|
@ -274,7 +274,7 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_HIGHLIGHT_NET_ITEMS:
|
case ID_HIGHLIGHT_NET_ITEMS:
|
||||||
if( m_SelNetnameBox->SetStringSelection( currItem->GetNetAttributes().m_Netname ) )
|
if( m_SelNetnameBox->SetStringSelection( UnescapeString( currItem->GetNetAttributes().m_Netname ) ) )
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ void GERBVIEW_FRAME::OnSelectHighlightChoice( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE:
|
case ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE:
|
||||||
settings->m_netHighlightString = m_SelNetnameBox->GetStringSelection();
|
settings->m_netHighlightString = EscapeString( m_SelNetnameBox->GetStringSelection(), CTX_NETNAME );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE:
|
case ID_GBR_AUX_TOOLBAR_PCB_APERATTRIBUTES_CHOICE:
|
||||||
|
|
|
@ -99,7 +99,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
|
||||||
wxString netHighlight;
|
wxString netHighlight;
|
||||||
|
|
||||||
if( gerbFrame->m_SelNetnameBox->GetSelection() > 0 )
|
if( gerbFrame->m_SelNetnameBox->GetSelection() > 0 )
|
||||||
netHighlight = gerbFrame->m_SelNetnameBox->GetStringSelection();
|
netHighlight = EscapeString( gerbFrame->m_SelNetnameBox->GetStringSelection(), CTX_NETNAME );
|
||||||
|
|
||||||
wxString aperAttrHighlight = gerbFrame->m_SelAperAttributesBox->GetStringSelection();
|
wxString aperAttrHighlight = gerbFrame->m_SelAperAttributesBox->GetStringSelection();
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
#include <gerber_draw_item.h>
|
#include <gerber_draw_item.h>
|
||||||
#include <gerber_file_image.h>
|
#include <gerber_file_image.h>
|
||||||
#include <gerber_file_image_list.h>
|
#include <gerber_file_image_list.h>
|
||||||
|
#include <kicad_string.h>
|
||||||
|
|
||||||
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GERBER_FILE_IMAGE* aGerberImageFile ) :
|
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GERBER_FILE_IMAGE* aGerberImageFile ) :
|
||||||
EDA_ITEM( (EDA_ITEM*)NULL, GERBER_DRAW_ITEM_T )
|
EDA_ITEM( (EDA_ITEM*)NULL, GERBER_DRAW_ITEM_T )
|
||||||
|
@ -741,16 +741,16 @@ void GERBER_DRAW_ITEM::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PAN
|
||||||
net_msg << " ";
|
net_msg << " ";
|
||||||
|
|
||||||
if( m_netAttributes.m_Netname.IsEmpty() )
|
if( m_netAttributes.m_Netname.IsEmpty() )
|
||||||
net_msg << "<no net name>";
|
net_msg << "<no net>";
|
||||||
else
|
else
|
||||||
net_msg << m_netAttributes.m_Netname;
|
net_msg << UnescapeString( m_netAttributes.m_Netname );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_PAD ) )
|
if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_PAD ) )
|
||||||
{
|
{
|
||||||
cmp_pad_msg.Printf( _( "Cmp: %s; Pad: %s" ),
|
cmp_pad_msg.Printf( _( "Cmp: %s; Pad: %s" ),
|
||||||
GetChars( m_netAttributes.m_Cmpref ),
|
m_netAttributes.m_Cmpref,
|
||||||
GetChars( m_netAttributes.m_Padname ) );
|
m_netAttributes.m_Padname );
|
||||||
}
|
}
|
||||||
|
|
||||||
else if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) )
|
else if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) )
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
#include <gerbview.h>
|
#include <gerbview.h>
|
||||||
#include <gerbview_frame.h>
|
#include <gerbview_frame.h>
|
||||||
#include <menus_helpers.h>
|
#include <menus_helpers.h>
|
||||||
|
#include <kicad_string.h>
|
||||||
|
|
||||||
/* Prepare the right-click pullup menu.
|
/* Prepare the right-click pullup menu.
|
||||||
* The menu already has a list of zoom commands.
|
* The menu already has a list of zoom commands.
|
||||||
|
@ -113,7 +113,7 @@ bool GERBVIEW_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
|
||||||
{
|
{
|
||||||
AddMenuItem( aPopMenu, ID_HIGHLIGHT_NET_ITEMS,
|
AddMenuItem( aPopMenu, ID_HIGHLIGHT_NET_ITEMS,
|
||||||
wxString::Format( _( "Highlight Items of Net \"%s\"" ),
|
wxString::Format( _( "Highlight Items of Net \"%s\"" ),
|
||||||
GetChars( net_attr.m_Netname ) ),
|
UnescapeString( net_attr.m_Netname ) ),
|
||||||
KiBitmap( general_ratsnest_xpm ) );
|
KiBitmap( general_ratsnest_xpm ) );
|
||||||
add_separator = true;
|
add_separator = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include <DCodeSelectionbox.h>
|
#include <DCodeSelectionbox.h>
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
#include <bitmaps.h>
|
#include <bitmaps.h>
|
||||||
|
#include <kicad_string.h>
|
||||||
#include <wx/wupdlock.h>
|
#include <wx/wupdlock.h>
|
||||||
|
|
||||||
void GERBVIEW_FRAME::ReCreateHToolbar( void )
|
void GERBVIEW_FRAME::ReCreateHToolbar( void )
|
||||||
|
@ -458,7 +458,7 @@ void GERBVIEW_FRAME::updateNetnameListSelectBox()
|
||||||
// Now copy the list to the choice box
|
// Now copy the list to the choice box
|
||||||
for( auto ii = full_list.begin(); ii != full_list.end(); ++ii )
|
for( auto ii = full_list.begin(); ii != full_list.end(); ++ii )
|
||||||
{
|
{
|
||||||
m_SelNetnameBox->Append( ii->first );
|
m_SelNetnameBox->Append( UnescapeString( ii->first ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_SelNetnameBox->SetSelection( 0 );
|
m_SelNetnameBox->SetSelection( 0 );
|
||||||
|
|
|
@ -135,7 +135,7 @@ int GERBVIEW_CONTROL::HighlightControl( const TOOL_EVENT& aEvent )
|
||||||
{
|
{
|
||||||
auto string = item->GetNetAttributes().m_Netname;
|
auto string = item->GetNetAttributes().m_Netname;
|
||||||
settings->m_netHighlightString = string;
|
settings->m_netHighlightString = string;
|
||||||
m_frame->m_SelNetnameBox->SetStringSelection( string );
|
m_frame->m_SelNetnameBox->SetStringSelection( UnescapeString( string ) );
|
||||||
}
|
}
|
||||||
else if( item && aEvent.IsAction( &GERBVIEW_ACTIONS::highlightComponent ) )
|
else if( item && aEvent.IsAction( &GERBVIEW_ACTIONS::highlightComponent ) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,7 +110,7 @@ private:
|
||||||
{
|
{
|
||||||
auto menuEntry = Add( GERBVIEW_ACTIONS::highlightNet );
|
auto menuEntry = Add( GERBVIEW_ACTIONS::highlightNet );
|
||||||
menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Net \"%s\"" ),
|
menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Net \"%s\"" ),
|
||||||
GetChars( net_attr.m_Netname ) ) );
|
UnescapeString( net_attr.m_Netname ) ) );
|
||||||
addSeparator = true;
|
addSeparator = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <base_struct.h> // EDA_RECT
|
#include <base_struct.h> // EDA_RECT
|
||||||
|
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include "kicad_string.h"
|
||||||
|
|
||||||
class SHAPE_POLY_SET;
|
class SHAPE_POLY_SET;
|
||||||
|
|
||||||
|
@ -149,7 +150,7 @@ public:
|
||||||
/**
|
/**
|
||||||
* Returns the string actually shown after processing of the base
|
* Returns the string actually shown after processing of the base
|
||||||
* text. Default is no processing */
|
* text. Default is no processing */
|
||||||
virtual wxString GetShownText() const { return m_Text; }
|
virtual wxString GetShownText() const { return UnescapeString( m_Text ); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a shortened version (max 15 characters) of the shown text */
|
* Returns a shortened version (max 15 characters) of the shown text */
|
||||||
|
|
|
@ -37,13 +37,19 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* These Escape/Unescape routines use HTML-entity-reference-style encoding to handle
|
* Escape/Unescape routines to safely encode reserved-characters in various
|
||||||
* characters which are:
|
* contexts.
|
||||||
* (a) not legal in filenames
|
|
||||||
* (b) used as control characters in LIB_IDs
|
|
||||||
* (c) used to delineate hierarchical paths
|
|
||||||
*/
|
*/
|
||||||
wxString EscapeString( const wxString& aSource );
|
enum ESCAPE_CONTEXT
|
||||||
|
{
|
||||||
|
CTX_NETNAME,
|
||||||
|
CTX_LIBID,
|
||||||
|
CTX_QUOTED_STR,
|
||||||
|
CTX_DELIMITED_STR,
|
||||||
|
CTX_FILENAME
|
||||||
|
};
|
||||||
|
|
||||||
|
wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext );
|
||||||
|
|
||||||
wxString UnescapeString( const wxString& aSource );
|
wxString UnescapeString( const wxString& aSource );
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
#include <class_board_item.h>
|
#include <class_board_item.h>
|
||||||
#include <netinfo.h>
|
#include <netinfo.h>
|
||||||
|
#include <kicad_string.h>
|
||||||
|
|
||||||
class NETCLASS;
|
class NETCLASS;
|
||||||
class TRACK;
|
class TRACK;
|
||||||
|
@ -139,9 +140,9 @@ public:
|
||||||
if( !netname.length() )
|
if( !netname.length() )
|
||||||
return wxT( "[<no net>]" );
|
return wxT( "[<no net>]" );
|
||||||
else if( GetNetCode() < 0 )
|
else if( GetNetCode() < 0 )
|
||||||
return wxT( "[" + netname + "](" + _( "Not Found" ) + ")" );
|
return wxT( "[" + UnescapeString( netname ) + "](" + _( "Not Found" ) + ")" );
|
||||||
else
|
else
|
||||||
return wxT( "[" + netname + "]" );
|
return wxT( "[" + UnescapeString( netname ) + "]" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -333,7 +333,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
m_addedNets[netName] = netinfo;
|
m_addedNets[netName] = netinfo;
|
||||||
msg.Printf( _( "Add net %s." ), netName );
|
msg.Printf( _( "Add net %s." ), UnescapeString( netName ) );
|
||||||
m_reporter->Report( msg, REPORTER::RPT_ACTION );
|
m_reporter->Report( msg, REPORTER::RPT_ACTION );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -344,15 +344,15 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
|
||||||
msg.Printf( _( "Reconnect %s pin %s from %s to %s."),
|
msg.Printf( _( "Reconnect %s pin %s from %s to %s."),
|
||||||
aPcbComponent->GetReference(),
|
aPcbComponent->GetReference(),
|
||||||
pad->GetName(),
|
pad->GetName(),
|
||||||
pad->GetNetname(),
|
UnescapeString( pad->GetNetname() ),
|
||||||
netName );
|
UnescapeString( netName ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Connect %s pin %s to %s."),
|
msg.Printf( _( "Connect %s pin %s to %s."),
|
||||||
aPcbComponent->GetReference(),
|
aPcbComponent->GetReference(),
|
||||||
pad->GetName(),
|
pad->GetName(),
|
||||||
netName );
|
UnescapeString( netName ) );
|
||||||
}
|
}
|
||||||
m_reporter->Report( msg, REPORTER::RPT_ACTION );
|
m_reporter->Report( msg, REPORTER::RPT_ACTION );
|
||||||
|
|
||||||
|
@ -439,8 +439,8 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist )
|
||||||
if( !updatedNetname.IsEmpty() )
|
if( !updatedNetname.IsEmpty() )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Reconnect copper zone from %s to %s." ),
|
msg.Printf( _( "Reconnect copper zone from %s to %s." ),
|
||||||
zone->GetNetname(),
|
UnescapeString( zone->GetNetname() ),
|
||||||
updatedNetname );
|
UnescapeString( updatedNetname ) );
|
||||||
m_reporter->Report( msg, REPORTER::RPT_ACTION );
|
m_reporter->Report( msg, REPORTER::RPT_ACTION );
|
||||||
|
|
||||||
if( !m_isDryRun )
|
if( !m_isDryRun )
|
||||||
|
@ -459,7 +459,8 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist )
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Copper zone (%s) has no pads connected." ), zone->GetNetname() );
|
msg.Printf( _( "Copper zone (%s) has no pads connected." ),
|
||||||
|
UnescapeString( zone->GetNetname() ) );
|
||||||
m_reporter->Report( msg, REPORTER::RPT_WARNING );
|
m_reporter->Report( msg, REPORTER::RPT_WARNING );
|
||||||
++m_warningCount;
|
++m_warningCount;
|
||||||
}
|
}
|
||||||
|
@ -552,7 +553,8 @@ bool BOARD_NETLIST_UPDATER::deleteSinglePadNets()
|
||||||
|
|
||||||
if( count == 1 ) // Really one pad, and nothing else
|
if( count == 1 ) // Really one pad, and nothing else
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Remove single pad net %s." ), getNetname( previouspad ) );
|
msg.Printf( _( "Remove single pad net %s." ),
|
||||||
|
UnescapeString( getNetname( previouspad ) ) );
|
||||||
m_reporter->Report( msg, REPORTER::RPT_ACTION );
|
m_reporter->Report( msg, REPORTER::RPT_ACTION );
|
||||||
|
|
||||||
if( !m_isDryRun )
|
if( !m_isDryRun )
|
||||||
|
|
|
@ -1512,7 +1512,7 @@ int BOARD::SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount )
|
||||||
{
|
{
|
||||||
auto netcode = net->GetNet();
|
auto netcode = net->GetNet();
|
||||||
|
|
||||||
if( netcode > 0 )
|
if( netcode > 0 && net->IsCurrent() )
|
||||||
{
|
{
|
||||||
netBuffer.push_back( net );
|
netBuffer.push_back( net );
|
||||||
max_netcode = std::max( netcode, max_netcode);
|
max_netcode = std::max( netcode, max_netcode);
|
||||||
|
@ -1539,7 +1539,7 @@ int BOARD::SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount )
|
||||||
}
|
}
|
||||||
|
|
||||||
for( NETINFO_ITEM* net : netBuffer )
|
for( NETINFO_ITEM* net : netBuffer )
|
||||||
aNames.Add( net->GetNetname() );
|
aNames.Add( UnescapeString( net->GetNetname() ) );
|
||||||
|
|
||||||
return netBuffer.size();
|
return netBuffer.size();
|
||||||
}
|
}
|
||||||
|
@ -2502,8 +2502,8 @@ void BOARD::updateComponentPadConnections( NETLIST& aNetlist, MODULE* footprint,
|
||||||
msg.Printf( _( "Changing footprint %s pad %s net from %s to %s." ),
|
msg.Printf( _( "Changing footprint %s pad %s net from %s to %s." ),
|
||||||
footprint->GetReference(),
|
footprint->GetReference(),
|
||||||
pad->GetName(),
|
pad->GetName(),
|
||||||
pad->GetNetname(),
|
UnescapeString( pad->GetNetname() ),
|
||||||
netName );
|
UnescapeString( netName ) );
|
||||||
aReporter.Report( msg, REPORTER::RPT_ACTION );
|
aReporter.Report( msg, REPORTER::RPT_ACTION );
|
||||||
|
|
||||||
if( !aNetlist.IsDryRun() )
|
if( !aNetlist.IsDryRun() )
|
||||||
|
@ -2825,7 +2825,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
|
|
||||||
if( pad && zoneCount == 0 )
|
if( pad && zoneCount == 0 )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Remove single pad net %s." ), GetChars( pad->GetNetname() ) );
|
msg.Printf( _( "Remove single pad net %s." ),
|
||||||
|
UnescapeString( pad->GetNetname() ) );
|
||||||
aReporter.Report( msg, REPORTER::RPT_ACTION );
|
aReporter.Report( msg, REPORTER::RPT_ACTION );
|
||||||
|
|
||||||
m_connectivity->Remove( pad );
|
m_connectivity->Remove( pad );
|
||||||
|
@ -2900,14 +2901,14 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
if( updatedNet )
|
if( updatedNet )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Updating copper zone from net %s to %s." ),
|
msg.Printf( _( "Updating copper zone from net %s to %s." ),
|
||||||
zone->GetNetname(),
|
UnescapeString( zone->GetNetname() ),
|
||||||
updatedNet->GetNetname() );
|
UnescapeString( updatedNet->GetNetname() ) );
|
||||||
aReporter.Report( msg, REPORTER::RPT_ACTION );
|
aReporter.Report( msg, REPORTER::RPT_ACTION );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Copper zone (net %s) has no pads connected." ),
|
msg.Printf( _( "Copper zone (net %s) has no pads connected." ),
|
||||||
zone->GetNetname() );
|
UnescapeString( zone->GetNetname() ) );
|
||||||
aReporter.Report( msg, REPORTER::RPT_WARNING );
|
aReporter.Report( msg, REPORTER::RPT_WARNING );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -781,7 +781,7 @@ void D_PAD::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL_ITEM>& a
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), m_name, BROWN ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Pad" ), m_name, BROWN ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Net" ), GetNetname(), DARKCYAN ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN ) );
|
||||||
|
|
||||||
board = GetBoard();
|
board = GetBoard();
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,9 @@ EDA_ITEM* SEGZONE::Clone() const
|
||||||
|
|
||||||
wxString SEGZONE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
wxString SEGZONE::GetSelectMenuText( EDA_UNITS_T aUnits ) const
|
||||||
{
|
{
|
||||||
return wxString::Format( _( "Zone [%s] on %s" ), GetNetnameMsg(), GetLayerName() );
|
return wxString::Format( _( "Zone [%s] on %s" ),
|
||||||
|
UnescapeString( GetNetnameMsg() ),
|
||||||
|
GetLayerName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -571,7 +573,8 @@ void TRACK::DrawShortNetname( EDA_DRAW_PANEL* panel,
|
||||||
if( net == NULL )
|
if( net == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int textlen = net->GetShortNetname().Len();
|
wxString text = UnescapeString( net->GetShortNetname() );
|
||||||
|
int textlen = text.Len();
|
||||||
|
|
||||||
if( textlen > 0 )
|
if( textlen > 0 )
|
||||||
{
|
{
|
||||||
|
@ -615,11 +618,10 @@ void TRACK::DrawShortNetname( EDA_DRAW_PANEL* panel,
|
||||||
|
|
||||||
tsize = (tsize * 7) / 10; // small reduction to give a better look
|
tsize = (tsize * 7) / 10; // small reduction to give a better look
|
||||||
DrawGraphicHaloText( panel->GetClipBox(), aDC, tpos,
|
DrawGraphicHaloText( panel->GetClipBox(), aDC, tpos,
|
||||||
aBgColor, BLACK, WHITE, net->GetShortNetname(), angle,
|
aBgColor, BLACK, WHITE,
|
||||||
wxSize( tsize, tsize ),
|
text, angle, wxSize( tsize, tsize ),
|
||||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||||
tsize / 7,
|
tsize / 7, false, false );
|
||||||
false, false );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -972,7 +974,8 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w
|
||||||
if( net == NULL )
|
if( net == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int len = net->GetShortNetname().Len();
|
wxString text = UnescapeString( net->GetShortNetname() );
|
||||||
|
int len = text.Len();
|
||||||
|
|
||||||
if( len > 0 )
|
if( len > 0 )
|
||||||
{
|
{
|
||||||
|
@ -988,8 +991,8 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w
|
||||||
|
|
||||||
EDA_RECT* clipbox = panel->GetClipBox();
|
EDA_RECT* clipbox = panel->GetClipBox();
|
||||||
DrawGraphicHaloText( clipbox, aDC, m_Start,
|
DrawGraphicHaloText( clipbox, aDC, m_Start,
|
||||||
color, WHITE, BLACK, net->GetShortNetname(), 0,
|
color, WHITE, BLACK,
|
||||||
wxSize( tsize, tsize ),
|
text, 0, wxSize( tsize, tsize ),
|
||||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||||
tsize / 7, false, false );
|
tsize / 7, false, false );
|
||||||
}
|
}
|
||||||
|
@ -1114,9 +1117,9 @@ void TRACK::GetMsgPanelInfoBase_Common( EDA_UNITS_T aUnits, std::vector< MSG_PAN
|
||||||
NETINFO_ITEM* net = GetNet();
|
NETINFO_ITEM* net = GetNet();
|
||||||
|
|
||||||
if( net )
|
if( net )
|
||||||
msg = net->GetNetname();
|
msg = UnescapeString( net->GetNetname() );
|
||||||
else
|
else
|
||||||
msg = wxT( "<noname>" );
|
msg = wxT( "<no name>" );
|
||||||
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );
|
||||||
|
|
||||||
|
|
|
@ -852,7 +852,7 @@ void ZONE_CONTAINER::GetMsgPanelInfo( EDA_UNITS_T aUnits, std::vector< MSG_PANEL
|
||||||
NETINFO_ITEM* net = GetNet();
|
NETINFO_ITEM* net = GetNet();
|
||||||
|
|
||||||
if( net )
|
if( net )
|
||||||
msg = net->GetNetname();
|
msg = UnescapeString( net->GetNetname() );
|
||||||
else // Should not occur
|
else // Should not occur
|
||||||
msg = _( "<unknown>" );
|
msg = _( "<unknown>" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -395,7 +395,10 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
|
||||||
|
|
||||||
// Search net_code for this net, if a net was selected
|
// Search net_code for this net, if a net was selected
|
||||||
if( m_ListNetNameSelection->GetSelection() > 0 )
|
if( m_ListNetNameSelection->GetSelection() > 0 )
|
||||||
net = m_Parent->GetBoard()->FindNet( m_ListNetNameSelection->GetStringSelection() );
|
{
|
||||||
|
wxString netname = EscapeString( m_ListNetNameSelection->GetStringSelection(), CTX_NETNAME );
|
||||||
|
net = m_Parent->GetBoard()->FindNet( netname );
|
||||||
|
}
|
||||||
|
|
||||||
m_settings.m_NetcodeSelection = net ? net->GetNet() : 0;
|
m_settings.m_NetcodeSelection = net ? net->GetNet() : 0;
|
||||||
|
|
||||||
|
|
|
@ -131,7 +131,7 @@ void DIALOG_SELECT_NET_FROM_LIST::buildNetsList()
|
||||||
|
|
||||||
if( !netFilter.IsEmpty() )
|
if( !netFilter.IsEmpty() )
|
||||||
{
|
{
|
||||||
wxString netname = net->GetNetname();
|
wxString netname = UnescapeString( net->GetNetname() );
|
||||||
if( filter.Find( netname.MakeUpper() ) == EDA_PATTERN_NOT_FOUND )
|
if( filter.Find( netname.MakeUpper() ) == EDA_PATTERN_NOT_FOUND )
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ void DIALOG_SELECT_NET_FROM_LIST::buildNetsList()
|
||||||
wxVector<wxVariant> dataLine;
|
wxVector<wxVariant> dataLine;
|
||||||
|
|
||||||
dataLine.push_back( wxVariant( wxString::Format( "%.3d", netcode ) ) );
|
dataLine.push_back( wxVariant( wxString::Format( "%.3d", netcode ) ) );
|
||||||
dataLine.push_back( wxVariant( net->GetNetname() ) );
|
dataLine.push_back( wxVariant( UnescapeString( net->GetNetname() ) ) );
|
||||||
|
|
||||||
if( netcode )
|
if( netcode )
|
||||||
dataLine.push_back( wxVariant( wxString::Format( "%u", nodes ) ) );
|
dataLine.push_back( wxVariant( wxString::Format( "%u", nodes ) ) );
|
||||||
|
@ -208,7 +208,7 @@ void DIALOG_SELECT_NET_FROM_LIST::onSelChanged( wxDataViewEvent& )
|
||||||
|
|
||||||
if( selected_row >= 0 )
|
if( selected_row >= 0 )
|
||||||
{
|
{
|
||||||
m_selection = m_netsList->GetTextValue( selected_row, 1 );
|
m_selection = EscapeString( m_netsList->GetTextValue( selected_row, 1 ), CTX_NETNAME );
|
||||||
m_wasSelected = true;
|
m_wasSelected = true;
|
||||||
|
|
||||||
HighlightNet( m_selection );
|
HighlightNet( m_selection );
|
||||||
|
|
|
@ -170,7 +170,7 @@ bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
|
||||||
for( NETINFO_ITEM* net : m_Pcb->GetNetInfo() )
|
for( NETINFO_ITEM* net : m_Pcb->GetNetInfo() )
|
||||||
{
|
{
|
||||||
if( net->GetNet() > 0 && net->IsCurrent() )
|
if( net->GetNet() > 0 && net->IsCurrent() )
|
||||||
addNet( net->GetNetname(), net->GetNetClass()->GetName() );
|
addNet( UnescapeString( net->GetNetname() ), net->GetNetClass()->GetName() );
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -261,7 +261,7 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
|
||||||
NETCLASSPTR nc = netclasses.Find( m_membershipGrid->GetCellValue( row, 1 ) );
|
NETCLASSPTR nc = netclasses.Find( m_membershipGrid->GetCellValue( row, 1 ) );
|
||||||
|
|
||||||
if( nc )
|
if( nc )
|
||||||
nc->Add( m_membershipGrid->GetCellValue( row, 0 ) );
|
nc->Add( EscapeString( m_membershipGrid->GetCellValue( row, 0 ), CTX_NETNAME ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Pcb->SynchronizeNetsAndNetClasses();
|
m_Pcb->SynchronizeNetsAndNetClasses();
|
||||||
|
|
|
@ -357,8 +357,8 @@ void FOOTPRINT_LIST_IMPL::WriteCacheToFile( wxTextFile* aCacheFile )
|
||||||
{
|
{
|
||||||
aCacheFile->AddLine( fpinfo->GetLibNickname() );
|
aCacheFile->AddLine( fpinfo->GetLibNickname() );
|
||||||
aCacheFile->AddLine( fpinfo->GetName() );
|
aCacheFile->AddLine( fpinfo->GetName() );
|
||||||
aCacheFile->AddLine( EscapeString( fpinfo->GetDescription() ) );
|
aCacheFile->AddLine( EscapeString( fpinfo->GetDescription(), CTX_DELIMITED_STR ) );
|
||||||
aCacheFile->AddLine( EscapeString( fpinfo->GetKeywords() ) );
|
aCacheFile->AddLine( EscapeString( fpinfo->GetKeywords(), CTX_DELIMITED_STR ) );
|
||||||
aCacheFile->AddLine( wxString::Format( "%d", fpinfo->GetOrderNum() ) );
|
aCacheFile->AddLine( wxString::Format( "%d", fpinfo->GetOrderNum() ) );
|
||||||
aCacheFile->AddLine( wxString::Format( "%u", fpinfo->GetPadCount() ) );
|
aCacheFile->AddLine( wxString::Format( "%u", fpinfo->GetPadCount() ) );
|
||||||
aCacheFile->AddLine( wxString::Format( "%u", fpinfo->GetUniquePadCount() ) );
|
aCacheFile->AddLine( wxString::Format( "%u", fpinfo->GetUniquePadCount() ) );
|
||||||
|
|
|
@ -172,8 +172,9 @@ void NETINFO_LIST::Show() const
|
||||||
for( it = m_netNames.begin(), itEnd = m_netNames.end(); it != itEnd; ++it )
|
for( it = m_netNames.begin(), itEnd = m_netNames.end(); it != itEnd; ++it )
|
||||||
{
|
{
|
||||||
printf( "[%d]: netcode:%d netname:<%s>\n",
|
printf( "[%d]: netcode:%d netname:<%s>\n",
|
||||||
i++, it->second->GetNet(),
|
i++,
|
||||||
TO_UTF8( it->second->GetNetname() ) );
|
it->second->GetNet(),
|
||||||
|
TO_UTF8( it->second->GetNetname() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -653,13 +653,17 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
if( !aDrawInfo.m_Display_padnum && !aDrawInfo.m_Display_netname )
|
if( !aDrawInfo.m_Display_padnum && !aDrawInfo.m_Display_netname )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wxPoint tpos0 = shape_pos; // Position of the centre of text
|
wxPoint tpos0 = shape_pos; // Position of the centre of text
|
||||||
wxPoint tpos = tpos0;
|
wxPoint tpos = tpos0;
|
||||||
wxSize AreaSize; // size of text area, normalized to AreaSize.y < AreaSize.x
|
wxSize AreaSize; // size of text area, normalized to AreaSize.y < AreaSize.x
|
||||||
int shortname_len = 0;
|
wxString shortname;
|
||||||
|
int shortname_len = 0;
|
||||||
|
|
||||||
if( aDrawInfo.m_Display_netname )
|
if( aDrawInfo.m_Display_netname )
|
||||||
shortname_len = GetShortNetname().Len();
|
{
|
||||||
|
shortname = UnescapeString( GetShortNetname() );
|
||||||
|
shortname_len = shortname.Len();
|
||||||
|
}
|
||||||
|
|
||||||
if( GetShape() == PAD_SHAPE_CIRCLE )
|
if( GetShape() == PAD_SHAPE_CIRCLE )
|
||||||
angle = 0;
|
angle = 0;
|
||||||
|
@ -695,8 +699,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
constexpr int MIN_CHAR_COUNT = 3;
|
constexpr int MIN_CHAR_COUNT = 3;
|
||||||
|
|
||||||
unsigned int tsize;
|
unsigned int tsize;
|
||||||
EDA_RECT* clipBox = aDrawInfo.m_DrawPanel?
|
EDA_RECT* clipBox = aDrawInfo.m_DrawPanel ? aDrawInfo.m_DrawPanel->GetClipBox() : NULL;
|
||||||
aDrawInfo.m_DrawPanel->GetClipBox() : NULL;
|
|
||||||
|
|
||||||
if( aDrawInfo.m_Display_padnum )
|
if( aDrawInfo.m_Display_padnum )
|
||||||
{
|
{
|
||||||
|
@ -736,9 +739,9 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
||||||
tsize = ( tsize * 7 ) / 10;
|
tsize = ( tsize * 7 ) / 10;
|
||||||
DrawGraphicHaloText( clipBox, aDC, tpos,
|
DrawGraphicHaloText( clipBox, aDC, tpos,
|
||||||
aDrawInfo.m_Color, BLACK, WHITE,
|
aDrawInfo.m_Color, BLACK, WHITE,
|
||||||
GetShortNetname(), t_angle,
|
shortname, t_angle, wxSize( tsize, tsize ),
|
||||||
wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||||
GR_TEXT_VJUSTIFY_CENTER, tsize / 7, false, false );
|
tsize / 7, false, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,8 +39,8 @@
|
||||||
int COMPONENT_NET::Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl )
|
int COMPONENT_NET::Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl )
|
||||||
{
|
{
|
||||||
return aOut->Print( aNestLevel, "(pin_net %s %s)",
|
return aOut->Print( aNestLevel, "(pin_net %s %s)",
|
||||||
aOut->Quotew( m_pinName ).c_str(),
|
aOut->Quotew( m_pinName ).c_str(),
|
||||||
aOut->Quotew( m_netName ).c_str() );
|
aOut->Quotew( m_netName ).c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -382,7 +382,7 @@ void PCB_PAINTER::draw( const TRACK* aTrack, int aLayer )
|
||||||
if( length < 10 * width )
|
if( length < 10 * width )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const wxString& netName = aTrack->GetShortNetname();
|
const wxString& netName = UnescapeString( aTrack->GetShortNetname() );
|
||||||
VECTOR2D textPosition = start + line / 2.0; // center of the track
|
VECTOR2D textPosition = start + line / 2.0; // center of the track
|
||||||
|
|
||||||
double textOrientation;
|
double textOrientation;
|
||||||
|
@ -470,8 +470,9 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
|
||||||
|
|
||||||
if( displayNetname )
|
if( displayNetname )
|
||||||
{
|
{
|
||||||
|
wxString netname = UnescapeString( aVia->GetShortNetname() );
|
||||||
// calculate the size of net name text:
|
// calculate the size of net name text:
|
||||||
double tsize = 1.5 * size / aVia->GetShortNetname().Length();
|
double tsize = 1.5 * size / netname.Length();
|
||||||
tsize = std::min( tsize, size );
|
tsize = std::min( tsize, size );
|
||||||
// Use a smaller text size to handle interline, pen size..
|
// Use a smaller text size to handle interline, pen size..
|
||||||
tsize *= 0.7;
|
tsize *= 0.7;
|
||||||
|
@ -479,7 +480,7 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
|
||||||
|
|
||||||
m_gal->SetGlyphSize( namesize );
|
m_gal->SetGlyphSize( namesize );
|
||||||
m_gal->SetLineWidth( namesize.x / 12.0 );
|
m_gal->SetLineWidth( namesize.x / 12.0 );
|
||||||
m_gal->BitmapText( aVia->GetShortNetname(), textpos, 0.0 );
|
m_gal->BitmapText( netname, textpos, 0.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -655,8 +656,9 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
||||||
|
|
||||||
if( displayNetname )
|
if( displayNetname )
|
||||||
{
|
{
|
||||||
|
wxString netname = UnescapeString( aPad->GetShortNetname() );
|
||||||
// calculate the size of net name text:
|
// calculate the size of net name text:
|
||||||
double tsize = 1.5 * padsize.x / aPad->GetShortNetname().Length();
|
double tsize = 1.5 * padsize.x / netname.Length();
|
||||||
tsize = std::min( tsize, size );
|
tsize = std::min( tsize, size );
|
||||||
// Use a smaller text size to handle interline, pen size..
|
// Use a smaller text size to handle interline, pen size..
|
||||||
tsize *= 0.7;
|
tsize *= 0.7;
|
||||||
|
@ -664,7 +666,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
||||||
|
|
||||||
m_gal->SetGlyphSize( namesize );
|
m_gal->SetGlyphSize( namesize );
|
||||||
m_gal->SetLineWidth( namesize.x / 12.0 );
|
m_gal->SetLineWidth( namesize.x / 12.0 );
|
||||||
m_gal->BitmapText( aPad->GetShortNetname(), textpos, 0.0 );
|
m_gal->BitmapText( netname, textpos, 0.0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_pcbSettings.m_padNumbers )
|
if( m_pcbSettings.m_padNumbers )
|
||||||
|
|
Loading…
Reference in New Issue