Use sheetname for single-sheet plotting to PDF.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/14974
This commit is contained in:
Jeff Young 2023-11-15 11:06:54 +00:00
parent 9bb6b11c1d
commit d54e5b180b
1 changed files with 7 additions and 5 deletions

View File

@ -124,10 +124,8 @@ void SCH_PLOTTER::createPDFFile( const SCH_PLOT_SETTINGS& aPlotSettings,
// remove the non-selected pages if we are in plot pages mode // remove the non-selected pages if we are in plot pages mode
if( aPlotSettings.m_plotPages.size() > 0 ) if( aPlotSettings.m_plotPages.size() > 0 )
{
sheetList.TrimToPageNumbers( aPlotSettings.m_plotPages ); sheetList.TrimToPageNumbers( aPlotSettings.m_plotPages );
} }
}
else else
{ {
// in eeschema, this prints the current page // in eeschema, this prints the current page
@ -153,6 +151,7 @@ void SCH_PLOTTER::createPDFFile( const SCH_PLOT_SETTINGS& aPlotSettings,
m_schematic->SetSheetNumberAndCount(); m_schematic->SetSheetNumberAndCount();
SCH_SCREEN* screen = m_schematic->CurrentSheet().LastScreen(); SCH_SCREEN* screen = m_schematic->CurrentSheet().LastScreen();
wxString sheetName = sheetList[i].Last()->GetFields()[SHEETNAME].GetShownText( false );
if( i == 0 ) if( i == 0 )
{ {
@ -180,7 +179,11 @@ void SCH_PLOTTER::createPDFFile( const SCH_PLOT_SETTINGS& aPlotSettings,
// Open the plotter and do the first page // Open the plotter and do the first page
setupPlotPagePDF( plotter, screen, aPlotSettings ); setupPlotPagePDF( plotter, screen, aPlotSettings );
if( sheetList.size() > 1 )
plotter->StartPlot( sheetList[i].GetPageNumber(), _( "Root" ) ); plotter->StartPlot( sheetList[i].GetPageNumber(), _( "Root" ) );
else
plotter->StartPlot( sheetList[i].GetPageNumber(), sheetName );
} }
catch( const IO_ERROR& e ) 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 */ * reconfigure, and then start a new one */
plotter->ClosePage(); plotter->ClosePage();
setupPlotPagePDF( plotter, screen, aPlotSettings ); setupPlotPagePDF( plotter, screen, aPlotSettings );
plotter->StartPage( sheetList[i].GetPageNumber(), plotter->StartPage( sheetList[i].GetPageNumber(), sheetName );
sheetList[i].Last()->GetFields()[SHEETNAME].GetShownText( false ) );
} }
plotOneSheetPDF( plotter, screen, aPlotSettings ); plotOneSheetPDF( plotter, screen, aPlotSettings );