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  *
11  * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, you may find one here:
25  * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
26  * or you may search the http://www.gnu.org website for the version 2 license,
27  * or you may write to the Free Software Foundation, Inc.,
28  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
29  */
30 
31 #include <fctsys.h>
32 #include <plotter.h>
33 #include <sch_screen.h>
34 #include <sch_edit_frame.h>
36 #include <reporter.h>
37 #include <widgets/unit_binder.h>
38 
43 };
44 
45 
47 {
48 private:
50  wxConfigBase* m_config;
51  bool m_configChanged; // true if a project config param has changed
53  static int m_pageSizeSelect; // Static to keep last option for some format
54  static int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
55  double m_HPGLPenSize; // for HPGL format only: pen size
56 
59 
60 public:
61  // / Constructors
63 
64  bool PrjConfigChanged() { return m_configChanged; } // return true if the prj config was modified
65  // and therefore should be saved
66 
67 private:
68  void OnPageSizeSelected( wxCommandEvent& event ) override;
69  void OnPlotCurrent( wxCommandEvent& event ) override;
70  void OnPlotAll( wxCommandEvent& event ) override;
71  void OnUpdateUI( wxUpdateUIEvent& event ) override;
72 
73  void initDlg();
74 
75  // common
76  void getPlotOptions();
77 
78  bool getModeColor()
79  { return m_ModeColorOption->GetSelection() == 0; }
80 
81  void setModeColor( bool aColor )
82  { m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); }
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 );
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 );
110  bool PlotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
111  wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
112 
113  // HPGL
115  {
116  return m_plotOriginOpt->GetSelection() == 1;
117  }
118 
119  void SetPlotOriginCenter( bool aCenter )
120  {
121  m_plotOriginOpt->SetSelection( aCenter ? 1 : 0 );
122  }
123 
124  void createHPGLFile( bool aPlotAll, bool aPlotFrameRef );
125  void SetHPGLPenWidth();
126  bool Plot_1_Page_HPGL( const wxString& aFileName, SCH_SCREEN* aScreen,
127  const PAGE_INFO& aPageInfo,
128  wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
129 
130  // PS
131  void createPSFile( bool aPlotAll, bool aPlotFrameRef );
132  bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
133  const PAGE_INFO& aPageInfo,
134  wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
135 
136  // SVG
137  void createSVGFile( bool aPlotAll, bool aPlotFrameRef );
138 
149  wxFileName createPlotFileName( wxTextCtrl* aOutputDirectoryName,
150  wxString& aPlotFileName,
151  wxString& aExtension, REPORTER* aReporter = NULL );
152 
153 public:
154  // This function is static because it is called by libedit
155  // outside a dialog. This is the reason we need aFrame as parameter
156  static bool plotOneSheetSVG( EDA_DRAW_FRAME* aFrame, const wxString& aFileName,
157  SCH_SCREEN* aScreen,
158  bool aPlotBlackAndWhite, bool aPlotFrameRef );
159 };
void PlotSchematic(bool aPlotAll)
void CreateDXFFile(bool aPlotAll, bool aPlotFrameRef)
void OnOutputDirectoryBrowseClicked(wxCommandEvent &event) override
Set the m_outputDirectoryName variable to the selected directory from directory dialog.
void OnUpdateUI(wxUpdateUIEvent &event) override
void SetPlotOriginCenter(bool aCenter)
DIALOG_PLOT_SCHEMATIC(SCH_EDIT_FRAME *parent)
PlotFormat
Enum PlotFormat is the set of supported output plot formats.
Definition: plotter.h:50
void OnPlotCurrent(wxCommandEvent &event) override
Class DIALOG_PLOT_SCHEMATIC_BASE.
Schematic editor (Eeschema) main window.
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
The base class for create windows for drawing purpose.
Definition: draw_frame.h:78
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 createHPGLFile(bool aPlotAll, bool aPlotFrameRef)
void OnPlotAll(wxCommandEvent &event) override
void setPlotFrameRef(bool aPlot)
bool plotOneSheetPS(const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
wxFileName createPlotFileName(wxTextCtrl *aOutputDirectoryName, wxString &aPlotFileName, wxString &aExtension, REPORTER *aReporter=NULL)
Create a file name with an absolute path name.
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
bool PlotOneSheetDXF(const wxString &aFileName, SCH_SCREEN *aScreen, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
Class SCH_SHEET_PATH.
Definitions for the Eeschema program SCH_SCREEN class.
void createPDFFile(bool aPlotAll, bool aPlotFrameRef)
Base plotter engine class.
Definition: plotter.h:97
bool Plot_1_Page_HPGL(const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
void createPSFile(bool aPlotAll, bool aPlotFrameRef)
void createSVGFile(bool aPlotAll, bool aPlotFrameRef)
void plotOneSheetPDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, bool aPlotFrameRef)
void setModeColor(bool aColor)
static bool plotOneSheetSVG(EDA_DRAW_FRAME *aFrame, const wxString &aFileName, SCH_SCREEN *aScreen, bool aPlotBlackAndWhite, bool aPlotFrameRef)