From d54e5b180b9d24b46d6c3dc4d01dd0492062f03d Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 15 Nov 2023 11:06:54 +0000 Subject: [PATCH] Use sheetname for single-sheet plotting to PDF. Fixes https://gitlab.com/kicad/code/kicad/-/issues/14974 --- eeschema/sch_plotter.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/eeschema/sch_plotter.cpp b/eeschema/sch_plotter.cpp index e4820abf1f..bc84283497 100644 --- a/eeschema/sch_plotter.cpp +++ b/eeschema/sch_plotter.cpp @@ -124,9 +124,7 @@ void SCH_PLOTTER::createPDFFile( const SCH_PLOT_SETTINGS& aPlotSettings, // remove the non-selected pages if we are in plot pages mode if( aPlotSettings.m_plotPages.size() > 0 ) - { sheetList.TrimToPageNumbers( aPlotSettings.m_plotPages ); - } } else { @@ -153,6 +151,7 @@ void SCH_PLOTTER::createPDFFile( const SCH_PLOT_SETTINGS& aPlotSettings, m_schematic->SetSheetNumberAndCount(); SCH_SCREEN* screen = m_schematic->CurrentSheet().LastScreen(); + wxString sheetName = sheetList[i].Last()->GetFields()[SHEETNAME].GetShownText( false ); if( i == 0 ) { @@ -180,7 +179,11 @@ void SCH_PLOTTER::createPDFFile( const SCH_PLOT_SETTINGS& aPlotSettings, // Open the plotter and do the first page setupPlotPagePDF( plotter, screen, aPlotSettings ); - plotter->StartPlot( sheetList[i].GetPageNumber(), _( "Root" ) ); + + if( sheetList.size() > 1 ) + plotter->StartPlot( sheetList[i].GetPageNumber(), _( "Root" ) ); + else + plotter->StartPlot( sheetList[i].GetPageNumber(), sheetName ); } catch( const IO_ERROR& e ) { @@ -201,8 +204,7 @@ void SCH_PLOTTER::createPDFFile( const SCH_PLOT_SETTINGS& aPlotSettings, * reconfigure, and then start a new one */ plotter->ClosePage(); setupPlotPagePDF( plotter, screen, aPlotSettings ); - plotter->StartPage( sheetList[i].GetPageNumber(), - sheetList[i].Last()->GetFields()[SHEETNAME].GetShownText( false ) ); + plotter->StartPage( sheetList[i].GetPageNumber(), sheetName ); } plotOneSheetPDF( plotter, screen, aPlotSettings );