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
3.2 KiB

5 years ago
  1. /*
  2. * Copyright (C) 2018 CERN
  3. * Copyright (C) 2018-2023 KiCad Developers, see AUTHORS.txt for contributors.
  4. *
  5. * @author Maciej Suminski <maciej.suminski@cern.ch>
  6. *
  7. * This program is free software: you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation, either version 3 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. #ifndef PCBNEW_PRINTOUT_H
  21. #define PCBNEW_PRINTOUT_H
  22. #include <board_printout.h>
  23. #include <pcb_painter.h>
  24. #include <plotprint_opts.h>
  25. class BOARD;
  26. struct PCBNEW_PRINTOUT_SETTINGS : BOARD_PRINTOUT_SETTINGS
  27. {
  28. PCBNEW_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo );
  29. enum DRILL_MARKS m_DrillMarks;
  30. enum PAGINATION_T {
  31. LAYER_PER_PAGE,
  32. ALL_LAYERS
  33. } m_Pagination;
  34. bool m_PrintEdgeCutsOnAllPages; ///< Print board outline on each page
  35. bool m_AsItemCheckboxes; ///< Honor checkboxes in the Items tab of the Layers Manager
  36. void Load( APP_SETTINGS_BASE* aConfig ) override;
  37. void Save( APP_SETTINGS_BASE* aConfig ) override;
  38. };
  39. class PCBNEW_PRINTOUT : public BOARD_PRINTOUT
  40. {
  41. public:
  42. PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS& aParams,
  43. const KIGFX::VIEW* aView, const wxString& aTitle );
  44. bool OnPrintPage( int aPage ) override;
  45. protected:
  46. int milsToIU( double aMils ) const override;
  47. void setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet ) override;
  48. void setupPainter( KIGFX::PAINTER& aPainter ) override;
  49. void setupGal( KIGFX::GAL* aGal ) override;
  50. BOX2I getBoundingBox() override;
  51. std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) override;
  52. private:
  53. BOARD* m_board;
  54. PCBNEW_PRINTOUT_SETTINGS m_pcbnewSettings;
  55. };
  56. namespace KIGFX {
  57. /**
  58. * Special flavor of PCB_PAINTER that contains modifications to handle printing options.
  59. */
  60. class PCB_PRINT_PAINTER : public PCB_PAINTER
  61. {
  62. public:
  63. PCB_PRINT_PAINTER( GAL* aGal );
  64. /**
  65. * Set drill marks visibility and options.
  66. *
  67. * @param aRealSize when enabled, drill marks represent actual holes. Otherwise aSize
  68. * parameter is used.
  69. * @param aSize is drill mark size (internal units), valid only when aRealSize == false.
  70. */
  71. void SetDrillMarks( bool aRealSize, unsigned int aSize = 0 )
  72. {
  73. m_drillMarkReal = aRealSize;
  74. m_drillMarkSize = aSize;
  75. }
  76. protected:
  77. int getDrillShape( const PAD* aPad ) const override;
  78. SHAPE_SEGMENT getPadHoleShape( const PAD* aPad ) const override;
  79. int getViaDrillSize( const PCB_VIA* aVia ) const override;
  80. protected:
  81. bool m_drillMarkReal; ///< Actual hole size or user-specified size for drill marks
  82. int m_drillMarkSize; ///< User-specified size (in internal units)
  83. };
  84. }; // namespace KIGFX
  85. #endif /* PCBNEW_PRINTOUT_H */