From 96a9ec4a0c9f9bdc0b3f274513027fc580763e5c Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Mon, 12 Dec 2022 16:37:27 +0100 Subject: [PATCH] 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. --- eeschema/sch_field.cpp | 4 +++- eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp | 12 +++++++++--- pcbnew/tools/edit_tool_move_fct.cpp | 2 -- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp index 212231694c..16dba43203 100644 --- a/eeschema/sch_field.cpp +++ b/eeschema/sch_field.cpp @@ -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; diff --git a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp index da83f870ba..b7e8c424fd 100644 --- a/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp +++ b/eeschema/sch_plugins/kicad/sch_sexpr_parser.cpp @@ -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( 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( text.get() ); + label->GetFields()[0] = *field; + } } else static_cast( text.get() )->GetFields().emplace_back( *field ); diff --git a/pcbnew/tools/edit_tool_move_fct.cpp b/pcbnew/tools/edit_tool_move_fct.cpp index 5a3e23311c..b8e5df20f4 100644 --- a/pcbnew/tools/edit_tool_move_fct.cpp +++ b/pcbnew/tools/edit_tool_move_fct.cpp @@ -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_SELECTION& selection = m_selectionTool->RequestSelection( []( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector, PCB_SELECTION_TOOL* sTool ) {