From 6428836755aae0120c494912c288483f1c6ca00e Mon Sep 17 00:00:00 2001 From: Marco Mattila Date: Thu, 17 Feb 2011 19:11:20 +0200 Subject: [PATCH] Fix postscript output option in pcbnew plot dialog. --- pcbnew/dialogs/dialog_plot_base.cpp | 4 ++-- pcbnew/dialogs/dialog_plot_base.fbp | 4 ++-- pcbnew/dialogs/dialog_plot_base.h | 2 +- pcbnew/pcb_plot_params.cpp | 8 ++++++++ pcbnew/pcb_plot_params.h | 3 +++ pcbnew/pcb_plot_params.keywords | 1 + pcbnew/pcbplot.cpp | 4 +++- 7 files changed, 20 insertions(+), 6 deletions(-) diff --git a/pcbnew/dialogs/dialog_plot_base.cpp b/pcbnew/dialogs/dialog_plot_base.cpp index 3e8de1c716..4738523c0e 100644 --- a/pcbnew/dialogs/dialog_plot_base.cpp +++ b/pcbnew/dialogs/dialog_plot_base.cpp @@ -272,8 +272,8 @@ DIALOG_PLOT_BASE::DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id, const wxStr m_plotPSNegativeOpt = new wxCheckBox( this, wxID_ANY, _("Negative plot"), wxDefaultPosition, wxDefaultSize, 0 ); m_PSOptionsSizer->Add( m_plotPSNegativeOpt, 0, wxALL, 2 ); - m_usePsA4Opt = new wxCheckBox( this, wxID_ANY, _("Force A4 paper size"), wxDefaultPosition, wxDefaultSize, 0 ); - m_PSOptionsSizer->Add( m_usePsA4Opt, 0, wxALL, 2 ); + m_forcePSA4OutputOpt = new wxCheckBox( this, wxID_ANY, _("Force A4 output"), wxDefaultPosition, wxDefaultSize, 0 ); + m_PSOptionsSizer->Add( m_forcePSA4OutputOpt, 0, wxALL, 2 ); m_PlotOptionsSizer->Add( m_PSOptionsSizer, 0, wxALL|wxEXPAND, 3 ); diff --git a/pcbnew/dialogs/dialog_plot_base.fbp b/pcbnew/dialogs/dialog_plot_base.fbp index 456760fc3f..38be8deba0 100644 --- a/pcbnew/dialogs/dialog_plot_base.fbp +++ b/pcbnew/dialogs/dialog_plot_base.fbp @@ -3457,14 +3457,14 @@ 0 0 wxID_ANY - Force A4 paper size + Force A4 output 0 0 1 - m_usePsA4Opt + m_forcePSA4OutputOpt 1 diff --git a/pcbnew/dialogs/dialog_plot_base.h b/pcbnew/dialogs/dialog_plot_base.h index b96b694e86..3d529d6a2e 100644 --- a/pcbnew/dialogs/dialog_plot_base.h +++ b/pcbnew/dialogs/dialog_plot_base.h @@ -84,7 +84,7 @@ class DIALOG_PLOT_BASE : public wxDialog wxStaticText* m_staticText8; wxTextCtrl* m_fineAdjustYscaleOpt; wxCheckBox* m_plotPSNegativeOpt; - wxCheckBox* m_usePsA4Opt; + wxCheckBox* m_forcePSA4OutputOpt; wxStaticText* m_staticText2; wxTextCtrl* m_messagesBox; diff --git a/pcbnew/pcb_plot_params.cpp b/pcbnew/pcb_plot_params.cpp index a822181768..b6c2227bb8 100644 --- a/pcbnew/pcb_plot_params.cpp +++ b/pcbnew/pcb_plot_params.cpp @@ -86,6 +86,7 @@ PCB_PLOT_PARAMS::PCB_PLOT_PARAMS() m_HPGLPenOvr = 2; m_PlotPSColorOpt = true; m_PlotPSNegative = false; + psA4Output = false; m_PlotReference = true; m_PlotValue = true; m_PlotTextOther = true; @@ -139,6 +140,8 @@ void PCB_PLOT_PARAMS::Format( OUTPUTFORMATTER* aFormatter, m_PlotPSColorOpt ? trueStr : falseStr ); aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_psnegative ), m_PlotPSNegative ? trueStr : falseStr ); + aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_psa4output ), + psA4Output ? trueStr : falseStr ); aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotreference ), m_PlotReference ? trueStr : falseStr ); aFormatter->Print( aNestLevel+1, "(%s %s)\n", getTokenName( T_plotvalue ), @@ -201,6 +204,8 @@ bool PCB_PLOT_PARAMS::operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const return false; if( m_PlotPSNegative != aPcbPlotParams.m_PlotPSNegative ) return false; + if( psA4Output != aPcbPlotParams.psA4Output ) + return false; if( m_PlotReference != aPcbPlotParams.m_PlotReference ) return false; if( m_PlotValue != aPcbPlotParams.m_PlotValue ) @@ -296,6 +301,9 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_ case T_usegerberextensions: aPcbPlotParams->useGerberExtensions = ParseBool(); break; + case T_psa4output: + aPcbPlotParams->psA4Output = ParseBool(); + break; case T_excludeedgelayer: aPcbPlotParams->m_ExcludeEdgeLayer = ParseBool(); break; diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h index 3e2f68f668..c01c48432e 100644 --- a/pcbnew/pcb_plot_params.h +++ b/pcbnew/pcb_plot_params.h @@ -90,6 +90,7 @@ private: bool useGerberExtensions; bool useAuxOrigin; bool subtractMaskFromSilk; + bool psA4Output; int scaleSelection; wxString outputDirectory; @@ -116,6 +117,8 @@ public: bool GetUseAuxOrigin() const { return useAuxOrigin; }; void SetScaleSelection( int aSelection ) { scaleSelection = aSelection; }; int GetScaleSelection() const { return scaleSelection; }; + void SetPsA4Output( int aForce ) { psA4Output = aForce; }; + bool GetPsA4Output() const { return psA4Output; }; int GetHpglPenDiameter() const { return m_HPGLPenDiam; }; bool SetHpglPenDiameter( int aValue ); diff --git a/pcbnew/pcb_plot_params.keywords b/pcbnew/pcb_plot_params.keywords index 99b3976771..972afcb313 100644 --- a/pcbnew/pcb_plot_params.keywords +++ b/pcbnew/pcb_plot_params.keywords @@ -18,6 +18,7 @@ plotinvisibletext plotothertext plotreference plotvalue +psa4output pscolor psnegative scaleselection diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 4aa6dcf2de..455b468a6d 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -141,6 +141,7 @@ void DIALOG_PLOT::Init_Dialog() m_fineAdjustYscaleOpt->AppendText( msg ); m_plotPSNegativeOpt->SetValue( g_PcbPlotOptions.m_PlotPSNegative ); + m_forcePSA4OutputOpt->SetValue( g_PcbPlotOptions.GetPsA4Output() ); // List layers in same order than in setup layers dialog // (Front or Top to Back or Bottom) @@ -514,6 +515,7 @@ void DIALOG_PLOT::applyPlotSettings() tempOptions.SetLayerSelection( selectedLayers ); tempOptions.m_PlotPSNegative = m_plotPSNegativeOpt->GetValue(); + tempOptions.SetPsA4Output( m_forcePSA4OutputOpt->GetValue() ); // Set output directory and replace backslashes with forward ones wxString dirStr; @@ -732,7 +734,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) { case PLOT_FORMAT_POST: success = m_Parent->Genere_PS( fn.GetFullPath(), layer, - m_usePsA4Opt->GetValue(), + g_PcbPlotOptions.GetPsA4Output(), g_PcbPlotOptions.m_PlotMode ); break;