Remove extraneous isPrinting test.

Fixes https://gitlab.com/kicad/code/kicad/issues/8609
This commit is contained in:
Jeff Young 2021-06-25 10:35:17 +01:00
parent cbe7f9057b
commit 1f4a56005e
6 changed files with 19 additions and 53 deletions

View File

@ -94,12 +94,13 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
std::unique_ptr<KIGFX::VIEW> view( m_view->DataReference() );
// Target paper size
wxRect pageSizePx = GetLogicalPageRect();
wxRect pageSizePx = GetLogicalPageRect();
const VECTOR2D pageSizeIn( (double) pageSizePx.width / dc->GetPPI().x,
(double) pageSizePx.height / dc->GetPPI().y );
galPrint->SetSheetSize( pageSizeIn );
(double) pageSizePx.height / dc->GetPPI().y );
const VECTOR2D pageSizeIU( milsToIU( pageSizeIn.x * 1000 ), milsToIU( pageSizeIn.y * 1000 ) );
galPrint->SetSheetSize( pageSizeIn );
view->SetGAL( gal );
view->SetPainter( painter.get() );
view->SetScaleLimits( 10e9, 0.0001 );
@ -131,9 +132,10 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
setupPainter( *painter );
setupViewLayers( *view, m_settings.m_LayerSet );
auto sheetSizeMils = m_settings.m_pageInfo.GetSizeMils();
VECTOR2I sheetSizeIU( milsToIU( sheetSizeMils.GetWidth() ), milsToIU( sheetSizeMils.GetHeight() ) );
BOX2I bBox;
wxSize sheetSizeMils = m_settings.m_pageInfo.GetSizeMils();
VECTOR2I sheetSizeIU( milsToIU( sheetSizeMils.GetWidth() ),
milsToIU( sheetSizeMils.GetHeight() ) );
BOX2I bBox;
// Determine printout bounding box
if( m_settings.PrintBorderAndTitleBlock() )
@ -165,8 +167,6 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
}
}
view->SetPrintMode( 1 );
setupGal( gal );
galPrint->SetNativePaperSize( pageSizeIn, printCtx->HasNativeLandscapeRotation() );
gal->SetLookAtPoint( bBox.Centre() );
@ -176,11 +176,9 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa
gal->ClearScreen();
{
KIGFX::GAL_DRAWING_CONTEXT ctx( gal );
view->Redraw();
KIGFX::GAL_DRAWING_CONTEXT ctx( gal );
view->Redraw();
}
view->SetPrintMode( 0 );
}

View File

@ -281,7 +281,6 @@ VIEW::VIEW( bool aIsDynamic ) :
double size = coord_limits::max() - coord_limits::epsilon();
m_boundary.SetOrigin( pos, pos );
m_boundary.SetSize( size, size );
SetPrintMode( 0 );
m_allItems.reset( new std::vector<VIEW_ITEM*> );
m_allItems->reserve( 32768 );

View File

@ -406,9 +406,6 @@ public:
wxCHECK( aLayer >= 0, false);
wxCHECK( aLayer < (int) m_layers.size(), false );
if( GetPrintMode() > 0 )
return true;
return m_layers.at( aLayer ).visible;
}
@ -680,24 +677,6 @@ public:
*/
std::unique_ptr<VIEW> DataReference() const;
/**
* Get the current print mode.
*
* Return values less than or equal to zero indicate the current mode is the draw mode.
* Return values greater than zero indicate print mode.
* @return the printing mode.
*/
int GetPrintMode() const { return m_printMode; }
/**
* Set the printing mode.
*
* @param aPrintMode is the printing mode. If 0, the current mode is not a printing mode,
* just the draw mode
*/
void SetPrintMode( int aPrintMode ) { m_printMode = aPrintMode; }
static constexpr int VIEW_MAX_LAYERS = 512; ///< maximum number of layers that may be shown
protected:
@ -863,10 +842,6 @@ protected:
///< Flag to reverse the draw order when using draw priority.
bool m_reverseDrawOrder;
///< A control for printing: m_printMode <= 0 means no printing mode (normal draw mode
///< m_printMode > 0 is a printing mode (currently means "we are in printing mode").
int m_printMode;
};
} // namespace KIGFX

View File

@ -1239,8 +1239,8 @@ double PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
if( !aView->IsLayerVisible( LAYER_PADS ) )
return HIDE;
// Handle board visibility (unless printing)
if( board && !aView->GetPrintMode() )
// Handle board visibility
if( board )
visible = board->GetVisibleLayers() & board->GetEnabledLayers();
// Handle Render tab switches

View File

@ -627,8 +627,8 @@ double PCB_VIA::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const
if( !aView->IsLayerVisible( LAYER_VIAS ) )
return HIDE;
// Handle board visibility (unless printing)
if( board && !aView->GetPrintMode() )
// Handle board visibility
if( board )
visible = board->GetVisibleLayers() & board->GetEnabledLayers();
if( IsViaPadLayer( aLayer ) )

View File

@ -161,12 +161,17 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
setVisibility( LAYER_MOD_TEXT_FR );
setVisibility( LAYER_MOD_TEXT_BK );
setVisibility( LAYER_MOD_TEXT_INVISIBLE );
setVisibility( LAYER_PADS );
setVisibility( LAYER_PAD_FR );
setVisibility( LAYER_PAD_BK );
setVisibility( LAYER_PADS_TH );
setVisibility( LAYER_TRACKS );
setVisibility( LAYER_VIAS );
setVisibility( LAYER_VIA_MICROVIA );
setVisibility( LAYER_VIA_BBLIND );
setVisibility( LAYER_VIA_THROUGH );
setVisibility( LAYER_ZONES );
setVisibility( LAYER_NO_CONNECTS );
setVisibility( LAYER_DRC_WARNING );
@ -175,17 +180,6 @@ void PCBNEW_PRINTOUT::setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet
setVisibility( LAYER_ANCHOR );
setVisibility( LAYER_DRAWINGSHEET );
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 layer : alwaysEnabled )
aView.SetLayerVisible( layer, true );
}
else
{