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 along
18 * with this program. If not, see <http://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<bool>( "plot_drawing_sheet",
71 &m_plotDrawingSheet, m_plotDrawingSheet ) );
72
73 m_params.emplace_back( new JOB_PARAM<bool>( "black_and_white",
74 &m_blackAndWhite, m_blackAndWhite ) );
75
76 m_params.emplace_back( new JOB_PARAM<bool>( "show_hop_over",
77 &m_show_hop_over, m_show_hop_over ) );
78
79 m_params.emplace_back( new JOB_PARAM<JOB_PAGE_SIZE>( "page_size",
80 &m_pageSizeSelect, m_pageSizeSelect ) );
81
82 m_params.emplace_back( new JOB_PARAM<bool>( "use_background_color",
83 &m_useBackgroundColor, m_useBackgroundColor ) );
84
85 m_params.emplace_back( new JOB_PARAM<int>( "min_pen_width",
86 &m_minPenWidth, m_minPenWidth ) );
87
88 m_params.emplace_back( new JOB_PARAM<bool>( "pdf_property_popups",
89 &m_PDFPropertyPopups, m_PDFPropertyPopups ) );
90
91 m_params.emplace_back( new JOB_PARAM<bool>( "pdf_hierarchical_links",
92 &m_PDFHierarchicalLinks, m_PDFHierarchicalLinks ) );
93
94 m_params.emplace_back( new JOB_PARAM<bool>( "pdf_metadata",
95 &m_PDFMetadata, m_PDFMetadata ) );
96
97 m_params.emplace_back( new JOB_PARAM<wxString>( "color_theme",
98 &m_theme, m_theme ) );
99
100 m_params.emplace_back( new JOB_PARAM<wxString>( "variant_name", &m_variant, m_variant ) );
101
102 m_params.emplace_back( new JOB_PARAM_LIST<wxString>( "variant_names", &m_variantNames,
103 m_variantNames ) );
104}
105
106
107JOB_EXPORT_SCH_PLOT_PDF::JOB_EXPORT_SCH_PLOT_PDF( bool aOutputIsDirectory ) :
108 JOB_EXPORT_SCH_PLOT( aOutputIsDirectory )
109{
110 m_plotFormat = SCH_PLOT_FORMAT::PDF;
111}
112
113
115{
116 return _( "Export PDF" );
117}
118
119
121{
122 return _( "Export PDF Job Settings" );
123}
124
125
126JOB_EXPORT_SCH_PLOT_DXF ::JOB_EXPORT_SCH_PLOT_DXF () :
127 JOB_EXPORT_SCH_PLOT( true )
128{
129 m_plotFormat = SCH_PLOT_FORMAT::DXF;
130}
131
132
134{
135 return _( "Export DXF" );
136}
137
138
140{
141 return _( "Export DXF Job Settings" );
142}
143
144
146 JOB_EXPORT_SCH_PLOT( true )
147{
148 m_plotFormat = SCH_PLOT_FORMAT::SVG;
149}
150
151
153{
154 return _( "Export SVG" );
155}
156
157
159{
160 return _( "Export SVG Job Settings" );
161}
162
163
165 JOB_EXPORT_SCH_PLOT( true )
166{
167 m_plotFormat = SCH_PLOT_FORMAT::POST;
168}
169
170
172{
173 return _( "Export Postscript" );
174}
175
176
178{
179 return _( "Export Postscript Job Settings" );
180}
181
182
184 JOB_EXPORT_SCH_PLOT( true )
185{
186 m_plotFormat = SCH_PLOT_FORMAT::HPGL;
187}
188
189
191{
192 return _( "Export HPGL" );
193}
194
195
197 JOB_EXPORT_SCH_PLOT( true ),
198 m_dpi( DEFAULT_PNG_DPI ),
199 m_antialias( true )
200{
201 m_plotFormat = SCH_PLOT_FORMAT::PNG;
202 m_params.emplace_back( new JOB_PARAM<int>( "dpi", &m_dpi, m_dpi ) );
203 m_params.emplace_back( new JOB_PARAM<bool>( "antialias", &m_antialias, m_antialias ) );
204}
205
206
208{
209 return _( "Export PNG" );
210}
211
212
214{
215 return _( "Export PNG Job Settings" );
216}
217
218
219REGISTER_JOB( sch_export_plot_svg, _HKI( "Schematic: Export SVG" ), KIWAY::FACE_SCH,
221REGISTER_DEPRECATED_JOB( sch_export_plot_hpgl, _HKI( "Schematic: Export HPGL" ), KIWAY::FACE_SCH,
223REGISTER_JOB( sch_export_plot_ps, _HKI( "Schematic: Export Postscript" ), KIWAY::FACE_SCH,
225REGISTER_JOB( sch_export_plot_dxf, _HKI( "Schematic: Export DXF" ), KIWAY::FACE_SCH,
227REGISTER_JOB( sch_export_plot_pdf, _HKI( "Schematic: Export PDF" ), KIWAY::FACE_SCH,
229REGISTER_JOB( sch_export_plot_png, _HKI( "Schematic: Export PNG" ), KIWAY::FACE_SCH,
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)
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
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:322
#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:44
constexpr int DEFAULT_PNG_DPI
Definition plotter_png.h:28
@ PAGE_SIZE_AUTO
Definition sch_plotter.h:49