Enhance compatibility with V6.0 for Intersheetrefs fields associated to GLOBAL labels.

In V6.0, the identifier is "Intersheet References" and was not immediately
seen as Intersheetrefs field.
This commit is contained in:
jean-pierre charras 2022-12-12 16:37:27 +01:00
parent ccbbd2ddd9
commit 96a9ec4a0c
3 changed files with 12 additions and 6 deletions

View File

@ -889,7 +889,9 @@ wxString SCH_FIELD::GetCanonicalName() const
// These should be stored in canonical format, but just in case:
if( m_name == _( "Net Class" ) || m_name == wxT( "Net Class" ) )
return wxT( "Netclass" );
else if( m_name == _( "Sheet References" ) || m_name == wxT( "Sheet References" ) )
else if( m_name == _( "Sheet References" )
|| m_name == wxT( "Sheet References" )
|| m_name == wxT( "Intersheet References" ) )
return wxT( "Intersheetrefs" );
else
return m_name;

View File

@ -3839,10 +3839,16 @@ SCH_TEXT* SCH_SEXPR_PARSER::parseSchText()
SCH_FIELD* field = parseSchField( text.get() );
if( text->Type() == SCH_GLOBAL_LABEL_T && field->GetInternalName() == wxT( "Intersheetrefs") )
if( text->Type() == SCH_GLOBAL_LABEL_T )
{
SCH_GLOBALLABEL* label = static_cast<SCH_GLOBALLABEL*>( text.get() );
label->GetFields()[0] = *field;
// If the field is a Intersheetrefs it is not handled like other fields:
// It always exists and is the first in list
if( field->GetInternalName() == wxT( "Intersheetrefs") || // Current name
field->GetInternalName() == wxT( "Intersheet References") ) // old name in V6.0
{
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 );

View File

@ -190,8 +190,6 @@ int EDIT_TOOL::Swap( const TOOL_EVENT& aEvent )
int EDIT_TOOL::PackAndMoveFootprints( const TOOL_EVENT& aEvent )
{
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
PCB_SELECTION& selection = m_selectionTool->RequestSelection(
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool )
{