Fill in missing bits of LAYER variable for printing/plotting.

Fixes https://gitlab.com/kicad/code/kicad/issues/11788

(cherry picked from commit f22cf1cc3a)
This commit is contained in:
Jeff Young 2022-06-10 14:09:22 +01:00
parent ce92c676e6
commit 0321d96b1e
7 changed files with 20 additions and 2 deletions

View File

@ -137,6 +137,8 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
setupPainter( *painter );
setupViewLayers( *view, m_settings.m_LayerSet );
dstSettings->SetLayerName( aLayerName );
wxSize sheetSizeMils = m_settings.m_pageInfo.GetSizeMils();
VECTOR2I sheetSizeIU( milsToIU( sheetSizeMils.GetWidth() ),
milsToIU( sheetSizeMils.GetHeight() ) );

View File

@ -83,6 +83,7 @@ void DS_PROXY_VIEW_ITEM::buildDrawList( VIEW* aView, DS_DRAW_ITEM_LIST* aDrawLis
aDrawList->SetSheetCount( m_sheetCount );
aDrawList->SetFileName( fileName );
aDrawList->SetSheetName( sheetName );
aDrawList->SetSheetLayer( settings->GetLayerName() );
aDrawList->SetProject( m_project );
aDrawList->BuildDrawItemsList( *m_pageInfo, *m_titleBlock );

View File

@ -84,6 +84,7 @@ void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BL
drawList.SetSheetCount( aSheetCount );
drawList.SetFileName( fn.GetFullName() ); // Print only the short filename
drawList.SetSheetName( aSheetDesc );
drawList.SetSheetLayer( plotter->RenderSettings()->GetLayerName() );
drawList.SetProject( aProject );
drawList.SetIsFirstPage( aIsFirstPage );

View File

@ -60,6 +60,11 @@ public:
*/
void SetSheetName( const std::string& aSheetName ) { m_sheetName = aSheetName; }
/**
* Set the sheet path displayed in the title block.
*/
void SetSheetPath( const std::string& aSheetPath ) { m_sheetPath = aSheetPath; }
/**
* Changes the page number displayed in the title block.
*/
@ -132,6 +137,7 @@ protected:
std::string m_fileName;
std::string m_sheetName;
std::string m_sheetPath;
const TITLE_BLOCK* m_titleBlock;
const PAGE_INFO* m_pageInfo;
std::string m_pageNumber;

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.TXT for contributors.
* Copyright (C) 2019-2022 KiCad Developers, see AUTHORS.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -112,6 +112,9 @@ public:
PCB_LAYER_ID GetActiveLayer() const { return m_activeLayer; }
void SetActiveLayer( PCB_LAYER_ID aLayer ) { m_activeLayer = aLayer; }
const wxString& GetLayerName() const { return m_layerName; }
void SetLayerName( const wxString& aLayerName ) { m_layerName = aLayerName; }
/**
* Clear the list of active layers.
*/
@ -283,6 +286,7 @@ protected:
virtual void update();
PCB_LAYER_ID m_activeLayer; // The active layer (as shown by appearance mgr)
wxString m_layerName;
std::set<unsigned int> m_highContrastLayers; // High-contrast layers (both board layers and
// synthetic GAL layers)
COLOR4D m_layerColors[LAYER_ID_COUNT]; // Layer colors

View File

@ -109,7 +109,7 @@ bool PCBNEW_PRINTOUT::OnPrintPage( int aPage )
if( extractLayer == UNDEFINED_LAYER )
layerName = _( "Multiple Layers" );
else
layerName = LSET::Name( extractLayer );
layerName = m_board->GetLayerName( extractLayer );
// In Pcbnew we can want the layer EDGE always printed
if( m_pcbnewSettings.m_PrintEdgeCutsOnAllPages )

View File

@ -1187,6 +1187,10 @@ PLOTTER* StartPlotBoard( BOARD *aBoard, const PCB_PLOT_PARAMS *aPlotOpts, int aL
KIGFX::PCB_RENDER_SETTINGS* renderSettings = new KIGFX::PCB_RENDER_SETTINGS();
renderSettings->LoadColors( aPlotOpts->ColorSettings() );
renderSettings->SetDefaultPenWidth( Millimeter2iu( 0.0212 ) ); // Hairline at 1200dpi
if( aLayer < GAL_LAYER_ID_END )
renderSettings->SetLayerName( aBoard->GetLayerName( ToLAYER_ID( aLayer ) ) );
plotter->SetRenderSettings( renderSettings );
// Compute the viewport and set the other options