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.

114 lines
4.3 KiB

  1. /*
  2. * This program source code file is part of KiCad, a free EDA CAD application.
  3. *
  4. * Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
  5. * Copyright (C) 1992-2010 Lorenzo Marcantonio
  6. * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
  7. * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
  8. *
  9. * This program is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU General Public License
  11. * as published by the Free Software Foundation; either version 2
  12. * of the License, or (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, you may find one here:
  21. * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
  22. * or you may search the http://www.gnu.org website for the version 2 license,
  23. * or you may write to the Free Software Foundation, Inc.,
  24. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  25. */
  26. #ifndef __DIALOG_PLOT_SCHEMATIC__
  27. #define __DIALOG_PLOT_SCHEMATIC__
  28. #include <plotters/plotter.h>
  29. #include <dialog_plot_schematic_base.h>
  30. #include <widgets/unit_binder.h>
  31. #include <sch_plotter.h>
  32. class PDF_PLOTTER;
  33. class SCH_EDIT_FRAME;
  34. class SCH_SCREEN;
  35. class SCH_SHEET_PATH;
  36. class JOB_EXPORT_SCH_PLOT;
  37. class DIALOG_PLOT_SCHEMATIC : public DIALOG_PLOT_SCHEMATIC_BASE
  38. {
  39. public:
  40. DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* aEditFrame );
  41. DIALOG_PLOT_SCHEMATIC( SCH_EDIT_FRAME* aEditFrame, wxWindow* aParent,
  42. JOB_EXPORT_SCH_PLOT* aJob = nullptr );
  43. /**
  44. * Return true if the project configuration was modified.
  45. */
  46. bool PrjConfigChanged() { return m_configChanged; }
  47. private:
  48. void OnPageSizeSelected( wxCommandEvent& event ) override;
  49. void OnPlotCurrent( wxCommandEvent& event ) override;
  50. void OnPlotAll( wxCommandEvent& event ) override;
  51. void OnUpdateUI( wxUpdateUIEvent& event ) override;
  52. void initDlg();
  53. // common
  54. void getPlotOptions( RENDER_SETTINGS* aSettings );
  55. bool getModeColor() { return m_ModeColorOption->GetSelection() == 0; }
  56. void setModeColor( bool aColor ) { m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); }
  57. COLOR_SETTINGS* getColorSettings();
  58. /**
  59. * Set the m_outputDirectoryName variable to the selected directory from directory dialog.
  60. */
  61. void onOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
  62. PLOT_FORMAT GetPlotFileFormat();
  63. bool getPlotDrawingSheet() { return m_plotDrawingSheet->GetValue(); }
  64. void setPlotDrawingSheet( bool aPlot) { m_plotDrawingSheet->SetValue( aPlot ); }
  65. bool getOpenFileAfterPlot() { return m_openFileAfterPlot->GetValue(); }
  66. void setOpenFileAfterPlot( bool aOpen ) { m_openFileAfterPlot->SetValue( aOpen ); }
  67. void plotSchematic( bool aPlotAll );
  68. /**
  69. * Determine the best absolute path to plot files given the contents of the path
  70. * edit control.
  71. *
  72. * - If the path edit control results in an absolute path, use it as is.
  73. * - If the path edit control is not an absolute path and the project file is valid, use
  74. the project root path to normalize the contents of the path edit control.
  75. * - If the path edit control is not an absolute path and the project file does not exist
  76. * and the screen file name is valid, use the screen file name path.
  77. * - If the path edit control is not an absolute path and the project file does not exist
  78. * and the screen file name is empty, user the user's documents folder.
  79. * - Fall back to the user's document path if any of the above conditions do not result
  80. * in a valid absolute path.
  81. *
  82. * @return a valid path to write the plot files.
  83. */
  84. wxString getOutputPath();
  85. private:
  86. SCH_EDIT_FRAME* m_editFrame;
  87. bool m_configChanged; // true if a project config param has changed
  88. PLOT_FORMAT m_plotFormat;
  89. static int m_pageSizeSelect; // Static to keep last option for some format
  90. UNIT_BINDER m_defaultLineWidth;
  91. JOB_EXPORT_SCH_PLOT* m_job;
  92. };
  93. #endif // __DIALOG_PLOT_SCHEMATIC__