sch_field named Intersheetref in global labels: fix incorrect behavior when loading a sch file.
This is a special field, always existing, that cannot be handled like other fields. Also avoid using translated names when initializing the field name. Translated names can be used only in UI, not in internal data. fixes #13113 fixes #13125
This commit is contained in:
parent
fbd2d66a75
commit
a57ca559aa
|
@ -887,9 +887,9 @@ wxString SCH_FIELD::GetCanonicalName() const
|
||||||
else if( m_parent && m_parent->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
|
else if( m_parent && m_parent->IsType( { SCH_LABEL_LOCATE_ANY_T } ) )
|
||||||
{
|
{
|
||||||
// These should be stored in canonical format, but just in case:
|
// 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" );
|
return wxT( "Netclass" );
|
||||||
else if (m_name == _( "Sheet References" ) )
|
else if( m_name == _( "Sheet References" ) || m_name == wxT( "Sheet References" ) )
|
||||||
return wxT( "Intersheetrefs" );
|
return wxT( "Intersheetrefs" );
|
||||||
else
|
else
|
||||||
return m_name;
|
return m_name;
|
||||||
|
|
|
@ -116,6 +116,12 @@ public:
|
||||||
|
|
||||||
void SetName( const wxString& aName ) { m_name = aName; }
|
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; }
|
int GetId() const { return m_id; }
|
||||||
|
|
||||||
void SetId( int aId );
|
void SetId( int aId );
|
||||||
|
|
|
@ -1254,7 +1254,7 @@ SCH_GLOBALLABEL::SCH_GLOBALLABEL( const VECTOR2I& pos, const wxString& text ) :
|
||||||
|
|
||||||
SetVertJustify( GR_TEXT_V_ALIGN_CENTER );
|
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].SetText( wxT( "${INTERSHEET_REFS}" ) );
|
||||||
m_fields[0].SetVisible( false );
|
m_fields[0].SetVisible( false );
|
||||||
m_fields[0].SetLayer( LAYER_INTERSHEET_REFS );
|
m_fields[0].SetLayer( LAYER_INTERSHEET_REFS );
|
||||||
|
|
|
@ -3839,7 +3839,13 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
|
||||||
|
|
||||||
SCH_FIELD* field = parseSchField( text.get() );
|
SCH_FIELD* field = parseSchField( text.get() );
|
||||||
|
|
||||||
static_cast<SCH_LABEL_BASE*>( text.get() )->GetFields().emplace_back( *field );
|
if( text->Type() == SCH_GLOBAL_LABEL_T && field->GetInternalName() == wxT( "Intersheetrefs") )
|
||||||
|
{
|
||||||
|
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( text.get() );
|
||||||
|
label->GetFields()[0] = *field;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
static_cast<SCH_LABEL_BASE*>( text.get() )->GetFields().emplace_back( *field );
|
||||||
|
|
||||||
delete field;
|
delete field;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue