diff --git a/pcbnew/dialogs/dialog_plot.cpp b/pcbnew/dialogs/dialog_plot.cpp index a20c8d2229..3d565cbee5 100644 --- a/pcbnew/dialogs/dialog_plot.cpp +++ b/pcbnew/dialogs/dialog_plot.cpp @@ -334,6 +334,7 @@ void DIALOG_PLOT::init_Dialog() // Black and white plotting m_SVGBlackAndWhite->SetValue( m_plotOpts.GetBlackAndWhite() ); + m_PDFBlackAndWhite->SetValue( m_plotOpts.GetBlackAndWhite() ); // Initialize a few other parameters, which can also be modified // from the drill dialog @@ -575,7 +576,6 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_PlotOptionsSizer->Hide( m_SizerSolderMaskAlert ); } - switch( getPlotFormat() ) { case PLOT_FORMAT::SVG: @@ -597,9 +597,15 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_forcePSA4OutputOpt->SetValue( false ); if( getPlotFormat() == PLOT_FORMAT::SVG ) + { m_PlotOptionsSizer->Show( m_svgOptionsSizer ); + m_PlotOptionsSizer->Hide( m_PDFOptionsSizer ); + } else + { m_PlotOptionsSizer->Hide( m_svgOptionsSizer ); + m_PlotOptionsSizer->Show( m_PDFOptionsSizer ); + } m_PlotOptionsSizer->Hide( m_GerberOptionsSizer ); m_PlotOptionsSizer->Hide( m_HPGLOptionsSizer ); @@ -626,6 +632,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_PlotOptionsSizer->Show( m_PSOptionsSizer ); m_PlotOptionsSizer->Hide( m_SizerDXF_options ); m_PlotOptionsSizer->Hide( m_svgOptionsSizer ); + m_PlotOptionsSizer->Hide( m_PDFOptionsSizer ); break; case PLOT_FORMAT::GERBER: @@ -652,6 +659,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_PlotOptionsSizer->Hide( m_PSOptionsSizer ); m_PlotOptionsSizer->Hide( m_SizerDXF_options ); m_PlotOptionsSizer->Hide( m_svgOptionsSizer ); + m_PlotOptionsSizer->Hide( m_PDFOptionsSizer ); break; case PLOT_FORMAT::HPGL: @@ -674,6 +682,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_PlotOptionsSizer->Hide( m_PSOptionsSizer ); m_PlotOptionsSizer->Hide( m_SizerDXF_options ); m_PlotOptionsSizer->Hide( m_svgOptionsSizer ); + m_PlotOptionsSizer->Hide( m_PDFOptionsSizer ); break; case PLOT_FORMAT::DXF: @@ -699,6 +708,7 @@ void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) m_PlotOptionsSizer->Hide( m_PSOptionsSizer ); m_PlotOptionsSizer->Show( m_SizerDXF_options ); m_PlotOptionsSizer->Hide( m_svgOptionsSizer ); + m_PlotOptionsSizer->Hide( m_PDFOptionsSizer ); OnChangeDXFPlotMode( event ); break; @@ -787,7 +797,12 @@ void DIALOG_PLOT::applyPlotSettings() tempOptions.SetTextMode( m_DXF_plotTextStrokeFontOpt->GetValue() ? PLOT_TEXT_MODE::DEFAULT : PLOT_TEXT_MODE::NATIVE ); - tempOptions.SetBlackAndWhite( m_SVGBlackAndWhite->GetValue() ); + if( getPlotFormat() == PLOT_FORMAT::SVG ) + tempOptions.SetBlackAndWhite( m_SVGBlackAndWhite->GetValue() ); + else if( getPlotFormat() == PLOT_FORMAT::PDF ) + tempOptions.SetBlackAndWhite( m_PDFBlackAndWhite->GetValue() ); + else + tempOptions.SetBlackAndWhite( true ); // Update settings from text fields. Rewrite values back to the fields, // since the values may have been constrained by the setters. diff --git a/pcbnew/dialogs/dialog_plot_base.cpp b/pcbnew/dialogs/dialog_plot_base.cpp index 05e8f14ca2..ff770a16f2 100644 --- a/pcbnew/dialogs/dialog_plot_base.cpp +++ b/pcbnew/dialogs/dialog_plot_base.cpp @@ -377,7 +377,7 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr gbSizer3->Add( m_svgPrecsision, wxGBPosition( 0, 1 ), wxGBSpan( 1, 1 ), wxALL, 5 ); m_SVGBlackAndWhite = new wxCheckBox( m_svgOptionsSizer->GetStaticBox(), wxID_ANY, _("Plot in black and white"), wxDefaultPosition, wxDefaultSize, 0 ); - m_SVGBlackAndWhite->SetToolTip( _("Check to use KiCad stroke font\nUncheck to plot single-line ASCII texts as editable text (using DXF font)") ); + m_SVGBlackAndWhite->SetToolTip( _("When disabled, the color from the chosen layer will be used to plot.") ); gbSizer3->Add( m_SVGBlackAndWhite, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALL, 5 ); @@ -387,6 +387,16 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr m_PlotOptionsSizer->Add( m_svgOptionsSizer, 1, wxEXPAND|wxALL, 5 ); + m_PDFOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("PDF Options") ), wxVERTICAL ); + + m_PDFBlackAndWhite = new wxCheckBox( m_PDFOptionsSizer->GetStaticBox(), wxID_ANY, _("Plot in black and white"), wxDefaultPosition, wxDefaultSize, 0 ); + m_PDFBlackAndWhite->SetToolTip( _("When disabled, the color from the chosen layer will be used to plot.") ); + + m_PDFOptionsSizer->Add( m_PDFBlackAndWhite, 0, wxALL, 5 ); + + + m_PlotOptionsSizer->Add( m_PDFOptionsSizer, 1, wxALL|wxEXPAND, 5 ); + bmiddleSizer->Add( m_PlotOptionsSizer, 0, 0, 6 ); diff --git a/pcbnew/dialogs/dialog_plot_base.fbp b/pcbnew/dialogs/dialog_plot_base.fbp index 8ded36b9d2..111078e2a1 100644 --- a/pcbnew/dialogs/dialog_plot_base.fbp +++ b/pcbnew/dialogs/dialog_plot_base.fbp @@ -3727,7 +3727,7 @@ 0 - Check to use KiCad stroke font Uncheck to plot single-line ASCII texts as editable text (using DXF font) + When disabled, the color from the chosen layer will be used to plot. wxFILTER_NONE wxDefaultValidator @@ -3741,6 +3741,84 @@ + + 5 + wxALL|wxEXPAND + 1 + + wxID_ANY + PDF Options + + m_PDFOptionsSizer + wxVERTICAL + 1 + protected + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Plot in black and white + + 0 + + + 0 + + 1 + m_PDFBlackAndWhite + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + When disabled, the color from the chosen layer will be used to plot. + + wxFILTER_NONE + wxDefaultValidator + + + + + + + + diff --git a/pcbnew/dialogs/dialog_plot_base.h b/pcbnew/dialogs/dialog_plot_base.h index f2943d4a92..34f8d689e5 100644 --- a/pcbnew/dialogs/dialog_plot_base.h +++ b/pcbnew/dialogs/dialog_plot_base.h @@ -122,6 +122,8 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM wxStaticText* svgPrecisionLabel; wxSpinCtrl* m_svgPrecsision; wxCheckBox* m_SVGBlackAndWhite; + wxStaticBoxSizer* m_PDFOptionsSizer; + wxCheckBox* m_PDFBlackAndWhite; WX_HTML_REPORT_PANEL* m_messagesPanel; wxBoxSizer* m_sizerButtons; wxButton* m_buttonDRC; diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp index 72fe60675e..4af283224d 100644 --- a/pcbnew/plot_board_layers.cpp +++ b/pcbnew/plot_board_layers.cpp @@ -314,16 +314,24 @@ void PlotStandardLayer( BOARD* aBoard, PLOTTER* aPlotter, LSET aLayerMask, COLOR4D color = COLOR4D::BLACK; - if( ( pad->GetLayerSet() & aLayerMask )[B_Cu] ) - color = aPlotOpt.ColorSettings()->GetColor( B_Cu ); + // If we're plotting a single layer, the color for that layer can be used directly. + if( aLayerMask.count() == 1 ) + { + color = aPlotOpt.ColorSettings()->GetColor( aLayerMask.Seq()[0] ); + } + else + { + if( ( pad->GetLayerSet() & aLayerMask )[B_Cu] ) + color = aPlotOpt.ColorSettings()->GetColor( B_Cu ); - if( ( pad->GetLayerSet() & aLayerMask )[F_Cu] ) - color = color.LegacyMix( aPlotOpt.ColorSettings()->GetColor( F_Cu ) ); + if( ( pad->GetLayerSet() & aLayerMask )[F_Cu] ) + color = color.LegacyMix( aPlotOpt.ColorSettings()->GetColor( F_Cu ) ); - if( sketchPads && aLayerMask[F_Fab] ) - color = aPlotOpt.ColorSettings()->GetColor( F_Fab ); - else if( sketchPads && aLayerMask[B_Fab] ) - color = aPlotOpt.ColorSettings()->GetColor( B_Fab ); + if( sketchPads && aLayerMask[F_Fab] ) + color = aPlotOpt.ColorSettings()->GetColor( F_Fab ); + else if( sketchPads && aLayerMask[B_Fab] ) + color = aPlotOpt.ColorSettings()->GetColor( B_Fab ); + } VECTOR2I margin; int width_adj = 0;