KiCad PCB EDA Suite
dialog_plot_schematic.h
Go to the documentation of this file.
1 
4 /*
5  * This program source code file is part of KiCad, a free EDA CAD application.
6  *
7  * Copyright (C) 1992-2018 Jean-Pierre Charras jp.charras at wanadoo.fr
8  * Copyright (C) 1992-2010 Lorenzo Marcantonio
9  * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
10  * Copyright (C) 1992-2020 KiCad Developers, see AUTHORS.txt for contributors.
11  *
12  * This program is free software; you can redistribute it and/or
13  * modify it under the terms of the GNU General Public License
14  * as published by the Free Software Foundation; either version 2
15  * of the License, or (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, you may find one here:
24  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
25  * or you may search the http://www.gnu.org website for the version 2 license,
26  * or you may write to the Free Software Foundation, Inc.,
27  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
28  */
29 
30 #include <fctsys.h>
31 #include <plotter.h>
32 #include <sch_screen.h>
33 #include <sch_edit_frame.h>
35 #include <reporter.h>
36 #include <widgets/unit_binder.h>
37 
42 };
43 
44 
46 {
47 private:
49  bool m_configChanged; // true if a project config param has changed
51  static int m_pageSizeSelect; // Static to keep last option for some format
52  static int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
53  double m_HPGLPenSize; // for HPGL format only: pen size
54 
57 
58 public:
59  // / Constructors
61 
62  bool PrjConfigChanged() { return m_configChanged; } // return true if the prj config was modified
63  // and therefore should be saved
64 
65 private:
66  void OnPageSizeSelected( wxCommandEvent& event ) override;
67  void OnPlotCurrent( wxCommandEvent& event ) override;
68  void OnPlotAll( wxCommandEvent& event ) override;
69  void OnUpdateUI( wxUpdateUIEvent& event ) override;
70 
71  void initDlg();
72 
73  // common
74  void getPlotOptions( RENDER_SETTINGS* aSettings );
75 
76  bool getModeColor()
77  { return m_ModeColorOption->GetSelection() == 0; }
78 
79  void setModeColor( bool aColor )
80  { m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); }
81 
83 
87  void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
88 
90 
91  bool getPlotFrameRef() { return m_PlotFrameRefOpt->GetValue(); }
92  void setPlotFrameRef( bool aPlot) {m_PlotFrameRefOpt->SetValue( aPlot ); }
93 
94  void PlotSchematic( bool aPlotAll );
95 
96  // PDF
97  void createPDFFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings );
98  void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, bool aPlotFrameRef);
99  void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen );
100 
106  void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath );
107 
108  // DXF
109  void CreateDXFFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings );
110  bool PlotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
111  RENDER_SETTINGS* aRenderSettings,
112  wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
113 
114  // HPGL
116  {
117  return m_plotOriginOpt->GetSelection() == 1;
118  }
119 
120  void SetPlotOriginCenter( bool aCenter )
121  {
122  m_plotOriginOpt->SetSelection( aCenter ? 1 : 0 );
123  }
124 
125  void createHPGLFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aRenderSettings );
126  void SetHPGLPenWidth();
127  bool Plot_1_Page_HPGL( const wxString& aFileName, SCH_SCREEN* aScreen,
128  const PAGE_INFO& aPageInfo, RENDER_SETTINGS* aRenderSettings,
129  wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
130 
131  // PS
132  void createPSFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
133  bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
134  RENDER_SETTINGS* aRenderSettings, const PAGE_INFO& aPageInfo,
135  wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
136 
137  // SVG
138  void createSVGFile( bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS* aSettings );
139  bool plotOneSheetSVG( const wxString& aFileName, SCH_SCREEN* aScreen,
140  RENDER_SETTINGS* aRenderSettings, bool aPlotBlackAndWhite,
141  bool aPlotFrameRef );
142 
151  wxFileName createPlotFileName( wxString& aPlotFileName, wxString& aExtension,
152  REPORTER* aReporter = NULL );
153 };
void PlotSchematic(bool aPlotAll)
void OnOutputDirectoryBrowseClicked(wxCommandEvent &event) override
Set the m_outputDirectoryName variable to the selected directory from directory dialog.
RENDER_SETTINGS Contains all the knowledge about how graphical objects are drawn on any output surfac...
void OnUpdateUI(wxUpdateUIEvent &event) override
void SetPlotOriginCenter(bool aCenter)
DIALOG_PLOT_SCHEMATIC(SCH_EDIT_FRAME *parent)
bool Plot_1_Page_HPGL(const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, RENDER_SETTINGS *aRenderSettings, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
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 CreateDXFFile(bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aRenderSettings)
void getPlotOptions(RENDER_SETTINGS *aSettings)
REPORTER is 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
void restoreEnvironment(PDF_PLOTTER *aPlotter, SCH_SHEET_PATH &aOldsheetpath)
Everything done, close the plot and restore the environment.
void setupPlotPagePDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen)
void OnPlotAll(wxCommandEvent &event) override
#define NULL
void setPlotFrameRef(bool aPlot)
bool plotOneSheetPS(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const PAGE_INFO &aPageInfo, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
PLOT_FORMAT
Enum PlotFormat is the set of supported output plot formats.
Definition: plotter.h:51
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
SCH_SHEET_PATH.
void createPSFile(bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aSettings)
Base plotter engine class.
Definition: plotter.h:114
bool PlotOneSheetDXF(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
void createPDFFile(bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aRenderSettings)
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)
wxFileName createPlotFileName(wxString &aPlotFileName, wxString &aExtension, REPORTER *aReporter=NULL)
Create a file name with an absolute path name.
void plotOneSheetPDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, bool aPlotFrameRef)
void setModeColor(bool aColor)