From db601c58cc5dc177c0cc288527abcea44f4f9d99 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Tue, 7 Jan 2025 19:13:58 +0500 Subject: [PATCH] Don't lose reference designators when importing EasyEDA Pro/Std, LTspice, CADSTAR schematics. Fixes https://gitlab.com/kicad/code/kicad/-/issues/19490 (cherry picked from commit 644c4f8c0a027c9058647b73d641aea11bdd8af0) --- eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp | 3 +++ eeschema/sch_io/easyeda/sch_io_easyeda.cpp | 3 +++ eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp | 3 +++ eeschema/sch_io/ltspice/sch_io_ltspice.cpp | 3 +++ 4 files changed, 12 insertions(+) diff --git a/eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp b/eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp index 9de9bb1203..53a15c76eb 100644 --- a/eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp +++ b/eeschema/sch_io/cadstar/sch_io_cadstar_archive.cpp @@ -92,6 +92,9 @@ SCH_SHEET* SCH_IO_CADSTAR_ARCHIVE::LoadSchematicFile( const wxString& aFi SCH_SCREEN* screen = new SCH_SCREEN( aSchematic ); screen->SetFileName( aFileName ); rootSheet->SetScreen( screen ); + + // Virtual root sheet UUID must be the same as the schematic file UUID. + const_cast( rootSheet->m_Uuid ) = screen->GetUuid(); } CADSTAR_SCH_ARCHIVE_LOADER csaLoader( aFileName, m_reporter, m_progressReporter ); diff --git a/eeschema/sch_io/easyeda/sch_io_easyeda.cpp b/eeschema/sch_io/easyeda/sch_io_easyeda.cpp index 9c98623990..0b4dfc85af 100644 --- a/eeschema/sch_io/easyeda/sch_io_easyeda.cpp +++ b/eeschema/sch_io/easyeda/sch_io_easyeda.cpp @@ -640,6 +640,9 @@ SCH_SHEET* SCH_IO_EASYEDA::LoadSchematicFile( const wxString& aFileName, SCHEMAT screen->SetFileName( aFileName ); rootSheet->SetScreen( screen ); + + // Virtual root sheet UUID must be the same as the schematic file UUID. + const_cast( rootSheet->m_Uuid ) = screen->GetUuid(); } SYMBOL_LIB_TABLE* libTable = PROJECT_SCH::SchSymbolLibTable( &aSchematic->Prj() ); diff --git a/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp b/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp index b19276ce84..dfbaca6d57 100644 --- a/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp +++ b/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp @@ -456,6 +456,9 @@ SCH_SHEET* SCH_IO_EASYEDAPRO::LoadSchematicFile( const wxString& aFileName, screen->SetFileName( aFileName ); rootSheet->SetScreen( screen ); + + // Virtual root sheet UUID must be the same as the schematic file UUID. + const_cast( rootSheet->m_Uuid ) = screen->GetUuid(); } SYMBOL_LIB_TABLE* libTable = PROJECT_SCH::SchSymbolLibTable( &aSchematic->Prj() ); diff --git a/eeschema/sch_io/ltspice/sch_io_ltspice.cpp b/eeschema/sch_io/ltspice/sch_io_ltspice.cpp index d2fea59686..ac158414d4 100644 --- a/eeschema/sch_io/ltspice/sch_io_ltspice.cpp +++ b/eeschema/sch_io/ltspice/sch_io_ltspice.cpp @@ -66,6 +66,9 @@ SCH_SHEET* SCH_IO_LTSPICE::LoadSchematicFile( const wxString& aFileName, SCHEMAT screen->SetFileName( aFileName ); rootSheet->SetScreen( screen ); + + // Virtual root sheet UUID must be the same as the schematic file UUID. + const_cast( rootSheet->m_Uuid ) = screen->GetUuid(); } SYMBOL_LIB_TABLE* libTable = PROJECT_SCH::SchSymbolLibTable( &aSchematic->Prj() );