diff --git a/common/wildcards_and_files_ext.cpp b/common/wildcards_and_files_ext.cpp
index 1076d9de55..c3a74a8ec3 100644
--- a/common/wildcards_and_files_ext.cpp
+++ b/common/wildcards_and_files_ext.cpp
@@ -72,6 +72,7 @@ const wxString AllFilesWildcard( _( "All files (*)|*" ) );
// Wildcard for cvpcb component to footprint link file
const wxString ComponentFileWildcard( _( "KiCad cmp/footprint link files (*.cmp)|*.cmp" ) );
+// Wildcard for reports and fabrication documents
const wxString DrillFileWildcard( _( "Drill files (*.drl)|*.drl;*.DRL" ) );
const wxString SVGFileWildcard( _( "SVG files (*.svg)|*.svg;*.SVG" ) );
const wxString ReportFileWildcard = _( "Report files (*.rpt)|*.rpt" );
diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index 478e3e820e..ffc56cdfde 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -151,9 +151,8 @@ set(PCBNEW_CLASS_SRCS
export_vrml.cpp
files.cpp
gen_drill_report_files.cpp
- gen_holes_and_tools_lists_for_drill.cpp
gen_modules_placefile.cpp
- gendrill.cpp
+ gendrill_Excellon_writer.cpp
globaleditpad.cpp
gpcb_exchange.cpp
highlight.cpp
diff --git a/pcbnew/dialogs/dialog_SVG_print_base.cpp b/pcbnew/dialogs/dialog_SVG_print_base.cpp
index 34605e00a3..ea8185194d 100644
--- a/pcbnew/dialogs/dialog_SVG_print_base.cpp
+++ b/pcbnew/dialogs/dialog_SVG_print_base.cpp
@@ -40,11 +40,11 @@ DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, c
m_TextPenWidth = new wxStaticText( this, wxID_ANY, _("Default pen size"), wxDefaultPosition, wxDefaultSize, 0 );
m_TextPenWidth->Wrap( -1 );
+ m_TextPenWidth->SetToolTip( _("Selection of the pen size used to draw items which have no pen size specified.") );
+
sbOptionsSizer->Add( m_TextPenWidth, 0, wxRIGHT|wxLEFT, 5 );
m_DialogDefaultPenSize = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
- m_DialogDefaultPenSize->SetToolTip( _("Selection of the pen size used to draw items which have no pen size speicfied.") );
-
sbOptionsSizer->Add( m_DialogDefaultPenSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxString m_ModeColorOptionChoices[] = { _("Color"), _("Black and white") };
@@ -67,7 +67,7 @@ DIALOG_SVG_PRINT_base::DIALOG_SVG_PRINT_base( wxWindow* parent, wxWindowID id, c
sbOptionsSizer->Add( m_PrintBoardEdgesCtrl, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
- m_printMirrorOpt = new wxCheckBox( this, wxID_ANY, _("Print mirror"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_printMirrorOpt = new wxCheckBox( this, wxID_ANY, _("Print mirrored"), wxDefaultPosition, wxDefaultSize, 0 );
sbOptionsSizer->Add( m_printMirrorOpt, 0, wxRIGHT|wxLEFT, 5 );
diff --git a/pcbnew/dialogs/dialog_SVG_print_base.fbp b/pcbnew/dialogs/dialog_SVG_print_base.fbp
index a267ca1193..adf328e778 100644
--- a/pcbnew/dialogs/dialog_SVG_print_base.fbp
+++ b/pcbnew/dialogs/dialog_SVG_print_base.fbp
@@ -207,7 +207,7 @@
0
-
+ Selection of the pen size used to draw items which have no pen size specified.
@@ -290,7 +290,7 @@
0
- Selection of the pen size used to draw items which have no pen size speicfied.
+
wxFILTER_NONE
wxDefaultValidator
@@ -629,7 +629,7 @@
0
0
wxID_ANY
- Print mirror
+ Print mirrored
0
diff --git a/pcbnew/dialogs/dialog_gendrill.cpp b/pcbnew/dialogs/dialog_gendrill.cpp
index f07f41ae64..3b84202876 100644
--- a/pcbnew/dialogs/dialog_gendrill.cpp
+++ b/pcbnew/dialogs/dialog_gendrill.cpp
@@ -5,8 +5,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
- * Copyright (C) 1992-2010 Jean_Pierre Charras
- * Copyright (C) 1992-2010 KiCad Developers, see change_log.txt for contributors.
+ * Copyright (C) 1992-2012 Jean_Pierre Charras
+ * Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -31,13 +31,14 @@
#include
#include
#include
-#include
+#include
#include
#include
#include
#include
+#include
// Keywords for read and write config
@@ -62,11 +63,26 @@ static DRILL_PRECISION precisionListForMetric[] =
};
+
+
+/* This function displays the dialog frame for drill tools
+ */
+void PCB_EDIT_FRAME::InstallDrillFrame( wxCommandEvent& event )
+{
+ DIALOG_GENDRILL dlg( this );
+
+ dlg.ShowModal();
+}
+
+
+
DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* parent ) :
DIALOG_GENDRILL_BASE( parent )
{
m_parent = parent;
m_board = parent->GetBoard();
+ m_config = wxGetApp().GetSettings();
+ m_plotOpts = m_parent->GetPlotSettings();
SetReturnCode( 1 );
initDialog();
@@ -75,14 +91,13 @@ DIALOG_GENDRILL::DIALOG_GENDRILL( PCB_EDIT_FRAME* parent ) :
// Static members of DIALOG_GENDRILL
-int DIALOG_GENDRILL:: m_UnitDrillIsInch = true;
-int DIALOG_GENDRILL:: m_ZerosFormat = EXCELLON_WRITER::DECIMAL_FORMAT;
+int DIALOG_GENDRILL::m_UnitDrillIsInch = true;
+int DIALOG_GENDRILL::m_ZerosFormat = EXCELLON_WRITER::DECIMAL_FORMAT;
bool DIALOG_GENDRILL::m_MinimalHeader = false;
bool DIALOG_GENDRILL::m_Mirror = false;
bool DIALOG_GENDRILL::m_DrillOriginIsAuxAxis = false;
-int DIALOG_GENDRILL:: m_PrecisionFormat = 1;
-bool DIALOG_GENDRILL::m_createRpt = false;
-int DIALOG_GENDRILL::m_createMap = 0;
+int DIALOG_GENDRILL::m_PrecisionFormat = 1;
+int DIALOG_GENDRILL::m_mapFileType = 1;
DIALOG_GENDRILL::~DIALOG_GENDRILL()
@@ -93,17 +108,12 @@ DIALOG_GENDRILL::~DIALOG_GENDRILL()
void DIALOG_GENDRILL::initDialog()
{
- wxConfig* Config = wxGetApp().GetSettings();
-
- if( Config )
- {
- Config->Read( ZerosFormatKey, &DIALOG_GENDRILL::m_ZerosFormat );
- Config->Read( PrecisionKey, &DIALOG_GENDRILL::m_PrecisionFormat );
- Config->Read( MirrorKey, &DIALOG_GENDRILL::m_Mirror );
- Config->Read( MinimalHeaderKey, &DIALOG_GENDRILL::m_MinimalHeader );
- Config->Read( UnitDrillInchKey, &DIALOG_GENDRILL::m_UnitDrillIsInch );
- Config->Read( DrillOriginIsAuxAxisKey, &DIALOG_GENDRILL::m_DrillOriginIsAuxAxis );
- }
+ m_config->Read( ZerosFormatKey, &DIALOG_GENDRILL::m_ZerosFormat );
+ m_config->Read( PrecisionKey, &DIALOG_GENDRILL::m_PrecisionFormat );
+ m_config->Read( MirrorKey, &DIALOG_GENDRILL::m_Mirror );
+ m_config->Read( MinimalHeaderKey, &DIALOG_GENDRILL::m_MinimalHeader );
+ m_config->Read( UnitDrillInchKey, &DIALOG_GENDRILL::m_UnitDrillIsInch );
+ m_config->Read( DrillOriginIsAuxAxisKey, &DIALOG_GENDRILL::m_DrillOriginIsAuxAxis );
InitDisplayParams();
}
@@ -129,8 +139,7 @@ void DIALOG_GENDRILL::InitDisplayParams()
m_Check_Mirror->SetValue( m_Mirror );
- m_Choice_Drill_Map->SetSelection( m_createMap );
- m_Choice_Drill_Report->SetSelection( m_createRpt );
+ m_Choice_Drill_Map->SetSelection( m_mapFileType );
m_ViaDrillValue->SetLabel( _( "Use Netclasses values" ) );
@@ -208,6 +217,9 @@ void DIALOG_GENDRILL::InitDisplayParams()
msg = m_BuriedViasInfoMsg->GetLabel();
msg << wxT( " " ) << m_blindOrBuriedViasCount;
m_BuriedViasInfoMsg->SetLabel( msg );
+
+ // Output directory
+ m_outputDirectoryName->SetValue( m_plotOpts.GetOutputDirectory() );
}
@@ -215,17 +227,12 @@ void DIALOG_GENDRILL::UpdateConfig()
{
SetParams();
- wxConfig* config = wxGetApp().GetSettings();
-
- if( config )
- {
- config->Write( ZerosFormatKey, m_ZerosFormat );
- config->Write( PrecisionKey, m_PrecisionFormat );
- config->Write( MirrorKey, m_Mirror );
- config->Write( MinimalHeaderKey, m_MinimalHeader );
- config->Write( UnitDrillInchKey, m_UnitDrillIsInch );
- config->Write( DrillOriginIsAuxAxisKey, m_DrillOriginIsAuxAxis );
- }
+ m_config->Write( ZerosFormatKey, m_ZerosFormat );
+ m_config->Write( PrecisionKey, m_PrecisionFormat );
+ m_config->Write( MirrorKey, m_Mirror );
+ m_config->Write( MinimalHeaderKey, m_MinimalHeader );
+ m_config->Write( UnitDrillInchKey, m_UnitDrillIsInch );
+ m_config->Write( DrillOriginIsAuxAxisKey, m_DrillOriginIsAuxAxis );
}
@@ -234,11 +241,14 @@ void DIALOG_GENDRILL::OnSelDrillUnitsSelected( wxCommandEvent& event )
UpdatePrecisionOptions();
}
-
-void DIALOG_GENDRILL::OnOkClick( wxCommandEvent& event )
+void DIALOG_GENDRILL::OnGenMapFile( wxCommandEvent& event )
{
- GenDrillAndReportFiles();
- EndModal( wxID_OK );
+ GenDrillAndMapFiles( false, true);
+}
+
+void DIALOG_GENDRILL::OnGenDrillFile( wxCommandEvent& event )
+{
+ GenDrillAndMapFiles(true, false);
}
@@ -276,17 +286,53 @@ void DIALOG_GENDRILL::UpdatePrecisionOptions()
m_Choice_Precision->Enable( true );
}
+void DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked( wxCommandEvent& event )
+{
+ // Build the absolute path of current output plot directory
+ // to preselect it when opening the dialog.
+ wxFileName fn( m_outputDirectoryName->GetValue() );
+ wxString path;
+
+ if( fn.IsRelative() )
+ path = wxGetCwd() + fn.GetPathSeparator() + m_outputDirectoryName->GetValue();
+ else
+ path = m_outputDirectoryName->GetValue();
+
+ wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
+
+ if( dirDialog.ShowModal() == wxID_CANCEL )
+ return;
+
+ wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
+
+ wxMessageDialog dialog( this, _( "Use a relative path? " ),
+ _( "Plot Output Directory" ),
+ wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
+
+ if( dialog.ShowModal() == wxID_YES )
+ {
+ wxString boardFilePath = ( (wxFileName) m_parent->GetBoard()->GetFileName() ).GetPath();
+
+ if( !dirName.MakeRelativeTo( boardFilePath ) )
+ wxMessageBox( _(
+ "Cannot make path relative (target volume different from board file volume)!" ),
+ _( "Plot Output Directory" ), wxOK | wxICON_ERROR );
+ }
+
+ m_outputDirectoryName->SetValue( dirName.GetFullPath() );
+}
void DIALOG_GENDRILL::SetParams()
{
wxString msg;
- PCB_PLOT_PARAMS plot_opts = m_board->GetPlotOptions();
+ // Set output directory and replace backslashes with forward ones
+ wxString dirStr;
+ dirStr = m_outputDirectoryName->GetValue();
+ dirStr.Replace( wxT( "\\" ), wxT( "/" ) );
+ m_plotOpts.SetOutputDirectory( dirStr );
- m_plotDefaultpath = plot_opts.GetOutputDirectory();
-
- m_createMap = m_Choice_Drill_Map->GetSelection();
- m_createRpt = m_Choice_Drill_Report->GetSelection();
+ m_mapFileType = m_Choice_Drill_Map->GetSelection();
m_UnitDrillIsInch = (m_Choice_Unit->GetSelection() == 0) ? false : true;
m_MinimalHeader = m_Check_Minimal->IsChecked();
@@ -295,8 +341,6 @@ void DIALOG_GENDRILL::SetParams()
m_DrillOriginIsAuxAxis = m_Choice_Drill_Offset->GetSelection();
m_PrecisionFormat = m_Choice_Precision->GetSelection();
- plot_opts.SetHPGLPenNum( 1 );
-
if( m_Choice_Drill_Offset->GetSelection() == 0 )
m_FileDrillOffset = wxPoint( 0, 0 );
else
@@ -310,5 +354,271 @@ void DIALOG_GENDRILL::SetParams()
else
m_Precision = precisionListForMetric[idx];
- m_board->SetPlotOptions( plot_opts );
+ m_board->SetPlotOptions( m_plotOpts );
+}
+
+/**
+ * Function GenDrillAndMapFiles
+ * Calls the functions to create EXCELLON drill files and/or drill map files
+ * >When all holes are through, only one excellon file is created.
+ * >When there are some partial holes (some blind or buried vias),
+ * one excellon file is created, for all plated through holes,
+ * and one file per layer pair, which have one or more holes, excluding
+ * through holes, already in the first file.
+ * one file for all Not Plated through holes
+ */
+void DIALOG_GENDRILL::GenDrillAndMapFiles(bool aGenDrill, bool aGenMap)
+{
+ wxString layer_extend; /* added to the Board FileName to
+ * create FullFileName (= Board
+ * FileName + layer pair names) */
+ wxString msg;
+ bool hasBuriedVias = false; /* If true, drill files are created
+ * layer pair by layer pair for
+ * buried vias */
+ int layer1 = LAYER_N_BACK;
+ int layer2 = LAYER_N_FRONT;
+ bool gen_through_holes = true;
+ bool gen_NPTH_holes = false;
+
+ wxString currentWD = ::wxGetCwd();
+
+ UpdateConfig(); // set params and Save drill options
+
+ m_parent->ClearMsgPanel();
+
+ if( m_microViasCount || m_blindOrBuriedViasCount )
+ hasBuriedVias = true;
+
+ EXCELLON_WRITER excellonWriter( m_parent->GetBoard(),
+ m_FileDrillOffset );
+ excellonWriter.SetFormat( !m_UnitDrillIsInch,
+ (EXCELLON_WRITER::zeros_fmt) m_ZerosFormat,
+ m_Precision.m_lhs, m_Precision.m_rhs );
+ excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset );
+
+ wxFileName fn;
+
+ for( ; ; )
+ {
+ excellonWriter.BuildHolesList( layer1, layer2,
+ gen_through_holes ? false : true, gen_NPTH_holes );
+
+ if( excellonWriter.GetHolesCount() > 0 ) // has holes?
+ {
+ fn = m_parent->GetBoard()->GetFileName();
+ layer_extend.Empty();
+
+ if( gen_NPTH_holes )
+ {
+ layer_extend << wxT( "-NPTH" );
+ }
+ else if( !gen_through_holes )
+ {
+ if( layer1 == LAYER_N_BACK )
+ layer_extend << wxT( "-back" );
+ else
+ layer_extend << wxT( "-inner" ) << layer1;
+ if( layer2 == LAYER_N_FRONT )
+ layer_extend << wxT( "-front" );
+ else
+ layer_extend << wxT( "-inner" ) << layer2;
+ }
+
+ fn.SetName( fn.GetName() + layer_extend );
+ wxString defaultPath = m_plotOpts.GetOutputDirectory();
+ if( defaultPath.IsEmpty() )
+ defaultPath = ::wxGetCwd();
+
+ fn.SetPath( defaultPath );
+
+ if( aGenDrill )
+ {
+ fn.SetExt( DrillFileExtension );
+ wxString fullFilename = fn.GetFullPath();
+
+ FILE* file = wxFopen( fullFilename, wxT( "w" ) );
+
+ if( file == 0 )
+ {
+ msg.Printf( _( "** Unable to create %s **\n" ),
+ GetChars( fullFilename ) );
+ m_messagesBox->AppendText( msg );
+ break;
+ }
+ else
+ {
+ msg.Printf( _( "Plot: %s OK\n" ), GetChars( fullFilename ) );
+ m_messagesBox->AppendText( msg );
+ }
+
+ excellonWriter.CreateDrillFile( file );
+ }
+
+ if( aGenMap )
+ {
+ const PlotFormat filefmt[5] =
+ { // Keep these format ids in the same order than m_Choice_Drill_Map choices
+ PLOT_FORMAT_HPGL, PLOT_FORMAT_POST, PLOT_FORMAT_GERBER,
+ PLOT_FORMAT_DXF, PLOT_FORMAT_SVG
+ };
+ unsigned choice = (unsigned) m_Choice_Drill_Map->GetSelection();
+
+ if( choice > 4 )
+ choice = 1;
+
+ fn.SetExt( wxEmptyString ); // Will be modified by GenDrillMap
+
+ GenDrillMap( fn.GetFullPath(), excellonWriter, filefmt[choice] );
+ }
+ }
+
+ if( gen_NPTH_holes ) // The last drill file was created
+ break;
+
+ if( !hasBuriedVias )
+ gen_NPTH_holes = true;
+ else
+ {
+ if( gen_through_holes )
+ layer2 = layer1 + 1; // prepare generation of first layer pair
+ else
+ {
+ if( layer2 >= LAYER_N_FRONT ) // no more layer pair to consider
+ {
+ layer1 = LAYER_N_BACK;
+ layer2 = LAYER_N_FRONT;
+ gen_NPTH_holes = true;
+ continue;
+ }
+ layer1++;
+ layer2++; // use next layer pair
+
+ if( layer2 == m_parent->GetBoard()->GetCopperLayerCount() - 1 )
+ layer2 = LAYER_N_FRONT; // the last layer is always the
+ // Front layer
+ }
+
+ gen_through_holes = false;
+ }
+ }
+
+ ::wxSetWorkingDirectory( currentWD );
+}
+
+
+/*
+ * Create a plain text report file giving a list of drill values and drill count
+ * for through holes, oblong holes, and for buried vias,
+ * drill values and drill count per layer pair
+ */
+void DIALOG_GENDRILL::OnGenReportFile( wxCommandEvent& event )
+{
+ UpdateConfig(); // set params and Save drill options
+
+ wxFileName fn = m_parent->GetBoard()->GetFileName();
+
+ fn.SetName( fn.GetName() + wxT( "-drl" ) );
+ fn.SetExt( ReportFileExtension );
+
+ wxString defaultPath = m_plotOpts.GetOutputDirectory();
+ if( defaultPath.IsEmpty() )
+ defaultPath = ::wxGetCwd();
+
+ wxFileDialog dlg( this, _( "Save Drill Report File" ), defaultPath,
+ fn.GetFullName(), wxGetTranslation( ReportFileWildcard ),
+ wxFD_SAVE );
+
+ if( dlg.ShowModal() == wxID_CANCEL )
+ return;
+
+ EXCELLON_WRITER excellonWriter( m_parent->GetBoard(),
+ m_FileDrillOffset );
+ excellonWriter.SetFormat( !m_UnitDrillIsInch,
+ (EXCELLON_WRITER::zeros_fmt) m_ZerosFormat,
+ m_Precision.m_lhs, m_Precision.m_rhs );
+ excellonWriter.SetOptions( m_Mirror, m_MinimalHeader, m_FileDrillOffset );
+
+ bool success = excellonWriter.GenDrillReportFile( dlg.GetPath() );
+
+ wxString msg;
+
+ if( ! success )
+ {
+ msg.Printf( _( "** Unable to create %s **\n" ), GetChars( dlg.GetPath() ) );
+ m_messagesBox->AppendText( msg );
+ }
+ else
+ {
+ msg.Printf( _( "Create report file %s\n" ), GetChars( dlg.GetPath() ) );
+ m_messagesBox->AppendText( msg );
+ }
+}
+
+
+// Generate the drill map of the board
+void DIALOG_GENDRILL::GenDrillMap( const wxString aFileName,
+ EXCELLON_WRITER& aExcellonWriter,
+ PlotFormat format )
+{
+ wxString ext, wildcard;
+
+ /* Init extension */
+ switch( format )
+ {
+ case PLOT_FORMAT_HPGL:
+ ext = HPGL_PLOTTER::GetDefaultFileExtension();
+ wildcard = _( "HPGL plot files (.plt)|*.plt" );
+ break;
+
+ case PLOT_FORMAT_POST:
+ ext = PS_PLOTTER::GetDefaultFileExtension();
+ wildcard = _( "PostScript files (.ps)|*.ps" );
+ break;
+
+ case PLOT_FORMAT_GERBER:
+ ext = GERBER_PLOTTER::GetDefaultFileExtension();
+ wildcard = _( "Gerber files (.pho)|*.pho" );
+ break;
+
+ case PLOT_FORMAT_DXF:
+ ext = DXF_PLOTTER::GetDefaultFileExtension();
+ wildcard = _( "DXF files (.dxf)|*.dxf" );
+ break;
+
+ case PLOT_FORMAT_SVG:
+ ext = SVG_PLOTTER::GetDefaultFileExtension();
+ wildcard = SVGFileWildcard;
+ break;
+
+ default:
+ wxMessageBox( wxT( "DIALOG_GENDRILL::GenDrillMap() error" ) );
+ return;
+ }
+
+ /* Init file name */
+ wxFileName fn = aFileName;
+ fn.SetName( fn.GetName() + wxT( "-drl_map" ) );
+ fn.SetExt( ext );
+ wxString fullFilename = fn.GetFullPath();
+
+ bool success = aExcellonWriter.GenDrillMapFile( fullFilename,
+ m_parent->GetPageSettings(),
+ format );
+
+ wxString msg;
+
+ if( ! success )
+ {
+ msg.Printf( _( "** Unable to create %s **\n" ),
+ GetChars( fullFilename ) );
+ m_messagesBox->AppendText( msg );
+ return;
+ }
+ else
+ {
+ msg.Printf( _( "Plot: %s OK\n" ), GetChars( fullFilename ) );
+ m_messagesBox->AppendText( msg );
+ }
+
}
diff --git a/pcbnew/dialogs/dialog_gendrill.h b/pcbnew/dialogs/dialog_gendrill.h
index 5771138625..58b3307d20 100644
--- a/pcbnew/dialogs/dialog_gendrill.h
+++ b/pcbnew/dialogs/dialog_gendrill.h
@@ -51,8 +51,9 @@ public:
private:
PCB_EDIT_FRAME* m_parent;
+ wxConfig* m_config;
BOARD* m_board;
- wxString m_plotDefaultpath; // Current default plot dircetory.
+ PCB_PLOT_PARAMS m_plotOpts;
int m_platedPadsHoleCount;
int m_notplatedPadsHoleCount;
@@ -60,8 +61,7 @@ private:
int m_microViasCount;
int m_blindOrBuriedViasCount;
- static bool m_createRpt; // true to create a drill file report
- static int m_createMap; // > 0 to create a map file report
+ static int m_mapFileType; // HPGL, PS ...
void initDialog();
@@ -70,24 +70,25 @@ private:
// event functions
void OnSelDrillUnitsSelected( wxCommandEvent& event );
void OnSelZerosFmtSelected( wxCommandEvent& event );
- void OnOkClick( wxCommandEvent& event );
+ void OnGenDrillFile( wxCommandEvent& event );
+ void OnGenMapFile( wxCommandEvent& event );
+ void OnGenReportFile( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
+ void OnOutputDirectoryBrowseClicked( wxCommandEvent& event );
// Specific functions:
void SetParams( void );
- void GenDrillAndReportFiles();
- void GenDrillMap( const wxString aFileName,
- std::vector& aHoleListBuffer,
- std::vector& aToolListBuffer,
- int format );
+ void GenDrillAndMapFiles(bool aGenDrill, bool aGenMap);
+ void GenDrillMap( const wxString aFileName,
+ EXCELLON_WRITER& aExcellonWriter,
+ PlotFormat format );
+
void UpdatePrecisionOptions();
void UpdateConfig();
- void GenDrillReport( const wxString aFileName );
- int Create_Drill_File_EXCELLON( FILE* aFile,
- wxPoint aOffset,
- std::vector& aHoleListBuffer,
- std::vector& aToolListBuffer );
- int Gen_Liste_Tools( std::vector& buffer, bool print_header );
+ int Create_Drill_File_EXCELLON( FILE* aFile,
+ wxPoint aOffset );
+ int Gen_Liste_Tools( std::vector& buffer,
+ bool print_header );
/**
* Return the selected format for coordinates, if not decimal
diff --git a/pcbnew/dialogs/dialog_gendrill_base.cpp b/pcbnew/dialogs/dialog_gendrill_base.cpp
index d3a326a80b..cdbd6f7520 100644
--- a/pcbnew/dialogs/dialog_gendrill_base.cpp
+++ b/pcbnew/dialogs/dialog_gendrill_base.cpp
@@ -14,7 +14,28 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
- bMainSizer = new wxBoxSizer( wxHORIZONTAL );
+ bMainSizer = new wxBoxSizer( wxVERTICAL );
+
+ wxBoxSizer* bupperSizer;
+ bupperSizer = new wxBoxSizer( wxVERTICAL );
+
+ wxStaticBoxSizer* bdirnameSizer;
+ bdirnameSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Output directory:") ), wxHORIZONTAL );
+
+ m_outputDirectoryName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
+ bdirnameSizer->Add( m_outputDirectoryName, 1, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
+
+ m_buttonBrowse = new wxButton( this, wxID_ANY, _("Browse"), wxDefaultPosition, wxDefaultSize, 0 );
+ bdirnameSizer->Add( m_buttonBrowse, 0, wxBOTTOM|wxLEFT, 5 );
+
+
+ bupperSizer->Add( bdirnameSizer, 1, wxEXPAND|wxRIGHT|wxLEFT, 5 );
+
+
+ bMainSizer->Add( bupperSizer, 0, wxEXPAND, 5 );
+
+ wxBoxSizer* bmiddlerSizer;
+ bmiddlerSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* m_LeftBoxSizer;
m_LeftBoxSizer = new wxBoxSizer( wxVERTICAL );
@@ -41,36 +62,20 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
m_LeftBoxSizer->Add( m_Choice_Precision, 0, wxALL|wxEXPAND, 5 );
- wxString m_Choice_Drill_OffsetChoices[] = { _("Absolute"), _("Auxiliary axis") };
- int m_Choice_Drill_OffsetNChoices = sizeof( m_Choice_Drill_OffsetChoices ) / sizeof( wxString );
- m_Choice_Drill_Offset = new wxRadioBox( this, wxID_ANY, _("Drill Origin:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_OffsetNChoices, m_Choice_Drill_OffsetChoices, 1, wxRA_SPECIFY_COLS );
- m_Choice_Drill_Offset->SetSelection( 0 );
- m_Choice_Drill_Offset->SetToolTip( _("Choose the coordinate origin: absolute or relative to the auxiliray axis") );
- m_LeftBoxSizer->Add( m_Choice_Drill_Offset, 0, wxALL|wxEXPAND, 5 );
-
-
- bMainSizer->Add( m_LeftBoxSizer, 1, wxEXPAND, 5 );
+ bmiddlerSizer->Add( m_LeftBoxSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bMiddleBoxSizer;
bMiddleBoxSizer = new wxBoxSizer( wxVERTICAL );
- wxString m_Choice_Drill_MapChoices[] = { _("None"), _("Drill map (HPGL)"), _("Drill map (PostScript)"), _("Drill map (Gerber)"), _("Drill map (DXF)"), _("Drill map (SVG)") };
+ wxString m_Choice_Drill_MapChoices[] = { _("Drill map (HPGL)"), _("Drill map (PostScript)"), _("Drill map (Gerber)"), _("Drill map (DXF)"), _("Drill map (SVG)") };
int m_Choice_Drill_MapNChoices = sizeof( m_Choice_Drill_MapChoices ) / sizeof( wxString );
m_Choice_Drill_Map = new wxRadioBox( this, wxID_ANY, _("Drill Map:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_MapNChoices, m_Choice_Drill_MapChoices, 1, wxRA_SPECIFY_COLS );
- m_Choice_Drill_Map->SetSelection( 0 );
+ m_Choice_Drill_Map->SetSelection( 1 );
m_Choice_Drill_Map->SetToolTip( _("Creates a drill map in PS, HPGL or other formats") );
bMiddleBoxSizer->Add( m_Choice_Drill_Map, 0, wxALL|wxEXPAND, 5 );
- wxString m_Choice_Drill_ReportChoices[] = { _("None"), _("Drill report") };
- int m_Choice_Drill_ReportNChoices = sizeof( m_Choice_Drill_ReportChoices ) / sizeof( wxString );
- m_Choice_Drill_Report = new wxRadioBox( this, wxID_ANY, _("Drill Report:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_ReportNChoices, m_Choice_Drill_ReportChoices, 1, wxRA_SPECIFY_COLS );
- m_Choice_Drill_Report->SetSelection( 0 );
- m_Choice_Drill_Report->SetToolTip( _("Creates a plain text report") );
-
- bMiddleBoxSizer->Add( m_Choice_Drill_Report, 0, wxALL|wxEXPAND, 5 );
-
wxStaticBoxSizer* sbOptSizer;
sbOptSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
@@ -81,10 +86,18 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
sbOptSizer->Add( m_Check_Minimal, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
- bMiddleBoxSizer->Add( sbOptSizer, 0, wxEXPAND, 5 );
+ bMiddleBoxSizer->Add( sbOptSizer, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
+
+ wxString m_Choice_Drill_OffsetChoices[] = { _("Absolute"), _("Auxiliary axis") };
+ int m_Choice_Drill_OffsetNChoices = sizeof( m_Choice_Drill_OffsetChoices ) / sizeof( wxString );
+ m_Choice_Drill_Offset = new wxRadioBox( this, wxID_ANY, _("Drill Origin:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_OffsetNChoices, m_Choice_Drill_OffsetChoices, 1, wxRA_SPECIFY_COLS );
+ m_Choice_Drill_Offset->SetSelection( 0 );
+ m_Choice_Drill_Offset->SetToolTip( _("Choose the coordinate origin: absolute or relative to the auxiliray axis") );
+
+ bMiddleBoxSizer->Add( m_Choice_Drill_Offset, 0, wxALL|wxEXPAND, 5 );
- bMainSizer->Add( bMiddleBoxSizer, 1, wxEXPAND, 5 );
+ bmiddlerSizer->Add( bMiddleBoxSizer, 0, wxEXPAND, 5 );
wxBoxSizer* bRightBoxSizer;
bRightBoxSizer = new wxBoxSizer( wxVERTICAL );
@@ -108,7 +121,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
m_MicroViasDrillSizer->Add( m_MicroViaDrillValue, 0, wxALL, 5 );
- sbSizerInfo->Add( m_MicroViasDrillSizer, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
+ sbSizerInfo->Add( m_MicroViasDrillSizer, 0, wxEXPAND|wxBOTTOM, 5 );
wxStaticBoxSizer* sbSizerHoles;
sbSizerHoles = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Holes Count:") ), wxVERTICAL );
@@ -134,23 +147,49 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
sbSizerHoles->Add( m_BuriedViasInfoMsg, 0, wxALL, 5 );
- sbSizerInfo->Add( sbSizerHoles, 1, wxEXPAND|wxTOP|wxBOTTOM, 5 );
+ sbSizerInfo->Add( sbSizerHoles, 1, wxEXPAND|wxBOTTOM, 5 );
bRightBoxSizer->Add( sbSizerInfo, 0, wxEXPAND|wxTOP, 5 );
- bRightBoxSizer->Add( 10, 10, 1, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
+ bmiddlerSizer->Add( bRightBoxSizer, 0, wxEXPAND, 5 );
- m_OkButton = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
- m_OkButton->SetDefault();
- bRightBoxSizer->Add( m_OkButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
-
- m_CancelButton = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
- bRightBoxSizer->Add( m_CancelButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
+ wxBoxSizer* bSizerButtons;
+ bSizerButtons = new wxBoxSizer( wxVERTICAL );
- bMainSizer->Add( bRightBoxSizer, 1, wxEXPAND, 5 );
+ bSizerButtons->Add( 10, 20, 0, 0, 5 );
+
+ m_buttonDrill = new wxButton( this, ID_GEN_DRILL_FILE, _("Drill Fille"), wxDefaultPosition, wxDefaultSize, 0 );
+ m_buttonDrill->SetDefault();
+ bSizerButtons->Add( m_buttonDrill, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
+
+ m_buttonMap = new wxButton( this, wxID_ANY, _("Map File"), wxDefaultPosition, wxDefaultSize, 0 );
+ bSizerButtons->Add( m_buttonMap, 0, wxALL, 5 );
+
+ m_buttonReport = new wxButton( this, wxID_ANY, _("Report File"), wxDefaultPosition, wxDefaultSize, 0 );
+ bSizerButtons->Add( m_buttonReport, 0, wxALL, 5 );
+
+ m_CancelButton = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
+ bSizerButtons->Add( m_CancelButton, 0, wxALL|wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
+
+
+ bmiddlerSizer->Add( bSizerButtons, 1, wxEXPAND, 5 );
+
+
+ bMainSizer->Add( bmiddlerSizer, 0, wxEXPAND, 5 );
+
+ wxStaticBoxSizer* bmsgSizer;
+ bmsgSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Messages:") ), wxVERTICAL );
+
+ m_messagesBox = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY );
+ m_messagesBox->SetMinSize( wxSize( -1,90 ) );
+
+ bmsgSizer->Add( m_messagesBox, 1, wxALL|wxEXPAND, 5 );
+
+
+ bMainSizer->Add( bmsgSizer, 1, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
@@ -159,18 +198,24 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
this->Centre( wxBOTH );
// Connect Events
+ m_buttonBrowse->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_Choice_Unit->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelDrillUnitsSelected ), NULL, this );
m_Choice_Zeros_Format->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelZerosFmtSelected ), NULL, this );
- m_OkButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnOkClick ), NULL, this );
+ m_buttonDrill->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenDrillFile ), NULL, this );
+ m_buttonMap->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenMapFile ), NULL, this );
+ m_buttonReport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenReportFile ), NULL, this );
m_CancelButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnCancelClick ), NULL, this );
}
DIALOG_GENDRILL_BASE::~DIALOG_GENDRILL_BASE()
{
// Disconnect Events
+ m_buttonBrowse->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnOutputDirectoryBrowseClicked ), NULL, this );
m_Choice_Unit->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelDrillUnitsSelected ), NULL, this );
m_Choice_Zeros_Format->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnSelZerosFmtSelected ), NULL, this );
- m_OkButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnOkClick ), NULL, this );
+ m_buttonDrill->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenDrillFile ), NULL, this );
+ m_buttonMap->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenMapFile ), NULL, this );
+ m_buttonReport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnGenReportFile ), NULL, this );
m_CancelButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GENDRILL_BASE::OnCancelClick ), NULL, this );
}
diff --git a/pcbnew/dialogs/dialog_gendrill_base.fbp b/pcbnew/dialogs/dialog_gendrill_base.fbp
index 4895e56de9..3c0424596d 100644
--- a/pcbnew/dialogs/dialog_gendrill_base.fbp
+++ b/pcbnew/dialogs/dialog_gendrill_base.fbp
@@ -42,7 +42,7 @@
DIALOG_GENDRILL_BASE
- 455,358
+ 506,471
wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
DIALOG_SHIM; dialog_shim.h
Drill Files Generation
@@ -89,375 +89,208 @@