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-2016 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 namespace KIGFX {
42 class GAL;
43 class VIEW;
44 class PAINTER;
45 };
46 
47 
49 {
50  BOARD_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo );
51 
53  bool m_mirror;
54 
55  void Load( wxConfigBase* aConfig ) override;
56  void Save( wxConfigBase* aConfig ) override;
57 };
58 
64 class BOARD_PRINTOUT : public wxPrintout
65 {
66 public:
67  BOARD_PRINTOUT( const BOARD_PRINTOUT_SETTINGS& aParams, const KIGFX::VIEW* aView,
68  const wxString& aTitle );
69 
70  virtual ~BOARD_PRINTOUT() {}
71 
72  void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo ) override;
73 
74  bool HasPage( int aPage ) override
75  {
76  return aPage <= m_settings.m_pageCount;
77  }
78 
87  virtual void DrawPage( const wxString& aLayerName = wxEmptyString,
88  int aPageNum = 1, int aPageCount = 1 );
89 
90 protected:
92  virtual int milsToIU( double aMils ) const = 0;
93 
95  virtual void setupViewLayers( const std::unique_ptr<KIGFX::VIEW>& aView, const LSET& aLayerSet );
96 
98  virtual void setupPainter( const std::unique_ptr<KIGFX::PAINTER>& aPainter );
99 
101  virtual void setupGal( KIGFX::GAL* aGal );
102 
104  virtual EDA_RECT getBoundingBox() = 0;
105 
107  virtual std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) = 0;
108 
111 
114 };
115 
116 #endif // BOARD_PRINTOUT_H
Class PRINT_PARAMETERS handles the parameters used to print a board drawing.
Definition: printout.h:30
Class CAIRO_GAL is the cairo implementation of the graphics abstraction layer.
Definition: class_module.h:58
const KIGFX::VIEW * m_view
Source VIEW object (note that actual printing only refers to this object)
bool HasPage(int aPage) override
BOARD_PRINTOUT_SETTINGS m_settings
Printout parameters
static struct PcbQueue * Save
Definition: queue.cpp:56
Class LSET is a set of PCB_LAYER_IDs.
bool m_mirror
Print mirrored.
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
virtual ~BOARD_PRINTOUT()
Class BOARD_PRINTOUT is a class derived from wxPrintout to handle the necessary information to contro...
Board layer functions and definitions.
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
KICAD_PLUGIN_EXPORT SCENEGRAPH * Load(char const *aFileName)
reads a model file and creates a generic display structure
Class VIEW.
Definition: view.h:61
LSET m_layerSet
Layers to print.
Class GAL is the abstract interface for drawing on a 2D-surface.