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
This commit is contained in:
Jeff Young 2018-05-30 20:45:02 +01:00
parent fe1f837d0c
commit d90d4ff682
2 changed files with 15 additions and 41 deletions

View File

@ -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();
}

View File

@ -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() )