From dde933ba08c0143f6061ed1e2db12aee2d44a87f Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Sat, 22 Dec 2018 13:44:49 +0100 Subject: [PATCH] When printing, pads are not always printed (especially on tech layers) A printing mode is added, to force ViewGetLOD() to return 0 in printing mode (pads are always drawn) Fixes: lp:1809528 https://bugs.launchpad.net/kicad/+bug/1809528 --- common/board_printout.cpp | 14 +++++++++----- common/view/view.cpp | 1 + include/view/view.h | 17 +++++++++++++++++ pcbnew/class_pad.cpp | 3 +++ 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/common/board_printout.cpp b/common/board_printout.cpp index 62f7e1af87..dfc7e97258 100644 --- a/common/board_printout.cpp +++ b/common/board_printout.cpp @@ -119,12 +119,12 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa else // color enabled { for( int i = 0; i < LAYER_ID_COUNT; ++i ) - { - // Cairo does not support translucent colors on PostScript surfaces - // see 'Features support by the PostScript surface' on - // ttps://www.cairographics.org/documentation/using_the_postscript_surface/ + { + // Cairo does not support translucent colors on PostScript surfaces + // see 'Features support by the PostScript surface' on + // ttps://www.cairographics.org/documentation/using_the_postscript_surface/ dstSettings->SetLayerColor( i, srcSettings->GetLayerColor( i ).WithAlpha( 1.0 ) ); - } + } } @@ -165,6 +165,8 @@ 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() ); @@ -174,6 +176,8 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa KIGFX::GAL_DRAWING_CONTEXT ctx( gal ); view->Redraw(); } + + view->SetPrintMode( 0 ); } diff --git a/common/view/view.cpp b/common/view/view.cpp index c5d6feb344..2690e703e3 100644 --- a/common/view/view.cpp +++ b/common/view/view.cpp @@ -303,6 +303,7 @@ 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 ); m_allItems->reserve( 32768 ); diff --git a/include/view/view.h b/include/view/view.h index 99b5d24d29..c78232950b 100644 --- a/include/view/view.h +++ b/include/view/view.h @@ -696,6 +696,19 @@ public: */ std::unique_ptr DataReference() const; + /** + * @return the printing mode. + * if return <= 0, the current mode is not a printing mode, just the draw mode + */ + int GetPrintMode() { 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: @@ -865,6 +878,10 @@ 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; + VIEW( const VIEW& ) = delete; }; } // namespace KIGFX diff --git a/pcbnew/class_pad.cpp b/pcbnew/class_pad.cpp index 511dd5c38e..f13e4ac114 100644 --- a/pcbnew/class_pad.cpp +++ b/pcbnew/class_pad.cpp @@ -1307,6 +1307,9 @@ void D_PAD::ViewGetLayers( int aLayers[], int& aCount ) const unsigned int D_PAD::ViewGetLOD( int aLayer, KIGFX::VIEW* aView ) const { + if( aView->GetPrintMode() > 0 ) // In printing mode the pad is always drawable + return 0; + const int HIDE = std::numeric_limits::max(); BOARD* board = GetBoard();