Fix printing for introduction of zone layers and meta items.

Fixes https://gitlab.com/kicad/code/kicad/issues/5298
This commit is contained in:
Jeff Young 2020-08-30 22:20:37 +01:00
parent 38a4e4ad5a
commit 14a9c8dc42
2 changed files with 28 additions and 14 deletions

View File

@ -1052,9 +1052,8 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
break;
}
// If there are no pads, and only drawings on a silkscreen layer, then
// report the silkscreen layer as well so that the component can be edited
// with the silkscreen layer
// If there are no pads, and only drawings on a silkscreen layer, then report the silkscreen
// layer as well so that the component can be edited with the silkscreen layer
bool f_silk = false, b_silk = false, non_silk = false;
for( auto item : m_drawings )
@ -1083,7 +1082,8 @@ unsigned int MODULE::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
int layer = ( m_Layer == F_Cu ) ? LAYER_MOD_FR :
( m_Layer == B_Cu ) ? LAYER_MOD_BK : LAYER_ANCHOR;
// Currently it is only for anchor layer
// Currently this is only pertinent for the anchor layer; everything else is drawn from the
// children.
if( aView->IsLayerVisible( layer ) )
return 3;
@ -1099,9 +1099,8 @@ const BOX2I MODULE::ViewBBox() const
area.Merge( m_Reference->GetBoundingBox() );
area.Merge( m_Value->GetBoundingBox() );
// Add the Clearance shape size: (shape around the pads when the
// clearance is shown. Not optimized, but the draw cost is small
// (perhaps smaller than optimization).
// Add the Clearance shape size: (shape around the pads when the clearance is shown. Not
// optimized, but the draw cost is small (perhaps smaller than optimization).
BOARD* board = GetBoard();
if( board )
{

View File

@ -81,7 +81,7 @@ bool PCBNEW_PRINTOUT::OnPrintPage( int aPage )
// needed.
LSET lset = m_settings.m_layerSet;
int pageCount = lset.count();
wxString layer;
wxString layerName;
PCB_LAYER_ID extractLayer;
// compute layer mask from page number if we want one page per layer
@ -102,15 +102,15 @@ bool PCBNEW_PRINTOUT::OnPrintPage( int aPage )
extractLayer = m_settings.m_layerSet.ExtractLayer();
if( extractLayer == UNDEFINED_LAYER )
layer = _( "Multiple Layers" );
layerName = _( "Multiple Layers" );
else
layer = LSET::Name( extractLayer );
layerName = LSET::Name( extractLayer );
// In Pcbnew we can want the layer EDGE always printed
if( !m_pcbnewSettings.m_noEdgeLayer )
m_settings.m_layerSet.set( Edge_Cuts );
DrawPage( layer, aPage, pageCount );
DrawPage( layerName, aPage, pageCount );
// Restore the original layer set, so the next page can be printed
m_settings.m_layerSet = lset;
@ -130,8 +130,14 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
BOARD_PRINTOUT::setupViewLayers( aView, aLayerSet );
for( LSEQ layerSeq = m_settings.m_layerSet.Seq(); layerSeq; ++layerSeq )
{
aView.SetLayerVisible( PCBNEW_LAYER_ID_START + *layerSeq, true );
// Enable the corresponding zone layer
if( IsCopperLayer( *layerSeq ) )
aView.SetLayerVisible( LAYER_ZONE_START + *layerSeq, true );
}
if( m_pcbnewSettings.m_asItemCheckboxes )
{
auto setVisibility = [&]( GAL_LAYER_ID aLayer )
@ -161,6 +167,15 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
setVisibility( LAYER_ANCHOR );
setVisibility( LAYER_WORKSHEET );
setVisibility( LAYER_GRID );
// Keep certain items always enabled and just rely on either the finer or coarser
// visibility controls
const int alwaysEnabled[] = {
LAYER_ZONES, LAYER_PADS, LAYER_VIA_MICROVIA, LAYER_VIA_BBLIND, LAYER_VIA_THROUGH
};
for( int item : alwaysEnabled )
aView.SetLayerVisible( item, true );
}
else
{
@ -194,7 +209,7 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
// Keep certain items always enabled/disabled and just rely on the layer visibility
const int alwaysEnabled[] = {
LAYER_MOD_TEXT_FR, LAYER_MOD_TEXT_BK, LAYER_MOD_FR, LAYER_MOD_BK,
LAYER_MOD_VALUES, LAYER_MOD_REFERENCES, LAYER_TRACKS,
LAYER_MOD_VALUES, LAYER_MOD_REFERENCES, LAYER_TRACKS, LAYER_ZONES, LAYER_PADS,
LAYER_VIA_MICROVIA, LAYER_VIA_BBLIND, LAYER_VIA_THROUGH
};