Remove curly braces from netname escaping context.
They're now used for bus definition control characters. Also fixes the sheet pin edit dialog to correctly escape/unescape netnames. Fixes: lp:1840834 * https://bugs.launchpad.net/kicad/+bug/1840834
This commit is contained in:
parent
97212acecb
commit
23fd4b64dd
|
@ -53,11 +53,7 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
|
|||
|
||||
for( wxUniChar c: aSource )
|
||||
{
|
||||
if( c == '{' )
|
||||
{
|
||||
converted += "{brace}";
|
||||
}
|
||||
else if( aContext == CTX_NETNAME )
|
||||
if( aContext == CTX_NETNAME )
|
||||
{
|
||||
if( c == '/' )
|
||||
converted += "{slash}";
|
||||
|
@ -66,21 +62,27 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
|
|||
}
|
||||
else if( aContext == CTX_LIBID )
|
||||
{
|
||||
if( c == ':' )
|
||||
if( c == '{' )
|
||||
converted += "{brace}";
|
||||
else if( c == ':' )
|
||||
converted += "{colon}";
|
||||
else
|
||||
converted += c;
|
||||
}
|
||||
else if( aContext == CTX_QUOTED_STR )
|
||||
{
|
||||
if( c == '\"' )
|
||||
if( c == '{' )
|
||||
converted += "{brace}";
|
||||
else if( c == '\"' )
|
||||
converted += "{dblquote}";
|
||||
else
|
||||
converted += c;
|
||||
}
|
||||
else if( aContext == CTX_DELIMITED_STR )
|
||||
{
|
||||
if( c == ' ' )
|
||||
if( c == '{' )
|
||||
converted += "{brace}";
|
||||
else if( c == ' ' )
|
||||
converted += "{space}";
|
||||
else if( c == '\t' )
|
||||
converted += "{tab}";
|
||||
|
@ -91,7 +93,9 @@ wxString EscapeString( const wxString& aSource, ESCAPE_CONTEXT aContext )
|
|||
}
|
||||
else if( aContext == CTX_FILENAME )
|
||||
{
|
||||
if( c == '/' )
|
||||
if( c == '{' )
|
||||
converted += "{brace}";
|
||||
else if( c == '/' )
|
||||
converted += "{slash}";
|
||||
else if( c == '\\' )
|
||||
converted += "{backslash}";
|
||||
|
|
|
@ -51,6 +51,8 @@ set( EESCHEMA_DLGS
|
|||
dialogs/dialog_edit_line_style.cpp
|
||||
dialogs/dialog_edit_line_style_base.cpp
|
||||
dialogs/dialog_edit_one_field.cpp
|
||||
dialogs/dialog_edit_sheet_pin.cpp
|
||||
dialogs/dialog_edit_sheet_pin_base.cpp
|
||||
dialogs/dialog_erc.cpp
|
||||
dialogs/dialog_erc_base.cpp
|
||||
dialogs/dialog_global_sym_lib_table_config.cpp
|
||||
|
@ -76,8 +78,7 @@ set( EESCHEMA_DLGS
|
|||
dialogs/dialog_print_using_printer_base.cpp
|
||||
dialogs/dialog_rescue_each.cpp
|
||||
dialogs/dialog_rescue_each_base.cpp
|
||||
dialogs/dialog_sch_edit_sheet_pin.cpp
|
||||
dialogs/dialog_sch_edit_sheet_pin_base.cpp
|
||||
dialogs/dialog_edit_sheet_pin.cpp
|
||||
dialogs/dialog_sch_sheet_props.cpp
|
||||
dialogs/dialog_sch_sheet_props_base.cpp
|
||||
dialogs/dialog_schematic_find.cpp
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <sch_edit_frame.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_validators.h>
|
||||
#include <dialog_sch_edit_sheet_pin.h>
|
||||
#include <dialog_edit_sheet_pin.h>
|
||||
|
||||
|
||||
static wxString sheetPinTypes[] =
|
||||
|
@ -38,8 +38,8 @@ static wxString sheetPinTypes[] =
|
|||
};
|
||||
|
||||
|
||||
DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN( SCH_EDIT_FRAME* parent, SCH_SHEET_PIN* aPin ) :
|
||||
DIALOG_SCH_EDIT_SHEET_PIN_BASE( parent ),
|
||||
DIALOG_EDIT_SHEET_PIN::DIALOG_EDIT_SHEET_PIN( SCH_EDIT_FRAME* parent, SCH_SHEET_PIN* aPin ) :
|
||||
DIALOG_EDIT_SHEET_PIN_BASE( parent ),
|
||||
m_frame( parent ),
|
||||
m_sheetPin( aPin ),
|
||||
m_textWidth( parent, m_widthLabel, m_widthCtrl, m_widthUnits, true ),
|
||||
|
@ -75,9 +75,9 @@ DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN( SCH_EDIT_FRAME* parent, SC
|
|||
}
|
||||
|
||||
|
||||
bool DIALOG_SCH_EDIT_SHEET_PIN::TransferDataToWindow()
|
||||
bool DIALOG_EDIT_SHEET_PIN::TransferDataToWindow()
|
||||
{
|
||||
m_textName->SetValue( m_sheetPin->GetText() );
|
||||
m_textName->SetValue( UnescapeString( m_sheetPin->GetText() ) );
|
||||
m_textName->SelectAll();
|
||||
m_textWidth.SetValue( m_sheetPin->GetTextWidth() );
|
||||
m_textHeight.SetValue( m_sheetPin->GetTextHeight() );
|
||||
|
@ -87,12 +87,12 @@ bool DIALOG_SCH_EDIT_SHEET_PIN::TransferDataToWindow()
|
|||
}
|
||||
|
||||
|
||||
bool DIALOG_SCH_EDIT_SHEET_PIN::TransferDataFromWindow()
|
||||
bool DIALOG_EDIT_SHEET_PIN::TransferDataFromWindow()
|
||||
{
|
||||
if( !m_sheetPin->IsNew() )
|
||||
m_frame->SaveCopyInUndoList( (SCH_ITEM*) m_sheetPin->GetParent(), UR_CHANGED );
|
||||
|
||||
m_sheetPin->SetText( m_textName->GetValue() );
|
||||
m_sheetPin->SetText( EscapeString( m_textName->GetValue(), CTX_NETNAME ) );
|
||||
m_sheetPin->SetTextSize( wxSize( m_textWidth.GetValue(), m_textHeight.GetValue() ) );
|
||||
|
||||
auto shape = static_cast<PINSHEETLABEL_SHAPE>( m_choiceConnectionType->GetCurrentSelection() );
|
||||
|
@ -106,7 +106,7 @@ bool DIALOG_SCH_EDIT_SHEET_PIN::TransferDataFromWindow()
|
|||
}
|
||||
|
||||
|
||||
void DIALOG_SCH_EDIT_SHEET_PIN::onOKButton( wxCommandEvent& event )
|
||||
void DIALOG_EDIT_SHEET_PIN::onOKButton( wxCommandEvent& event )
|
||||
{
|
||||
event.Skip();
|
||||
}
|
|
@ -22,25 +22,18 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __dialog_sch_edit_sheet_pin__
|
||||
#define __dialog_sch_edit_sheet_pin__
|
||||
#ifndef DIALOG_EDIT_SHEET_PIN_H
|
||||
#define DIALOG_EDIT_SHEET_PIN_H
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* Subclass of DIALOG_SCH_EDIT_SHEET_PIN_BASE, which is generated by wxFormBuilder.
|
||||
*/
|
||||
|
||||
|
||||
#include <dialog_sch_edit_sheet_pin_base.h>
|
||||
#include <sch_text.h> // enum PINSHEETLABEL_SHAPE definition
|
||||
#include <dialog_edit_sheet_pin_base.h>
|
||||
#include <widgets/unit_binder.h>
|
||||
|
||||
|
||||
class SCH_SHEET_PIN;
|
||||
|
||||
|
||||
class DIALOG_SCH_EDIT_SHEET_PIN : public DIALOG_SCH_EDIT_SHEET_PIN_BASE
|
||||
class DIALOG_EDIT_SHEET_PIN : public DIALOG_EDIT_SHEET_PIN_BASE
|
||||
{
|
||||
SCH_EDIT_FRAME* m_frame;
|
||||
SCH_SHEET_PIN* m_sheetPin;
|
||||
|
@ -49,7 +42,7 @@ class DIALOG_SCH_EDIT_SHEET_PIN : public DIALOG_SCH_EDIT_SHEET_PIN_BASE
|
|||
UNIT_BINDER m_textHeight;
|
||||
|
||||
public:
|
||||
DIALOG_SCH_EDIT_SHEET_PIN( SCH_EDIT_FRAME* parent, SCH_SHEET_PIN* aPin );
|
||||
DIALOG_EDIT_SHEET_PIN( SCH_EDIT_FRAME* parent, SCH_SHEET_PIN* aPin );
|
||||
|
||||
bool TransferDataToWindow() override;
|
||||
bool TransferDataFromWindow() override;
|
||||
|
@ -58,4 +51,4 @@ private:
|
|||
void onOKButton( wxCommandEvent& event ) override;
|
||||
};
|
||||
|
||||
#endif // __dialog_sch_edit_sheet_pin__
|
||||
#endif // DIALOG_EDIT_SHEET_PIN_H
|
|
@ -5,11 +5,11 @@
|
|||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_sch_edit_sheet_pin_base.h"
|
||||
#include "dialog_edit_sheet_pin_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
DIALOG_EDIT_SHEET_PIN_BASE::DIALOG_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxSize( -1,-1 ), wxDefaultSize );
|
||||
|
||||
|
@ -97,12 +97,12 @@ DIALOG_SCH_EDIT_SHEET_PIN_BASE::DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent
|
|||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_EDIT_SHEET_PIN_BASE::onOKButton ), NULL, this );
|
||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_SHEET_PIN_BASE::onOKButton ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_SCH_EDIT_SHEET_PIN_BASE::~DIALOG_SCH_EDIT_SHEET_PIN_BASE()
|
||||
DIALOG_EDIT_SHEET_PIN_BASE::~DIALOG_EDIT_SHEET_PIN_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_SCH_EDIT_SHEET_PIN_BASE::onOKButton ), NULL, this );
|
||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_EDIT_SHEET_PIN_BASE::onOKButton ), NULL, this );
|
||||
|
||||
}
|
|
@ -11,12 +11,12 @@
|
|||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">dialog_sch_edit_sheet_pin_base</property>
|
||||
<property name="file">dialog_edit_sheet_pin_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">dialog_sch_edit_sheet_pin</property>
|
||||
<property name="name">dialog_edit_sheet_pin</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
|
@ -43,7 +43,7 @@
|
|||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size">-1,-1</property>
|
||||
<property name="name">DIALOG_SCH_EDIT_SHEET_PIN_BASE</property>
|
||||
<property name="name">DIALOG_EDIT_SHEET_PIN_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">-1,-1</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
|
@ -28,9 +28,9 @@
|
|||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_SCH_EDIT_SHEET_PIN_BASE
|
||||
/// Class DIALOG_EDIT_SHEET_PIN_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_SCH_EDIT_SHEET_PIN_BASE : public DIALOG_SHIM
|
||||
class DIALOG_EDIT_SHEET_PIN_BASE : public DIALOG_SHIM
|
||||
{
|
||||
private:
|
||||
|
||||
|
@ -56,8 +56,8 @@ class DIALOG_SCH_EDIT_SHEET_PIN_BASE : public DIALOG_SHIM
|
|||
|
||||
public:
|
||||
|
||||
DIALOG_SCH_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sheet Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_SCH_EDIT_SHEET_PIN_BASE();
|
||||
DIALOG_EDIT_SHEET_PIN_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Sheet Pin Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||
~DIALOG_EDIT_SHEET_PIN_BASE();
|
||||
|
||||
};
|
||||
|
|
@ -37,7 +37,7 @@
|
|||
#include <sch_view.h>
|
||||
#include <symbol_lib_table.h>
|
||||
#include <dialogs/dialog_sch_sheet_props.h>
|
||||
#include <dialogs/dialog_sch_edit_sheet_pin.h>
|
||||
#include <dialogs/dialog_edit_sheet_pin.h>
|
||||
#include <tool/actions.h>
|
||||
|
||||
|
||||
|
@ -794,7 +794,7 @@ SCH_SHEET_PIN* SCH_EDIT_FRAME::CreateSheetPin( SCH_SHEET* aSheet, SCH_HIERLABEL*
|
|||
|
||||
if( !aLabel )
|
||||
{
|
||||
DIALOG_SCH_EDIT_SHEET_PIN dlg( this, sheetPin );
|
||||
DIALOG_EDIT_SHEET_PIN dlg( this, sheetPin );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK || sheetPin->GetText().IsEmpty() )
|
||||
{
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
#include <dialogs/dialog_image_editor.h>
|
||||
#include <dialogs/dialog_edit_line_style.h>
|
||||
#include <dialogs/dialog_edit_component_in_schematic.h>
|
||||
#include <dialogs/dialog_sch_edit_sheet_pin.h>
|
||||
#include <dialogs/dialog_edit_sheet_pin.h>
|
||||
#include <dialogs/dialog_edit_one_field.h>
|
||||
#include "sch_drawing_tools.h"
|
||||
|
||||
|
@ -1214,7 +1214,7 @@ int SCH_EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
case SCH_SHEET_PIN_T:
|
||||
{
|
||||
SCH_SHEET_PIN* pin = (SCH_SHEET_PIN*) item;
|
||||
DIALOG_SCH_EDIT_SHEET_PIN dlg( m_frame, pin );
|
||||
DIALOG_EDIT_SHEET_PIN dlg( m_frame, pin );
|
||||
|
||||
if( dlg.ShowModal() == wxID_OK )
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue