KiCad PCB EDA Suite
dialog_plot_schematic.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) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
5 * Copyright (C) 1992-2010 Lorenzo Marcantonio
6 * Copyright (C) 2011 Wayne Stambaugh <[email protected]>
7 * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors.
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, you may find one here:
21 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
22 * or you may search the http://www.gnu.org website for the version 2 license,
23 * or you may write to the Free Software Foundation, Inc.,
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
25 */
26
31#ifndef __DIALOG_PLOT_SCHEMATIC__
32#define __DIALOG_PLOT_SCHEMATIC__
33
34#include <plotters/plotter.h>
36#include <widgets/unit_binder.h>
37
39{
43};
44
46{
51};
52
53class PDF_PLOTTER;
54class SCH_REPORTER;
55class SCH_EDIT_FRAME;
56class SCH_SCREEN;
57class SCH_SHEET_PATH;
58
59
61{
62public:
64
69
70private:
71 void OnPageSizeSelected( wxCommandEvent& event ) override;
72 void OnPlotCurrent( wxCommandEvent& event ) override;
73 void OnPlotAll( wxCommandEvent& event ) override;
74 void OnUpdateUI( wxUpdateUIEvent& event ) override;
75
76 void initDlg();
77
78 // common
79 void getPlotOptions( RENDER_SETTINGS* aSettings );
80
81 bool getModeColor() { return m_ModeColorOption->GetSelection() == 0; }
82
83 void setModeColor( bool aColor ) { m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); }
84
86
90 void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
91
93
94 bool getPlotDrawingSheet() { return m_plotDrawingSheet->GetValue(); }
95 void setPlotDrawingSheet( bool aPlot) { m_plotDrawingSheet->SetValue( aPlot ); }
96
97 void plotSchematic( bool aPlotAll );
98
99 // PDF
100 void createPDFFile( bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS* aRenderSettings );
101 void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, bool aPlotDrawingSheet);
102 void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen );
103
110 void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath );
111
112 // DXF
113 void createDXFFiles( bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS* aRenderSettings );
114 bool plotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
115 RENDER_SETTINGS* aRenderSettings, const wxPoint& aPlotOffset,
116 double aScale, bool aPlotFrameRef );
117
118 // HPGLGetPlotOriginAndUnits
120 {
121 switch( m_plotOriginOpt->GetSelection() )
122 {
123 case 0:
128 }
129 }
130
132 {
133 switch( aOriginAndUnits )
134 {
136 default:
137 m_plotOriginOpt->SetSelection( 0 );
138 break;
139
141 m_plotOriginOpt->SetSelection( 1 );
142 break;
143
145 m_plotOriginOpt->SetSelection( 2 );
146 break;
147
149 m_plotOriginOpt->SetSelection( 3 );
150 break;
151 }
152 }
153
154 void createHPGLFiles( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings );
155 void setHpglPenWidth();
156 bool plotOneSheetHpgl( const wxString& aFileName, SCH_SCREEN* aScreen,
157 const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
158 const wxPoint& aPlot0ffset, double aScale, bool aPlotFrameRef,
159 HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits );
160
161 // PS
162 void createPSFiles( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
163 bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
164 RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
165 const wxPoint& aPlot0ffset, double aScale, bool aPlotFrameRef );
166
167 // SVG
168 void createSVGFiles( bool aPrintAll, bool aPrintFrameRef, RENDER_SETTINGS* aRenderSettings );
169 bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
170 RENDER_SETTINGS* aRenderSettings, bool aPlotBlackAndWhite,
171 bool aPlotFrameRef );
172
182 wxFileName createPlotFileName( const wxString& aPlotFileName, const wxString& aExtension,
183 REPORTER* aReporter = nullptr );
184
201 wxString getOutputPath();
202
204 bool m_configChanged; // true if a project config param has changed
206 static int m_pageSizeSelect; // Static to keep last option for some format
207 static int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
208 double m_HPGLPenSize; // for HPGL format only: pen size
209
212};
213
214#endif // __DIALOG_PLOT_SCHEMATIC__
Color settings are a bit different than most of the settings objects in that there can be more than o...
Class DIALOG_PLOT_SCHEMATIC_BASE.
DIALOG_PLOT_SCHEMATIC(SCH_EDIT_FRAME *parent)
void OnPageSizeSelected(wxCommandEvent &event) override
void OnPlotAll(wxCommandEvent &event) override
void restoreEnvironment(PDF_PLOTTER *aPlotter, SCH_SHEET_PATH &aOldsheetpath)
Everything done, close the plot and restore the environment.
void createDXFFiles(bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS *aRenderSettings)
bool plotOneSheetDXF(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const wxPoint &aPlotOffset, double aScale, bool aPlotFrameRef)
bool plotOneSheetHpgl(const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, RENDER_SETTINGS *aRenderSettings, const wxPoint &aPlot0ffset, double aScale, bool aPlotFrameRef, HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits)
void OnOutputDirectoryBrowseClicked(wxCommandEvent &event) override
Set the m_outputDirectoryName variable to the selected directory from directory dialog.
void createSVGFiles(bool aPrintAll, bool aPrintFrameRef, RENDER_SETTINGS *aRenderSettings)
wxFileName createPlotFileName(const wxString &aPlotFileName, const wxString &aExtension, REPORTER *aReporter=nullptr)
Create a file name with an absolute path name.
void createPSFiles(bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aSettings)
void setupPlotPagePDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen)
void OnPlotCurrent(wxCommandEvent &event) override
void setPlotOriginAndUnits(HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits)
HPGL_PLOT_ORIGIN_AND_UNITS getPlotOriginAndUnits()
void setModeColor(bool aColor)
void createHPGLFiles(bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aRenderSettings)
void setPlotDrawingSheet(bool aPlot)
bool PrjConfigChanged()
Return true if the project configuration was modified.
void getPlotOptions(RENDER_SETTINGS *aSettings)
COLOR_SETTINGS * getColorSettings()
void plotOneSheetPDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, bool aPlotDrawingSheet)
bool plotOneSheetSVG(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, bool aPlotBlackAndWhite, bool aPlotFrameRef)
bool plotOneSheetPS(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const PAGE_INFO &aPageInfo, const wxPoint &aPlot0ffset, double aScale, bool aPlotFrameRef)
void plotSchematic(bool aPlotAll)
void OnUpdateUI(wxUpdateUIEvent &event) override
void createPDFFile(bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS *aRenderSettings)
wxString getOutputPath()
Determine the best absolute path to plot files given the contents of the path edit control.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
Base plotter engine class.
Definition: plotter.h:109
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:71
Schematic editor (Eeschema) main window.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
@ PAGE_SIZE_AUTO
@ PAGE_SIZE_A
@ PAGE_SIZE_A4
HPGL_PLOT_ORIGIN_AND_UNITS
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:69