mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-04-07 18:25:31 +00:00
Store/fetch sheetpath along with symbol UUID.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/19623
This commit is contained in:
parent
5b1fdbe645
commit
7bf0d36057
eeschema
@ -113,4 +113,5 @@
|
||||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20240812 // Netclass color highlighting
|
||||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20240819 // Embedded Files - Update hash algorithm to Murmur3
|
||||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20241004 // Use booleans for 'hide' in symbols
|
||||
#define SEXPR_SCHEMATIC_FILE_VERSION 20241209 // Private flags for SCH_FIELDs
|
||||
//#define SEXPR_SCHEMATIC_FILE_VERSION 20241209 // Private flags for SCH_FIELDs
|
||||
#define SEXPR_SCHEMATIC_FILE_VERSION 20250114 // Full paths for text variable cross references
|
||||
|
@ -443,8 +443,16 @@ bool SCHEMATIC::ResolveCrossReference( wxString* token, int aDepth ) const
|
||||
{
|
||||
wxString remainder;
|
||||
wxString ref = token->BeforeFirst( ':', &remainder );
|
||||
KIID_PATH path( ref );
|
||||
KIID uuid = path.back();
|
||||
SCH_SHEET_PATH sheetPath;
|
||||
SCH_ITEM* refItem = GetItem( KIID( ref ), &sheetPath );
|
||||
SCH_ITEM* refItem = GetItem( KIID( uuid ), &sheetPath );
|
||||
|
||||
if( path.size() > 1 )
|
||||
{
|
||||
path.pop_back();
|
||||
sheetPath = Hierarchy().GetSheetPathByKIIDPath( path ).value_or( sheetPath );
|
||||
}
|
||||
|
||||
if( refItem && refItem->Type() == SCH_SYMBOL_T )
|
||||
{
|
||||
@ -549,7 +557,10 @@ wxString SCHEMATIC::ConvertRefsToKIIDs( const wxString& aSource ) const
|
||||
|
||||
if( ref == refSymbol->GetRef( &references[ jj ].GetSheetPath(), true ) )
|
||||
{
|
||||
token = refSymbol->m_Uuid.AsString() + wxS( ":" ) + remainder;
|
||||
KIID_PATH path = references[ jj ].GetSheetPath().Path();
|
||||
path.push_back( refSymbol->m_Uuid );
|
||||
|
||||
token = path.AsString() + wxS( ":" ) + remainder;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -592,16 +603,23 @@ wxString SCHEMATIC::ConvertKIIDsToRefs( const wxString& aSource ) const
|
||||
|
||||
if( isCrossRef )
|
||||
{
|
||||
wxString remainder;
|
||||
wxString ref = token.BeforeFirst( ':', &remainder );
|
||||
wxString remainder;
|
||||
wxString ref = token.BeforeFirst( ':', &remainder );
|
||||
KIID_PATH path( ref );
|
||||
KIID uuid = path.back();
|
||||
SCH_SHEET_PATH sheetPath;
|
||||
SCH_ITEM* refItem = GetItem( uuid, &sheetPath );
|
||||
|
||||
SCH_SHEET_PATH refSheetPath;
|
||||
SCH_ITEM* refItem = GetItem( KIID( ref ), &refSheetPath );
|
||||
if( path.size() > 1 )
|
||||
{
|
||||
path.pop_back();
|
||||
sheetPath = Hierarchy().GetSheetPathByKIIDPath( path ).value_or( sheetPath );
|
||||
}
|
||||
|
||||
if( refItem && refItem->Type() == SCH_SYMBOL_T )
|
||||
{
|
||||
SCH_SYMBOL* refSymbol = static_cast<SCH_SYMBOL*>( refItem );
|
||||
token = refSymbol->GetRef( &refSheetPath, true ) + wxS( ":" ) + remainder;
|
||||
token = refSymbol->GetRef( &sheetPath, true ) + wxS( ":" ) + remainder;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user