Commit ac0979fa authored by Marco Mattila's avatar Marco Mattila

Tune pcbnew plot dialog. Make actual plotting code independent of dialog...

Tune pcbnew plot dialog. Make actual plotting code independent of dialog widgets and get settings from PCB_PLOT_PARAMS instead.
parent e30ceb0a
This diff is collapsed.
This diff is collapsed.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Nov 18 2010)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_plot_base__ #ifndef __dialog_plot_base__
#define __dialog_plot_base__ #define __dialog_plot_base__
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_BASE /// Class DIALOG_PLOT_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_BASE : public wxDialog class DIALOG_PLOT_BASE : public wxDialog
{ {
private: private:
protected: protected:
enum enum
{ {
ID_ALLOW_PRINT_PAD_ON_SILKSCREEN = 1000, ID_ALLOW_PRINT_PAD_ON_SILKSCREEN = 1000,
ID_PRINT_REF, ID_PRINT_REF,
ID_MIROR_OPT, ID_MIROR_OPT,
ID_CREATE_DRILL_FILE, ID_CREATE_DRILL_FILE,
}; };
wxBoxSizer* m_MainSizer; wxBoxSizer* m_MainSizer;
wxStaticText* m_staticText121; wxStaticText* m_staticText121;
wxChoice* m_plotFormatOpt; wxChoice* m_plotFormatOpt;
wxStaticText* m_staticTextDir; wxStaticText* m_staticTextDir;
wxTextCtrl* m_outputDirectoryName; wxTextCtrl* m_outputDirectoryName;
wxButton* m_browseButton; wxButton* m_browseButton;
wxStaticBoxSizer* m_LayersSizer; wxStaticBoxSizer* m_LayersSizer;
wxBoxSizer* m_PlotOptionsSizer; wxBoxSizer* m_PlotOptionsSizer;
wxCheckBox* m_plotSheetRef; wxCheckBox* m_plotSheetRef;
wxCheckBox* m_plotPads_on_Silkscreen; wxCheckBox* m_plotPads_on_Silkscreen;
wxCheckBox* m_plotModuleValueOpt; wxCheckBox* m_plotModuleValueOpt;
wxCheckBox* m_plotModuleRefOpt; wxCheckBox* m_plotModuleRefOpt;
wxCheckBox* m_plotTextOther; wxCheckBox* m_plotTextOther;
wxCheckBox* m_plotInvisibleText; wxCheckBox* m_plotInvisibleText;
wxCheckBox* m_plotNoViaOnMaskOpt; wxCheckBox* m_plotNoViaOnMaskOpt;
wxCheckBox* m_plotMirrorOpt; wxCheckBox* m_plotMirrorOpt;
wxStaticText* m_staticText11; wxStaticText* m_staticText11;
wxChoice* m_drillShapeOpt; wxChoice* m_drillShapeOpt;
wxStaticText* m_staticText12; wxStaticText* m_staticText12;
wxChoice* m_scaleOpt; wxChoice* m_scaleOpt;
wxStaticText* m_staticText13; wxStaticText* m_staticText13;
wxChoice* m_plotModeOpt; wxChoice* m_plotModeOpt;
wxStaticText* m_textDefaultPenSize; wxStaticText* m_textDefaultPenSize;
wxTextCtrl* m_linesWidth; wxTextCtrl* m_linesWidth;
wxStaticBoxSizer* m_GerberOptionsSizer; wxStaticBoxSizer* m_GerberOptionsSizer;
wxCheckBox* m_useGerberExtensions; wxCheckBox* m_useGerberExtensions;
wxCheckBox* m_excludeEdgeLayerOpt; wxCheckBox* m_excludeEdgeLayerOpt;
wxCheckBox* m_subtractMaskFromSilk; wxCheckBox* m_subtractMaskFromSilk;
wxCheckBox* m_useAuxOriginCheckBox; wxCheckBox* m_useAuxOriginCheckBox;
wxStaticBoxSizer* m_HPGLOptionsSizer; wxStaticBoxSizer* m_HPGLOptionsSizer;
wxStaticText* m_textPenSize; wxStaticText* m_textPenSize;
wxTextCtrl* m_HPGLPenSizeOpt; wxTextCtrl* m_HPGLPenSizeOpt;
wxStaticText* m_textPenOvr; wxStaticText* m_textPenOvr;
wxTextCtrl* m_HPGLPenOverlayOpt; wxTextCtrl* m_HPGLPenOverlayOpt;
wxStaticText* m_textPenSpeed; wxStaticText* m_textPenSpeed;
wxTextCtrl* m_HPGLPenSpeedOpt; wxTextCtrl* m_HPGLPenSpeedOpt;
wxStaticBoxSizer* m_PSOptionsSizer; wxStaticBoxSizer* m_PSOptionsSizer;
wxStaticText* m_staticText7; wxStaticText* m_staticText7;
wxTextCtrl* m_fineAdjustXscaleOpt; wxTextCtrl* m_fineAdjustXscaleOpt;
wxStaticText* m_staticText8; wxStaticText* m_staticText8;
wxTextCtrl* m_fineAdjustYscaleOpt; wxTextCtrl* m_fineAdjustYscaleOpt;
wxCheckBox* m_plotPSNegativeOpt; wxCheckBox* m_plotPSNegativeOpt;
wxStaticText* m_staticText2; wxCheckBox* m_usePsA4Opt;
wxTextCtrl* m_messagesBox; wxStaticText* m_staticText2;
wxTextCtrl* m_messagesBox;
wxButton* m_plotButton;
wxButton* m_buttonDrill; wxButton* m_plotButton;
wxButton* m_buttonQuit; wxButton* m_buttonDrill;
wxButton* m_buttonQuit;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); } // Virtual event handlers, overide them in your derived class
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); } virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); } virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); } virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetScaleOpt( wxCommandEvent& event ) { event.Skip(); } virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void Plot( wxCommandEvent& event ) { event.Skip(); } virtual void OnSetScaleOpt( wxCommandEvent& event ) { event.Skip(); }
virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); } virtual void Plot( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); } virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
public:
public:
DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 447,723 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_BASE(); DIALOG_PLOT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Plot"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 447,723 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PLOT_BASE();
};
};
#endif //__dialog_plot_base__
#endif //__dialog_plot_base__
...@@ -356,7 +356,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_ ...@@ -356,7 +356,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
aPcbPlotParams->subtractMaskFromSilk = ParseBool(); aPcbPlotParams->subtractMaskFromSilk = ParseBool();
break; break;
case T_outputformat: case T_outputformat:
aPcbPlotParams->m_PlotFormat = ParseInt( 0, 4 ); aPcbPlotParams->m_PlotFormat = ParseInt( 0, 3 );
break; break;
case T_mirror: case T_mirror:
aPcbPlotParams->m_PlotMirror = ParseBool(); aPcbPlotParams->m_PlotMirror = ParseBool();
......
...@@ -102,6 +102,8 @@ public: ...@@ -102,6 +102,8 @@ public:
bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const; bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
bool operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const; bool operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
void SetPlotFormat( int aFormat ) { m_PlotFormat = aFormat; };
int GetPlotFormat() const { return m_PlotFormat; };
void SetOutputDirectory( wxString aDir ) { outputDirectory = aDir; }; void SetOutputDirectory( wxString aDir ) { outputDirectory = aDir; };
wxString GetOutputDirectory() const { return outputDirectory; }; wxString GetOutputDirectory() const { return outputDirectory; };
void SetUseGerberExtensions( bool aUse ) { useGerberExtensions = aUse; }; void SetUseGerberExtensions( bool aUse ) { useGerberExtensions = aUse; };
......
...@@ -62,38 +62,6 @@ public: ...@@ -62,38 +62,6 @@ public:
double m_XScaleAdjust; double m_XScaleAdjust;
double m_YScaleAdjust; double m_YScaleAdjust;
bool useA4()
{
return m_plotFormatOpt->GetSelection() == 3;
}
/**
* Function getFormat
* returns one of the values from the m_PlotFormat enum. If the 4th
* radio button is selected, map this back to postscript.
*/
PlotFormat getFormat()
{
int radioNdx = m_plotFormatOpt->GetSelection();
// change the A4 to the simple postscript, according to the
// m_PlotFormat enum
switch( radioNdx )
{
case 3:
radioNdx = PLOT_FORMAT_POST;
break;
case 4:
radioNdx = PLOT_FORMAT_DXF;
break;
}
return PlotFormat( radioNdx );
}
public: DIALOG_PLOT( WinEDA_PcbFrame* parent ); public: DIALOG_PLOT( WinEDA_PcbFrame* parent );
private: private:
void Init_Dialog(); void Init_Dialog();
...@@ -138,7 +106,7 @@ void DIALOG_PLOT::Init_Dialog() ...@@ -138,7 +106,7 @@ void DIALOG_PLOT::Init_Dialog()
m_Config->Read( CONFIG_XFINESCALE_ADJ, &m_XScaleAdjust ); m_Config->Read( CONFIG_XFINESCALE_ADJ, &m_XScaleAdjust );
m_Config->Read( CONFIG_YFINESCALE_ADJ, &m_YScaleAdjust ); m_Config->Read( CONFIG_YFINESCALE_ADJ, &m_YScaleAdjust );
m_plotFormatOpt->SetSelection( g_PcbPlotOptions.m_PlotFormat ); m_plotFormatOpt->SetSelection( g_PcbPlotOptions.GetPlotFormat() );
// Set units and value for HPGL pen size. // Set units and value for HPGL pen size.
AddUnitSymbol( *m_textPenSize, g_UserUnit ); AddUnitSymbol( *m_textPenSize, g_UserUnit );
...@@ -317,9 +285,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) ...@@ -317,9 +285,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event ) void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
{ {
int format = getFormat(); switch( m_plotFormatOpt->GetSelection() )
switch( format )
{ {
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
default: default:
...@@ -536,7 +502,7 @@ void DIALOG_PLOT::applyPlotSettings() ...@@ -536,7 +502,7 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() ); tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() );
tempOptions.m_PlotFormat = m_plotFormatOpt->GetSelection(); tempOptions.SetPlotFormat( m_plotFormatOpt->GetSelection() );
long selectedLayers = 0; long selectedLayers = 0;
unsigned int i; unsigned int i;
...@@ -574,7 +540,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -574,7 +540,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
applyPlotSettings(); applyPlotSettings();
// Create output directory if it does not exist // Create output directory if it does not exist
wxFileName outputDir = wxFileName::DirName( m_outputDirectoryName->GetValue() ); wxFileName outputDir = wxFileName::DirName( g_PcbPlotOptions.GetOutputDirectory() );
wxString boardFilePath = ( (wxFileName) m_Parent->GetScreen()->GetFileName()).GetPath(); wxString boardFilePath = ( (wxFileName) m_Parent->GetScreen()->GetFileName()).GetPath();
if( !outputDir.MakeAbsolute( boardFilePath ) ) if( !outputDir.MakeAbsolute( boardFilePath ) )
...@@ -636,9 +602,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -636,9 +602,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
if( m_fineAdjustYscaleOpt->IsEnabled() && m_YScaleAdjust != 0.0 ) if( m_fineAdjustYscaleOpt->IsEnabled() && m_YScaleAdjust != 0.0 )
g_PcbPlotOptions.m_FineScaleAdjustY = m_YScaleAdjust; g_PcbPlotOptions.m_FineScaleAdjustY = m_YScaleAdjust;
int format = getFormat(); switch( g_PcbPlotOptions.GetPlotFormat() )
switch( format )
{ {
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
ext = wxT( "ps" ); ext = wxT( "ps" );
...@@ -667,13 +631,12 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -667,13 +631,12 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
DisplayInfoMessage( this, DisplayInfoMessage( this,
_( "Warning: Scale option set to a very large value" ) ); _( "Warning: Scale option set to a very large value" ) );
unsigned int i; long layerMask = 1;
for( i = 0; i < layerList.size(); i++ ) for( layer = 0; layer < NB_LAYERS; layer++, layerMask <<= 1 )
{ {
bool success = false; bool success = false;
if( layerCheckListBox->IsChecked( i ) ) if( g_PcbPlotOptions.GetLayerSelection() & layerMask )
{ {
layer = layerList[i];
fn = m_Parent->GetScreen()->GetFileName(); fn = m_Parent->GetScreen()->GetFileName();
fn.SetPath( outputDir.GetPath() ); fn.SetPath( outputDir.GetPath() );
...@@ -684,7 +647,8 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -684,7 +647,8 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
// Use Gerber Extensions based on layer number // Use Gerber Extensions based on layer number
// (See http://en.wikipedia.org/wiki/Gerber_File) // (See http://en.wikipedia.org/wiki/Gerber_File)
if( (format == PLOT_FORMAT_GERBER) && m_useGerberExtensions->GetValue() ) if( ( g_PcbPlotOptions.GetPlotFormat() == PLOT_FORMAT_GERBER )
&& m_useGerberExtensions->GetValue() )
{ {
switch( layer ) switch( layer )
{ {
...@@ -764,10 +728,11 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event ) ...@@ -764,10 +728,11 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
fn.SetExt( ext ); fn.SetExt( ext );
} }
switch( format ) switch( g_PcbPlotOptions.GetPlotFormat() )
{ {
case PLOT_FORMAT_POST: case PLOT_FORMAT_POST:
success = m_Parent->Genere_PS( fn.GetFullPath(), layer, useA4(), success = m_Parent->Genere_PS( fn.GetFullPath(), layer,
m_usePsA4Opt->GetValue(),
g_PcbPlotOptions.m_PlotMode ); g_PcbPlotOptions.m_PlotMode );
break; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment