KiCad PCB EDA Suite
Loading...
Searching...
No Matches
job_export_sch_plot.cpp
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) 2023 Mark Roszko <[email protected]>
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <https://www.gnu.org/licenses/>.
19 */
20
22#include <jobs/job_registry.h>
23#include <i18n_utility.h>
25
27 {
31 } )
32
34 {
35 { SCH_PLOT_FORMAT::HPGL, "hpgl" },
36 { SCH_PLOT_FORMAT::PDF, "pdf" },
37 { SCH_PLOT_FORMAT::POST, "post" },
38 { SCH_PLOT_FORMAT::SVG, "svg" },
39 { SCH_PLOT_FORMAT::DXF, "dxf" },
40 { SCH_PLOT_FORMAT::PNG, "png" },
41 } )
42
43JOB_EXPORT_SCH_PLOT::JOB_EXPORT_SCH_PLOT( bool aOutputIsDirectory ) :
44 JOB( "plot", aOutputIsDirectory ),
45 m_plotFormat( SCH_PLOT_FORMAT::PDF ),
46 m_filename(),
47 m_drawingSheet(),
48 m_plotAll( true ),
49 m_plotDrawingSheet( true ),
50 m_show_hop_over( false ),
51 m_blackAndWhite( false ),
52 m_pageSizeSelect( JOB_PAGE_SIZE::PAGE_SIZE_AUTO ),
53 m_useBackgroundColor( true ),
54 m_minPenWidth( 847 /* hairline @ 300dpi */ ),
55 m_PDFPropertyPopups( true ),
56 m_PDFHierarchicalLinks( true ),
57 m_PDFMetadata( true ),
58 m_theme(),
59 m_variantNames()
60{
61 m_params.emplace_back( new JOB_PARAM<SCH_PLOT_FORMAT>( "format",
62 &m_plotFormat, m_plotFormat ) );
63
64 m_params.emplace_back( new JOB_PARAM<wxString>( "drawing_sheet",
65 &m_drawingSheet, m_drawingSheet ) );
66
67 m_params.emplace_back( new JOB_PARAM<bool>( "plot_all",
68 &m_plotAll, m_plotAll ) );
69
70 m_params.emplace_back( new JOB_PARAM<wxString>( "sheet_path",
71 &m_sheetPath, m_sheetPath ) );
72
73 m_params.emplace_back( new JOB_PARAM<bool>( "plot_drawing_sheet",
74 &m_plotDrawingSheet, m_plotDrawingSheet ) );
75
76 m_params.emplace_back( new JOB_PARAM<bool>( "black_and_white",
77 &m_blackAndWhite, m_blackAndWhite ) );
78
79 m_params.emplace_back( new JOB_PARAM<bool>( "show_hop_over",
80 &m_show_hop_over, m_show_hop_over ) );
81
82 m_params.emplace_back( new JOB_PARAM<JOB_PAGE_SIZE>( "page_size",
83 &m_pageSizeSelect, m_pageSizeSelect ) );
84
85 m_params.emplace_back( new JOB_PARAM<bool>( "use_background_color",
86 &m_useBackgroundColor, m_useBackgroundColor ) );
87
88 m_params.emplace_back( new JOB_PARAM<int>( "min_pen_width",
89 &m_minPenWidth, m_minPenWidth ) );
90
91 m_params.emplace_back( new JOB_PARAM<bool>( "pdf_property_popups",
92 &m_PDFPropertyPopups, m_PDFPropertyPopups ) );
93
94 m_params.emplace_back( new JOB_PARAM<bool>( "pdf_hierarchical_links",
95 &m_PDFHierarchicalLinks, m_PDFHierarchicalLinks ) );
96
97 m_params.emplace_back( new JOB_PARAM<bool>( "pdf_metadata",
98 &m_PDFMetadata, m_PDFMetadata ) );
99
100 m_params.emplace_back( new JOB_PARAM<wxString>( "color_theme",
101 &m_theme, m_theme ) );
102
103 m_params.emplace_back( new JOB_PARAM<wxString>( "variant_name", &m_variant, m_variant ) );
104
105 m_params.emplace_back( new JOB_PARAM_LIST<wxString>( "variant_names", &m_variantNames,
106 m_variantNames ) );
107}
108
109
110JOB_EXPORT_SCH_PLOT_PDF::JOB_EXPORT_SCH_PLOT_PDF( bool aOutputIsDirectory ) :
111 JOB_EXPORT_SCH_PLOT( aOutputIsDirectory )
112{
113 m_plotFormat = SCH_PLOT_FORMAT::PDF;
114}
115
116
118{
119 return _( "Export PDF" );
120}
121
122
124{
125 return _( "Export PDF Job Settings" );
126}
127
128
129JOB_EXPORT_SCH_PLOT_DXF::JOB_EXPORT_SCH_PLOT_DXF( bool aOutputIsDirectory ) :
130 JOB_EXPORT_SCH_PLOT( aOutputIsDirectory )
131{
132 m_plotFormat = SCH_PLOT_FORMAT::DXF;
133}
134
135
137{
138 return _( "Export DXF" );
139}
140
141
143{
144 return _( "Export DXF Job Settings" );
145}
146
147
148JOB_EXPORT_SCH_PLOT_SVG::JOB_EXPORT_SCH_PLOT_SVG( bool aOutputIsDirectory ) :
149 JOB_EXPORT_SCH_PLOT( aOutputIsDirectory )
150{
151 m_plotFormat = SCH_PLOT_FORMAT::SVG;
152}
153
154
156{
157 return _( "Export SVG" );
158}
159
160
162{
163 return _( "Export SVG Job Settings" );
164}
165
166
167JOB_EXPORT_SCH_PLOT_PS::JOB_EXPORT_SCH_PLOT_PS( bool aOutputIsDirectory ) :
168 JOB_EXPORT_SCH_PLOT( aOutputIsDirectory )
169{
170 m_plotFormat = SCH_PLOT_FORMAT::POST;
171}
172
173
175{
176 return _( "Export Postscript" );
177}
178
179
181{
182 return _( "Export Postscript Job Settings" );
183}
184
185
187 JOB_EXPORT_SCH_PLOT( true )
188{
189 m_plotFormat = SCH_PLOT_FORMAT::HPGL;
190}
191
192
194{
195 return _( "Export HPGL" );
196}
197
198
199JOB_EXPORT_SCH_PLOT_PNG::JOB_EXPORT_SCH_PLOT_PNG( bool aOutputIsDirectory ) :
200 JOB_EXPORT_SCH_PLOT( aOutputIsDirectory ),
201 m_dpi( DEFAULT_PNG_DPI ),
202 m_antialias( true )
203{
204 m_plotFormat = SCH_PLOT_FORMAT::PNG;
205 m_params.emplace_back( new JOB_PARAM<int>( "dpi", &m_dpi, m_dpi ) );
206 m_params.emplace_back( new JOB_PARAM<bool>( "antialias", &m_antialias, m_antialias ) );
207}
208
209
211{
212 return _( "Export PNG" );
213}
214
215
217{
218 return _( "Export PNG Job Settings" );
219}
220
221
222REGISTER_JOB( sch_export_plot_svg, _HKI( "Schematic: Export SVG" ), KIWAY::FACE_SCH,
224REGISTER_DEPRECATED_JOB( sch_export_plot_hpgl, _HKI( "Schematic: Export HPGL" ), KIWAY::FACE_SCH,
226REGISTER_JOB( sch_export_plot_ps, _HKI( "Schematic: Export Postscript" ), KIWAY::FACE_SCH,
228REGISTER_JOB( sch_export_plot_dxf, _HKI( "Schematic: Export DXF" ), KIWAY::FACE_SCH,
230REGISTER_JOB( sch_export_plot_pdf, _HKI( "Schematic: Export PDF" ), KIWAY::FACE_SCH,
232REGISTER_JOB( sch_export_plot_png, _HKI( "Schematic: Export PNG" ), KIWAY::FACE_SCH,
JOB_EXPORT_SCH_PLOT_DXF(bool aOutputIsDirectory=true)
wxString GetSettingsDialogTitle() const override
wxString GetDefaultDescription() const override
wxString GetDefaultDescription() const override
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
JOB_EXPORT_SCH_PLOT_PDF(bool aOutputIsDirectory=false)
JOB_EXPORT_SCH_PLOT_PNG(bool aOutputIsDirectory=true)
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
wxString GetDefaultDescription() const override
JOB_EXPORT_SCH_PLOT_PS(bool aOutputIsDirectory=true)
wxString GetSettingsDialogTitle() const override
JOB_EXPORT_SCH_PLOT_SVG(bool aOutputIsDirectory=true)
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
JOB_EXPORT_SCH_PLOT(bool aOutputIsDirectory)
An simple container class that lets us dispatch output jobs to kifaces.
Definition job.h:184
@ FACE_SCH
eeschema DSO
Definition kiway.h:355
#define _(s)
Some functions to handle hotkeys in KiCad.
NLOHMANN_JSON_SERIALIZE_ENUM(JOB_PAGE_SIZE, { { JOB_PAGE_SIZE::PAGE_SIZE_AUTO, "auto" }, { JOB_PAGE_SIZE::PAGE_SIZE_A4, "A4" }, { JOB_PAGE_SIZE::PAGE_SIZE_A, "A" }, }) NLOHMANN_JSON_SERIALIZE_ENUM(SCH_PLOT_FORMAT
SCH_PLOT_FORMAT
#define REGISTER_JOB(job_name, title, face, T)
#define REGISTER_DEPRECATED_JOB(job_name, title, face, T)
#define _HKI(x)
Definition page_info.cpp:40
constexpr int DEFAULT_PNG_DPI
Definition plotter_png.h:28
@ PAGE_SIZE_AUTO
Definition sch_plotter.h:47