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

  1. /*
  2. * Copyright (C) 2018 CERN
  3. * Copyright The 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 <lset.h>
  24. #include <pcb_painter.h>
  25. #include <plotprint_opts.h>
  26. class BOARD;
  27. struct PCBNEW_PRINTOUT_SETTINGS : BOARD_PRINTOUT_SETTINGS
  28. {
  29. PCBNEW_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo );
  30. enum DRILL_MARKS m_DrillMarks;
  31. enum PAGINATION_T {
  32. LAYER_PER_PAGE,
  33. ALL_LAYERS
  34. } m_Pagination;
  35. bool m_PrintEdgeCutsOnAllPages; ///< Print board outline on each page
  36. bool m_AsItemCheckboxes; ///< Honor checkboxes in the Items tab of the Layers Manager
  37. void Load( APP_SETTINGS_BASE* aConfig ) override;
  38. void Save( APP_SETTINGS_BASE* aConfig ) override;
  39. };
  40. class PCBNEW_PRINTOUT : public BOARD_PRINTOUT
  41. {
  42. public:
  43. PCBNEW_PRINTOUT( BOARD* aBoard, const PCBNEW_PRINTOUT_SETTINGS& aParams,
  44. const KIGFX::VIEW* aView, const wxString& aTitle );
  45. bool OnPrintPage( int aPage ) override;
  46. protected:
  47. int milsToIU( double aMils ) const override;
  48. void setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet ) override;
  49. void setupPainter( KIGFX::PAINTER& aPainter ) override;
  50. void setupGal( KIGFX::GAL* aGal ) override;
  51. BOX2I getBoundingBox() override;
  52. std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) override;
  53. private:
  54. BOARD* m_board;
  55. PCBNEW_PRINTOUT_SETTINGS m_pcbnewSettings;
  56. };
  57. namespace KIGFX {
  58. /**
  59. * Special flavor of PCB_PAINTER that contains modifications to handle printing options.
  60. */
  61. class PCB_PRINT_PAINTER : public PCB_PAINTER
  62. {
  63. public:
  64. PCB_PRINT_PAINTER( GAL* aGal );
  65. /**
  66. * Set drill marks visibility and options.
  67. *
  68. * @param aRealSize when enabled, drill marks represent actual holes. Otherwise aSize
  69. * parameter is used.
  70. * @param aSize is drill mark size (internal units), valid only when aRealSize == false.
  71. */
  72. void SetDrillMarks( bool aRealSize, unsigned int aSize = 0 )
  73. {
  74. m_drillMarkReal = aRealSize;
  75. m_drillMarkSize = aSize;
  76. }
  77. protected:
  78. PAD_DRILL_SHAPE getDrillShape( const PAD* aPad ) const override;
  79. SHAPE_SEGMENT getPadHoleShape( const PAD* aPad ) const override;
  80. int getViaDrillSize( const PCB_VIA* aVia ) const override;
  81. protected:
  82. bool m_drillMarkReal; ///< Actual hole size or user-specified size for drill marks
  83. int m_drillMarkSize; ///< User-specified size (in internal units)
  84. };
  85. }; // namespace KIGFX
  86. #endif /* PCBNEW_PRINTOUT_H */