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 The 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, see <https://www.gnu.org/licenses/>.
21 */
22
23
24#ifndef BOARD_PRINTOUT_H
25#define BOARD_PRINTOUT_H
26
27#include <wx/print.h>
28#include <layer_ids.h>
29#include <lset.h>
30#include <printout.h>
31#include <math/box2.h>
32
33#include <memory>
34
35namespace KIGFX
36{
37class GAL;
38class VIEW;
39class PAINTER;
40};
41
42
44{
45 BOARD_PRINTOUT_SETTINGS( const PAGE_INFO& aPageInfo );
46
48 {
49 }
50
52 bool m_Mirror;
53
54 void Load( APP_SETTINGS_BASE* aConfig ) override;
55 void Save( APP_SETTINGS_BASE* aConfig ) override;
56};
57
58
63class BOARD_PRINTOUT : public wxPrintout
64{
65public:
66 BOARD_PRINTOUT( const BOARD_PRINTOUT_SETTINGS& aParams, const KIGFX::VIEW* aView,
67 const wxString& aTitle );
68
69 virtual ~BOARD_PRINTOUT() {}
70
71 void GetPageInfo( int* minPage, int* maxPage, int* selPageFrom, int* selPageTo ) override;
72
73 bool HasPage( int aPage ) override
74 {
75 return aPage <= m_settings.m_pageCount;
76 }
77
88 virtual void DrawPage( const wxString& aLayerName = wxEmptyString,
89 int aPageNum = 1, int aPageCount = 1 );
90
91protected:
93 virtual int milsToIU( double aMils ) const = 0;
94
96 virtual void setupViewLayers( KIGFX::VIEW& aView, const LSET& aLayerSet );
97
99 virtual void setupPainter( KIGFX::PAINTER& aPainter );
100
102 virtual void setupGal( KIGFX::GAL* aGal );
103
105 virtual BOX2I getBoundingBox() = 0;
106
108 virtual std::unique_ptr<KIGFX::PAINTER> getPainter( KIGFX::GAL* aGal ) = 0;
109
112
115
118};
119
120#endif // BOARD_PRINTOUT_H
BOX2< VECTOR2I > BOX2I
Definition box2.h:918
APP_SETTINGS_BASE is a settings class that should be derived for each standalone KiCad application.
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)
Configure #PAINTER 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
Return the #PAINTER instance used to draw the items.
const KIGFX::VIEW * m_view
Source VIEW object (note that actual printing only refers to this object).
virtual void setupViewLayers(KIGFX::VIEW &aView, const LSET &aLayerSet)
Enable layers visibility for a printout.
BOARD_PRINTOUT(const BOARD_PRINTOUT_SETTINGS &aParams, const KIGFX::VIEW *aView, const wxString &aTitle)
void GetPageInfo(int *minPage, int *maxPage, int *selPageFrom, int *selPageTo) override
bool HasPage(int aPage) override
virtual void setupGal(KIGFX::GAL *aGal)
Configure GAL object for a printout.
BOARD_PRINTOUT_SETTINGS m_settings
Printout parameters.
virtual BOX2I getBoundingBox()=0
Return bounding box of the printed objects (excluding drawing-sheet frame).
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:55
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
Definition view.h:63
LSET is a set of PCB_LAYER_IDs.
Definition lset.h:37
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition page_info.h:75
The Cairo implementation of the graphics abstraction layer.
Definition eda_group.h:29
void Load(APP_SETTINGS_BASE *aConfig) override
BOARD_PRINTOUT_SETTINGS(const PAGE_INFO &aPageInfo)
LSET m_LayerSet
Layers to print.
void Save(APP_SETTINGS_BASE *aConfig) override
bool m_Mirror
Print mirrored.
PRINTOUT_SETTINGS(const PAGE_INFO &aPageInfo)
Definition printout.h:33