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[] = "\\/:\"<>|";
|
||||
|
||||
|
||||
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;
|
||||
|
||||
for( wxUniChar c: aSource )
|
||||
{
|
||||
if( c == '\"' )
|
||||
converted += """;
|
||||
else if( c == '\'' )
|
||||
converted += "'";
|
||||
else if( c == '&' )
|
||||
converted += "&";
|
||||
else if( c == '<' )
|
||||
converted += "<";
|
||||
else if( c == '>' )
|
||||
converted += ">";
|
||||
else if( c == '\\' )
|
||||
converted += "∖";
|
||||
else if( c == '/' )
|
||||
converted += "⁄";
|
||||
else if( c == '|' )
|
||||
converted += "|";
|
||||
else if( c == ':' )
|
||||
converted += ":";
|
||||
else if( c == ' ' )
|
||||
converted += " ";
|
||||
else if( c == '%' )
|
||||
converted += "%";
|
||||
else if( c == '$' )
|
||||
converted += "$";
|
||||
else if( c == '\t' )
|
||||
converted += "&tab;";
|
||||
else if( c == '\n' || c == '\r' )
|
||||
converted += "&Newline;";
|
||||
if( c == '{' )
|
||||
{
|
||||
converted += "{brace}";
|
||||
}
|
||||
else if( aContext == CTX_NETNAME )
|
||||
{
|
||||
if( c == '/' )
|
||||
converted += "{slash}";
|
||||
else
|
||||
converted += c;
|
||||
}
|
||||
else if( aContext == CTX_LIBID )
|
||||
{
|
||||
if( c == ':' )
|
||||
converted += "{colon}";
|
||||
else
|
||||
converted += c;
|
||||
}
|
||||
else if( aContext == CTX_QUOTED_STR )
|
||||
{
|
||||
if( c == '\"' )
|
||||
converted += "{dblquote}";
|
||||
else
|
||||
converted += c;
|
||||
}
|
||||
else if( aContext == CTX_DELIMITED_STR )
|
||||
{
|
||||
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
|
||||
converted += c;
|
||||
}
|
||||
|
||||
return converted;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
wxString UnescapeString( const wxString& aSource )
|
||||
{
|
||||
#if 1
|
||||
return aSource;
|
||||
#else
|
||||
wxString converted = aSource;
|
||||
|
||||
converted.Replace( """, "\"" );
|
||||
converted.Replace( "'", "'" );
|
||||
converted.Replace( "<", "<" );
|
||||
converted.Replace( ">", ">" );
|
||||
converted.Replace( "∖", "\\" );
|
||||
converted.Replace( "⁄", "/" );
|
||||
converted.Replace( "|", "|" );
|
||||
converted.Replace( ":", ":" );
|
||||
converted.Replace( " ", " " );
|
||||
converted.Replace( "%", "%" );
|
||||
converted.Replace( "$", "$" );
|
||||
converted.Replace( "&tab;", "\t" );
|
||||
converted.Replace( "&Newline;", "\n" );
|
||||
converted.Replace( "{dblquote}", "\"" );
|
||||
converted.Replace( "{quote}", "'" );
|
||||
converted.Replace( "{lt}", "<" );
|
||||
converted.Replace( "{gt}", ">" );
|
||||
converted.Replace( "{backslash}", "\\" );
|
||||
converted.Replace( "{slash}", "/" );
|
||||
converted.Replace( "{bar}", "|" );
|
||||
converted.Replace( "{colon}", ":" );
|
||||
converted.Replace( "{space}", " " );
|
||||
converted.Replace( "{dollar}", "$" );
|
||||
converted.Replace( "{tab}", "\t" );
|
||||
converted.Replace( "{return}", "\n" );
|
||||
|
||||
// must be done last
|
||||
converted.Replace( "&", "&" );
|
||||
converted.Replace( "{brace}", "{" );
|
||||
|
||||
return converted;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -189,8 +189,19 @@ public:
|
|||
}
|
||||
else
|
||||
{
|
||||
m_selectedNetcode = m_netinfoList->GetNetItem( selectedNetName )->GetNet();
|
||||
GetComboCtrl()->SetValue( selectedNetName );
|
||||
wxString netname = EscapeString( selectedNetName, CTX_NETNAME );
|
||||
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 );
|
||||
|
@ -241,8 +252,10 @@ protected:
|
|||
{
|
||||
if( netinfo->GetNet() > 0 && netinfo->IsCurrent() )
|
||||
{
|
||||
if( filter.IsEmpty() || wxString( netinfo->GetNetname() ).MakeLower().Matches( filter ) )
|
||||
netNames.push_back( netinfo->GetNetname() );
|
||||
wxString netname = UnescapeString( netinfo->GetNetname() );
|
||||
|
||||
if( filter.IsEmpty() || wxString( netname ).MakeLower().Matches( filter ) )
|
||||
netNames.push_back( netname );
|
||||
}
|
||||
}
|
||||
std::sort( netNames.begin(), netNames.end() );
|
||||
|
|
|
@ -34,7 +34,7 @@ void XNODE::Format( OUTPUTFORMATTER* out, int nestLevel )
|
|||
switch( GetType() )
|
||||
{
|
||||
case wxXML_ELEMENT_NODE:
|
||||
out->Print( nestLevel, "(%s", out->Quotew( GetName() ).c_str() );
|
||||
out->Print( nestLevel, "(%s", TO_UTF8( GetName() ) );
|
||||
FormatContents( out, nestLevel );
|
||||
if( GetNext() )
|
||||
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() )
|
||||
{
|
||||
out->Print( 0, " (%s %s)",
|
||||
// attr names should never need quoting, no spaces, we designed the file.
|
||||
out->Quotew( attr->GetName() ).c_str(),
|
||||
out->Quotew( attr->GetValue() ).c_str()
|
||||
);
|
||||
TO_UTF8( attr->GetName() ),
|
||||
out->Quotew( attr->GetValue() ).c_str() );
|
||||
}
|
||||
|
||||
// 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 );
|
||||
|
||||
SetStatusText( _( "Selected net: " ) + m_SelectedNetName );
|
||||
SetStatusText( _( "Selected net: " ) + UnescapeString( m_SelectedNetName ) );
|
||||
std::vector<EDA_ITEM*> itemsToRedraw;
|
||||
SetCurrentSheetHighlightFlags( &itemsToRedraw );
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include <widgets/unit_binder.h>
|
||||
|
||||
#include <dialog_edit_label_base.h>
|
||||
#include <kicad_string.h>
|
||||
|
||||
class SCH_EDIT_FRAME;
|
||||
class SCH_TEXT;
|
||||
|
@ -153,10 +154,6 @@ DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR( SCH_EDIT_FRAME* aParent, SCH_TEXT* aTe
|
|||
|
||||
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_CurrentText->Type() == SCH_HIERARCHICAL_LABEL_T );
|
||||
|
||||
|
@ -209,7 +206,7 @@ bool DIALOG_LABEL_EDITOR::TransferDataToWindow()
|
|||
if( !wxDialog::TransferDataToWindow() )
|
||||
return false;
|
||||
|
||||
m_activeTextEntry->SetValue( m_CurrentText->GetText() );
|
||||
m_activeTextEntry->SetValue( UnescapeString( m_CurrentText->GetText() ) );
|
||||
|
||||
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_ITEM* item = screen->GetDrawItems(); item; item = item->Next() )
|
||||
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;
|
||||
|
||||
|
@ -307,7 +307,7 @@ bool DIALOG_LABEL_EDITOR::TransferDataFromWindow()
|
|||
|
||||
m_Parent->GetCanvas()->Refresh();
|
||||
|
||||
text = m_activeTextEntry->GetValue();
|
||||
text = EscapeString( m_activeTextEntry->GetValue(), CTX_NETNAME );
|
||||
|
||||
if( !text.IsEmpty() )
|
||||
m_CurrentText->SetText( text );
|
||||
|
|
|
@ -162,7 +162,7 @@ void DIALOG_EDIT_ONE_FIELD::OnSetFocusText( wxFocusEvent& event )
|
|||
|
||||
bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
|
||||
{
|
||||
m_TextValue->SetValue( UnescapeString( m_text ) );
|
||||
m_TextValue->SetValue( m_text );
|
||||
|
||||
m_posX.SetValue( m_position.x );
|
||||
m_posY.SetValue( m_position.y );
|
||||
|
@ -180,7 +180,7 @@ bool DIALOG_EDIT_ONE_FIELD::TransferDataToWindow()
|
|||
|
||||
bool DIALOG_EDIT_ONE_FIELD::TransferDataFromWindow()
|
||||
{
|
||||
m_text = EscapeString( m_TextValue->GetValue() );
|
||||
m_text = m_TextValue->GetValue();
|
||||
|
||||
if( m_fieldId == REFERENCE )
|
||||
{
|
||||
|
|
|
@ -316,7 +316,7 @@ public:
|
|||
fieldValue = wxString::Format( wxT( "%d" ), ( int )references.size() );
|
||||
}
|
||||
|
||||
return UnescapeString( fieldValue );
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
|
||||
|
@ -325,7 +325,7 @@ public:
|
|||
if( aCol == REFERENCE || aCol == QUANTITY_COLUMN )
|
||||
return; // Can't modify references or quantity
|
||||
|
||||
wxString value = EscapeString( aValue );
|
||||
wxString value = aValue;
|
||||
|
||||
DATA_MODEL_ROW& rowGroup = m_rows[ aRow ];
|
||||
wxString fieldName = m_fieldNames[ aCol ];
|
||||
|
|
|
@ -72,7 +72,7 @@ bool SCH_EDIT_FRAME::HighlightConnectionAtPosition( wxPoint aPosition )
|
|||
}
|
||||
|
||||
SendCrossProbeNetName( m_SelectedNetName );
|
||||
SetStatusText( _( "Selected net: " ) + m_SelectedNetName );
|
||||
SetStatusText( _( "Selected net: " ) + UnescapeString( m_SelectedNetName ) );
|
||||
SetCurrentSheetHighlightFlags( &itemsToRedraw );
|
||||
|
||||
// Be sure hightlight change will be redrawn
|
||||
|
|
|
@ -274,7 +274,7 @@ void GERBVIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
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();
|
||||
break;
|
||||
|
||||
|
@ -317,7 +317,7 @@ void GERBVIEW_FRAME::OnSelectHighlightChoice( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_GBR_AUX_TOOLBAR_PCB_NET_CHOICE:
|
||||
settings->m_netHighlightString = m_SelNetnameBox->GetStringSelection();
|
||||
settings->m_netHighlightString = EscapeString( m_SelNetnameBox->GetStringSelection(), CTX_NETNAME );
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
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();
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include <gerber_draw_item.h>
|
||||
#include <gerber_file_image.h>
|
||||
#include <gerber_file_image_list.h>
|
||||
|
||||
#include <kicad_string.h>
|
||||
|
||||
GERBER_DRAW_ITEM::GERBER_DRAW_ITEM( GERBER_FILE_IMAGE* aGerberImageFile ) :
|
||||
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 << " ";
|
||||
|
||||
if( m_netAttributes.m_Netname.IsEmpty() )
|
||||
net_msg << "<no net name>";
|
||||
net_msg << "<no net>";
|
||||
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 ) )
|
||||
{
|
||||
cmp_pad_msg.Printf( _( "Cmp: %s; Pad: %s" ),
|
||||
GetChars( m_netAttributes.m_Cmpref ),
|
||||
GetChars( m_netAttributes.m_Padname ) );
|
||||
m_netAttributes.m_Cmpref,
|
||||
m_netAttributes.m_Padname );
|
||||
}
|
||||
|
||||
else if( ( m_netAttributes.m_NetAttribType & GBR_NETLIST_METADATA::GBR_NETINFO_CMP ) )
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <gerbview.h>
|
||||
#include <gerbview_frame.h>
|
||||
#include <menus_helpers.h>
|
||||
|
||||
#include <kicad_string.h>
|
||||
|
||||
/* Prepare the right-click pullup menu.
|
||||
* 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,
|
||||
wxString::Format( _( "Highlight Items of Net \"%s\"" ),
|
||||
GetChars( net_attr.m_Netname ) ),
|
||||
UnescapeString( net_attr.m_Netname ) ),
|
||||
KiBitmap( general_ratsnest_xpm ) );
|
||||
add_separator = true;
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <DCodeSelectionbox.h>
|
||||
#include <dialog_helpers.h>
|
||||
#include <bitmaps.h>
|
||||
|
||||
#include <kicad_string.h>
|
||||
#include <wx/wupdlock.h>
|
||||
|
||||
void GERBVIEW_FRAME::ReCreateHToolbar( void )
|
||||
|
@ -458,7 +458,7 @@ void GERBVIEW_FRAME::updateNetnameListSelectBox()
|
|||
// Now copy the list to the choice box
|
||||
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 );
|
||||
|
|
|
@ -135,7 +135,7 @@ int GERBVIEW_CONTROL::HighlightControl( const TOOL_EVENT& aEvent )
|
|||
{
|
||||
auto string = item->GetNetAttributes().m_Netname;
|
||||
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 ) )
|
||||
{
|
||||
|
|
|
@ -110,7 +110,7 @@ private:
|
|||
{
|
||||
auto menuEntry = Add( GERBVIEW_ACTIONS::highlightNet );
|
||||
menuEntry->SetItemLabel( wxString::Format( _( "Highlight Items of Net \"%s\"" ),
|
||||
GetChars( net_attr.m_Netname ) ) );
|
||||
UnescapeString( net_attr.m_Netname ) ) );
|
||||
addSeparator = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include <base_struct.h> // EDA_RECT
|
||||
|
||||
#include <mutex>
|
||||
#include "kicad_string.h"
|
||||
|
||||
class SHAPE_POLY_SET;
|
||||
|
||||
|
@ -149,7 +150,7 @@ public:
|
|||
/**
|
||||
* Returns the string actually shown after processing of the base
|
||||
* 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 */
|
||||
|
|
|
@ -37,13 +37,19 @@
|
|||
|
||||
|
||||
/**
|
||||
* 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
|
||||
* Escape/Unescape routines to safely encode reserved-characters in various
|
||||
* contexts.
|
||||
*/
|
||||
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 );
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <class_board_item.h>
|
||||
#include <netinfo.h>
|
||||
#include <kicad_string.h>
|
||||
|
||||
class NETCLASS;
|
||||
class TRACK;
|
||||
|
@ -139,9 +140,9 @@ public:
|
|||
if( !netname.length() )
|
||||
return wxT( "[<no net>]" );
|
||||
else if( GetNetCode() < 0 )
|
||||
return wxT( "[" + netname + "](" + _( "Not Found" ) + ")" );
|
||||
return wxT( "[" + UnescapeString( netname ) + "](" + _( "Not Found" ) + ")" );
|
||||
else
|
||||
return wxT( "[" + netname + "]" );
|
||||
return wxT( "[" + UnescapeString( netname ) + "]" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -333,7 +333,7 @@ bool BOARD_NETLIST_UPDATER::updateComponentPadConnections( MODULE* aPcbComponent
|
|||
}
|
||||
|
||||
m_addedNets[netName] = netinfo;
|
||||
msg.Printf( _( "Add net %s." ), netName );
|
||||
msg.Printf( _( "Add net %s." ), UnescapeString( netName ) );
|
||||
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."),
|
||||
aPcbComponent->GetReference(),
|
||||
pad->GetName(),
|
||||
pad->GetNetname(),
|
||||
netName );
|
||||
UnescapeString( pad->GetNetname() ),
|
||||
UnescapeString( netName ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "Connect %s pin %s to %s."),
|
||||
aPcbComponent->GetReference(),
|
||||
pad->GetName(),
|
||||
netName );
|
||||
UnescapeString( netName ) );
|
||||
}
|
||||
m_reporter->Report( msg, REPORTER::RPT_ACTION );
|
||||
|
||||
|
@ -439,8 +439,8 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist )
|
|||
if( !updatedNetname.IsEmpty() )
|
||||
{
|
||||
msg.Printf( _( "Reconnect copper zone from %s to %s." ),
|
||||
zone->GetNetname(),
|
||||
updatedNetname );
|
||||
UnescapeString( zone->GetNetname() ),
|
||||
UnescapeString( updatedNetname ) );
|
||||
m_reporter->Report( msg, REPORTER::RPT_ACTION );
|
||||
|
||||
if( !m_isDryRun )
|
||||
|
@ -459,7 +459,8 @@ bool BOARD_NETLIST_UPDATER::updateCopperZoneNets( NETLIST& aNetlist )
|
|||
}
|
||||
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_warningCount;
|
||||
}
|
||||
|
@ -552,7 +553,8 @@ bool BOARD_NETLIST_UPDATER::deleteSinglePadNets()
|
|||
|
||||
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 );
|
||||
|
||||
if( !m_isDryRun )
|
||||
|
|
|
@ -1512,7 +1512,7 @@ int BOARD::SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount )
|
|||
{
|
||||
auto netcode = net->GetNet();
|
||||
|
||||
if( netcode > 0 )
|
||||
if( netcode > 0 && net->IsCurrent() )
|
||||
{
|
||||
netBuffer.push_back( net );
|
||||
max_netcode = std::max( netcode, max_netcode);
|
||||
|
@ -1539,7 +1539,7 @@ int BOARD::SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount )
|
|||
}
|
||||
|
||||
for( NETINFO_ITEM* net : netBuffer )
|
||||
aNames.Add( net->GetNetname() );
|
||||
aNames.Add( UnescapeString( net->GetNetname() ) );
|
||||
|
||||
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." ),
|
||||
footprint->GetReference(),
|
||||
pad->GetName(),
|
||||
pad->GetNetname(),
|
||||
netName );
|
||||
UnescapeString( pad->GetNetname() ),
|
||||
UnescapeString( netName ) );
|
||||
aReporter.Report( msg, REPORTER::RPT_ACTION );
|
||||
|
||||
if( !aNetlist.IsDryRun() )
|
||||
|
@ -2825,7 +2825,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
|||
|
||||
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 );
|
||||
|
||||
m_connectivity->Remove( pad );
|
||||
|
@ -2900,14 +2901,14 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
|||
if( updatedNet )
|
||||
{
|
||||
msg.Printf( _( "Updating copper zone from net %s to %s." ),
|
||||
zone->GetNetname(),
|
||||
updatedNet->GetNetname() );
|
||||
UnescapeString( zone->GetNetname() ),
|
||||
UnescapeString( updatedNet->GetNetname() ) );
|
||||
aReporter.Report( msg, REPORTER::RPT_ACTION );
|
||||
}
|
||||
else
|
||||
{
|
||||
msg.Printf( _( "Copper zone (net %s) has no pads connected." ),
|
||||
zone->GetNetname() );
|
||||
UnescapeString( zone->GetNetname() ) );
|
||||
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( _( "Net" ), GetNetname(), DARKCYAN ) );
|
||||
aList.push_back( MSG_PANEL_ITEM( _( "Net" ), UnescapeString( GetNetname() ), DARKCYAN ) );
|
||||
|
||||
board = GetBoard();
|
||||
|
||||
|
|
|
@ -122,7 +122,9 @@ EDA_ITEM* SEGZONE::Clone() 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 )
|
||||
return;
|
||||
|
||||
int textlen = net->GetShortNetname().Len();
|
||||
wxString text = UnescapeString( net->GetShortNetname() );
|
||||
int textlen = text.Len();
|
||||
|
||||
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
|
||||
DrawGraphicHaloText( panel->GetClipBox(), aDC, tpos,
|
||||
aBgColor, BLACK, WHITE, net->GetShortNetname(), angle,
|
||||
wxSize( tsize, tsize ),
|
||||
aBgColor, BLACK, WHITE,
|
||||
text, angle, wxSize( tsize, tsize ),
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
tsize / 7,
|
||||
false, false );
|
||||
tsize / 7, false, false );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -972,7 +974,8 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w
|
|||
if( net == NULL )
|
||||
return;
|
||||
|
||||
int len = net->GetShortNetname().Len();
|
||||
wxString text = UnescapeString( net->GetShortNetname() );
|
||||
int len = text.Len();
|
||||
|
||||
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();
|
||||
DrawGraphicHaloText( clipbox, aDC, m_Start,
|
||||
color, WHITE, BLACK, net->GetShortNetname(), 0,
|
||||
wxSize( tsize, tsize ),
|
||||
color, WHITE, BLACK,
|
||||
text, 0, wxSize( tsize, tsize ),
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
tsize / 7, false, false );
|
||||
}
|
||||
|
@ -1114,9 +1117,9 @@ void TRACK::GetMsgPanelInfoBase_Common( EDA_UNITS_T aUnits, std::vector< MSG_PAN
|
|||
NETINFO_ITEM* net = GetNet();
|
||||
|
||||
if( net )
|
||||
msg = net->GetNetname();
|
||||
msg = UnescapeString( net->GetNetname() );
|
||||
else
|
||||
msg = wxT( "<noname>" );
|
||||
msg = wxT( "<no name>" );
|
||||
|
||||
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();
|
||||
|
||||
if( net )
|
||||
msg = net->GetNetname();
|
||||
msg = UnescapeString( net->GetNetname() );
|
||||
else // Should not occur
|
||||
msg = _( "<unknown>" );
|
||||
}
|
||||
|
|
|
@ -395,7 +395,10 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aUseExportableSetupOnly )
|
|||
|
||||
// Search net_code for this net, if a net was selected
|
||||
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;
|
||||
|
||||
|
|
|
@ -131,7 +131,7 @@ void DIALOG_SELECT_NET_FROM_LIST::buildNetsList()
|
|||
|
||||
if( !netFilter.IsEmpty() )
|
||||
{
|
||||
wxString netname = net->GetNetname();
|
||||
wxString netname = UnescapeString( net->GetNetname() );
|
||||
if( filter.Find( netname.MakeUpper() ) == EDA_PATTERN_NOT_FOUND )
|
||||
continue;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ void DIALOG_SELECT_NET_FROM_LIST::buildNetsList()
|
|||
wxVector<wxVariant> dataLine;
|
||||
|
||||
dataLine.push_back( wxVariant( wxString::Format( "%.3d", netcode ) ) );
|
||||
dataLine.push_back( wxVariant( net->GetNetname() ) );
|
||||
dataLine.push_back( wxVariant( UnescapeString( net->GetNetname() ) ) );
|
||||
|
||||
if( netcode )
|
||||
dataLine.push_back( wxVariant( wxString::Format( "%u", nodes ) ) );
|
||||
|
@ -208,7 +208,7 @@ void DIALOG_SELECT_NET_FROM_LIST::onSelChanged( wxDataViewEvent& )
|
|||
|
||||
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;
|
||||
|
||||
HighlightNet( m_selection );
|
||||
|
|
|
@ -170,7 +170,7 @@ bool PANEL_SETUP_NETCLASSES::TransferDataToWindow()
|
|||
for( NETINFO_ITEM* net : m_Pcb->GetNetInfo() )
|
||||
{
|
||||
if( net->GetNet() > 0 && net->IsCurrent() )
|
||||
addNet( net->GetNetname(), net->GetNetClass()->GetName() );
|
||||
addNet( UnescapeString( net->GetNetname() ), net->GetNetClass()->GetName() );
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -261,7 +261,7 @@ bool PANEL_SETUP_NETCLASSES::TransferDataFromWindow()
|
|||
NETCLASSPTR nc = netclasses.Find( m_membershipGrid->GetCellValue( row, 1 ) );
|
||||
|
||||
if( nc )
|
||||
nc->Add( m_membershipGrid->GetCellValue( row, 0 ) );
|
||||
nc->Add( EscapeString( m_membershipGrid->GetCellValue( row, 0 ), CTX_NETNAME ) );
|
||||
}
|
||||
|
||||
m_Pcb->SynchronizeNetsAndNetClasses();
|
||||
|
|
|
@ -357,8 +357,8 @@ void FOOTPRINT_LIST_IMPL::WriteCacheToFile( wxTextFile* aCacheFile )
|
|||
{
|
||||
aCacheFile->AddLine( fpinfo->GetLibNickname() );
|
||||
aCacheFile->AddLine( fpinfo->GetName() );
|
||||
aCacheFile->AddLine( EscapeString( fpinfo->GetDescription() ) );
|
||||
aCacheFile->AddLine( EscapeString( fpinfo->GetKeywords() ) );
|
||||
aCacheFile->AddLine( EscapeString( fpinfo->GetDescription(), CTX_DELIMITED_STR ) );
|
||||
aCacheFile->AddLine( EscapeString( fpinfo->GetKeywords(), CTX_DELIMITED_STR ) );
|
||||
aCacheFile->AddLine( wxString::Format( "%d", fpinfo->GetOrderNum() ) );
|
||||
aCacheFile->AddLine( wxString::Format( "%u", fpinfo->GetPadCount() ) );
|
||||
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 )
|
||||
{
|
||||
printf( "[%d]: netcode:%d netname:<%s>\n",
|
||||
i++, it->second->GetNet(),
|
||||
TO_UTF8( it->second->GetNetname() ) );
|
||||
i++,
|
||||
it->second->GetNet(),
|
||||
TO_UTF8( it->second->GetNetname() ) );
|
||||
}
|
||||
}
|
||||
#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 )
|
||||
return;
|
||||
|
||||
wxPoint tpos0 = shape_pos; // Position of the centre of text
|
||||
wxPoint tpos = tpos0;
|
||||
wxSize AreaSize; // size of text area, normalized to AreaSize.y < AreaSize.x
|
||||
int shortname_len = 0;
|
||||
wxPoint tpos0 = shape_pos; // Position of the centre of text
|
||||
wxPoint tpos = tpos0;
|
||||
wxSize AreaSize; // size of text area, normalized to AreaSize.y < AreaSize.x
|
||||
wxString shortname;
|
||||
int shortname_len = 0;
|
||||
|
||||
if( aDrawInfo.m_Display_netname )
|
||||
shortname_len = GetShortNetname().Len();
|
||||
{
|
||||
shortname = UnescapeString( GetShortNetname() );
|
||||
shortname_len = shortname.Len();
|
||||
}
|
||||
|
||||
if( GetShape() == PAD_SHAPE_CIRCLE )
|
||||
angle = 0;
|
||||
|
@ -695,8 +699,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
|
|||
constexpr int MIN_CHAR_COUNT = 3;
|
||||
|
||||
unsigned int tsize;
|
||||
EDA_RECT* clipBox = aDrawInfo.m_DrawPanel?
|
||||
aDrawInfo.m_DrawPanel->GetClipBox() : NULL;
|
||||
EDA_RECT* clipBox = aDrawInfo.m_DrawPanel ? aDrawInfo.m_DrawPanel->GetClipBox() : NULL;
|
||||
|
||||
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;
|
||||
DrawGraphicHaloText( clipBox, aDC, tpos,
|
||||
aDrawInfo.m_Color, BLACK, WHITE,
|
||||
GetShortNetname(), t_angle,
|
||||
wxSize( tsize, tsize ), GR_TEXT_HJUSTIFY_CENTER,
|
||||
GR_TEXT_VJUSTIFY_CENTER, tsize / 7, false, false );
|
||||
shortname, t_angle, wxSize( tsize, tsize ),
|
||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||
tsize / 7, false, false );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@
|
|||
int COMPONENT_NET::Format( OUTPUTFORMATTER* aOut, int aNestLevel, int aCtl )
|
||||
{
|
||||
return aOut->Print( aNestLevel, "(pin_net %s %s)",
|
||||
aOut->Quotew( m_pinName ).c_str(),
|
||||
aOut->Quotew( m_netName ).c_str() );
|
||||
aOut->Quotew( m_pinName ).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 )
|
||||
return;
|
||||
|
||||
const wxString& netName = aTrack->GetShortNetname();
|
||||
const wxString& netName = UnescapeString( aTrack->GetShortNetname() );
|
||||
VECTOR2D textPosition = start + line / 2.0; // center of the track
|
||||
|
||||
double textOrientation;
|
||||
|
@ -470,8 +470,9 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
|
|||
|
||||
if( displayNetname )
|
||||
{
|
||||
wxString netname = UnescapeString( aVia->GetShortNetname() );
|
||||
// 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 );
|
||||
// Use a smaller text size to handle interline, pen size..
|
||||
tsize *= 0.7;
|
||||
|
@ -479,7 +480,7 @@ void PCB_PAINTER::draw( const VIA* aVia, int aLayer )
|
|||
|
||||
m_gal->SetGlyphSize( namesize );
|
||||
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 )
|
||||
{
|
||||
wxString netname = UnescapeString( aPad->GetShortNetname() );
|
||||
// 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 );
|
||||
// Use a smaller text size to handle interline, pen size..
|
||||
tsize *= 0.7;
|
||||
|
@ -664,7 +666,7 @@ void PCB_PAINTER::draw( const D_PAD* aPad, int aLayer )
|
|||
|
||||
m_gal->SetGlyphSize( namesize );
|
||||
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 )
|
||||
|
|
Loading…
Reference in New Issue