From aaff163d7c9e5d4a8bd91fcad0a8e768c38bd7e8 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 31 May 2022 15:05:10 +0100 Subject: [PATCH] Repair Eagle importer page number handling. The root sheet needs a page number, and the other sheets need to not have their last step in the path duplicated. Fixes https://gitlab.com/kicad/code/kicad/issues/11409 --- eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp index 1cbad53884..3b8bbe0695 100644 --- a/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp +++ b/eeschema/sch_plugins/eagle/sch_eagle_plugin.cpp @@ -692,15 +692,21 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) if( sheet_count > 1 ) { int x, y, i; - i = 1; + i = 2; x = 1; y = 1; + SCH_SHEET_PATH rootsheetpath; + rootsheetpath.push_back( m_rootSheet ); + m_rootSheet->AddInstance( rootsheetpath ); + m_rootSheet->SetPageNumber( rootsheetpath, "1" ); + while( sheetNode ) { VECTOR2I pos = VECTOR2I( x * Mils2iu( 1000 ), y * Mils2iu( 1000 ) ); std::unique_ptr sheet = std::make_unique( m_rootSheet, pos ); SCH_SCREEN* screen = new SCH_SCREEN( m_schematic ); + wxString pageNo = wxString::Format( "%d", i ); sheet->SetScreen( screen ); sheet->GetScreen()->SetFileName( sheet->GetFileName() ); @@ -711,10 +717,10 @@ void SCH_EAGLE_PLUGIN::loadSchematic( wxXmlNode* aSchematicNode ) SCH_SHEET_PATH sheetpath; m_rootSheet->LocatePathOfScreen( m_currentSheet->GetScreen(), &sheetpath ); - sheetpath.push_back( m_currentSheet ); - + m_currentSheet->AddInstance( sheetpath ); + m_currentSheet->SetPageNumber( sheetpath, pageNo ); m_rootSheet->AddInstance( sheetpath ); - m_rootSheet->SetPageNumber( sheetpath, wxString::Format( "%d", i ) ); + m_rootSheet->SetPageNumber( sheetpath, pageNo ); sheetNode = sheetNode->GetNext(); x += 2;