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 <printout.h>
34#include <math/box2.h>
35
36#include <memory>
37
38namespace KIGFX
39{
40class GAL;
41class VIEW;
42class PAINTER;
43};
44
45
47{
48 BOARD_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo );
49
51 {
52 }
53
55 bool m_Mirror;
56
57 void Load( APP_SETTINGS_BASE* aConfig ) override;
58 void Save( APP_SETTINGS_BASE* aConfig ) override;
59};
60
61
66class BOARD_PRINTOUT : public wxPrintout
67{
68public:
69 BOARD_PRINTOUT( const BOARD_PRINTOUT_SETTINGS& aParams, const KIGFX::VIEW* aView,
70 const wxString& aTitle );
71
72 virtual ~BOARD_PRINTOUT() {}
73
74 void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo ) override;
75
76 bool HasPage( int aPage ) override
77 {
78 return aPage <= m_settings.m_pageCount;
79 }
80
91 virtual void DrawPage( const wxString& aLayerName = wxEmptyString,
92 int aPageNum = 1, int aPageCount = 1 );
93
94protected:
96 virtual int milsToIU( double aMils ) const = 0;
97
99 virtual void setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet );
100
102 virtual void setupPainter( KIGFX::PAINTER& aPainter );
103
105 virtual void setupGal( KIGFX::GAL* aGal );
106
108 virtual BOX2I getBoundingBox() = 0;
109
111 virtual std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) = 0;
112
115
118
121};
122
123#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: layer_ids.h:575
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