KiCad PCB EDA Suite
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
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 <mark.roszko@gmail.com>
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>
24
26 {
30 } )
31
33 {
34 { JOB_HPGL_PAGE_SIZE::DEFAULT, "default" },
46 } )
47
49 {
54 } )
55
57 {
58 { SCH_PLOT_FORMAT::HPGL, "hpgl" },
59 { SCH_PLOT_FORMAT::PDF, "pdf" },
60 { SCH_PLOT_FORMAT::POST, "post" },
61 { SCH_PLOT_FORMAT::SVG, "svg" },
62 { SCH_PLOT_FORMAT::DXF, "dxf" },
63 } )
64
65JOB_EXPORT_SCH_PLOT::JOB_EXPORT_SCH_PLOT( bool aOutputIsDirectory ) :
66 JOB( "plot", aOutputIsDirectory ),
67 m_plotFormat( SCH_PLOT_FORMAT::PDF ),
68 m_filename(),
69 m_drawingSheet(),
70 m_plotAll( true ),
71 m_plotDrawingSheet( true ),
72 m_blackAndWhite( false ),
73 m_pageSizeSelect( JOB_PAGE_SIZE::PAGE_SIZE_AUTO ),
74 m_useBackgroundColor( true ),
75 m_minPenWidth( 847 /* hairline @ 300dpi */ ),
76 m_HPGLPenSize( 1.0 ),
77 m_HPGLPaperSizeSelect( JOB_HPGL_PAGE_SIZE::DEFAULT ),
78 m_PDFPropertyPopups( true ),
79 m_PDFHierarchicalLinks( true ),
80 m_PDFMetadata( true ),
81 m_theme(),
83{
84 m_params.emplace_back( new JOB_PARAM<SCH_PLOT_FORMAT>( "format",
85 &m_plotFormat, m_plotFormat ) );
86
87 m_params.emplace_back( new JOB_PARAM<wxString>( "drawing_sheet",
88 &m_drawingSheet, m_drawingSheet ) );
89
90 m_params.emplace_back( new JOB_PARAM<bool>( "plot_all",
91 &m_plotAll, m_plotAll ) );
92
93 m_params.emplace_back( new JOB_PARAM<bool>( "plot_drawing_sheet",
94 &m_plotDrawingSheet, m_plotDrawingSheet ) );
95
96 m_params.emplace_back( new JOB_PARAM<bool>( "black_and_white",
97 &m_blackAndWhite, m_blackAndWhite ) );
98
99 m_params.emplace_back( new JOB_PARAM<JOB_PAGE_SIZE>( "page_size",
100 &m_pageSizeSelect, m_pageSizeSelect ) );
101
102 m_params.emplace_back( new JOB_PARAM<bool>( "use_background_color",
103 &m_useBackgroundColor, m_useBackgroundColor ) );
104
105 m_params.emplace_back( new JOB_PARAM<int>( "min_pen_width",
106 &m_minPenWidth, m_minPenWidth ) );
107
108 m_params.emplace_back( new JOB_PARAM<double>( "hpgl_pen_size",
109 &m_HPGLPenSize, m_HPGLPenSize ) );
110
111 m_params.emplace_back( new JOB_PARAM<JOB_HPGL_PAGE_SIZE>( "hpgl_page_size",
112 &m_HPGLPaperSizeSelect, m_HPGLPaperSizeSelect ) );
113
114 m_params.emplace_back( new JOB_PARAM<bool>( "pdf_property_popups",
115 &m_PDFPropertyPopups, m_PDFPropertyPopups ) );
116
117 m_params.emplace_back( new JOB_PARAM<bool>( "pdf_hierarchical_links",
118 &m_PDFHierarchicalLinks, m_PDFHierarchicalLinks ) );
119
120 m_params.emplace_back( new JOB_PARAM<bool>( "pdf_metadata",
121 &m_PDFMetadata, m_PDFMetadata ) );
122
123 m_params.emplace_back( new JOB_PARAM<wxString>( "color_theme",
124 &m_theme, m_theme ) );
125
126 m_params.emplace_back( new JOB_PARAM<JOB_HPGL_PLOT_ORIGIN_AND_UNITS>( "hpgl_plot_origin",
127 &m_HPGLPlotOrigin, m_HPGLPlotOrigin ) );
128
129}
130
131
132JOB_EXPORT_SCH_PLOT_PDF::JOB_EXPORT_SCH_PLOT_PDF( bool aOutputIsDirectory ) :
133 JOB_EXPORT_SCH_PLOT( aOutputIsDirectory )
134{
135 m_plotFormat = SCH_PLOT_FORMAT::PDF;
136}
137
138
140{
141 return _( "Export PDF" );
142}
143
144
146{
147 return _( "Export PDF Job Settings" );
148}
149
150
151JOB_EXPORT_SCH_PLOT_DXF ::JOB_EXPORT_SCH_PLOT_DXF () :
152 JOB_EXPORT_SCH_PLOT( true )
153{
154 m_plotFormat = SCH_PLOT_FORMAT::DXF;
155}
156
157
159{
160 return _( "Export DXF" );
161}
162
163
165{
166 return _( "Export DXF Job Settings" );
167}
168
169
171 JOB_EXPORT_SCH_PLOT( true )
172{
173 m_plotFormat = SCH_PLOT_FORMAT::SVG;
174}
175
176
178{
179 return _( "Export SVG" );
180}
181
182
184{
185 return _( "Export SVG Job Settings" );
186}
187
188
190 JOB_EXPORT_SCH_PLOT( true )
191{
192 m_plotFormat = SCH_PLOT_FORMAT::POST;
193}
194
195
197{
198 return _( "Export Postscript" );
199}
200
201
203{
204 return _( "Export Postscript Job Settings" );
205}
206
207
209 JOB_EXPORT_SCH_PLOT( true )
210{
211 m_plotFormat = SCH_PLOT_FORMAT::HPGL;
212}
213
214
216{
217 return _( "Export HPGL" );
218}
219
220
222{
223 return _( "Export HPGL Job Settings" );
224}
225
226
227REGISTER_JOB( sch_export_plot_svg, _HKI( "Schematic: Export SVG" ), KIWAY::FACE_SCH,
229REGISTER_JOB( sch_export_plot_hpgl, _HKI( "Schematic: Export HPGL" ), KIWAY::FACE_SCH,
231REGISTER_JOB( sch_export_plot_ps, _HKI( "Schematic: Export Postscript" ), KIWAY::FACE_SCH,
233REGISTER_JOB( sch_export_plot_dxf, _HKI( "Schematic: Export DXF" ), KIWAY::FACE_SCH,
235REGISTER_JOB( sch_export_plot_pdf, _HKI( "Schematic: Export PDF" ), KIWAY::FACE_SCH,
wxString GetSettingsDialogTitle() const override
wxString GetDefaultDescription() const override
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
JOB_EXPORT_SCH_PLOT_PDF(bool aOutputIsDirectory=true)
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
wxString GetDefaultDescription() const override
wxString GetSettingsDialogTitle() const override
JOB_EXPORT_SCH_PLOT(bool aOutputIsDirectory)
Definition: job.h:50
An simple container class that lets us dispatch output jobs to kifaces.
Definition: job.h:182
@ FACE_SCH
eeschema DSO
Definition: kiway.h:292
#define _HKI(x)
#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(JOB_HPGL_PAGE_SIZE
SCH_PLOT_FORMAT
JOB_PAGE_SIZE
JOB_HPGL_PLOT_ORIGIN_AND_UNITS
JOB_HPGL_PAGE_SIZE
#define REGISTER_JOB(job_name, title, face, T)
Definition: job_registry.h:64
@ PAGE_SIZE_AUTO
Definition: sch_plotter.h:57