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 <stambaughw@verizon.net>
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 <plotter.h>
35 #include <sch_screen.h>
36 #include <sch_edit_frame.h>
38 #include <reporter.h>
39 #include <widgets/unit_binder.h>
40 
42 {
46 };
47 
49 {
54 };
55 
56 class PDF_PLOTTER;
57 
59 {
60 public:
61  // / Constructors
63 
67  bool PrjConfigChanged() { return m_configChanged; }
68 
69 private:
70  void OnPageSizeSelected( wxCommandEvent& event ) override;
71  void OnPlotCurrent( wxCommandEvent& event ) override;
72  void OnPlotAll( wxCommandEvent& event ) override;
73  void OnUpdateUI( wxUpdateUIEvent& event ) override;
74 
75  void initDlg();
76 
77  // common
78  void getPlotOptions( RENDER_SETTINGS* aSettings );
79 
80  bool getModeColor()
81  { return m_ModeColorOption->GetSelection() == 0; }
82 
83  void setModeColor( bool aColor )
84  { m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); }
85 
87 
91  void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
92 
94 
95  bool getPlotDrawingSheet() { return m_plotDrawingSheet->GetValue(); }
96  void setPlotDrawingSheet( bool aPlot) { m_plotDrawingSheet->SetValue( aPlot ); }
97 
98  void PlotSchematic( bool aPlotAll );
99 
100  // PDF
101  void createPDFFile( bool aPlotAll, bool aPlotDrawingSheet,
102  RENDER_SETTINGS* aRenderSettings );
103  void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, bool aPlotDrawingSheet);
104  void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen );
105 
111  void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath );
112 
113  // DXF
114  void CreateDXFFile( bool aPlotAll, bool aPlotDrawingSheet,
115  RENDER_SETTINGS* aRenderSettings );
116  bool PlotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
117  RENDER_SETTINGS* aRenderSettings, wxPoint aPlotOffset, double aScale,
118  bool aPlotFrameRef );
119 
120  // HPGL
122  {
123  switch( m_plotOriginOpt->GetSelection() )
124  {
125  case 0:
130  }
131  }
132 
134  {
135  switch( aOriginAndUnits )
136  {
138  default:
139  m_plotOriginOpt->SetSelection( 0 );
140  break;
141 
143  m_plotOriginOpt->SetSelection( 1 );
144  break;
145 
147  m_plotOriginOpt->SetSelection( 2 );
148  break;
149 
151  m_plotOriginOpt->SetSelection( 3 );
152  break;
153  }
154  }
155 
156  void createHPGLFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings );
157  void SetHPGLPenWidth();
158  bool Plot_1_Page_HPGL( const wxString& aFileName, SCH_SCREEN* aScreen,
159  const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
160  wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef,
161  HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits );
162 
163  // PS
164  void createPSFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
165  bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
166  RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
167  wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
168 
169  // SVG
170  void createSVGFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
171  bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
172  RENDER_SETTINGS* aRenderSettings, bool aPlotBlackAndWhite,
173  bool aPlotFrameRef );
174 
184  wxFileName createPlotFileName( const wxString& aPlotFileName, const wxString& aExtension,
185  REPORTER* aReporter = NULL );
186 
188  bool m_configChanged; // true if a project config param has changed
190  static int m_pageSizeSelect; // Static to keep last option for some format
191  static int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
192  double m_HPGLPenSize; // for HPGL format only: pen size
193 
196 };
197 
198 #endif // __DIALOG_PLOT_SCHEMATIC__
void PlotSchematic(bool aPlotAll)
Plot settings, and plotting engines (PostScript, Gerber, HPGL and DXF)
void plotOneSheetPDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, bool aPlotDrawingSheet)
void OnOutputDirectoryBrowseClicked(wxCommandEvent &event) override
Set the m_outputDirectoryName variable to the selected directory from directory dialog.
Container for all the knowledge about how graphical objects are drawn on any output surface/device.
void OnUpdateUI(wxUpdateUIEvent &event) override
bool PrjConfigChanged()
Return true if the project configutation was modified.
DIALOG_PLOT_SCHEMATIC(SCH_EDIT_FRAME *parent)
void setPlotDrawingSheet(bool aPlot)
COLOR_SETTINGS * getColorSettings()
bool plotOneSheetSVG(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, bool aPlotBlackAndWhite, bool aPlotFrameRef)
void OnPlotCurrent(wxCommandEvent &event) override
Class DIALOG_PLOT_SCHEMATIC_BASE.
Schematic editor (Eeschema) main window.
void createPDFFile(bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS *aRenderSettings)
void getPlotOptions(RENDER_SETTINGS *aSettings)
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:64
void createSVGFile(bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aSettings)
void OnPageSizeSelected(wxCommandEvent &event) override
HPGL_PLOT_ORIGIN_AND_UNITS
void restoreEnvironment(PDF_PLOTTER *aPlotter, SCH_SHEET_PATH &aOldsheetpath)
Everything done, close the plot and restore the environment.
void CreateDXFFile(bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS *aRenderSettings)
void setupPlotPagePDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen)
wxFileName createPlotFileName(const wxString &aPlotFileName, const wxString &aExtension, REPORTER *aReporter=NULL)
Create a file name with an absolute path name.
void OnPlotAll(wxCommandEvent &event) override
#define NULL
bool plotOneSheetPS(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const PAGE_INFO &aPageInfo, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:67
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
void SetPlotOriginAndUnits(HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits)
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
void createPSFile(bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aSettings)
HPGL_PLOT_ORIGIN_AND_UNITS GetPlotOriginAndUnits()
bool PlotOneSheetDXF(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, wxPoint aPlotOffset, double aScale, bool aPlotFrameRef)
bool Plot_1_Page_HPGL(const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, RENDER_SETTINGS *aRenderSettings, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef, HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits)
Base plotter engine class.
Definition: plotter.h:121
Color settings are a bit different than most of the settings objects in that there can be more than o...
void createHPGLFile(bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aRenderSettings)
void setModeColor(bool aColor)