Fix printing for introduction of zone layers and meta items.
Fixes https://gitlab.com/kicad/code/kicad/issues/5298
This commit is contained in:
parent
38a4e4ad5a
commit
14a9c8dc42
|
@ -1052,9 +1052,8 @@ void MODULE::ViewGetLayers( int aLayers[], int& aCount ) const
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are no pads, and only drawings on a silkscreen layer, then
|
// If there are no pads, and only drawings on a silkscreen layer, then report the silkscreen
|
||||||
// report the silkscreen layer as well so that the component can be edited
|
// layer as well so that the component can be edited with the silkscreen layer
|
||||||
// with the silkscreen layer
|
|
||||||
bool f_silk = false, b_silk = false, non_silk = false;
|
bool f_silk = false, b_silk = false, non_silk = false;
|
||||||
|
|
||||||
for( auto item : m_drawings )
|
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 :
|
int layer = ( m_Layer == F_Cu ) ? LAYER_MOD_FR :
|
||||||
( m_Layer == B_Cu ) ? LAYER_MOD_BK : LAYER_ANCHOR;
|
( 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 ) )
|
if( aView->IsLayerVisible( layer ) )
|
||||||
return 3;
|
return 3;
|
||||||
|
|
||||||
|
@ -1099,9 +1099,8 @@ const BOX2I MODULE::ViewBBox() const
|
||||||
area.Merge( m_Reference->GetBoundingBox() );
|
area.Merge( m_Reference->GetBoundingBox() );
|
||||||
area.Merge( m_Value->GetBoundingBox() );
|
area.Merge( m_Value->GetBoundingBox() );
|
||||||
|
|
||||||
// Add the Clearance shape size: (shape around the pads when the
|
// Add the Clearance shape size: (shape around the pads when the clearance is shown. Not
|
||||||
// clearance is shown. Not optimized, but the draw cost is small
|
// optimized, but the draw cost is small (perhaps smaller than optimization).
|
||||||
// (perhaps smaller than optimization).
|
|
||||||
BOARD* board = GetBoard();
|
BOARD* board = GetBoard();
|
||||||
if( board )
|
if( board )
|
||||||
{
|
{
|
||||||
|
|
|
@ -79,9 +79,9 @@ bool PCBNEW_PRINTOUT::OnPrintPage( int aPage )
|
||||||
{
|
{
|
||||||
// Store the layerset, as it is going to be modified below and the original settings are
|
// Store the layerset, as it is going to be modified below and the original settings are
|
||||||
// needed.
|
// needed.
|
||||||
LSET lset = m_settings.m_layerSet;
|
LSET lset = m_settings.m_layerSet;
|
||||||
int pageCount = lset.count();
|
int pageCount = lset.count();
|
||||||
wxString layer;
|
wxString layerName;
|
||||||
PCB_LAYER_ID extractLayer;
|
PCB_LAYER_ID extractLayer;
|
||||||
|
|
||||||
// compute layer mask from page number if we want one page per layer
|
// 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();
|
extractLayer = m_settings.m_layerSet.ExtractLayer();
|
||||||
|
|
||||||
if( extractLayer == UNDEFINED_LAYER )
|
if( extractLayer == UNDEFINED_LAYER )
|
||||||
layer = _( "Multiple Layers" );
|
layerName = _( "Multiple Layers" );
|
||||||
else
|
else
|
||||||
layer = LSET::Name( extractLayer );
|
layerName = LSET::Name( extractLayer );
|
||||||
|
|
||||||
// In Pcbnew we can want the layer EDGE always printed
|
// In Pcbnew we can want the layer EDGE always printed
|
||||||
if( !m_pcbnewSettings.m_noEdgeLayer )
|
if( !m_pcbnewSettings.m_noEdgeLayer )
|
||||||
m_settings.m_layerSet.set( Edge_Cuts );
|
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
|
// Restore the original layer set, so the next page can be printed
|
||||||
m_settings.m_layerSet = lset;
|
m_settings.m_layerSet = lset;
|
||||||
|
@ -130,8 +130,14 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
|
||||||
BOARD_PRINTOUT::setupViewLayers( aView, aLayerSet );
|
BOARD_PRINTOUT::setupViewLayers( aView, aLayerSet );
|
||||||
|
|
||||||
for( LSEQ layerSeq = m_settings.m_layerSet.Seq(); layerSeq; ++layerSeq )
|
for( LSEQ layerSeq = m_settings.m_layerSet.Seq(); layerSeq; ++layerSeq )
|
||||||
|
{
|
||||||
aView.SetLayerVisible( PCBNEW_LAYER_ID_START + *layerSeq, true );
|
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 )
|
if( m_pcbnewSettings.m_asItemCheckboxes )
|
||||||
{
|
{
|
||||||
auto setVisibility = [&]( GAL_LAYER_ID aLayer )
|
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_ANCHOR );
|
||||||
setVisibility( LAYER_WORKSHEET );
|
setVisibility( LAYER_WORKSHEET );
|
||||||
setVisibility( LAYER_GRID );
|
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
|
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
|
// Keep certain items always enabled/disabled and just rely on the layer visibility
|
||||||
const int alwaysEnabled[] = {
|
const int alwaysEnabled[] = {
|
||||||
LAYER_MOD_TEXT_FR, LAYER_MOD_TEXT_BK, LAYER_MOD_FR, LAYER_MOD_BK,
|
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
|
LAYER_VIA_MICROVIA, LAYER_VIA_BBLIND, LAYER_VIA_THROUGH
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue