From b8e97bb6b6d0cbc5c16dcb416ea86ae0afc30d28 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 2 Feb 2021 15:36:45 +0000 Subject: [PATCH] Only apply B&W printer fixes when printing. Fixes https://gitlab.com/kicad/code/kicad/issues/7388 --- common/board_printout.cpp | 4 +++- common/painter.cpp | 3 +-- eeschema/dialogs/dialog_print_using_printer.cpp | 2 ++ include/painter.h | 3 --- include/render_settings.h | 4 ++++ pcbnew/pcb_painter.cpp | 4 +--- pcbnew/pcb_painter.h | 2 +- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/common/board_printout.cpp b/common/board_printout.cpp index 7ed5da8106..d7fd7bcff8 100644 --- a/common/board_printout.cpp +++ b/common/board_printout.cpp @@ -107,7 +107,7 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa // Set the color scheme - auto dstSettings = view->GetPainter()->GetSettings(); + RENDER_SETTINGS* dstSettings = view->GetPainter()->GetSettings(); dstSettings->LoadColors( m_settings.m_colorSettings ); if( m_settings.m_blackWhite ) @@ -126,6 +126,8 @@ void BOARD_PRINTOUT::DrawPage( const wxString& aLayerName, int aPageNum, int aPa } } + dstSettings->SetIsPrinting( true ); + setupViewLayers( *view, m_settings.m_LayerSet ); setupPainter( *painter ); diff --git a/common/painter.cpp b/common/painter.cpp index 525203f693..84f3ce30ba 100644 --- a/common/painter.cpp +++ b/common/painter.cpp @@ -30,8 +30,7 @@ using namespace KIGFX; PAINTER::PAINTER( GAL* aGal ) : - m_gal( aGal ), - m_brightenedColor( 0.0, 1.0, 0.0, 0.9 ) + m_gal( aGal ) { } diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index b40c558cea..b5d2d6ae8a 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -497,6 +497,8 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen ) wxEmptyString ); } + renderSettings.SetIsPrinting( true ); + aScreen->Print( &renderSettings ); m_parent->SetDrawBgColor( savedBgColor ); diff --git a/include/painter.h b/include/painter.h index 240051f036..31c11cdf37 100644 --- a/include/painter.h +++ b/include/painter.h @@ -99,9 +99,6 @@ protected: /// Instance of graphic abstraction layer that gives an interface to call /// commands used to draw (eg. DrawLine, DrawCircle, etc.) GAL* m_gal; - - /// Color of brightened item frame - COLOR4D m_brightenedColor; }; } // namespace KIGFX diff --git a/include/render_settings.h b/include/render_settings.h index 5eb82e2c2c..e773e7b35e 100644 --- a/include/render_settings.h +++ b/include/render_settings.h @@ -191,6 +191,9 @@ public: bool GetShowPageLimits() const { return m_showPageLimits; } void SetShowPageLimits( bool aDraw ) { m_showPageLimits = aDraw; } + bool IsPrinting() const { return m_isPrinting; } + void SetIsPrinting( bool isPrinting ) { m_isPrinting = isPrinting; } + /** * Return current background color settings. */ @@ -292,6 +295,7 @@ protected: int m_minPenWidth; // Some clients (such as PDF) don't like ultra-thin // lines. This sets an absolute minimum. bool m_showPageLimits; + bool m_isPrinting; wxDC* m_printDC; // This can go away once the worksheet is moved to // Cairo-based printing. diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp index fbe0335c87..8764bd45ad 100644 --- a/pcbnew/pcb_painter.cpp +++ b/pcbnew/pcb_painter.cpp @@ -77,9 +77,7 @@ PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS() // By default everything should be displayed as filled for( unsigned int i = 0; i < arrayDim( m_sketchMode ); ++i ) - { m_sketchMode[i] = false; - } update(); } @@ -233,7 +231,7 @@ COLOR4D PCB_RENDER_SETTINGS::GetColor( const VIEW_ITEM* aItem, int aLayer ) cons if( aLayer == LAYER_MARKER_SHADOWS ) return m_backgroundColor.WithAlpha( 0.6 ); - if( IsHoleLayer( aLayer ) ) + if( IsHoleLayer( aLayer ) && m_isPrinting ) { // Careful that we don't end up with the same colour for the annular ring and the hole // when printing in B&W. diff --git a/pcbnew/pcb_painter.h b/pcbnew/pcb_painter.h index 9af9b4aac4..68343e9976 100644 --- a/pcbnew/pcb_painter.h +++ b/pcbnew/pcb_painter.h @@ -292,7 +292,7 @@ protected: virtual int getDrillSize( const VIA* aVia ) const; protected: - PCB_RENDER_SETTINGS m_pcbSettings; + PCB_RENDER_SETTINGS m_pcbSettings; }; } // namespace KIGFX