You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
4.8 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 1992-2019 Jean_Pierre Charras <jp.charras@ujf-grenoble.fr>
  5. * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, you may find one here:
  19. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  20. * or you may search the http://www.gnu.org website for the version 2 license,
  21. * or you may write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  23. */
  24. #ifndef DIALOG_GENDRILL_H_
  25. #define DIALOG_GENDRILL_H_
  26. #include <gendrill_file_writer_base.h> // for DRILL_PRECISION definition
  27. #include <dialog_gendrill_base.h>
  28. class JOB_EXPORT_PCB_DRILL;
  29. class DIALOG_GENDRILL : public DIALOG_GENDRILL_BASE
  30. {
  31. public:
  32. /**
  33. * @param aPcbEditFrame is the board edit frame.
  34. * @param aParent is the parent window caller ( the board edit frame or a dialog ).
  35. */
  36. DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, wxWindow* aParent );
  37. DIALOG_GENDRILL( PCB_EDIT_FRAME* aPcbEditFrame, JOB_EXPORT_PCB_DRILL* aJob, wxWindow* aParent );
  38. ~DIALOG_GENDRILL();
  39. /**
  40. * Update board drill/plot parameters
  41. */
  42. void UpdateDrillParams();
  43. bool TransferDataFromWindow() override;
  44. bool TransferDataToWindow() override;
  45. private:
  46. void initDialog();
  47. // event functions
  48. void onSelDrillUnitsSelected( wxCommandEvent& event ) override;
  49. void onSelZerosFmtSelected( wxCommandEvent& event ) override;
  50. void onFileFormatSelection( wxCommandEvent& event ) override;
  51. // Called when closing the dialog: Update config.
  52. // This is not done in Dtor, because the dtor call is often delayed and the update
  53. // could happen too late for the caller.
  54. void onCloseDlg( wxCloseEvent& event ) override
  55. {
  56. updateConfig();
  57. event.Skip();
  58. }
  59. /*
  60. * Create a plain text report file giving a list of drill values and drill count
  61. * for through holes, oblong holes, and for buried vias,
  62. * drill values and drill count per layer pair
  63. */
  64. void onGenReportFile( wxCommandEvent& event ) override;
  65. void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
  66. // Specific functions:
  67. /**
  68. * Call the functions to create EXCELLON drill files and/or drill map files.
  69. *
  70. * When all holes are through holes, only one excellon file is created. When there are
  71. * some partial holes (some blind or buried vias), one excellon file is created, for all
  72. * plated through holes, and one file per layer pair, which have one or more holes, excluding
  73. * through holes, already in the first file. One file for all Not Plated through holes.
  74. */
  75. void genDrillAndMapFiles( bool aGenDrill, bool aGenMap, bool aGenTenting );
  76. void updatePrecisionOptions();
  77. void updateConfig();
  78. private:
  79. static int g_unitDrillIsInch;
  80. static int g_zerosFormat;
  81. static bool g_minimalHeader;
  82. static bool g_mirror;
  83. static bool g_merge_PTH_NPTH;
  84. static bool g_generateMap;
  85. static bool g_generateTenting;
  86. static DRILL_PRECISION g_precision; // Precision for drill files in non-decimal
  87. // format
  88. static VECTOR2I g_drillFileOffset; // Drill offset: 0,0 for absolute
  89. // coordinates, or aux origin
  90. static bool g_useRouteModeForOvalHoles; // True to use a G00 route command for
  91. // oval holes; false to use a G85 canned
  92. // mode for oval holes
  93. private:
  94. PCB_EDIT_FRAME* m_pcbEditFrame;
  95. BOARD* m_board;
  96. PCB_PLOT_PARAMS m_plotOpts;
  97. JOB_EXPORT_PCB_DRILL* m_job;
  98. bool m_drillOriginIsAuxAxis; // Axis selection (main / auxiliary)
  99. // for drill origin coordinates
  100. static int g_mapFileType; // format of map file: PS, PDF ...
  101. static int g_drillFileType; // for Excellon, Gerber
  102. };
  103. #endif // DIALOG_GENDRILL_H_