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)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_plot_base__
#define __dialog_plot_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_BASE : public wxDialog
{
private:
protected:
enum
{
ID_ALLOW_PRINT_PAD_ON_SILKSCREEN = 1000,
ID_PRINT_REF,
ID_MIROR_OPT,
ID_CREATE_DRILL_FILE,
};
wxBoxSizer* m_MainSizer;
wxStaticText* m_staticText121;
wxChoice* m_plotFormatOpt;
wxStaticText* m_staticTextDir;
wxTextCtrl* m_outputDirectoryName;
wxButton* m_browseButton;
wxStaticBoxSizer* m_LayersSizer;
wxBoxSizer* m_PlotOptionsSizer;
wxCheckBox* m_plotSheetRef;
wxCheckBox* m_plotPads_on_Silkscreen;
wxCheckBox* m_plotModuleValueOpt;
wxCheckBox* m_plotModuleRefOpt;
wxCheckBox* m_plotTextOther;
wxCheckBox* m_plotInvisibleText;
wxCheckBox* m_plotNoViaOnMaskOpt;
wxCheckBox* m_plotMirrorOpt;
wxStaticText* m_staticText11;
wxChoice* m_drillShapeOpt;
wxStaticText* m_staticText12;
wxChoice* m_scaleOpt;
wxStaticText* m_staticText13;
wxChoice* m_plotModeOpt;
wxStaticText* m_textDefaultPenSize;
wxTextCtrl* m_linesWidth;
wxStaticBoxSizer* m_GerberOptionsSizer;
wxCheckBox* m_useGerberExtensions;
wxCheckBox* m_excludeEdgeLayerOpt;
wxCheckBox* m_subtractMaskFromSilk;
wxCheckBox* m_useAuxOriginCheckBox;
wxStaticBoxSizer* m_HPGLOptionsSizer;
wxStaticText* m_textPenSize;
wxTextCtrl* m_HPGLPenSizeOpt;
wxStaticText* m_textPenOvr;
wxTextCtrl* m_HPGLPenOverlayOpt;
wxStaticText* m_textPenSpeed;
wxTextCtrl* m_HPGLPenSpeedOpt;
wxStaticBoxSizer* m_PSOptionsSizer;
wxStaticText* m_staticText7;
wxTextCtrl* m_fineAdjustXscaleOpt;
wxStaticText* m_staticText8;
wxTextCtrl* m_fineAdjustYscaleOpt;
wxCheckBox* m_plotPSNegativeOpt;
wxStaticText* m_staticText2;
wxTextCtrl* m_messagesBox;
wxButton* m_plotButton;
wxButton* m_buttonDrill;
wxButton* m_buttonQuit;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetScaleOpt( wxCommandEvent& event ) { event.Skip(); }
virtual void Plot( wxCommandEvent& event ) { event.Skip(); }
virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
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();
};
#endif //__dialog_plot_base__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 18 2010)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_plot_base__
#define __dialog_plot_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/statbox.h>
#include <wx/checkbox.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_PLOT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_PLOT_BASE : public wxDialog
{
private:
protected:
enum
{
ID_ALLOW_PRINT_PAD_ON_SILKSCREEN = 1000,
ID_PRINT_REF,
ID_MIROR_OPT,
ID_CREATE_DRILL_FILE,
};
wxBoxSizer* m_MainSizer;
wxStaticText* m_staticText121;
wxChoice* m_plotFormatOpt;
wxStaticText* m_staticTextDir;
wxTextCtrl* m_outputDirectoryName;
wxButton* m_browseButton;
wxStaticBoxSizer* m_LayersSizer;
wxBoxSizer* m_PlotOptionsSizer;
wxCheckBox* m_plotSheetRef;
wxCheckBox* m_plotPads_on_Silkscreen;
wxCheckBox* m_plotModuleValueOpt;
wxCheckBox* m_plotModuleRefOpt;
wxCheckBox* m_plotTextOther;
wxCheckBox* m_plotInvisibleText;
wxCheckBox* m_plotNoViaOnMaskOpt;
wxCheckBox* m_plotMirrorOpt;
wxStaticText* m_staticText11;
wxChoice* m_drillShapeOpt;
wxStaticText* m_staticText12;
wxChoice* m_scaleOpt;
wxStaticText* m_staticText13;
wxChoice* m_plotModeOpt;
wxStaticText* m_textDefaultPenSize;
wxTextCtrl* m_linesWidth;
wxStaticBoxSizer* m_GerberOptionsSizer;
wxCheckBox* m_useGerberExtensions;
wxCheckBox* m_excludeEdgeLayerOpt;
wxCheckBox* m_subtractMaskFromSilk;
wxCheckBox* m_useAuxOriginCheckBox;
wxStaticBoxSizer* m_HPGLOptionsSizer;
wxStaticText* m_textPenSize;
wxTextCtrl* m_HPGLPenSizeOpt;
wxStaticText* m_textPenOvr;
wxTextCtrl* m_HPGLPenOverlayOpt;
wxStaticText* m_textPenSpeed;
wxTextCtrl* m_HPGLPenSpeedOpt;
wxStaticBoxSizer* m_PSOptionsSizer;
wxStaticText* m_staticText7;
wxTextCtrl* m_fineAdjustXscaleOpt;
wxStaticText* m_staticText8;
wxTextCtrl* m_fineAdjustYscaleOpt;
wxCheckBox* m_plotPSNegativeOpt;
wxCheckBox* m_usePsA4Opt;
wxStaticText* m_staticText2;
wxTextCtrl* m_messagesBox;
wxButton* m_plotButton;
wxButton* m_buttonDrill;
wxButton* m_buttonQuit;
// Virtual event handlers, overide them in your derived class
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
virtual void OnInitDialog( wxInitDialogEvent& event ) { event.Skip(); }
virtual void SetPlotFormat( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSetScaleOpt( wxCommandEvent& event ) { event.Skip(); }
virtual void Plot( wxCommandEvent& event ) { event.Skip(); }
virtual void CreateDrillFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnQuit( wxCommandEvent& event ) { event.Skip(); }
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();
};
#endif //__dialog_plot_base__
......@@ -356,7 +356,7 @@ void PCB_PLOT_PARAMS_PARSER::Parse( PCB_PLOT_PARAMS* aPcbPlotParams ) throw( IO_
aPcbPlotParams->subtractMaskFromSilk = ParseBool();
break;
case T_outputformat:
aPcbPlotParams->m_PlotFormat = ParseInt( 0, 4 );
aPcbPlotParams->m_PlotFormat = ParseInt( 0, 3 );
break;
case T_mirror:
aPcbPlotParams->m_PlotMirror = ParseBool();
......
......@@ -102,6 +102,8 @@ public:
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; };
wxString GetOutputDirectory() const { return outputDirectory; };
void SetUseGerberExtensions( bool aUse ) { useGerberExtensions = aUse; };
......
......@@ -62,38 +62,6 @@ public:
double m_XScaleAdjust;
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 );
private:
void Init_Dialog();
......@@ -138,7 +106,7 @@ void DIALOG_PLOT::Init_Dialog()
m_Config->Read( CONFIG_XFINESCALE_ADJ, &m_XScaleAdjust );
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.
AddUnitSymbol( *m_textPenSize, g_UserUnit );
......@@ -317,9 +285,7 @@ void DIALOG_PLOT::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
void DIALOG_PLOT::SetPlotFormat( wxCommandEvent& event )
{
int format = getFormat();
switch( format )
switch( m_plotFormatOpt->GetSelection() )
{
case PLOT_FORMAT_POST:
default:
......@@ -536,7 +502,7 @@ void DIALOG_PLOT::applyPlotSettings()
tempOptions.SetUseGerberExtensions( m_useGerberExtensions->GetValue() );
tempOptions.m_PlotFormat = m_plotFormatOpt->GetSelection();
tempOptions.SetPlotFormat( m_plotFormatOpt->GetSelection() );
long selectedLayers = 0;
unsigned int i;
......@@ -574,7 +540,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
applyPlotSettings();
// 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();
if( !outputDir.MakeAbsolute( boardFilePath ) )
......@@ -636,9 +602,7 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
if( m_fineAdjustYscaleOpt->IsEnabled() && m_YScaleAdjust != 0.0 )
g_PcbPlotOptions.m_FineScaleAdjustY = m_YScaleAdjust;
int format = getFormat();
switch( format )
switch( g_PcbPlotOptions.GetPlotFormat() )
{
case PLOT_FORMAT_POST:
ext = wxT( "ps" );
......@@ -667,13 +631,12 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
DisplayInfoMessage( this,
_( "Warning: Scale option set to a very large value" ) );
unsigned int i;
for( i = 0; i < layerList.size(); i++ )
long layerMask = 1;
for( layer = 0; layer < NB_LAYERS; layer++, layerMask <<= 1 )
{
bool success = false;
if( layerCheckListBox->IsChecked( i ) )
if( g_PcbPlotOptions.GetLayerSelection() & layerMask )
{
layer = layerList[i];
fn = m_Parent->GetScreen()->GetFileName();
fn.SetPath( outputDir.GetPath() );
......@@ -684,7 +647,8 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
// Use Gerber Extensions based on layer number
// (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 )
{
......@@ -764,10 +728,11 @@ void DIALOG_PLOT::Plot( wxCommandEvent& event )
fn.SetExt( ext );
}
switch( format )
switch( g_PcbPlotOptions.GetPlotFormat() )
{
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 );
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