KiCad PCB EDA Suite
Loading...
Searching...
No Matches
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 at wanadoo.fr
5 * Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 * Copyright (C) 2018 CERN
7 * Author: Maciej Suminski <[email protected]>
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
28#ifndef BOARD_PRINTOUT_H
29#define BOARD_PRINTOUT_H
30
31#include <wx/print.h>
32#include <layer_ids.h>
33#include <lset.h>
34#include <printout.h>
35#include <math/box2.h>
36
37#include <memory>
38
39namespace KIGFX
40{
41class GAL;
42class VIEW;
43class PAINTER;
44};
45
46
48{
49 BOARD_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo );
50
52 {
53 }
54
56 bool m_Mirror;
57
58 void Load( APP_SETTINGS_BASE* aConfig ) override;
59 void Save( APP_SETTINGS_BASE* aConfig ) override;
60};
61
62
67class BOARD_PRINTOUT : public wxPrintout
68{
69public:
70 BOARD_PRINTOUT( const BOARD_PRINTOUT_SETTINGS& aParams, const KIGFX::VIEW* aView,
71 const wxString& aTitle );
72
73 virtual ~BOARD_PRINTOUT() {}
74
75 void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo ) override;
76
77 bool HasPage( int aPage ) override
78 {
79 return aPage <= m_settings.m_pageCount;
80 }
81
92 virtual void DrawPage( const wxString& aLayerName = wxEmptyString,
93 int aPageNum = 1, int aPageCount = 1 );
94
95protected:
97 virtual int milsToIU( double aMils ) const = 0;
98
100 virtual void setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet );
101
103 virtual void setupPainter( KIGFX::PAINTER& aPainter );
104
106 virtual void setupGal( KIGFX::GAL* aGal );
107
109 virtual BOX2I getBoundingBox() = 0;
110
112 virtual std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) = 0;
113
116
119
122};
123
124#endif // BOARD_PRINTOUT_H
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
Definition: app_settings.h:92
An object derived from wxPrintout to handle the necessary information to control a printer when print...
virtual void DrawPage(const wxString &aLayerName=wxEmptyString, int aPageNum=1, int aPageCount=1)
Print a page (or a set of pages).
bool m_gerbviewPrint
True if the caller is Gerbview, false for Pcbnew.
virtual void setupPainter(KIGFX::PAINTER &aPainter)
Configures GAL object for a printout.
virtual int milsToIU(double aMils) const =0
< Convert mils to internal units
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 void setupViewLayers(KIGFX::VIEW &aView, const LSET &aLayerSet)
Configures PAINTER object for a printout.
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) override
bool HasPage(int aPage) override
virtual void setupGal(KIGFX::GAL *aGal)
Returns bounding box of the printed objects (excluding drawing-sheet frame)
BOARD_PRINTOUT_SETTINGS m_settings
virtual BOX2I getBoundingBox()=0
Returns a PAINTER instance used to draw the items.
virtual ~BOARD_PRINTOUT()
Abstract interface for drawing on a 2D-surface.
Contains all the knowledge about how to draw graphical object onto any particular output device.
Definition: painter.h:59
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition: view.h:68
LSET is a set of PCB_LAYER_IDs.
Definition: lset.h:36
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:59
The Cairo implementation of the graphics abstraction layer.
Definition: color4d.cpp:247
void Load(APP_SETTINGS_BASE *aConfig) override
LSET m_LayerSet
Layers to print.
void Save(APP_SETTINGS_BASE *aConfig) override
bool m_Mirror
Print mirrored.
virtual ~BOARD_PRINTOUT_SETTINGS()
Handle the parameters used to print a board drawing.
Definition: printout.h:32
int m_pageCount
Number of pages to print.
Definition: printout.h:61