diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index c73b5cbecc..212231694c 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -887,9 +887,9 @@ wxString SCH_FIELD::GetCanonicalName() const else if( m_parent && m_parent->IsType( { SCH_LABEL_LOCATE_ANY_T } ) ) { // These should be stored in canonical format, but just in case: - if( m_name == _( "Net Class" ) ) + if( m_name == _( "Net Class" ) || m_name == wxT( "Net Class" ) ) return wxT( "Netclass" ); - else if (m_name == _( "Sheet References" ) ) + else if( m_name == _( "Sheet References" ) || m_name == wxT( "Sheet References" ) ) return wxT( "Intersheetrefs" ); else return m_name; diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h index 4c38fadc9d..60ae75fdc7 100644 --- a/eeschema/sch_field.h +++ b/eeschema/sch_field.h @@ -116,6 +116,12 @@ public: void SetName( const wxString& aName ) { m_name = aName; } + /** + * Get the initial name of the field set at creation (or set by SetName()). + * This is the raw field name with no translation and no change. + */ + const wxString& GetInternalName() { return m_name; } + int GetId() const { return m_id; } void SetId( int aId ); diff --git a/eeschema/sch_label.cpp b/eeschema/sch_label.cpp index 17c555b28f..36e04a25c6 100644 --- a/eeschema/sch_label.cpp +++ b/eeschema/sch_label.cpp @@ -1254,7 +1254,7 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const VECTOR2I& pos, const wxString& text ) : SetVertJustify( GR_TEXT_V_ALIGN_CENTER ); - m_fields.emplace_back( SCH_FIELD( pos, 0, this, _( "Sheet References" ) ) ); + m_fields.emplace_back( SCH_FIELD( pos, 0, this, wxT( "Sheet References" ) ) ); m_fields[0].SetText( wxT( "${INTERSHEET_REFS}" ) ); m_fields[0].SetVisible( false ); m_fields[0].SetLayer( LAYER_INTERSHEET_REFS ); diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index bf35ff5e8e..da83f870ba 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -3839,7 +3839,13 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText() SCH_FIELD* field = parseSchField( text.get() ); - static_cast( text.get() )->GetFields().emplace_back( *field ); + if( text->Type() == SCH_GLOBAL_LABEL_T && field->GetInternalName() == wxT( "Intersheetrefs") ) + { + SCH_GLOBALLABEL* label = static_cast( text.get() ); + label->GetFields()[0] = *field; + } + else + static_cast( text.get() )->GetFields().emplace_back( *field ); delete field; break;