29#include <wx/filedlg.h>
72 m_plotOpts( aPcbEditFrame->GetPlotSettings() ),
78 { wxID_CANCEL,
_(
"Close" ) } } );
104 SetTitle(
m_job->GetSettingsDialogTitle() );
135 m_zeros->SetSelection(
static_cast<int>(
m_job->m_zeroFormat ) );
149 wxCommandEvent
dummy;
190 m_units->Enable( enbl_Excellon );
192 m_zeros->Enable( enbl_Excellon );
217 dirStr.Replace( wxT(
"\\" ), wxT(
"/" ) );
243 if(
m_units->GetSelection() == 1 )
273 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
275 if( dirDialog.ShowModal() == wxID_CANCEL )
278 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
279 wxFileName fn(
Prj().AbsolutePath(
m_board->GetFileName() ) );
280 wxString defaultPath = fn.GetPathWithSep();
282 if(
IsOK(
this, wxString::Format(
_(
"Do you want to use a path relative to\n'%s'?" ), defaultPath ) ) )
284 if( !dirName.MakeRelativeTo( defaultPath ) )
320 std::function<bool( wxString* )> textResolver =
321 [&]( wxString* token ) ->
bool
324 return m_board->ResolveTextVar( token, 0 );
331 wxFileName outputDir = wxFileName::DirName(
path );
332 wxString boardFilename =
m_board->GetFileName();
336 DisplayError(
this, wxString::Format(
_(
"Could not write drill and/or map files to folder '%s'." ),
337 outputDir.GetPath() ) );
347 drillFileOffset =
m_board->GetDesignSettings().GetAuxOrigin();
349 if(
m_units->GetSelection() == 0 )
387 wxFileName fn =
m_board->GetFileName();
389 fn.SetName( fn.GetName() + wxT(
"-drl" ) );
395 if( defaultPath.IsEmpty() )
398 wxFileDialog dlg(
this,
_(
"Save Drill Report File" ), defaultPath, fn.GetFullName(),
401 if( dlg.ShowModal() == wxID_CANCEL )
422 m_messagesBox->AppendText( wxString::Format(
_(
"Failed to create file '%s'." ), dlg.GetPath() ) );
424 m_messagesBox->AppendText( wxString::Format(
_(
"Report file '%s' created." ), dlg.GetPath() ) );
constexpr std::size_t arrayDim(T const (&)[N]) noexcept
Returns # of elements in an array.
wxBitmapBundle KiBitmapBundle(BITMAPS aBitmap, int aMinHeight)
int GenerateDrillFiles(const TOOL_EVENT &aEvent)
wxRadioButton * m_rbExcellon
wxStaticText * m_staticTextPrecision
STD_BITMAP_BUTTON * m_browseButton
wxStaticBoxSizer * bMsgSizer
wxCheckBox * m_altDrillMode
wxStaticText * m_unitsLabel
wxChoice * m_choiceDrillMap
wxRadioButton * m_rbGerberX2
wxCheckBox * m_Check_Mirror
DIALOG_GENDRILL_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Generate Drill Files"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxCheckBox * m_Check_Merge_PTH_NPTH
wxStaticText * m_zerosLabel
wxTextCtrl * m_outputDirectoryName
wxCheckBox * m_cbGenerateMap
wxTextCtrl * m_messagesBox
wxCheckBox * m_generateTentingLayers
wxStaticText * m_precisionLabel
wxButton * m_buttonReport
wxCheckBox * m_Check_Minimal
PCB_PLOT_PARAMS m_plotOpts
void onOutputDirectoryBrowseClicked(wxCommandEvent &event) override
void onFileFormatSelection(wxCommandEvent &event) override
void genDrillAndMapFiles(bool aGenDrill, bool aGenMap, bool aGenTenting)
Call to create EXCELLON drill files and/or drill map files.
bool TransferDataFromWindow() override
PCB_EDIT_FRAME * m_pcbEditFrame
DIALOG_GENDRILL(PCB_EDIT_FRAME *aPcbEditFrame, wxWindow *aParent)
bool TransferDataToWindow() override
void onSelZerosFmtSelected(wxCommandEvent &event) override
void onGenReportFile(wxCommandEvent &event) override
JOB_EXPORT_PCB_DRILL * m_job
void onSelDrillUnitsSelected(wxCommandEvent &event) override
void updatePrecisionOptions()
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
Helper to handle drill precision format in excellon files.
Create Excellon drill, drill map, and drill report files.
void SetFormat(bool aMetric, ZEROS_FMT aZerosFmt=DECIMAL_FORMAT, int aLeftDigits=0, int aRightDigits=0)
Initialize internal parameters to match the given format.
bool CreateDrillandMapFilesSet(const wxString &aPlotDirectory, bool aGenDrill, bool aGenMap, REPORTER *aReporter=nullptr)
Create the full set of Excellon drill file for the board.
void SetOptions(bool aMirror, bool aMinimalHeader, const VECTOR2I &aOffset, bool aMerge_PTH_NPTH)
Initialize internal parameters to match drill options.
void SetRouteModeForOvalHoles(bool aUseRouteModeForOvalHoles)
void SetMapFileFormat(PLOT_FORMAT aMapFmt)
Initialize the format for the drill map file.
bool GenDrillReportFile(const wxString &aFullFileName)
Create a plain text report file giving a list of drill values and drill count for through holes,...
void SetMergeOption(bool aMerge)
Set the option to make separate drill files for PTH and NPTH.
void SetPageInfo(const PAGE_INFO *aPageInfo)
Set the page info used to plot drill maps.
Used to create Gerber drill files.
bool CreateDrillandMapFilesSet(const wxString &aPlotDirectory, bool aGenDrill, bool aGenMap, bool aGenTenting, REPORTER *aReporter=nullptr)
Create the full set of Excellon drill file for the board filenames are computed from the board name,...
void SetOptions(const VECTOR2I &aOffset)
Initialize internal parameters to match drill options.
void SetFormat(int aRightDigits=6)
Initialize internal parameters to match the given format.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
static wxString GetDefaultUserProjectsPath()
Gets the default path we point users to create projects.
The main frame for Pcbnew.
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
A wrapper for reporting to a wxTextCtrl object.
const wxString ExpandEnvVarSubstitutions(const wxString &aString, const PROJECT *aProject)
Replace any environment variable & text variable references with their values.
wxString ExpandTextVars(const wxString &aSource, const PROJECT *aProject, int aFlags)
bool EnsureFileDirectoryExists(wxFileName *aTargetFullFileName, const wxString &aBaseFilename, REPORTER *aReporter)
Make aTargetFullFileName absolute and create the path of this file if it doesn't yet exist.
bool IsOK(wxWindow *aParent, const wxString &aMessage)
Display a yes/no dialog with aMessage and returns the user response.
void DisplayErrorMessage(wxWindow *aParent, const wxString &aText, const wxString &aExtraInfo)
Display an error message with aMessage.
void DisplayError(wxWindow *aParent, const wxString &aText)
Display an error or warning message box with aMessage.
This file is part of the common library.
static DRILL_PRECISION precisionListForInches(2, 4)
static DRILL_PRECISION precisionListForMetric(3, 3)
Classes used in drill files, map files and report files generation.
Classes used in drill files, map files and report files generation.
static const std::string ReportFileExtension
static wxString ReportFileWildcard()
PLOT_FORMAT
The set of supported output plot formats.
std::vector< FAB_LAYER_COLOR > dummy
#define TO_UTF8(wxstring)
Convert a wxString to a UTF8 encoded C string for all wxWidgets build modes.
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.