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.

113 lines
4.5 KiB

11 months ago
  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
  5. *
  6. * This program is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU General Public License
  8. * as published by the Free Software Foundation; either version 2
  9. * of the License, or (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, you may find one here:
  18. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  19. * or you may search the http://www.gnu.org website for the version 2 license,
  20. * or you may write to the Free Software Foundation, Inc.,
  21. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  22. */
  23. #include <board.h>
  24. #include <dialog_plot_base.h>
  25. #include <pcb_plot_params.h>
  26. #include <widgets/unit_binder.h>
  27. // the plot dialog window name, used by wxWidgets
  28. #define DLG_WINDOW_NAME wxT( "plot_dialog-window" )
  29. class wxRearrangeList;
  30. class wxBitmapButton;
  31. class JOB_EXPORT_PCB_PLOT;
  32. /**
  33. * A dialog to set the plot options and create plot files in various formats.
  34. */
  35. class DIALOG_PLOT : public DIALOG_PLOT_BASE
  36. {
  37. public:
  38. DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame );
  39. DIALOG_PLOT( PCB_EDIT_FRAME* aEditFrame, wxWindow* aParent,
  40. JOB_EXPORT_PCB_PLOT* aJob = nullptr );
  41. virtual ~DIALOG_PLOT();
  42. private:
  43. // Event called functions
  44. void Plot( wxCommandEvent& event ) override;
  45. void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
  46. void OnRightClickLayers( wxMouseEvent& event );
  47. void OnRightClickAllLayers( wxMouseEvent& event );
  48. void SetPlotFormat( wxCommandEvent& event ) override;
  49. void OnChangeDXFPlotMode( wxCommandEvent& event ) override;
  50. void CreateDrillFile( wxCommandEvent& event ) override;
  51. void OnGerberX2Checked( wxCommandEvent& event ) override;
  52. void onRunDRC( wxCommandEvent& event ) override;
  53. void onOpenOutputDirectory( wxCommandEvent& event ) override;
  54. void onBoardSetup( wxHyperlinkEvent& aEvent ) override;
  55. void onPlotAllListMoveUp( wxCommandEvent& aEvent );
  56. void onPlotAllListMoveDown( wxCommandEvent& aEvent );
  57. void onDNPCheckbox( wxCommandEvent& event ) override;
  58. void onSketchPads( wxCommandEvent& event ) override;
  59. // other functions
  60. void init_Dialog(); // main initialization
  61. void reInitDialog(); // initialization after calling drill dialog
  62. void applyPlotSettings();
  63. PLOT_FORMAT getPlotFormat();
  64. void arrangeAllLayersList( const LSEQ& aSeq );
  65. void loadPlotParamsFromJob();
  66. void transferPlotParamsToJob();
  67. private:
  68. PCB_EDIT_FRAME* m_editFrame;
  69. LSEQ m_layerList; // List to hold CheckListBox layer numbers
  70. double m_XScaleAdjust; // X scale factor adjust to compensate
  71. // plotter X scaling error
  72. double m_YScaleAdjust; // X scale factor adjust to compensate
  73. // plotter Y scaling error
  74. int m_PSWidthAdjust; // Global width correction for exact line width
  75. // in postscript output.
  76. // this is a correction factor for tracks width
  77. // when plotted
  78. int m_widthAdjustMinValue; // Global track width limits
  79. int m_widthAdjustMaxValue; // tracks width will be "clipped" whenever the
  80. // m_PSWidthAdjust to these limits.
  81. UNIT_BINDER m_trackWidthCorrection;
  82. wxString m_DRCWarningTemplate;
  83. PCB_PLOT_PARAMS m_plotOpts;
  84. wxRearrangeList* m_plotAllLayersList;
  85. STD_BITMAP_BUTTON* m_bpMoveUp;
  86. STD_BITMAP_BUTTON* m_bpMoveDown;
  87. JOB_EXPORT_PCB_PLOT* m_job;
  88. /// The plot layer set that last time the dialog was opened.
  89. static LSET s_lastLayerSet;
  90. static LSET s_lastAllLayersSet;
  91. /// The plot on all layers ordering the last time the dialog was opened.
  92. static LSEQ s_lastAllLayersOrder;
  93. };