KiCad PCB EDA Suite
board_printout.h
Go to the documentation of this file.
1 /*
2  * This program source code file is part of KiCad, a free EDA CAD application.
3  *
4  * Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
5  * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
6  * Copyright (C) 2018 CERN
7  * Author: Maciej Suminski <maciej.suminski@cern.ch>
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 
27 
33 #ifndef BOARD_PRINTOUT_H
34 #define BOARD_PRINTOUT_H
35 
36 #include <wx/print.h>
38 #include <eda_rect.h>
39 #include <printout.h>
40 
41 #include <memory>
42 
43 namespace KIGFX {
44 class GAL;
45 class VIEW;
46 class PAINTER;
47 };
48 
49 
51 {
52  BOARD_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo );
53 
55  {
56  }
57 
59  bool m_Mirror;
60 
61  void Load( APP_SETTINGS_BASE* aConfig ) override;
62  void Save( APP_SETTINGS_BASE* aConfig ) override;
63 };
64 
65 
70 class BOARD_PRINTOUT : public wxPrintout
71 {
72 public:
73  BOARD_PRINTOUT( const BOARD_PRINTOUT_SETTINGS& aParams, const KIGFX::VIEW* aView,
74  const wxString& aTitle );
75 
76  virtual ~BOARD_PRINTOUT() {}
77 
78  void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo ) override;
79 
80  bool HasPage( int aPage ) override
81  {
82  return aPage <= m_settings.m_pageCount;
83  }
84 
95  virtual void DrawPage( const wxString& aLayerName = wxEmptyString,
96  int aPageNum = 1, int aPageCount = 1 );
97 
98 protected:
100  virtual int milsToIU( double aMils ) const = 0;
101 
103  virtual void setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet );
104 
106  virtual void setupPainter( KIGFX::PAINTER& aPainter );
107 
109  virtual void setupGal( KIGFX::GAL* aGal );
110 
112  virtual EDA_RECT getBoundingBox() = 0;
113 
115  virtual std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) = 0;
116 
119 
122 };
123 
124 #endif // BOARD_PRINTOUT_H
void Save(APP_SETTINGS_BASE *aConfig) override
Handle the parameters used to print a board drawing.
Definition: printout.h:31
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:191
virtual std::unique_ptr< KIGFX::PAINTER > getPainter(KIGFX::GAL *aGal)=0
Source VIEW object (note that actual printing only refers to this object)
const KIGFX::VIEW * m_view
Printout parameters.
virtual ~BOARD_PRINTOUT_SETTINGS()
void Load(APP_SETTINGS_BASE *aConfig) override
LSET m_LayerSet
Layers to print.
virtual void DrawPage(const wxString &aLayerName=wxEmptyString, int aPageNum=1, int aPageCount=1)
Print a page (or a set of pages).
bool HasPage(int aPage) override
BOARD_PRINTOUT_SETTINGS m_settings
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:57
LSET is a set of PCB_LAYER_IDs.
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) override
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:99
virtual int milsToIU(double aMils) const =0
< Convert mils to internal units
virtual void setupPainter(KIGFX::PAINTER &aPainter)
Configures GAL object for a printout.
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
virtual void setupGal(KIGFX::GAL *aGal)
Returns bounding box of the printed objects (excluding drawing-sheet frame)
virtual void setupViewLayers(KIGFX::VIEW &aView, const LSET &aLayerSet)
Configures PAINTER object for a printout.
virtual ~BOARD_PRINTOUT()
BOARD_PRINTOUT_SETTINGS(const PAGE_INFO &aPageInfo)
An object derived from wxPrintout to handle the necessary information to control a printer when print...
Board layer functions and definitions.
int m_pageCount
Number of pages to print.
Definition: printout.h:61
Handle the component boundary box.
Definition: eda_rect.h:42
BOARD_PRINTOUT(const BOARD_PRINTOUT_SETTINGS &aParams, const KIGFX::VIEW *aView, const wxString &aTitle)
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:67
bool m_Mirror
Print mirrored.
virtual EDA_RECT getBoundingBox()=0
Returns a PAINTER instance used to draw the items.
Abstract interface for drawing on a 2D-surface.