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-2014 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-2012 KiCad Developers, see change_log.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 <plot_common.h>
33 #include <class_sch_screen.h>
34 #include <schframe.h>
36 #include <reporter.h>
37 
38 
43 };
44 
45 
47 {
48 private:
50  wxConfigBase* m_config;
51  bool m_configChanged; // true if a project config param has changed
52  static int m_pageSizeSelect; // Static to keep last option for some format:
53  // Static to keep last option:
54  // use default size or force A or A4 size
55  int m_HPGLPaperSizeSelect; // for HPGL format only: last selected paper size
56  double m_HPGLPenSize; // for HPGL format only: pen size
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 OnPlotFormatSelection( wxCommandEvent& event ) override;
67  void OnButtonPlotCurrentClick( wxCommandEvent& event ) override;
68  void OnButtonPlotAllClick( wxCommandEvent& event ) override;
69  void OnButtonCancelClick( wxCommandEvent& event ) override;
70 
71  void initDlg();
72 
73  // common
74  void getPlotOptions();
75 
76  bool getModeColor()
77  { return m_ModeColorOption->GetSelection() == 0; }
78 
79  void setModeColor( bool aColor )
80  { m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); }
81 
85  void OnOutputDirectoryBrowseClicked( wxCommandEvent& event ) override;
86 
88 
89  bool getPlotFrameRef() { return m_PlotFrameRefOpt->GetValue(); }
90  void setPlotFrameRef( bool aPlot) {m_PlotFrameRefOpt->SetValue( aPlot ); }
91 
92  void PlotSchematic( bool aPlotAll );
93 
94  // PDF
95  void createPDFFile( bool aPlotAll, bool aPlotFrameRef );
96  void plotOneSheetPDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen, bool aPlotFrameRef);
97  void setupPlotPagePDF( PLOTTER* aPlotter, SCH_SCREEN* aScreen );
98 
104  void restoreEnvironment( PDF_PLOTTER* aPlotter, SCH_SHEET_PATH& aOldsheetpath );
105 
106  // DXF
107  void CreateDXFFile( bool aPlotAll, bool aPlotFrameRef );
108  bool PlotOneSheetDXF( const wxString& aFileName, SCH_SCREEN* aScreen,
109  wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
110 
111  // HPGL
113  {
114  return m_plotOriginOpt->GetSelection() == 1;
115  }
116 
117  void SetPlotOriginCenter( bool aCenter )
118  {
119  m_plotOriginOpt->SetSelection( aCenter ? 1 : 0 );
120  }
121 
122  void createHPGLFile( bool aPlotAll, bool aPlotFrameRef );
123  void SetHPGLPenWidth();
124  bool Plot_1_Page_HPGL( const wxString& aFileName, SCH_SCREEN* aScreen,
125  const PAGE_INFO& aPageInfo,
126  wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
127 
128  // PS
129  void createPSFile( bool aPlotAll, bool aPlotFrameRef );
130  bool plotOneSheetPS( const wxString& aFileName, SCH_SCREEN* aScreen,
131  const PAGE_INFO& aPageInfo,
132  wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef );
133 
134  // SVG
135  void createSVGFile( bool aPlotAll, bool aPlotFrameRef );
136 
147  wxFileName createPlotFileName( wxTextCtrl* aOutputDirectoryName,
148  wxString& aPlotFileName,
149  wxString& aExtension, REPORTER* aReporter = NULL );
150 
151 public:
152  // This function is static because it is called by libedit
153  // outside a dialog. This is the reason we need aFrame as parameter
154  static bool plotOneSheetSVG( EDA_DRAW_FRAME* aFrame, const wxString& aFileName,
155  SCH_SCREEN* aScreen,
156  bool aPlotBlackAndWhite, bool aPlotFrameRef );
157 };
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.
PlotFormat
Enum PlotFormat is the set of supported output plot formats.
Definition: plot_common.h:49
void SetPlotOriginCenter(bool aCenter)
DIALOG_PLOT_SCHEMATIC(SCH_EDIT_FRAME *parent)
Class DIALOG_PLOT_SCHEMATIC_BASE.
Schematic editor (Eeschema) main window.
Definition: schframe.h:117
void OnPlotFormatSelection(wxCommandEvent &event) override
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
Class EDA_DRAW_FRAME is the base class for create windows for drawing purpose.
Definition: draw_frame.h:53
void OnButtonPlotCurrentClick(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 setPlotFrameRef(bool aPlot)
bool plotOneSheetPS(const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
Definitions for the Eeschema program SCH_SCREEN class.
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...
bool PlotOneSheetDXF(const wxString &aFileName, SCH_SCREEN *aScreen, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
Common plot library Plot settings, and plotting engines (Postscript, Gerber, HPGL and DXF) ...
Class SCH_SHEET_PATH.
void createPDFFile(bool aPlotAll, bool aPlotFrameRef)
Base plotter engine class.
Definition: plot_common.h:86
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 OnButtonPlotAllClick(wxCommandEvent &event) override
void OnButtonCancelClick(wxCommandEvent &event) override
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)