44#include <wx/filedlg.h>
94 { wxID_CANCEL,
_(
"Close" ) } } );
102 wxWindow* aParent ) :
199 wxCommandEvent
dummy;
226 if( g_mapFileType < 0 || g_mapFileType >= (
int)
m_choiceDrillMap->GetCount() )
245 m_units->Enable( enbl_Excellon );
247 m_zeros->Enable( enbl_Excellon );
299 if(
m_units->GetSelection() == 1 )
329 wxDirDialog dirDialog(
this,
_(
"Select Output Directory" ),
path );
331 if( dirDialog.ShowModal() == wxID_CANCEL )
334 wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
336 wxString defaultPath = fn.GetPathWithSep();
338 msg.Printf(
_(
"Do you want to use a path relative to\n'%s'?" ), defaultPath );
340 wxMessageDialog dialog(
this, msg,
_(
"Plot Output Directory" ),
341 wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
343 if( dialog.ShowModal() == wxID_YES )
345 if( !dirName.MakeRelativeTo( defaultPath ) )
347 wxMessageBox(
_(
"Cannot make path relative (target volume different from board "
349 _(
"Plot Output Directory" ), wxOK | wxICON_ERROR );
362 dirStr.Replace( wxT(
"\\" ), wxT(
"/" ) );
419 std::function<bool( wxString* )> textResolver =
420 [&]( wxString* token ) ->
bool
430 wxFileName outputDir = wxFileName::DirName(
path );
436 msg.Printf(
_(
"Could not write drill and/or map files to folder '%s'." ),
437 outputDir.GetPath() );
476 fn.SetName( fn.GetName() + wxT(
"-drl" ) );
482 if( defaultPath.IsEmpty() )
485 wxFileDialog dlg(
this,
_(
"Save Drill Report File" ), defaultPath, fn.GetFullName(),
488 if( dlg.ShowModal() == wxID_CANCEL )
511 msg.Printf(
_(
"Failed to create file '%s'." ), dlg.GetPath() );
516 msg.Printf(
_(
"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)
const VECTOR2I & GetAuxOrigin()
int GenerateDrillFiles(const TOOL_EVENT &aEvent)
void SetPlotOptions(const PCB_PLOT_PARAMS &aOptions)
bool ResolveTextVar(wxString *token, int aDepth) const
const wxString & GetFileName() const
const PCB_PLOT_PARAMS & GetPlotOptions() const
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Class DIALOG_GENDRILL_BASE.
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
wxCheckBox * m_Check_Merge_PTH_NPTH
wxStaticText * m_zerosLabel
wxTextCtrl * m_outputDirectoryName
wxCheckBox * m_cbGenerateMap
wxTextCtrl * m_messagesBox
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
bool TransferDataFromWindow() override
PCB_EDIT_FRAME * m_pcbEditFrame
void genDrillAndMapFiles(bool aGenDrill, bool aGenMap)
Call the functions to create EXCELLON drill files and/or drill map files.
DIALOG_GENDRILL(PCB_EDIT_FRAME *aPcbEditFrame, wxWindow *aParent)
bool TransferDataToWindow() override
static bool g_useRouteModeForOvalHoles
void onSelZerosFmtSelected(wxCommandEvent &event) override
static int g_drillFileType
static VECTOR2I g_drillFileOffset
void UpdateDrillParams()
Update board drill/plot parameters.
static bool g_merge_PTH_NPTH
static int g_unitDrillIsInch
static bool g_minimalHeader
void onGenReportFile(wxCommandEvent &event) override
bool m_drillOriginIsAuxAxis
JOB_EXPORT_PCB_DRILL * m_job
void onSelDrillUnitsSelected(wxCommandEvent &event) override
static DRILL_PRECISION g_precision
void updatePrecisionOptions()
static bool g_generateMap
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.
wxString GetPrecisionString()
virtual void ClearMsgPanel()
Clear all messages from the message panel.
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.
Used to create Gerber drill files.
bool CreateDrillandMapFilesSet(const wxString &aPlotDirectory, bool aGenDrill, bool aGenMap, 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.
ZEROS_FORMAT m_zeroFormat
bool m_excellonOvalDrillRoute
DRILL_ORIGIN m_drillOrigin
bool m_excellonCombinePTHNPTH
bool m_excellonMinimalHeader
wxString GetSettingsDialogTitle() const override
void SetConfiguredOutputPath(const wxString &aPath)
Sets the configured output path for the job, this path is always saved to file.
wxString GetConfiguredOutputPath() const
Returns the configured output path for the job.
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.
DIALOG_GENERATE_DRILL m_GenDrill
virtual const PCB_PLOT_PARAMS & GetPlotSettings() const
Return the PCB_PLOT_PARAMS for the BOARD owned by this frame.
PCBNEW_SETTINGS * GetPcbNewSettings() const
The main frame for Pcbnew.
void OnModify() override
Must be called after a board change to set the modified flag.
bool GetUseAuxOrigin() const
void SetOutputDirectory(const wxString &aDir)
wxString GetOutputDirectory() const
int GetGerberPrecision() const
bool IsSameAs(const PCB_PLOT_PARAMS &aPcbPlotParams) const
Compare current settings to aPcbPlotParams, including not saved parameters in brd file.
void SetUseAuxOrigin(bool aAux)
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.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
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.
bool use_route_for_oval_holes
VECTOR2< int32_t > VECTOR2I
Definition of file extensions used in Kicad.