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 (C) 2023 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::GERBER, "gerber" },
61 { SCH_PLOT_FORMAT::POST, "post" },
62 { SCH_PLOT_FORMAT::SVG, "svg" },
63 { SCH_PLOT_FORMAT::DXF, "dxf" },
64 } )
65
67 JOB( "plot", false, aIsCli ),
68 m_plotFormat( SCH_PLOT_FORMAT::PDF ),
69 m_filename(),
70 m_drawingSheet(),
71 m_plotAll( true ),
72 m_plotDrawingSheet( true ),
73 m_blackAndWhite( false ),
74 m_pageSizeSelect( JOB_PAGE_SIZE::PAGE_SIZE_AUTO ),
75 m_useBackgroundColor( true ),
76 m_HPGLPenSize( 1.0 ),
77 m_HPGLPaperSizeSelect( JOB_HPGL_PAGE_SIZE::DEFAULT ),
78 m_PDFPropertyPopups( true ),
79 m_PDFMetadata( true ),
80 m_theme(),
81 m_outputDirectory(),
82 m_outputFile(),
84{
85 m_params.emplace_back(
86 new JOB_PARAM<SCH_PLOT_FORMAT>( "format", &m_plotFormat, m_plotFormat ) );
87 m_params.emplace_back(
88 new JOB_PARAM<wxString>( "drawing_sheet", &m_drawingSheet, m_drawingSheet ) );
89 m_params.emplace_back( new JOB_PARAM<bool>( "plot_all", &m_plotAll, m_plotAll ) );
90 m_params.emplace_back(
91 new JOB_PARAM<bool>( "plot_drawing_sheet", &m_plotDrawingSheet, m_plotDrawingSheet ) );
92 m_params.emplace_back(
93 new JOB_PARAM<bool>( "black_and_white", &m_blackAndWhite, m_blackAndWhite ) );
94 m_params.emplace_back(
95 new JOB_PARAM<JOB_PAGE_SIZE>( "page_size", &m_pageSizeSelect, m_pageSizeSelect ) );
96 m_params.emplace_back( new JOB_PARAM<bool>( "use_background_color", &m_useBackgroundColor,
97 m_useBackgroundColor ) );
98 m_params.emplace_back(
99 new JOB_PARAM<double>( "hpgl_pen_size", &m_HPGLPenSize, m_HPGLPenSize ) );
100 m_params.emplace_back( new JOB_PARAM<JOB_HPGL_PAGE_SIZE>(
101 "hpgl_page_size", &m_HPGLPaperSizeSelect, m_HPGLPaperSizeSelect ) );
102 m_params.emplace_back( new JOB_PARAM<bool>( "pdf_property_popups", &m_PDFPropertyPopups,
103 m_PDFPropertyPopups ) );
104 m_params.emplace_back( new JOB_PARAM<bool>( "pdf_metadata", &m_PDFMetadata, m_PDFMetadata ) );
105 m_params.emplace_back( new JOB_PARAM<wxString>( "color_theme", &m_theme, m_theme ) );
106 m_params.emplace_back(
107 new JOB_PARAM<wxString>( "output_filename", &m_outputFile, m_outputFile ) );
108 m_params.emplace_back(
109 new JOB_PARAM<wxString>( "output_directory", &m_outputDirectory, m_outputDirectory ) );
110 m_params.emplace_back( new JOB_PARAM<JOB_HPGL_PLOT_ORIGIN_AND_UNITS>(
111 "hpgl_plot_origin", &m_HPGLPlotOrigin, m_HPGLPlotOrigin ) );
112
113}
114
115
117{
118 return wxString::Format( _( "Schematic plot export" ) );
119}
120
121
123 JOB_EXPORT_SCH_PLOT( aIsCli )
124{
125 m_plotFormat = SCH_PLOT_FORMAT::PDF;
126}
127
128
129JOB_EXPORT_SCH_PLOT_DXF ::JOB_EXPORT_SCH_PLOT_DXF ( bool aIsCli ) :
130 JOB_EXPORT_SCH_PLOT( aIsCli )
131{
132 m_plotFormat = SCH_PLOT_FORMAT::DXF;
133}
134
135
137 JOB_EXPORT_SCH_PLOT( aIsCli )
138{
139 m_plotFormat = SCH_PLOT_FORMAT::SVG;
140}
141
142
144 JOB_EXPORT_SCH_PLOT( aIsCli )
145{
146 m_plotFormat = SCH_PLOT_FORMAT::POST;
147}
148
149
151 JOB_EXPORT_SCH_PLOT( aIsCli )
152{
153 m_plotFormat = SCH_PLOT_FORMAT::HPGL;
154}
155
156
157REGISTER_JOB( sch_export_plot_svg, _HKI( "Schematic: Export SVG" ), KIWAY::FACE_SCH,
159REGISTER_JOB( sch_export_plot_hpgl, _HKI( "Schematic: Export HPGL" ), KIWAY::FACE_SCH,
161REGISTER_JOB( sch_export_plot_ps, _HKI( "Schematic: Export PS" ), KIWAY::FACE_SCH,
163REGISTER_JOB( sch_export_plot_dxf, _HKI( "Schematic: Export DXF" ), KIWAY::FACE_SCH,
165REGISTER_JOB( sch_export_plot_pdf, _HKI( "Schematic: Export PDF" ), KIWAY::FACE_SCH,
JOB_EXPORT_SCH_PLOT_HPGL(bool aIsCli)
JOB_EXPORT_SCH_PLOT_PDF(bool aIsCli)
JOB_EXPORT_SCH_PLOT_PS(bool aIsCli)
JOB_EXPORT_SCH_PLOT_SVG(bool aIsCli)
JOB_EXPORT_SCH_PLOT(bool aIsCli)
wxString GetDescription() override
Definition: job.h:45
An simple container class that lets us dispatch output jobs to kifaces.
Definition: job.h:79
@ FACE_SCH
eeschema DSO
Definition: kiway.h:291
#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