Add the missing black and white setting to Plot -> SVG

This commit is contained in:
Marek Roszko 2022-10-24 22:45:24 -04:00
parent d10fd7bb09
commit b058ef2d87
7 changed files with 244 additions and 124 deletions

View File

@ -332,6 +332,9 @@ void DIALOG_PLOT::init_Dialog()
// Put vias on mask layer // Put vias on mask layer
m_plotNoViaOnMaskOpt->SetValue( m_plotOpts.GetPlotViaOnMaskLayer() ); m_plotNoViaOnMaskOpt->SetValue( m_plotOpts.GetPlotViaOnMaskLayer() );
// Black and white plotting
m_SVGBlackAndWhite->SetValue( m_plotOpts.GetBlackAndWhite() );
// Initialize a few other parameters, which can also be modified // Initialize a few other parameters, which can also be modified
// from the drill dialog // from the drill dialog
reInitDialog(); reInitDialog();
@ -784,6 +787,8 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetTextMode( m_DXF_plotTextStrokeFontOpt->GetValue() ? PLOT_TEXT_MODE::DEFAULT : tempOptions.SetTextMode( m_DXF_plotTextStrokeFontOpt->GetValue() ? PLOT_TEXT_MODE::DEFAULT :
PLOT_TEXT_MODE::NATIVE ); PLOT_TEXT_MODE::NATIVE );
tempOptions.SetBlackAndWhite( m_SVGBlackAndWhite->GetValue() );
// Update settings from text fields. Rewrite values back to the fields, // Update settings from text fields. Rewrite values back to the fields,
// since the values may have been constrained by the setters. // since the values may have been constrained by the setters.
wxString msg; wxString msg;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -362,14 +362,27 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr
m_svgOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("SVG Options") ), wxHORIZONTAL ); m_svgOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("SVG Options") ), wxHORIZONTAL );
wxGridBagSizer* gbSizer3;
gbSizer3 = new wxGridBagSizer( 3, 0 );
gbSizer3->SetFlexibleDirection( wxBOTH );
gbSizer3->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
svgPrecisionLabel = new wxStaticText( m_svgOptionsSizer->GetStaticBox(), wxID_ANY, _("Precision:"), wxDefaultPosition, wxDefaultSize, 0 ); svgPrecisionLabel = new wxStaticText( m_svgOptionsSizer->GetStaticBox(), wxID_ANY, _("Precision:"), wxDefaultPosition, wxDefaultSize, 0 );
svgPrecisionLabel->Wrap( -1 ); svgPrecisionLabel->Wrap( -1 );
m_svgOptionsSizer->Add( svgPrecisionLabel, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); gbSizer3->Add( svgPrecisionLabel, wxGBPosition( 0, 0 ), wxGBSpan( 1, 1 ), wxALL, 5 );
m_svgPrecsision = new wxSpinCtrl( m_svgOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 3, 6, 4 ); m_svgPrecsision = new wxSpinCtrl( m_svgOptionsSizer->GetStaticBox(), wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 3, 6, 4 );
m_svgPrecsision->SetToolTip( _("This number defines how many digits are exported that are below 1 mm.\nUser unit is 10^-<N> mm\nChoose 4 if you are not sure.") ); m_svgPrecsision->SetToolTip( _("This number defines how many digits are exported that are below 1 mm.\nUser unit is 10^-<N> mm\nChoose 4 if you are not sure.") );
m_svgOptionsSizer->Add( m_svgPrecsision, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 ); 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)") );
gbSizer3->Add( m_SVGBlackAndWhite, wxGBPosition( 0, 2 ), wxGBSpan( 1, 1 ), wxALL, 5 );
m_svgOptionsSizer->Add( gbSizer3, 1, wxEXPAND, 5 );
m_PlotOptionsSizer->Add( m_svgOptionsSizer, 1, wxEXPAND|wxALL, 5 ); m_PlotOptionsSizer->Add( m_svgOptionsSizer, 1, wxEXPAND|wxALL, 5 );

View File

@ -3526,127 +3526,217 @@
<property name="orient">wxHORIZONTAL</property> <property name="orient">wxHORIZONTAL</property>
<property name="parent">1</property> <property name="parent">1</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">1</property>
<object class="wxStaticText" expanded="0"> <object class="wxGridBagSizer" expanded="1">
<property name="BottomDockable">1</property> <property name="empty_cell_size"></property>
<property name="LeftDockable">1</property> <property name="flexible_direction">wxBOTH</property>
<property name="RightDockable">1</property> <property name="growablecols"></property>
<property name="TopDockable">1</property> <property name="growablerows"></property>
<property name="aui_layer"></property> <property name="hgap">0</property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Precision:</property>
<property name="markup">0</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="name">gbSizer3</property>
<property name="name">svgPrecisionLabel</property> <property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="pane_border">1</property> <property name="permission">none</property>
<property name="pane_position"></property> <property name="vgap">3</property>
<property name="pane_size"></property> <object class="gbsizeritem" expanded="1">
<property name="permission">protected</property> <property name="border">5</property>
<property name="pin_button">1</property> <property name="colspan">1</property>
<property name="pos"></property> <property name="column">0</property>
<property name="resize">Resizable</property> <property name="flag">wxALL</property>
<property name="show">1</property> <property name="row">0</property>
<property name="size"></property> <property name="rowspan">1</property>
<property name="style"></property> <object class="wxStaticText" expanded="0">
<property name="subclass">; forward_declare</property> <property name="BottomDockable">1</property>
<property name="toolbar_pane">0</property> <property name="LeftDockable">1</property>
<property name="tooltip"></property> <property name="RightDockable">1</property>
<property name="window_extra_style"></property> <property name="TopDockable">1</property>
<property name="window_name"></property> <property name="aui_layer"></property>
<property name="window_style"></property> <property name="aui_name"></property>
<property name="wrap">-1</property> <property name="aui_position"></property>
</object> <property name="aui_row"></property>
</object> <property name="best_size"></property>
<object class="sizeritem" expanded="0"> <property name="bg"></property>
<property name="border">5</property> <property name="caption"></property>
<property name="flag">wxALL|wxALIGN_CENTER_VERTICAL</property> <property name="caption_visible">1</property>
<property name="proportion">0</property> <property name="center_pane">0</property>
<object class="wxSpinCtrl" expanded="0"> <property name="close_button">1</property>
<property name="BottomDockable">1</property> <property name="context_help"></property>
<property name="LeftDockable">1</property> <property name="context_menu">1</property>
<property name="RightDockable">1</property> <property name="default_pane">0</property>
<property name="TopDockable">1</property> <property name="dock">Dock</property>
<property name="aui_layer"></property> <property name="dock_fixed">0</property>
<property name="aui_name"></property> <property name="docking">Left</property>
<property name="aui_position"></property> <property name="enabled">1</property>
<property name="aui_row"></property> <property name="fg"></property>
<property name="best_size"></property> <property name="floatable">1</property>
<property name="bg"></property> <property name="font"></property>
<property name="caption"></property> <property name="gripper">0</property>
<property name="caption_visible">1</property> <property name="hidden">0</property>
<property name="center_pane">0</property> <property name="id">wxID_ANY</property>
<property name="close_button">1</property> <property name="label">Precision:</property>
<property name="context_help"></property> <property name="markup">0</property>
<property name="context_menu">1</property> <property name="max_size"></property>
<property name="default_pane">0</property> <property name="maximize_button">0</property>
<property name="dock">Dock</property> <property name="maximum_size"></property>
<property name="dock_fixed">0</property> <property name="min_size"></property>
<property name="docking">Left</property> <property name="minimize_button">0</property>
<property name="enabled">1</property> <property name="minimum_size"></property>
<property name="fg"></property> <property name="moveable">1</property>
<property name="floatable">1</property> <property name="name">svgPrecisionLabel</property>
<property name="font"></property> <property name="pane_border">1</property>
<property name="gripper">0</property> <property name="pane_position"></property>
<property name="hidden">0</property> <property name="pane_size"></property>
<property name="id">wxID_ANY</property> <property name="permission">protected</property>
<property name="initial">4</property> <property name="pin_button">1</property>
<property name="max">6</property> <property name="pos"></property>
<property name="max_size"></property> <property name="resize">Resizable</property>
<property name="maximize_button">0</property> <property name="show">1</property>
<property name="maximum_size"></property> <property name="size"></property>
<property name="min">3</property> <property name="style"></property>
<property name="min_size"></property> <property name="subclass">; forward_declare</property>
<property name="minimize_button">0</property> <property name="toolbar_pane">0</property>
<property name="minimum_size"></property> <property name="tooltip"></property>
<property name="moveable">1</property> <property name="window_extra_style"></property>
<property name="name">m_svgPrecsision</property> <property name="window_name"></property>
<property name="pane_border">1</property> <property name="window_style"></property>
<property name="pane_position"></property> <property name="wrap">-1</property>
<property name="pane_size"></property> </object>
<property name="permission">protected</property> </object>
<property name="pin_button">1</property> <object class="gbsizeritem" expanded="1">
<property name="pos"></property> <property name="border">5</property>
<property name="resize">Resizable</property> <property name="colspan">1</property>
<property name="show">1</property> <property name="column">1</property>
<property name="size"></property> <property name="flag">wxALL</property>
<property name="style">wxSP_ARROW_KEYS</property> <property name="row">0</property>
<property name="subclass">; ; forward_declare</property> <property name="rowspan">1</property>
<property name="toolbar_pane">0</property> <object class="wxSpinCtrl" expanded="0">
<property name="tooltip">This number defines how many digits are exported that are below 1 mm.&#x0A;User unit is 10^-&lt;N&gt; mm&#x0A;Choose 4 if you are not sure.</property> <property name="BottomDockable">1</property>
<property name="value"></property> <property name="LeftDockable">1</property>
<property name="window_extra_style"></property> <property name="RightDockable">1</property>
<property name="window_name"></property> <property name="TopDockable">1</property>
<property name="window_style"></property> <property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="initial">4</property>
<property name="max">6</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min">3</property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_svgPrecsision</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxSP_ARROW_KEYS</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip">This number defines how many digits are exported that are below 1 mm.&#x0A;User unit is 10^-&lt;N&gt; mm&#x0A;Choose 4 if you are not sure.</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
<object class="gbsizeritem" expanded="1">
<property name="border">5</property>
<property name="colspan">1</property>
<property name="column">2</property>
<property name="flag">wxALL</property>
<property name="row">0</property>
<property name="rowspan">1</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Plot in black and white</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_SVGBlackAndWhite</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip">Check to use KiCad stroke font&#x0A;Uncheck to plot single-line ASCII texts as editable text (using DXF font)</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) // C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -121,6 +121,7 @@ class DIALOG_PLOT_BASE : public DIALOG_SHIM
wxStaticBoxSizer* m_svgOptionsSizer; wxStaticBoxSizer* m_svgOptionsSizer;
wxStaticText* svgPrecisionLabel; wxStaticText* svgPrecisionLabel;
wxSpinCtrl* m_svgPrecsision; wxSpinCtrl* m_svgPrecsision;
wxCheckBox* m_SVGBlackAndWhite;
WX_HTML_REPORT_PANEL* m_messagesPanel; WX_HTML_REPORT_PANEL* m_messagesPanel;
wxBoxSizer* m_sizerButtons; wxBoxSizer* m_sizerButtons;
wxButton* m_buttonDRC; wxButton* m_buttonDRC;

View File

@ -141,6 +141,8 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS()
m_default_colors = std::make_shared<COLOR_SETTINGS>(); m_default_colors = std::make_shared<COLOR_SETTINGS>();
m_colors = m_default_colors.get(); m_colors = m_default_colors.get();
m_blackAndWhite = true;
} }
@ -364,6 +366,9 @@ bool PCB_PLOT_PARAMS::IsSameAs( const PCB_PLOT_PARAMS &aPcbPlotParams ) const
if( m_textMode != aPcbPlotParams.m_textMode ) if( m_textMode != aPcbPlotParams.m_textMode )
return false; return false;
if( m_blackAndWhite != aPcbPlotParams.m_blackAndWhite )
return false;
if( !m_outputDirectory.IsSameAs( aPcbPlotParams.m_outputDirectory ) ) if( !m_outputDirectory.IsSameAs( aPcbPlotParams.m_outputDirectory ) )
return false; return false;

View File

@ -149,6 +149,9 @@ public:
void SetSvgPrecision( unsigned aPrecision ); void SetSvgPrecision( unsigned aPrecision );
unsigned GetSvgPrecision() const { return m_svgPrecision; } unsigned GetSvgPrecision() const { return m_svgPrecision; }
void SetBlackAndWhite( bool blackAndWhite ) { m_blackAndWhite = blackAndWhite; }
unsigned GetBlackAndWhite() const { return m_blackAndWhite; }
/** /**
* Default precision of coordinates in Gerber files. * Default precision of coordinates in Gerber files.
* *
@ -285,6 +288,9 @@ private:
/// 6 is the internal resolution of Pcbnew /// 6 is the internal resolution of Pcbnew
unsigned m_svgPrecision; unsigned m_svgPrecision;
/// Plot in black and white only
bool m_blackAndWhite;
/// Plot gerbers using auxiliary (drill) origin instead of absolute coordinates /// Plot gerbers using auxiliary (drill) origin instead of absolute coordinates
bool m_useAuxOrigin; bool m_useAuxOrigin;

View File

@ -1072,7 +1072,7 @@ static void initializePlotter( PLOTTER* aPlotter, const BOARD* aBoard,
aPlotter->SetSvgCoordinatesFormat( aPlotOpts->GetSvgPrecision() ); aPlotter->SetSvgCoordinatesFormat( aPlotOpts->GetSvgPrecision() );
aPlotter->SetCreator( wxT( "PCBNEW" ) ); aPlotter->SetCreator( wxT( "PCBNEW" ) );
aPlotter->SetColorMode( false ); // default is plot in Black and White. aPlotter->SetColorMode( !aPlotOpts->GetBlackAndWhite() ); // default is plot in Black and White.
aPlotter->SetTextMode( aPlotOpts->GetTextMode() ); aPlotter->SetTextMode( aPlotOpts->GetTextMode() );
} }