From d90d4ff682cc002b2d75ce5ac88e9fdeeb41c271 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Wed, 30 May 2018 20:45:02 +0100 Subject: [PATCH] Fix bugs in Export to SVG. We were trying to handle aOnlyOneFile at two different levels which was preventing the Silk layer from going through the right routine (and preventing board outlines from getting drawn if selected). We were also overwriting the references color local variable before using it, meaning the reference was always rendered in the value's color. Fixes: lp:1774171 * https://bugs.launchpad.net/kicad/+bug/1774171 --- pcbnew/dialogs/dialog_SVG_print.cpp | 19 ++++++--------- pcbnew/plot_brditems_plotter.cpp | 37 +++++++---------------------- 2 files changed, 15 insertions(+), 41 deletions(-) diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp index 6e4d700428..eb44aede92 100644 --- a/pcbnew/dialogs/dialog_SVG_print.cpp +++ b/pcbnew/dialogs/dialog_SVG_print.cpp @@ -88,7 +88,7 @@ private: return m_rbSvgPageSizeOpt->GetSelection() == 0; } - bool CreateSVGFile( const wxString& FullFileName, bool aOnlyOneFile ); + bool CreateSVGFile( const wxString& FullFileName ); LSET getCheckBoxSelectedLayers() const; }; @@ -298,7 +298,7 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile ) if( m_PrintBoardEdgesCtrl->IsChecked() ) m_printMaskLayer.set( Edge_Cuts ); - if( CreateSVGFile( fn.GetFullPath(), aOnlyOneFile ) ) + if( CreateSVGFile( fn.GetFullPath() ) ) { reporter.Report ( wxString::Format( _( "Plot: \"%s\" OK." ), GetChars( fn.GetFullPath() ) ), @@ -318,7 +318,7 @@ void DIALOG_SVG_PRINT::ExportSVGFile( bool aOnlyOneFile ) // Actual SVG file export function. -bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName, bool aOnlyOneFile ) +bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName ) { PCB_PLOT_PARAMS plot_opts; @@ -359,15 +359,10 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName, bool aOnlyO if( plotter ) { plotter->SetColorMode( !m_printBW ); - if( aOnlyOneFile ) - { - for( LSEQ seq = m_printMaskLayer.SeqStackupBottom2Top(); seq; ++seq ) - PlotOneBoardLayer( m_board, plotter, *seq, plot_opts ); - } - else - { - PlotStandardLayer( m_board, plotter, m_printMaskLayer, plot_opts ); - } + + for( LSEQ seq = m_printMaskLayer.SeqStackupBottom2Top(); seq; ++seq ) + PlotOneBoardLayer( m_board, plotter, *seq, plot_opts ); + plotter->EndPlot(); } diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp index 96ba2432ea..3c3316982a 100644 --- a/pcbnew/plot_brditems_plotter.cpp +++ b/pcbnew/plot_brditems_plotter.cpp @@ -210,43 +210,22 @@ void BRDITEMS_PLOTTER::PlotPad( D_PAD* aPad, COLOR4D aColor, EDA_DRAW_MODE_T aPl bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule ) { - // see if we want to plot VALUE and REF fields - bool trace_val = GetPlotValue(); - bool trace_ref = GetPlotReference(); - TEXTE_MODULE* textModule = &aModule->Reference(); LAYER_NUM textLayer = textModule->GetLayer(); - if( textLayer >= PCB_LAYER_ID_COUNT ) // how will this ever be true? - return false; - - if( !m_layerMask[textLayer] ) - trace_ref = false; - - if( !textModule->IsVisible() && !GetPlotInvisibleText() ) - trace_ref = false; + if( GetPlotReference() && m_layerMask[textLayer] + && ( textModule->IsVisible() || GetPlotInvisibleText() ) ) + { + PlotTextModule( textModule, getColor( textLayer ) ); + } textModule = &aModule->Value(); textLayer = textModule->GetLayer(); - if( textLayer > PCB_LAYER_ID_COUNT ) // how will this ever be true? - return false; - - if( !m_layerMask[textLayer] ) - trace_val = false; - - if( !textModule->IsVisible() && !GetPlotInvisibleText() ) - trace_val = false; - - // Plot text fields, if allowed - if( trace_ref ) + if( GetPlotValue() && m_layerMask[textLayer] + && ( textModule->IsVisible() || GetPlotInvisibleText() ) ) { - PlotTextModule( &aModule->Reference(), getColor( textLayer ) ); - } - - if( trace_val ) - { - PlotTextModule( &aModule->Value(), getColor( textLayer ) ); + PlotTextModule( textModule, getColor( textLayer ) ); } for( BOARD_ITEM* item = aModule->GraphicalItemsList().GetFirst(); item; item = item->Next() )