KiCad PCB EDA Suite
DIALOG_PLOT_SCHEMATIC Class Reference

#include <dialog_plot_schematic.h>

Inheritance diagram for DIALOG_PLOT_SCHEMATIC:
DIALOG_PLOT_SCHEMATIC_BASE DIALOG_SHIM KIWAY_HOLDER

Public Member Functions

 DIALOG_PLOT_SCHEMATIC (SCH_EDIT_FRAME *parent)
 
bool PrjConfigChanged ()
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
KIWAYKiway () const
 Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Function Prj returns a reference to the PROJECT "associated with" this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 Function SetKiway. More...
 

Static Public Member Functions

static bool plotOneSheetSVG (EDA_DRAW_FRAME *aFrame, const wxString &aFileName, SCH_SCREEN *aScreen, bool aPlotBlackAndWhite, bool aPlotFrameRef)
 

Protected Types

enum  { wxID_PRINT_CURRENT = 1000, wxID_PRINT_ALL }
 

Protected Member Functions

virtual void OnCloseWindow (wxCloseEvent &event)
 
virtual void OnHPGLPageSelected (wxCommandEvent &event)
 
void FinishDialogSettings ()
 In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls. More...
 
void FixOSXCancelButtonIssue ()
 A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms. More...
 

Protected Attributes

wxStaticText * m_staticTextOutputDirectory
 
wxTextCtrl * m_outputDirectoryName
 
wxButton * m_browseButton
 
wxBoxSizer * m_optionsSizer
 
wxRadioBox * m_plotFormatOpt
 
wxStaticBoxSizer * m_paperOptionsSizer
 
wxRadioBox * m_PaperSizeOption
 
wxStaticBoxSizer * m_paperHPGLSizer
 
wxStaticText * m_staticText4
 
wxChoice * m_HPGLPaperSizeOption
 
wxRadioBox * m_plotOriginOpt
 
wxStaticText * m_penHPLGWidthTitle
 
wxTextCtrl * m_penHPGLWidthCtrl
 
wxStaticText * m_defaultLineWidthTitle
 
wxTextCtrl * m_DefaultLineSizeCtrl
 
wxRadioBox * m_ModeColorOption
 
wxCheckBox * m_PlotFrameRefOpt
 
wxBoxSizer * m_ButtonsSizer
 
wxButton * m_buttonPlotCurrent
 
wxButton * m_buttonPlotAll
 
wxButton * m_buttonQuit
 
WX_HTML_REPORT_PANELm_MessagesBox
 
std::string m_hash_key
 
EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 

Private Member Functions

void OnPlotFormatSelection (wxCommandEvent &event) override
 
void OnButtonPlotCurrentClick (wxCommandEvent &event) override
 
void OnButtonPlotAllClick (wxCommandEvent &event) override
 
void OnButtonCancelClick (wxCommandEvent &event) override
 
void initDlg ()
 
void getPlotOptions ()
 
bool getModeColor ()
 
void setModeColor (bool aColor)
 
void OnOutputDirectoryBrowseClicked (wxCommandEvent &event) override
 Set the m_outputDirectoryName variable to the selected directory from directory dialog. More...
 
PlotFormat GetPlotFileFormat ()
 
bool getPlotFrameRef ()
 
void setPlotFrameRef (bool aPlot)
 
void PlotSchematic (bool aPlotAll)
 
void createPDFFile (bool aPlotAll, bool aPlotFrameRef)
 
void plotOneSheetPDF (PLOTTER *aPlotter, SCH_SCREEN *aScreen, bool aPlotFrameRef)
 
void setupPlotPagePDF (PLOTTER *aPlotter, SCH_SCREEN *aScreen)
 
void restoreEnvironment (PDF_PLOTTER *aPlotter, SCH_SHEET_PATH &aOldsheetpath)
 Everything done, close the plot and restore the environment. More...
 
void CreateDXFFile (bool aPlotAll, bool aPlotFrameRef)
 
bool PlotOneSheetDXF (const wxString &aFileName, SCH_SCREEN *aScreen, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
 
bool GetPlotOriginCenter ()
 
void SetPlotOriginCenter (bool aCenter)
 
void createHPGLFile (bool aPlotAll, bool aPlotFrameRef)
 
void SetHPGLPenWidth ()
 
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)
 
bool plotOneSheetPS (const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
 
void createSVGFile (bool aPlotAll, bool aPlotFrameRef)
 
wxFileName createPlotFileName (wxTextCtrl *aOutputDirectoryName, wxString &aPlotFileName, wxString &aExtension, REPORTER *aReporter=NULL)
 Create a file name with an absolute path name. More...
 

Private Attributes

SCH_EDIT_FRAMEm_parent
 
wxConfigBase * m_config
 
bool m_configChanged
 
int m_HPGLPaperSizeSelect
 
double m_HPGLPenSize
 

Static Private Attributes

static int m_pageSizeSelect = PAGE_SIZE_AUTO
 

Detailed Description

Definition at line 46 of file dialog_plot_schematic.h.

Member Enumeration Documentation

anonymous enum
protectedinherited

Constructor & Destructor Documentation

DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC ( SCH_EDIT_FRAME parent)

Definition at line 69 of file dialog_plot_schematic.cpp.

References DIALOG_SHIM::FinishDialogSettings(), initDlg(), Kiface(), KIFACE_I::KifaceSettings(), m_config, m_configChanged, and m_parent.

69  :
71 {
72  m_parent = parent;
73  m_configChanged = false;
75 
76  initDlg();
77 
78  // Now all widgets have the size fixed, call FinishDialogSettings
80 }
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
Definition: kicad.cpp:52
DIALOG_PLOT_SCHEMATIC_BASE(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=_("Plot Schematic Options"), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxSize(-1,-1), long style=wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER)
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103

Member Function Documentation

void DIALOG_PLOT_SCHEMATIC::CreateDXFFile ( bool  aPlotAll,
bool  aPlotFrameRef 
)
private

Definition at line 39 of file plot_schematic_DXF.cpp.

References SCH_SHEET_LIST::BuildSheetList(), createPlotFileName(), g_RootSheet, GetChars(), SCH_EDIT_FRAME::GetCurrentSheet(), DXF_PLOTTER::GetDefaultFileExtension(), SCH_EDIT_FRAME::GetScreen(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), SCH_SHEET_PATH::LastScreen(), DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_parent, PlotOneSheetDXF(), REPORTER::Report(), WX_HTML_REPORT_PANEL::Reporter(), REPORTER::RPT_ACTION, REPORTER::RPT_ERROR, SCH_EDIT_FRAME::SetCurrentSheet(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), SCH_SHEET_PATH::UpdateAllScreenReferences(), and IO_ERROR::What().

Referenced by PlotSchematic().

40 {
41  SCH_EDIT_FRAME* schframe = m_parent;
42  SCH_SCREEN* screen = schframe->GetScreen();
43  SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
44 
45  /* When printing all pages, the printed page is not the current page.
46  * In complex hierarchies, we must setup references and others parameters
47  * in the printed SCH_SCREEN
48  * because in complex hierarchies a SCH_SCREEN (a schematic drawings)
49  * is shared between many sheets
50  */
51  SCH_SHEET_LIST sheetList;
52 
53  if( aPlotAll )
54  sheetList.BuildSheetList( g_RootSheet );
55  else
56  sheetList.push_back( schframe->GetCurrentSheet() );
57 
58  REPORTER& reporter = m_MessagesBox->Reporter();
59 
60  for( unsigned i = 0; i < sheetList.size(); i++ )
61  {
62  schframe->SetCurrentSheet( sheetList[i] );
64  schframe->SetSheetNumberAndCount();
65  screen = schframe->GetCurrentSheet().LastScreen();
66 
67  wxPoint plot_offset;
68  wxString msg;
69 
70  try
71  {
72  wxString fname = schframe->GetUniqueFilenameForCurrentSheet();
73  wxString ext = DXF_PLOTTER::GetDefaultFileExtension();
74  wxFileName plotFileName = createPlotFileName( m_outputDirectoryName, fname,
75  ext, &reporter );
76 
77  if( PlotOneSheetDXF( plotFileName.GetFullPath(), screen, plot_offset, 1.0,
78  aPlotFrameRef ) )
79  {
80  msg.Printf( _( "Plot: '%s' OK.\n" ), GetChars( plotFileName.GetFullPath() ) );
81  reporter.Report( msg, REPORTER::RPT_ACTION );
82  }
83  else // Error
84  {
85  msg.Printf( _( "Unable to create file '%s'.\n" ),
86  GetChars( plotFileName.GetFullPath() ) );
87  reporter.Report( msg, REPORTER::RPT_ERROR );
88  }
89  }
90  catch( IO_ERROR& e )
91  {
92  msg.Printf( wxT( "DXF Plotter exception: %s"), GetChars( e.What() ) );
93  reporter.Report( msg, REPORTER::RPT_ERROR );
94  schframe->SetCurrentSheet( oldsheetpath );
96  schframe->SetSheetNumberAndCount();
97  return;
98  }
99  }
100 
101  schframe->SetCurrentSheet( oldsheetpath );
103  schframe->SetSheetNumberAndCount();
104 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Definition: schframe.cpp:581
Class SCH_SHEET_LIST.
Schematic editor (Eeschema) main window.
Definition: schframe.h:117
SCH_SCREEN * LastScreen() const
Function LastScreen.
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
static wxString GetDefaultFileExtension()
Definition: plot_common.h:1220
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:528
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
wxFileName createPlotFileName(wxTextCtrl *aOutputDirectoryName, wxString &aPlotFileName, wxString &aExtension, REPORTER *aReporter=NULL)
Create a file name with an absolute path name.
REPORTER & Reporter()
returns the reporter object that reports to this panel
SCH_SHEET_PATH & GetCurrentSheet()
Definition: schframe.cpp:573
bool PlotOneSheetDXF(const wxString &aFileName, SCH_SCREEN *aScreen, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
Class SCH_SHEET_PATH.
void BuildSheetList(SCH_SHEET *aSheet)
Function BuildSheetList builds the list of sheets and their sheet path from aSheet.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void SetSheetNumberAndCount()
Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must...
Definition: schframe.cpp:493
wxString GetUniqueFilenameForCurrentSheet()
Function GetUniqueFilenameForCurrentSheet.
Definition: schframe.cpp:738
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
WX_HTML_REPORT_PANEL * m_MessagesBox
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
void DIALOG_PLOT_SCHEMATIC::createHPGLFile ( bool  aPlotAll,
bool  aPlotFrameRef 
)
private

Definition at line 111 of file plot_schematic_HPGL.cpp.

References SCH_SHEET_LIST::BuildSheetList(), createPlotFileName(), g_RootSheet, GetChars(), SCH_EDIT_FRAME::GetCurrentSheet(), HPGL_PLOTTER::GetDefaultFileExtension(), SCH_SCREEN::GetPageSettings(), GetPlotOriginCenter(), SCH_EDIT_FRAME::GetScreen(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), PAGE_INFO::GetWidthMils(), SCH_SHEET_PATH::LastScreen(), DIALOG_PLOT_SCHEMATIC_BASE::m_HPGLPaperSizeOption, DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_parent, PAGE_DEFAULT, Plot_1_Page_HPGL(), plot_sheet_list(), REPORTER::Report(), WX_HTML_REPORT_PANEL::Reporter(), REPORTER::RPT_ACTION, REPORTER::RPT_ERROR, SCH_EDIT_FRAME::SetCurrentSheet(), SetHPGLPenWidth(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), PAGE_INFO::SetType(), SCH_SHEET_PATH::UpdateAllScreenReferences(), IO_ERROR::What(), wxPoint::x, and wxPoint::y.

Referenced by PlotSchematic().

112 {
113  SCH_SCREEN* screen = m_parent->GetScreen();
114  SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet();
115 
116  /* When printing all pages, the printed page is not the current page.
117  * In complex hierarchies, we must setup references and other parameters
118  * in the printed SCH_SCREEN
119  * because in complex hierarchies a SCH_SCREEN (a schematic drawings)
120  * is shared between many sheets
121  */
122  SCH_SHEET_LIST sheetList;
123 
124  if( aPlotAll )
125  sheetList.BuildSheetList( g_RootSheet );
126  else
127  sheetList.push_back( m_parent->GetCurrentSheet() );
128 
129  REPORTER& reporter = m_MessagesBox->Reporter();
130 
131  SetHPGLPenWidth();
132 
133  for( unsigned i = 0; i < sheetList.size(); i++ )
134  {
135  m_parent->SetCurrentSheet( sheetList[i] );
138 
139  screen = m_parent->GetCurrentSheet().LastScreen();
140 
141  if( !screen ) // LastScreen() may return NULL
142  screen = m_parent->GetScreen();
143 
144  const PAGE_INFO& curPage = screen->GetPageSettings();
145 
146  PAGE_INFO plotPage = curPage;
147 
148  // if plotting on a page size other than curPage
149  if( m_HPGLPaperSizeOption->GetSelection() != PAGE_DEFAULT )
150  plotPage.SetType( plot_sheet_list( m_HPGLPaperSizeOption->GetSelection() ) );
151 
152  // Calculation of conversion scales.
153  double plot_scale = (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
154 
155  // Calculate offsets
156  wxPoint plotOffset;
157  wxString msg;
158 
159  if( GetPlotOriginCenter() )
160  {
161  plotOffset.x = plotPage.GetWidthIU() / 2;
162  plotOffset.y = -plotPage.GetHeightIU() / 2;
163  }
164 
165  try
166  {
167  wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
168  wxString ext = HPGL_PLOTTER::GetDefaultFileExtension();
169  wxFileName plotFileName = createPlotFileName( m_outputDirectoryName, fname,
170  ext, &reporter );
171 
172  LOCALE_IO toggle;
173 
174  if( Plot_1_Page_HPGL( plotFileName.GetFullPath(), screen, plotPage, plotOffset,
175  plot_scale, aPlotFrameRef ) )
176  {
177  msg.Printf( _( "Plot: '%s' OK.\n" ), GetChars( plotFileName.GetFullPath() ) );
178  reporter.Report( msg, REPORTER::RPT_ACTION );
179  }
180  else
181  {
182  msg.Printf( _( "Unable to create file '%s'.\n" ),
183  GetChars( plotFileName.GetFullPath() ) );
184  reporter.Report( msg, REPORTER::RPT_ERROR );
185  }
186  }
187  catch( IO_ERROR& e )
188  {
189  msg.Printf( wxT( "HPGL Plotter exception: %s"), GetChars( e.What() ) );
190  reporter.Report( msg, REPORTER::RPT_ERROR );
191  }
192 
193  }
194 
195  m_parent->SetCurrentSheet( oldsheetpath );
198 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Definition: schframe.cpp:581
Class SCH_SHEET_LIST.
Class LOCALE_IO is a class that can be instantiated within a scope in which you are expecting excepti...
Definition: common.h:166
SCH_SCREEN * LastScreen() const
Function LastScreen.
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:528
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
static const wxChar * plot_sheet_list(int aSize)
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...
REPORTER & Reporter()
returns the reporter object that reports to this panel
SCH_SHEET_PATH & GetCurrentSheet()
Definition: schframe.cpp:573
bool SetType(const wxString &aStandardPageDescriptionName, bool IsPortrait=false)
Function SetType sets the name of the page type and also the sizes and margins commonly associated wi...
Class SCH_SHEET_PATH.
void BuildSheetList(SCH_SHEET *aSheet)
Function BuildSheetList builds the list of sheets and their sheet path from aSheet.
int GetWidthMils() const
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void SetSheetNumberAndCount()
Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must...
Definition: schframe.cpp:493
static wxString GetDefaultFileExtension()
Definition: plot_common.h:563
wxString GetUniqueFilenameForCurrentSheet()
Function GetUniqueFilenameForCurrentSheet.
Definition: schframe.cpp:738
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
const PAGE_INFO & GetPageSettings() const
bool Plot_1_Page_HPGL(const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
WX_HTML_REPORT_PANEL * m_MessagesBox
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
void DIALOG_PLOT_SCHEMATIC::createPDFFile ( bool  aPlotAll,
bool  aPlotFrameRef 
)
private

Definition at line 41 of file plot_schematic_PDF.cpp.

References SCH_SHEET_LIST::BuildSheetList(), PDF_PLOTTER::ClosePage(), createPlotFileName(), g_RootSheet, GetChars(), SCH_EDIT_FRAME::GetCurrentSheet(), PDF_PLOTTER::GetDefaultFileExtension(), GetDefaultLineThickness(), getModeColor(), SCH_EDIT_FRAME::GetScreen(), TITLE_BLOCK::GetTitle(), SCH_BASE_FRAME::GetTitleBlock(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), SCH_SHEET_PATH::LastScreen(), DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_parent, PDF_PLOTTER::OpenFile(), plotOneSheetPDF(), REPORTER::Report(), WX_HTML_REPORT_PANEL::Reporter(), restoreEnvironment(), REPORTER::RPT_ACTION, REPORTER::RPT_ERROR, PLOTTER::SetColorMode(), PLOTTER::SetCreator(), SCH_EDIT_FRAME::SetCurrentSheet(), PSLIKE_PLOTTER::SetDefaultLineWidth(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), PLOTTER::SetTitle(), setupPlotPagePDF(), PDF_PLOTTER::StartPage(), PDF_PLOTTER::StartPlot(), SCH_SHEET_PATH::UpdateAllScreenReferences(), and IO_ERROR::What().

Referenced by PlotSchematic().

42 {
43  SCH_SCREEN* screen = m_parent->GetScreen();
44  SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
45 
46  /* When printing all pages, the printed page is not the current page. In
47  * complex hierarchies, we must update component references and others
48  * parameters in the given printed SCH_SCREEN, accordint to the sheet path
49  * because in complex hierarchies a SCH_SCREEN (a drawing ) is shared
50  * between many sheets and component references depend on the actual sheet
51  * path used
52  */
53  SCH_SHEET_LIST sheetList;
54 
55  if( aPlotAll )
56  sheetList.BuildSheetList( g_RootSheet );
57  else
58  sheetList.push_back( m_parent->GetCurrentSheet() );
59 
60  // Allocate the plotter and set the job level parameter
61  PDF_PLOTTER* plotter = new PDF_PLOTTER();
63  plotter->SetColorMode( getModeColor() );
64  plotter->SetCreator( wxT( "Eeschema-PDF" ) );
65  plotter->SetTitle( m_parent->GetTitleBlock().GetTitle() );
66 
67  wxString msg;
68  wxFileName plotFileName;
69  REPORTER& reporter = m_MessagesBox->Reporter();
70  LOCALE_IO toggle; // Switch the locale to standard C
71 
72  for( unsigned i = 0; i < sheetList.size(); i++ )
73  {
74  m_parent->SetCurrentSheet( sheetList[i] );
77  screen = m_parent->GetCurrentSheet().LastScreen();
78 
79  if( i == 0 )
80  {
81 
82  try
83  {
84  wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
85  wxString ext = PDF_PLOTTER::GetDefaultFileExtension();
87  fname, ext, &reporter );
88 
89  if( !plotter->OpenFile( plotFileName.GetFullPath() ) )
90  {
91  msg.Printf( _( "Unable to create file '%s'.\n" ),
92  GetChars( plotFileName.GetFullPath() ) );
93  reporter.Report( msg, REPORTER::RPT_ERROR );
94  delete plotter;
95  return;
96  }
97 
98  // Open the plotter and do the first page
99  setupPlotPagePDF( plotter, screen );
100  plotter->StartPlot();
101  }
102  catch( const IO_ERROR& e )
103  {
104  // Cannot plot PDF file
105  msg.Printf( wxT( "PDF Plotter exception: %s" ), GetChars( e.What() ) );
106  reporter.Report( msg, REPORTER::RPT_ERROR );
107 
108  restoreEnvironment( plotter, oldsheetpath );
109  return;
110  }
111 
112  }
113  else
114  {
115  /* For the following pages you need to close the (finished) page,
116  * reconfigure, and then start a new one */
117  plotter->ClosePage();
118  setupPlotPagePDF( plotter, screen );
119  plotter->StartPage();
120  }
121 
122  plotOneSheetPDF( plotter, screen, aPlotFrameRef );
123  }
124 
125  // Everything done, close the plot and restore the environment
126  msg.Printf( _( "Plot: '%s' OK.\n" ), GetChars( plotFileName.GetFullPath() ) );
127  reporter.Report( msg, REPORTER::RPT_ACTION );
128 
129  restoreEnvironment( plotter, oldsheetpath );
130 }
static wxString GetDefaultFileExtension()
Definition: plot_common.h:804
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Definition: schframe.cpp:581
Class SCH_SHEET_LIST.
virtual void SetCreator(const wxString &aCreator)
Definition: plot_common.h:151
Class LOCALE_IO is a class that can be instantiated within a scope in which you are expecting excepti...
Definition: common.h:166
virtual void StartPage()
Starts a new page in the PDF document.
virtual void SetTitle(const wxString &aTitle)
Definition: plot_common.h:156
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
SCH_SCREEN * LastScreen() const
Function LastScreen.
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
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)
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:528
virtual void ClosePage()
Close the current page in the PDF document (and emit its compressed stream)
const wxString & GetTitle() const
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
wxFileName createPlotFileName(wxTextCtrl *aOutputDirectoryName, wxString &aPlotFileName, wxString &aExtension, REPORTER *aReporter=NULL)
Create a file name with an absolute path name.
REPORTER & Reporter()
returns the reporter object that reports to this panel
SCH_SHEET_PATH & GetCurrentSheet()
Definition: schframe.cpp:573
Class SCH_SHEET_PATH.
void BuildSheetList(SCH_SHEET *aSheet)
Function BuildSheetList builds the list of sheets and their sheet path from aSheet.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void SetSheetNumberAndCount()
Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must...
Definition: schframe.cpp:493
const TITLE_BLOCK & GetTitleBlock() const override
wxString GetUniqueFilenameForCurrentSheet()
Function GetUniqueFilenameForCurrentSheet.
Definition: schframe.cpp:738
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
virtual bool OpenFile(const wxString &aFullFilename) override
Open or create the plot file aFullFilename.
WX_HTML_REPORT_PANEL * m_MessagesBox
virtual bool StartPlot() override
The PDF engine supports multiple pages; the first one is opened 'for free' the following are to be cl...
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
virtual void SetColorMode(bool _color_mode)
Definition: plot_common.h:116
void plotOneSheetPDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, bool aPlotFrameRef)
wxFileName DIALOG_PLOT_SCHEMATIC::createPlotFileName ( wxTextCtrl *  aOutputDirectoryName,
wxString &  aPlotFileName,
wxString &  aExtension,
REPORTER aReporter = NULL 
)
private

Create a file name with an absolute path name.

Parameters
aOutputDirectoryNamethe diretory name to plot, this can be a relative name of the current project diretory or an absolute directory name.
aPlotFileNamethe name for the file to plot without a path
aExtensionthe extension for the file to plot
aReportera point to a REPORTER object use to show messages (can be NULL)
Returns
the created file name
Exceptions
IO_ERRORon file I/O errors

Definition at line 334 of file dialog_plot_schematic.cpp.

References PROJECT::AbsolutePath(), EnsureFileDirectoryExists(), GetChars(), KIWAY_HOLDER::Prj(), REPORTER::Report(), and REPORTER::RPT_ERROR.

Referenced by CreateDXFFile(), createHPGLFile(), createPDFFile(), createPSFile(), and createSVGFile().

338 {
339  wxString outputDirName = aOutputDirectoryName->GetValue();
340  wxFileName outputDir = wxFileName::DirName( outputDirName );
341 
342  wxString plotFileName = Prj().AbsolutePath( aPlotFileName + wxT(".") + aExtension);
343 
344  if( !EnsureFileDirectoryExists( &outputDir, plotFileName, aReporter ) )
345  {
346  wxString msg;
347  msg.Printf( _( "Could not write plot files to folder '%s'." ),
348  GetChars( outputDir.GetPath() ) );
349  aReporter->Report( msg, REPORTER::RPT_ERROR );
350  }
351 
352  wxFileName fn( plotFileName );
353  fn.SetPath( outputDir.GetFullPath() );
354  return fn;
355 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
bool EnsureFileDirectoryExists(wxFileName *aTargetFullFileName, const wxString &aBaseFilename, REPORTER *aReporter)
Helper function EnsureFileDirectoryExists make aTargetFullFileName absolute and creates the path of t...
Definition: common.cpp:267
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project's directory to be an absolu...
Definition: project.cpp:371
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
void DIALOG_PLOT_SCHEMATIC::createPSFile ( bool  aPlotAll,
bool  aPlotFrameRef 
)
private

Definition at line 39 of file plot_schematic_PS.cpp.

References SCH_SHEET_LIST::BuildSheetList(), createPlotFileName(), g_RootSheet, GetChars(), SCH_EDIT_FRAME::GetCurrentSheet(), PS_PLOTTER::GetDefaultFileExtension(), PAGE_INFO::GetHeightMils(), SCH_SCREEN::GetPageSettings(), SCH_EDIT_FRAME::GetScreen(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), PAGE_INFO::GetWidthMils(), PAGE_INFO::IsPortrait(), SCH_SHEET_PATH::LastScreen(), DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_pageSizeSelect, m_parent, min, PAGE_SIZE_A, PAGE_SIZE_A4, PAGE_SIZE_AUTO, plotOneSheetPS(), REPORTER::Report(), WX_HTML_REPORT_PANEL::Reporter(), REPORTER::RPT_ACTION, REPORTER::RPT_ERROR, scale, SCH_EDIT_FRAME::SetCurrentSheet(), PAGE_INFO::SetPortrait(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), PAGE_INFO::SetType(), SCH_SHEET_PATH::UpdateAllScreenReferences(), and IO_ERROR::What().

Referenced by PlotSchematic().

40 {
41  SCH_SCREEN* screen = m_parent->GetScreen();
42  SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
43  PAGE_INFO actualPage; // page size selected in schematic
44  PAGE_INFO plotPage; // page size selected to plot
45 
46  /* When printing all pages, the printed page is not the current page.
47  * In complex hierarchies, we must update component references
48  * and others parameters in the given printed SCH_SCREEN, accordint to the sheet path
49  * because in complex hierarchies a SCH_SCREEN (a drawing )
50  * is shared between many sheets and component references depend on the actual sheet path used
51  */
52  SCH_SHEET_LIST sheetList;
53 
54  if( aPlotAll )
55  sheetList.BuildSheetList( g_RootSheet );
56  else
57  sheetList.push_back( m_parent->GetCurrentSheet() );
58 
59  for( unsigned i = 0; i < sheetList.size(); i++ )
60  {
61  m_parent->SetCurrentSheet( sheetList[i] );
64  screen = m_parent->GetCurrentSheet().LastScreen();
65  actualPage = screen->GetPageSettings();
66 
67  switch( m_pageSizeSelect )
68  {
69  case PAGE_SIZE_A:
70  plotPage.SetType( wxT( "A" ) );
71  plotPage.SetPortrait( actualPage.IsPortrait() );
72  break;
73 
74  case PAGE_SIZE_A4:
75  plotPage.SetType( wxT( "A4" ) );
76  plotPage.SetPortrait( actualPage.IsPortrait() );
77  break;
78 
79  case PAGE_SIZE_AUTO:
80  default:
81  plotPage = actualPage;
82  break;
83  }
84 
85  double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
86  double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
87 
88  double scale = std::min( scalex, scaley );
89 
90  wxPoint plot_offset;
91 
92  wxString outputDirName = m_outputDirectoryName->GetValue();
93 
94  wxString msg;
95  REPORTER& reporter = m_MessagesBox->Reporter();
96 
97  try
98  {
99  wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
100  wxString ext = PS_PLOTTER::GetDefaultFileExtension();
101  wxFileName plotFileName = createPlotFileName( m_outputDirectoryName,
102  fname, ext, &reporter );
103 
104  if( plotOneSheetPS( plotFileName.GetFullPath(), screen, plotPage, plot_offset,
105  scale, aPlotFrameRef ) )
106  {
107  msg.Printf( _( "Plot: '%s' OK.\n" ), GetChars( plotFileName.GetFullPath() ) );
108  reporter.Report( msg, REPORTER::RPT_ACTION );
109  }
110  else
111  {
112  // Error
113  msg.Printf( _( "Unable to create file '%s'.\n" ),
114  GetChars( plotFileName.GetFullPath() ) );
115  reporter.Report( msg, REPORTER::RPT_ERROR );
116  }
117 
118  }
119  catch( IO_ERROR& e )
120  {
121  msg.Printf( wxT( "PS Plotter exception: %s"), GetChars( e.What() ) );
122  reporter.Report( msg, REPORTER::RPT_ERROR );
123  }
124  }
125 
126  m_parent->SetCurrentSheet( oldsheetpath );
129 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Definition: schframe.cpp:581
Class SCH_SHEET_LIST.
static wxString GetDefaultFileExtension()
Definition: plot_common.h:741
SCH_SCREEN * LastScreen() const
Function LastScreen.
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
SCH_SCREEN * GetScreen() const override
Function GetScreen returns a pointer to a BASE_SCREEN or one of its derivatives.
Definition: schframe.cpp:528
bool IsPortrait() const
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
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...
REPORTER & Reporter()
returns the reporter object that reports to this panel
SCH_SHEET_PATH & GetCurrentSheet()
Definition: schframe.cpp:573
bool SetType(const wxString &aStandardPageDescriptionName, bool IsPortrait=false)
Function SetType sets the name of the page type and also the sizes and margins commonly associated wi...
Class SCH_SHEET_PATH.
void BuildSheetList(SCH_SHEET *aSheet)
Function BuildSheetList builds the list of sheets and their sheet path from aSheet.
int GetWidthMils() const
void SetPortrait(bool isPortrait)
Function SetPortrait will rotate the paper page 90 degrees.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
const int scale
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void SetSheetNumberAndCount()
Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must...
Definition: schframe.cpp:493
wxString GetUniqueFilenameForCurrentSheet()
Function GetUniqueFilenameForCurrentSheet.
Definition: schframe.cpp:738
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
const PAGE_INFO & GetPageSettings() const
WX_HTML_REPORT_PANEL * m_MessagesBox
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
int GetHeightMils() const
#define min(a, b)
Definition: auxiliary.h:85
void DIALOG_PLOT_SCHEMATIC::createSVGFile ( bool  aPlotAll,
bool  aPlotFrameRef 
)
private

Definition at line 44 of file plot_schematic_SVG.cpp.

References SCH_SHEET_LIST::BuildSheetList(), createPlotFileName(), g_RootSheet, GetChars(), SCH_EDIT_FRAME::GetCurrentSheet(), SVG_PLOTTER::GetDefaultFileExtension(), getModeColor(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), SCH_SHEET_PATH::LastScreen(), DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_parent, plotOneSheetSVG(), REPORTER::Report(), WX_HTML_REPORT_PANEL::Reporter(), REPORTER::RPT_ACTION, REPORTER::RPT_ERROR, SCH_EDIT_FRAME::SetCurrentSheet(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), SCH_SHEET_PATH::UpdateAllScreenReferences(), and IO_ERROR::What().

Referenced by PlotSchematic().

45 {
46  wxString msg;
47  REPORTER& reporter = m_MessagesBox->Reporter();
48  SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet();
49  SCH_SHEET_LIST sheetList;
50 
51  if( aPrintAll )
52  sheetList.BuildSheetList( g_RootSheet );
53  else
54  sheetList.push_back( m_parent->GetCurrentSheet() );
55 
56  for( unsigned i = 0; i < sheetList.size(); i++ )
57  {
58  SCH_SCREEN* screen;
59  m_parent->SetCurrentSheet( sheetList[i] );
62  screen = m_parent->GetCurrentSheet().LastScreen();
63 
64  try
65  {
66  wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
67  wxString ext = SVG_PLOTTER::GetDefaultFileExtension();
68  wxFileName plotFileName = createPlotFileName( m_outputDirectoryName,
69  fname, ext, &reporter );
70 
71  bool success = plotOneSheetSVG( m_parent, plotFileName.GetFullPath(), screen,
72  getModeColor() ? false : true,
73  aPrintFrameRef );
74 
75  if( !success )
76  {
77  msg.Printf( _( "Cannot create file '%s'.\n" ),
78  GetChars( plotFileName.GetFullPath() ) );
79  reporter.Report( msg, REPORTER::RPT_ERROR );
80  }
81  else
82  {
83  msg.Printf( _( "Plot: '%s' OK.\n" ),
84  GetChars( plotFileName.GetFullPath() ) );
85  reporter.Report( msg, REPORTER::RPT_ACTION );
86  }
87  }
88  catch( const IO_ERROR& e )
89  {
90  // Cannot plot SVG file
91  msg.Printf( wxT( "SVG Plotter exception: %s" ), GetChars( e.What() ) );
92  reporter.Report( msg, REPORTER::RPT_ERROR );
93  break;
94  }
95  }
96 
97  m_parent->SetCurrentSheet( oldsheetpath );
100 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Definition: schframe.cpp:581
Class SCH_SHEET_LIST.
static wxString GetDefaultFileExtension()
Definition: plot_common.h:883
SCH_SCREEN * LastScreen() const
Function LastScreen.
Class REPORTER is a pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:61
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
wxFileName createPlotFileName(wxTextCtrl *aOutputDirectoryName, wxString &aPlotFileName, wxString &aExtension, REPORTER *aReporter=NULL)
Create a file name with an absolute path name.
REPORTER & Reporter()
returns the reporter object that reports to this panel
SCH_SHEET_PATH & GetCurrentSheet()
Definition: schframe.cpp:573
Class SCH_SHEET_PATH.
void BuildSheetList(SCH_SHEET *aSheet)
Function BuildSheetList builds the list of sheets and their sheet path from aSheet.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void SetSheetNumberAndCount()
Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must...
Definition: schframe.cpp:493
wxString GetUniqueFilenameForCurrentSheet()
Function GetUniqueFilenameForCurrentSheet.
Definition: schframe.cpp:738
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.
WX_HTML_REPORT_PANEL * m_MessagesBox
Struct IO_ERROR is a class used to hold an error message and may be used when throwing exceptions con...
Definition: ki_exception.h:47
static bool plotOneSheetSVG(EDA_DRAW_FRAME *aFrame, const wxString &aFileName, SCH_SCREEN *aScreen, bool aPlotBlackAndWhite, bool aPlotFrameRef)
bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 182 of file dialog_shim.cpp.

Referenced by DIALOG_PRINT_USING_PRINTER::InitValues().

183 {
184  // so we can do logging of this state change:
185 
186 #if defined(DEBUG)
187  const char* type_id = typeid( *this ).name();
188  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
189 #endif
190 
191  return wxDialog::Enable( enable );
192 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 540 of file dialog_shim.cpp.

References DIALOG_SHIM::IsQuasiModal(), DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, and DIALOG_SHIM::Show().

Referenced by HK_PROMPT_DIALOG::EndFlexible(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCancelButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick(), DIALOG_EDIT_ONE_FIELD::OnCancelClick(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnCloseDialog(), DIALOG_EDIT_ONE_FIELD::OnCloseDialog(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCloseDialog(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_EDIT_ONE_FIELD::OnOkClick(), DIALOG_EXCHANGE_MODULE::OnQuit(), DIALOG_CHOOSE_COMPONENT::OnSchViewDClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), and DIALOG_SHIM::~DIALOG_SHIM().

541 {
542  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
543  // handle validation in the same way as other dialogs.
544  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
545  return;
546 
547  SetReturnCode( retCode );
548 
549  if( !IsQuasiModal() )
550  {
551  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
552  return;
553  }
554 
555  m_qmodal_showing = false;
556 
557  if( m_qmodal_loop )
558  {
559  if( m_qmodal_loop->IsRunning() )
560  m_qmodal_loop->Exit( 0 );
561  else
562  m_qmodal_loop->ScheduleExit( 0 );
563 
564  m_qmodal_loop = NULL;
565  }
566 
569 
570  Show( false );
571 }
bool m_qmodal_showing
Definition: dialog_shim.h:132
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:131
bool IsQuasiModal()
Definition: dialog_shim.h:93
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:133
void DIALOG_SHIM::FinishDialogSettings ( )
protectedinherited

In all dialogs, we must call the same functions to fix minimal dlg size, the default position and perhaps some others to fix a few issues depending on Windows Managers this helper function does these calls.

FinishDialogSettings must be called from derived classes, when all widgets are initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at end of TransferDataToWindow, or better at end of a wxInitDialogEvent handler

In any case, the best way is to call it in a wxInitDialogEvent handler after calling TransfertDataToWindow(), which is the default wxInitDialogEvent handler wxDialog

Definition at line 104 of file dialog_shim.cpp.

References PCAD2KICAD::Center.

Referenced by COLOR4D_PICKER_DLG::COLOR4D_PICKER_DLG(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES(), DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR(), DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG(), DIALOG_KEEPOUT_AREA_PROPERTIES::DIALOG_KEEPOUT_AREA_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PLOT_SCHEMATIC(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_PRETTY_LIB::DIALOG_SELECT_PRETTY_LIB(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_EDIT_ONE_FIELD::init(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_LIB_EDIT_PIN::OnInitDialog(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnInitDialog(), DIALOG_TRACK_VIA_PROPERTIES::OnInitDlg(), DIALOG_GRAPHIC_ITEMS_OPTIONS::OnInitDlg(), DialogEditModuleText::OnInitDlg(), DIALOG_SET_GRID::OnInitDlg(), DIALOG_PCB_TEXT_PROPERTIES::OnInitDlg(), DIALOG_PRINT_FOR_MODEDIT::OnInitDlg(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_MODULE_MODULE_EDITOR::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_MODULE_BOARD_EDITOR::OnInitDlg(), DIALOG_PRINT_USING_PRINTER::OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR(), and DIALOG_SIGNAL_LIST::TransferDataToWindow().

105 {
106  // must be called from the constructor of derived classes,
107  // when all widgets are initialized, and therefore their size fixed
108 
109  // SetSizeHints fixes the minimal size of sizers in the dialog
110  // (SetSizeHints calls Fit(), so no need to call it)
111  GetSizer()->SetSizeHints( this );
112 
113  // the default position, when calling the first time the dlg
114  Center();
115 }
void DIALOG_SHIM::FixOSXCancelButtonIssue ( )
protectedinherited

A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms.

Definition at line 117 of file dialog_shim.cpp.

Referenced by DIALOG_SHIM::Show().

118 {
119 #ifdef __WXMAC__
120  // A ugly hack to fix an issue on OSX: ctrl+c closes the dialog instead of
121  // copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer
122  // created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority
123  // to copy text standard accelerator, and the dlg is closed when trying to copy text
124  wxButton* button = dynamic_cast< wxButton* > ( wxWindow::FindWindowById( wxID_CANCEL, this ) );
125 
126  if( button )
127  button->SetLabel( _( "Cancel" ) );
128 #endif
129 }
bool DIALOG_PLOT_SCHEMATIC::getModeColor ( )
inlineprivate
PlotFormat DIALOG_PLOT_SCHEMATIC::GetPlotFileFormat ( )
private

Definition at line 199 of file dialog_plot_schematic.cpp.

References DIALOG_PLOT_SCHEMATIC_BASE::m_plotFormatOpt, PLOT_FORMAT_DXF, PLOT_FORMAT_HPGL, PLOT_FORMAT_PDF, PLOT_FORMAT_POST, and PLOT_FORMAT_SVG.

Referenced by getPlotOptions(), OnPlotFormatSelection(), and PlotSchematic().

200 {
201  switch( m_plotFormatOpt->GetSelection() )
202  {
203  default:
204  case 0: return PLOT_FORMAT_POST;
205  case 1: return PLOT_FORMAT_PDF;
206  case 2: return PLOT_FORMAT_SVG;
207  case 3: return PLOT_FORMAT_DXF;
208  case 4: return PLOT_FORMAT_HPGL;
209  }
210 }
bool DIALOG_PLOT_SCHEMATIC::getPlotFrameRef ( )
inlineprivate
void DIALOG_PLOT_SCHEMATIC::getPlotOptions ( )
private

Definition at line 219 of file dialog_plot_schematic.cpp.

References getModeColor(), SCH_EDIT_FRAME::GetPlotDirectoryName(), GetPlotFileFormat(), getPlotFrameRef(), GetPlotOriginCenter(), m_config, m_configChanged, DIALOG_PLOT_SCHEMATIC_BASE::m_DefaultLineSizeCtrl, DIALOG_PLOT_SCHEMATIC_BASE::m_HPGLPaperSizeOption, m_HPGLPaperSizeSelect, m_HPGLPenSize, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_pageSizeSelect, DIALOG_PLOT_SCHEMATIC_BASE::m_PaperSizeOption, m_parent, PLOT_FORMAT_KEY, PLOT_FRAME_REFERENCE_KEY, PLOT_HPGL_ORIGIN_KEY, PLOT_HPGL_PAPERSIZE_KEY, PLOT_HPGL_PEN_SIZE_KEY, PLOT_MODECOLOR_KEY, SetDefaultLineThickness(), SCH_EDIT_FRAME::SetPlotDirectoryName(), and ValueFromTextCtrl().

Referenced by PlotSchematic().

220 {
223  m_config->Write( PLOT_FORMAT_KEY, (long) GetPlotFileFormat() );
227  // HPGL Pen Size is stored in mm in config
228  m_config->Write( PLOT_HPGL_PEN_SIZE_KEY, m_HPGLPenSize/IU_PER_MM );
229 
230  m_pageSizeSelect = m_PaperSizeOption->GetSelection();
232 
233  // Plot directory
234  wxString path = m_outputDirectoryName->GetValue();
235  path.Replace( '\\', '/' );
236 
237  if( m_parent->GetPlotDirectoryName() != path )
238  m_configChanged = true;
239 
241 
242 }
void SetPlotDirectoryName(const wxString &aDirName)
Definition: schframe.h:263
#define PLOT_HPGL_ORIGIN_KEY
void SetDefaultLineThickness(int aThickness)
#define PLOT_MODECOLOR_KEY
const wxString & GetPlotDirectoryName() const
accessor to the destination directory to use when generating plot files.
Definition: schframe.h:262
#define PLOT_FRAME_REFERENCE_KEY
int ValueFromTextCtrl(const wxTextCtrl &aTextCtr)
Convert the number Value in a string according to the internal units and the selected unit (g_UserUni...
Definition: base_units.cpp:384
#define PLOT_HPGL_PEN_SIZE_KEY
#define PLOT_HPGL_PAPERSIZE_KEY
#define PLOT_FORMAT_KEY
bool DIALOG_PLOT_SCHEMATIC::GetPlotOriginCenter ( )
inlineprivate

Definition at line 112 of file dialog_plot_schematic.h.

References DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginOpt.

Referenced by createHPGLFile(), and getPlotOptions().

113  {
114  return m_plotOriginOpt->GetSelection() == 1;
115  }
void DIALOG_PLOT_SCHEMATIC::initDlg ( )
private

Definition at line 85 of file dialog_plot_schematic.cpp.

References AddUnitSymbol(), g_UserUnit, GetDefaultLineThickness(), SCH_EDIT_FRAME::GetPlotDirectoryName(), m_config, DIALOG_PLOT_SCHEMATIC_BASE::m_DefaultLineSizeCtrl, DIALOG_PLOT_SCHEMATIC_BASE::m_defaultLineWidthTitle, DIALOG_PLOT_SCHEMATIC_BASE::m_HPGLPaperSizeOption, m_HPGLPaperSizeSelect, m_HPGLPenSize, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_pageSizeSelect, DIALOG_PLOT_SCHEMATIC_BASE::m_PaperSizeOption, m_parent, DIALOG_PLOT_SCHEMATIC_BASE::m_penHPGLWidthCtrl, DIALOG_PLOT_SCHEMATIC_BASE::m_penHPLGWidthTitle, DIALOG_PLOT_SCHEMATIC_BASE::m_plotFormatOpt, OnPlotFormatSelection(), PLOT_FORMAT_DXF, PLOT_FORMAT_HPGL, PLOT_FORMAT_KEY, PLOT_FORMAT_PDF, PLOT_FORMAT_POST, PLOT_FORMAT_SVG, PLOT_FRAME_REFERENCE_KEY, PLOT_HPGL_ORIGIN_KEY, PLOT_HPGL_PAPERSIZE_KEY, PLOT_HPGL_PEN_SIZE_KEY, PLOT_MODECOLOR_KEY, PutValueInLocalUnits(), setModeColor(), setPlotFrameRef(), and SetPlotOriginCenter().

Referenced by DIALOG_PLOT_SCHEMATIC().

86 {
87  // Set paper size option
88  m_PaperSizeOption->SetSelection( m_pageSizeSelect );
89 
90  // Set color or B&W plot option
91  bool tmp;
92  m_config->Read( PLOT_MODECOLOR_KEY, &tmp, true );
93  setModeColor( tmp );
94 
95  // Set plot or not frame reference option
96  m_config->Read( PLOT_FRAME_REFERENCE_KEY, &tmp, true );
97  setPlotFrameRef( tmp );
98 
99  // Set HPGL plot origin to center of paper of left bottom corner
100  m_config->Read( PLOT_HPGL_ORIGIN_KEY, &tmp, false );
101  SetPlotOriginCenter( tmp );
102 
105 
106  // HPGL Pen Size is stored in mm in config
108  m_HPGLPenSize *= IU_PER_MM;
109 
110  // Switch to the last save plot format
111  long plotfmt;
112  m_config->Read( PLOT_FORMAT_KEY, &plotfmt, 0 );
113 
114  switch( plotfmt )
115  {
116  default:
117  case PLOT_FORMAT_POST:
118  m_plotFormatOpt->SetSelection( 0 );
119  break;
120 
121  case PLOT_FORMAT_PDF:
122  m_plotFormatOpt->SetSelection( 1 );
123  break;
124 
125  case PLOT_FORMAT_SVG:
126  m_plotFormatOpt->SetSelection( 2 );
127  break;
128 
129  case PLOT_FORMAT_DXF:
130  m_plotFormatOpt->SetSelection( 3 );
131  break;
132 
133  case PLOT_FORMAT_HPGL:
134  m_plotFormatOpt->SetSelection( 4 );
135  break;
136  }
137 
138  // Set the default line width (pen width which should be used for
139  // items that do not have a pen size defined (like frame ref)
142 
143  // Initialize HPGL specific widgets
147 
148  // Plot directory
149  wxString path = m_parent->GetPlotDirectoryName();
150 #ifdef __WINDOWS__
151  path.Replace( '/', '\\' );
152 #endif
153  m_outputDirectoryName->SetValue( path );
154 
155  // Hide/show widgets that are not always displayed:
156  wxCommandEvent cmd_event;
157  OnPlotFormatSelection( cmd_event );
158 }
void SetPlotOriginCenter(bool aCenter)
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
void OnPlotFormatSelection(wxCommandEvent &event) override
#define PLOT_HPGL_ORIGIN_KEY
#define PLOT_MODECOLOR_KEY
const wxString & GetPlotDirectoryName() const
accessor to the destination directory to use when generating plot files.
Definition: schframe.h:262
void setPlotFrameRef(bool aPlot)
#define PLOT_FRAME_REFERENCE_KEY
#define PLOT_HPGL_PEN_SIZE_KEY
EDA_UNITS_T g_UserUnit
Global variables definitions.
Definition: common.cpp:56
void PutValueInLocalUnits(wxTextCtrl &aTextCtr, int aValue)
Function PutValueInLocalUnits converts aValue from internal units to user units and append the units ...
Definition: base_units.cpp:265
void AddUnitSymbol(wxStaticText &Stext, EDA_UNITS_T aUnit)
Definition: base_units.cpp:509
#define PLOT_HPGL_PAPERSIZE_KEY
#define PLOT_FORMAT_KEY
void setModeColor(bool aColor)
KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in.

A KIWAY_HOLDER is not necessarily a KIWAY_PLAYER.

Definition at line 60 of file kiway_player.h.

References KIWAY_HOLDER::m_kiway.

Referenced by SCH_EDIT_FRAME::AppendOneEEProject(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_SHIM::DIALOG_SHIM(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers(), LIB_EDIT_FRAME::InstallConfigFrame(), PCB_EDIT_FRAME::InstallModuleOptionsFrame(), KIWAY_PLAYER::language_change(), SCH_SHEET::Load(), CVPCB_MAINFRAME::LoadFootprintFiles(), KIWAY_PLAYER::OnChangeIconsOptions(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateReplaceModuleInBoard(), SCH_EDIT_FRAME::OpenProjectFiles(), KIWAY_HOLDER::Prj(), PCB_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Special_Functions(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), DISPLAY_FOOTPRINTS_FRAME::Show3D_Frame(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_EDIT_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::showButtonHandler(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::showButtonHandler(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), and DIALOG_EXCHANGE_MODULE::ViewAndSelectFootprint().

61  {
62  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
63  return *m_kiway;
64  }
KIWAY * m_kiway
Definition: kiway_player.h:85
void DIALOG_PLOT_SCHEMATIC::OnButtonCancelClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 213 of file dialog_plot_schematic.cpp.

214 {
215  EndModal( wxID_CANCEL );
216 }
void DIALOG_PLOT_SCHEMATIC::OnButtonPlotAllClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 297 of file dialog_plot_schematic.cpp.

References PlotSchematic().

298 {
299  PlotSchematic( true );
300 }
void PlotSchematic(bool aPlotAll)
void DIALOG_PLOT_SCHEMATIC::OnButtonPlotCurrentClick ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 291 of file dialog_plot_schematic.cpp.

References PlotSchematic().

292 {
293  PlotSchematic( false );
294 }
void PlotSchematic(bool aPlotAll)
virtual void DIALOG_PLOT_SCHEMATIC_BASE::OnCloseWindow ( wxCloseEvent &  event)
inlineprotectedvirtualinherited
virtual void DIALOG_PLOT_SCHEMATIC_BASE::OnHPGLPageSelected ( wxCommandEvent &  event)
inlineprotectedvirtualinherited
void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked ( wxCommandEvent &  event)
overrideprivatevirtual

Set the m_outputDirectoryName variable to the selected directory from directory dialog.

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 163 of file dialog_plot_schematic.cpp.

References PROJECT::AbsolutePath(), g_RootSheet, GetChars(), SCH_SHEET::GetFileName(), DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, and KIWAY_HOLDER::Prj().

164 {
165  // Build the absolute path of current output plot directory
166  // to preselect it when opening the dialog.
167  wxFileName fn( m_outputDirectoryName->GetValue() );
168  wxString path = Prj().AbsolutePath( m_outputDirectoryName->GetValue() );
169 
170  wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
171 
172  if( dirDialog.ShowModal() == wxID_CANCEL )
173  {
174  return;
175  }
176 
177  wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
178 
180  wxString defaultPath = fn.GetPathWithSep();
181  wxString msg;
182  msg.Printf( _( "Do you want to use a path relative to\n'%s'" ),
183  GetChars( defaultPath ) );
184 
185  wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
186  wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
187 
188  // relative directory selected
189  if( dialog.ShowModal() == wxID_YES )
190  {
191  if( !dirName.MakeRelativeTo( defaultPath ) )
192  wxMessageBox( _( "Cannot make path relative (target volume different from file volume)!" ),
193  _( "Plot Output Directory" ), wxOK | wxICON_ERROR );
194  }
195 
196  m_outputDirectoryName->SetValue( dirName.GetFullPath() );
197 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:55
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project's directory to be an absolu...
Definition: project.cpp:371
wxString GetFileName(void) const
Function GetFileName return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:880
static const wxChar * GetChars(const wxString &s)
Function GetChars returns a wxChar* to the actual wxChar* data within a wxString, and is helpful for ...
Definition: macros.h:92
void DIALOG_PLOT_SCHEMATIC::OnPlotFormatSelection ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 245 of file dialog_plot_schematic.cpp.

References GetPlotFileFormat(), DIALOG_PLOT_SCHEMATIC_BASE::m_DefaultLineSizeCtrl, DIALOG_PLOT_SCHEMATIC_BASE::m_paperHPGLSizer, DIALOG_PLOT_SCHEMATIC_BASE::m_paperOptionsSizer, DIALOG_PLOT_SCHEMATIC_BASE::m_PaperSizeOption, PLOT_FORMAT_DXF, PLOT_FORMAT_HPGL, PLOT_FORMAT_PDF, PLOT_FORMAT_POST, and PLOT_FORMAT_SVG.

Referenced by initDlg().

246 {
247 
248  switch( GetPlotFileFormat() )
249  {
250  default:
251  case PLOT_FORMAT_POST:
254  m_PaperSizeOption->Enable( true );
255  m_DefaultLineSizeCtrl->Enable( true );
256  break;
257 
258  case PLOT_FORMAT_PDF:
261  m_PaperSizeOption->Enable( true );
262  m_DefaultLineSizeCtrl->Enable( true );
263  break;
264 
265  case PLOT_FORMAT_SVG:
268  m_PaperSizeOption->Enable( false );
269  m_DefaultLineSizeCtrl->Enable( true );
270  break;
271 
272  case PLOT_FORMAT_DXF:
275  m_PaperSizeOption->Enable( false );
276  m_DefaultLineSizeCtrl->Enable( false );
277  break;
278 
279  case PLOT_FORMAT_HPGL:
282  m_DefaultLineSizeCtrl->Enable( false );
283  break;
284 
285  }
286 
287  GetSizer()->SetSizeHints( this );
288 }
bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL ( const wxString &  aFileName,
SCH_SCREEN aScreen,
const PAGE_INFO aPageInfo,
wxPoint  aPlot0ffset,
double  aScale,
bool  aPlotFrameRef 
)
private

Definition at line 201 of file plot_schematic_HPGL.cpp.

References BLACK, HPGL_PLOTTER::EndPlot(), SCH_SCREEN::GetFileName(), SCH_BASE_FRAME::GetPageSettings(), getPlotFrameRef(), SCH_EDIT_FRAME::GetScreenDesc(), SCH_BASE_FRAME::GetTitleBlock(), m_HPGLPenSize, BASE_SCREEN::m_NumberOfScreens, m_parent, BASE_SCREEN::m_ScreenNumber, PLOTTER::OpenFile(), SCH_SCREEN::Plot(), PlotWorkSheet(), HPGL_PLOTTER::SetColor(), PLOTTER::SetCreator(), PLOTTER::SetPageSettings(), HPGL_PLOTTER::SetPenDiameter(), HPGL_PLOTTER::SetViewport(), and HPGL_PLOTTER::StartPlot().

Referenced by createHPGLFile().

207 {
208  HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
209 
210  plotter->SetPageSettings( aPageInfo );
211  // Currently, plot units are in decimil
212  plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
213 
214  // Init :
215  plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
216 
217  if( ! plotter->OpenFile( aFileName ) )
218  {
219  delete plotter;
220  return false;
221  }
222 
223  LOCALE_IO toggle;
224 
225  // Pen num and pen speed are not initialized here.
226  // Default HPGL driver values are used
227  plotter->SetPenDiameter( m_HPGLPenSize );
228  plotter->StartPlot();
229 
230  plotter->SetColor( BLACK );
231 
232  if( getPlotFrameRef() )
233  PlotWorkSheet( plotter, m_parent->GetTitleBlock(),
235  aScreen->m_ScreenNumber, aScreen->m_NumberOfScreens,
237  aScreen->GetFileName() );
238 
239  aScreen->Plot( plotter );
240 
241  plotter->EndPlot();
242  delete plotter;
243 
244  return true;
245 }
virtual bool EndPlot() override
HPGL end of plot: pen return and release.
virtual void SetColor(COLOR4D color) override
Definition: plot_common.h:581
virtual void SetCreator(const wxString &aCreator)
Definition: plot_common.h:151
Class LOCALE_IO is a class that can be instantiated within a scope in which you are expecting excepti...
Definition: common.h:166
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
const wxString & GetFileName() const
virtual void SetPenDiameter(double diameter)
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
virtual bool StartPlot() override
At the start of the HPGL plot pen speed and number are requested.
void PlotWorkSheet(PLOTTER *plotter, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, int aSheetNumber, int aNumberOfSheets, const wxString &aSheetDesc, const wxString &aFilename)
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual wxString GetScreenDesc() const override
Definition: schframe.cpp:534
void Plot(PLOTTER *aPlotter)
Function Plot plots all the schematic objects to aPlotter.
Definition: sch_screen.cpp:584
const PAGE_INFO & GetPageSettings() const override
const TITLE_BLOCK & GetTitleBlock() const override
Definition: colors.h:45
bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF ( const wxString &  aFileName,
SCH_SCREEN aScreen,
wxPoint  aPlot0ffset,
double  aScale,
bool  aPlotFrameRef 
)
private

Definition at line 107 of file plot_schematic_DXF.cpp.

References DXF_PLOTTER::EndPlot(), SCH_SCREEN::GetFileName(), getModeColor(), SCH_BASE_FRAME::GetPageSettings(), SCH_SCREEN::GetPageSettings(), SCH_EDIT_FRAME::GetScreenDesc(), SCH_BASE_FRAME::GetTitleBlock(), BASE_SCREEN::m_NumberOfScreens, m_parent, BASE_SCREEN::m_ScreenNumber, PLOTTER::OpenFile(), SCH_SCREEN::Plot(), PlotWorkSheet(), PLOTTER::SetColorMode(), PLOTTER::SetCreator(), PLOTTER::SetPageSettings(), DXF_PLOTTER::SetViewport(), and DXF_PLOTTER::StartPlot().

Referenced by CreateDXFFile().

112 {
113  DXF_PLOTTER* plotter = new DXF_PLOTTER();
114 
115  const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
116  plotter->SetPageSettings( pageInfo );
117  plotter->SetColorMode( getModeColor() );
118  // Currently, plot units are in decimil
119  plotter->SetViewport( aPlotOffset, IU_PER_MILS/10, aScale, false );
120 
121  // Init :
122  plotter->SetCreator( wxT( "Eeschema-DXF" ) );
123 
124  if( ! plotter->OpenFile( aFileName ) )
125  {
126  delete plotter;
127  return false;
128  }
129 
130  LOCALE_IO toggle;
131 
132  plotter->StartPlot();
133 
134  if( aPlotFrameRef )
135  {
136  PlotWorkSheet( plotter, m_parent->GetTitleBlock(),
138  aScreen->m_ScreenNumber, aScreen->m_NumberOfScreens,
140  aScreen->GetFileName() );
141  }
142 
143  aScreen->Plot( plotter );
144 
145  // finish
146  plotter->EndPlot();
147  delete plotter;
148 
149  return true;
150 }
virtual void SetCreator(const wxString &aCreator)
Definition: plot_common.h:151
Class LOCALE_IO is a class that can be instantiated within a scope in which you are expecting excepti...
Definition: common.h:166
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the scale/position for the DXF plot The DXF engine doesn't support line widths and mirroring...
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
const wxString & GetFileName() const
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
void PlotWorkSheet(PLOTTER *plotter, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, int aSheetNumber, int aNumberOfSheets, const wxString &aSheetDesc, const wxString &aFilename)
virtual wxString GetScreenDesc() const override
Definition: schframe.cpp:534
virtual bool StartPlot() override
Opens the DXF plot with a skeleton header.
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
virtual bool EndPlot() override
void Plot(PLOTTER *aPlotter)
Function Plot plots all the schematic objects to aPlotter.
Definition: sch_screen.cpp:584
const PAGE_INFO & GetPageSettings() const override
const TITLE_BLOCK & GetTitleBlock() const override
const PAGE_INFO & GetPageSettings() const
virtual void SetColorMode(bool _color_mode)
Definition: plot_common.h:116
void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF ( PLOTTER aPlotter,
SCH_SCREEN aScreen,
bool  aPlotFrameRef 
)
private

Definition at line 146 of file plot_schematic_PDF.cpp.

References BLACK, SCH_SCREEN::GetFileName(), SCH_BASE_FRAME::GetPageSettings(), SCH_EDIT_FRAME::GetScreenDesc(), SCH_BASE_FRAME::GetTitleBlock(), BASE_SCREEN::m_NumberOfScreens, m_parent, BASE_SCREEN::m_ScreenNumber, SCH_SCREEN::Plot(), PlotWorkSheet(), and PLOTTER::SetColor().

Referenced by createPDFFile().

149 {
150  if( aPlotFrameRef )
151  {
152  aPlotter->SetColor( BLACK );
153  PlotWorkSheet( aPlotter, m_parent->GetTitleBlock(),
155  aScreen->m_ScreenNumber, aScreen->m_NumberOfScreens,
157  aScreen->GetFileName() );
158  }
159 
160  aScreen->Plot( aPlotter );
161 }
virtual void SetColor(COLOR4D color)=0
const wxString & GetFileName() const
void PlotWorkSheet(PLOTTER *plotter, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, int aSheetNumber, int aNumberOfSheets, const wxString &aSheetDesc, const wxString &aFilename)
virtual wxString GetScreenDesc() const override
Definition: schframe.cpp:534
void Plot(PLOTTER *aPlotter)
Function Plot plots all the schematic objects to aPlotter.
Definition: sch_screen.cpp:584
const PAGE_INFO & GetPageSettings() const override
const TITLE_BLOCK & GetTitleBlock() const override
Definition: colors.h:45
bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS ( const wxString &  aFileName,
SCH_SCREEN aScreen,
const PAGE_INFO aPageInfo,
wxPoint  aPlot0ffset,
double  aScale,
bool  aPlotFrameRef 
)
private

Definition at line 132 of file plot_schematic_PS.cpp.

References BLACK, PS_PLOTTER::EndPlot(), GetDefaultLineThickness(), SCH_SCREEN::GetFileName(), getModeColor(), SCH_BASE_FRAME::GetPageSettings(), SCH_EDIT_FRAME::GetScreenDesc(), SCH_BASE_FRAME::GetTitleBlock(), BASE_SCREEN::m_NumberOfScreens, m_parent, BASE_SCREEN::m_ScreenNumber, PLOTTER::OpenFile(), SCH_SCREEN::Plot(), PlotWorkSheet(), PSLIKE_PLOTTER::SetColor(), PLOTTER::SetColorMode(), PLOTTER::SetCreator(), PSLIKE_PLOTTER::SetDefaultLineWidth(), PLOTTER::SetPageSettings(), PS_PLOTTER::SetViewport(), and PS_PLOTTER::StartPlot().

Referenced by createPSFile().

138 {
139  PS_PLOTTER* plotter = new PS_PLOTTER();
140  plotter->SetPageSettings( aPageInfo );
142  plotter->SetColorMode( getModeColor() );
143  // Currently, plot units are in decimil
144  plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
145 
146  // Init :
147  plotter->SetCreator( wxT( "Eeschema-PS" ) );
148 
149  if( ! plotter->OpenFile( aFileName ) )
150  {
151  delete plotter;
152  return false;
153  }
154 
155  LOCALE_IO toggle; // Switch the locale to standard C
156 
157  plotter->StartPlot();
158 
159  if( aPlotFrameRef )
160  {
161  plotter->SetColor( BLACK );
162  PlotWorkSheet( plotter, m_parent->GetTitleBlock(),
164  aScreen->m_ScreenNumber, aScreen->m_NumberOfScreens,
166  aScreen->GetFileName() );
167  }
168 
169  aScreen->Plot( plotter );
170 
171  plotter->EndPlot();
172  delete plotter;
173 
174  return true;
175 }
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual void SetCreator(const wxString &aCreator)
Definition: plot_common.h:151
Class LOCALE_IO is a class that can be instantiated within a scope in which you are expecting excepti...
Definition: common.h:166
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
const wxString & GetFileName() const
virtual bool EndPlot() override
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
void PlotWorkSheet(PLOTTER *plotter, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, int aSheetNumber, int aNumberOfSheets, const wxString &aSheetDesc, const wxString &aFilename)
virtual wxString GetScreenDesc() const override
Definition: schframe.cpp:534
virtual bool StartPlot() override
The code within this function (and the CloseFilePS function) creates postscript files whose contents ...
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
virtual void SetColor(COLOR4D color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values...
void Plot(PLOTTER *aPlotter)
Function Plot plots all the schematic objects to aPlotter.
Definition: sch_screen.cpp:584
const PAGE_INFO & GetPageSettings() const override
const TITLE_BLOCK & GetTitleBlock() const override
Definition: colors.h:45
virtual void SetColorMode(bool _color_mode)
Definition: plot_common.h:116
bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG ( EDA_DRAW_FRAME aFrame,
const wxString &  aFileName,
SCH_SCREEN aScreen,
bool  aPlotBlackAndWhite,
bool  aPlotFrameRef 
)
static

Definition at line 103 of file plot_schematic_SVG.cpp.

References BLACK, SVG_PLOTTER::EndPlot(), GetDefaultLineThickness(), SCH_SCREEN::GetFileName(), SCH_SCREEN::GetPageSettings(), EDA_DRAW_FRAME::GetPageSettings(), EDA_DRAW_FRAME::GetScreenDesc(), EDA_DRAW_FRAME::GetTitleBlock(), BASE_SCREEN::m_NumberOfScreens, BASE_SCREEN::m_ScreenNumber, PLOTTER::OpenFile(), SCH_SCREEN::Plot(), PlotWorkSheet(), scale, SVG_PLOTTER::SetColor(), PLOTTER::SetColorMode(), PLOTTER::SetCreator(), PSLIKE_PLOTTER::SetDefaultLineWidth(), PLOTTER::SetPageSettings(), SVG_PLOTTER::SetViewport(), and SVG_PLOTTER::StartPlot().

Referenced by createSVGFile().

108 {
109  SVG_PLOTTER* plotter = new SVG_PLOTTER();
110 
111  const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
112  plotter->SetPageSettings( pageInfo );
114  plotter->SetColorMode( aPlotBlackAndWhite ? false : true );
115  wxPoint plot_offset;
116  double scale = 1.0;
117  // Currently, plot units are in decimil
118  plotter->SetViewport( plot_offset, IU_PER_MILS/10, scale, false );
119 
120  // Init :
121  plotter->SetCreator( wxT( "Eeschema-SVG" ) );
122 
123  if( ! plotter->OpenFile( aFileName ) )
124  {
125  delete plotter;
126  return false;
127  }
128 
129  LOCALE_IO toggle;
130 
131  plotter->StartPlot();
132 
133  if( aPlotFrameRef )
134  {
135  plotter->SetColor( BLACK );
136  PlotWorkSheet( plotter, aFrame->GetTitleBlock(),
137  aFrame->GetPageSettings(),
138  aScreen->m_ScreenNumber, aScreen->m_NumberOfScreens,
139  aFrame->GetScreenDesc(),
140  aScreen->GetFileName() );
141  }
142 
143  aScreen->Plot( plotter );
144 
145  plotter->EndPlot();
146  delete plotter;
147 
148  return true;
149 }
virtual void SetCreator(const wxString &aCreator)
Definition: plot_common.h:151
virtual const TITLE_BLOCK & GetTitleBlock() const =0
Class LOCALE_IO is a class that can be instantiated within a scope in which you are expecting excepti...
Definition: common.h:166
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
const wxString & GetFileName() const
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
void PlotWorkSheet(PLOTTER *plotter, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, int aSheetNumber, int aNumberOfSheets, const wxString &aSheetDesc, const wxString &aFilename)
virtual bool EndPlot() override
virtual const PAGE_INFO & GetPageSettings() const =0
virtual void SetColor(COLOR4D color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values...
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
virtual wxString GetScreenDesc() const
Definition: worksheet.cpp:120
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
virtual bool StartPlot() override
The code within this function creates SVG files header.
void Plot(PLOTTER *aPlotter)
Function Plot plots all the schematic objects to aPlotter.
Definition: sch_screen.cpp:584
const int scale
const PAGE_INFO & GetPageSettings() const
Definition: colors.h:45
virtual void SetColorMode(bool _color_mode)
Definition: plot_common.h:116
void DIALOG_PLOT_SCHEMATIC::PlotSchematic ( bool  aPlotAll)
private

Definition at line 303 of file dialog_plot_schematic.cpp.

References CreateDXFFile(), createHPGLFile(), createPDFFile(), createPSFile(), createSVGFile(), GetPlotFileFormat(), getPlotFrameRef(), getPlotOptions(), PLOT_FORMAT_DXF, PLOT_FORMAT_HPGL, PLOT_FORMAT_PDF, PLOT_FORMAT_POST, and PLOT_FORMAT_SVG.

Referenced by OnButtonPlotAllClick(), and OnButtonPlotCurrentClick().

304 {
305  getPlotOptions();
306 
307  switch( GetPlotFileFormat() )
308  {
309  case PLOT_FORMAT_HPGL:
310  createHPGLFile( aPlotAll, getPlotFrameRef() );
311  break;
312 
313  case PLOT_FORMAT_DXF:
314  CreateDXFFile( aPlotAll, getPlotFrameRef() );
315  break;
316 
317  case PLOT_FORMAT_PDF:
318  createPDFFile( aPlotAll, getPlotFrameRef() );
319  break;
320 
321  case PLOT_FORMAT_SVG:
322  createSVGFile( aPlotAll, getPlotFrameRef() );
323  break;
324 
325  case PLOT_FORMAT_POST:
326  // Fall through. Default to Postscript.
327  default:
328  createPSFile( aPlotAll, getPlotFrameRef() );
329  break;
330 
331  }
332 }
void CreateDXFFile(bool aPlotAll, bool aPlotFrameRef)
void createHPGLFile(bool aPlotAll, bool aPlotFrameRef)
void createPDFFile(bool aPlotAll, bool aPlotFrameRef)
void createPSFile(bool aPlotAll, bool aPlotFrameRef)
void createSVGFile(bool aPlotAll, bool aPlotFrameRef)
PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Function Prj returns a reference to the PROJECT "associated with" this KIWAY.

Definition at line 34 of file kiway_holder.cpp.

References KIWAY_HOLDER::Kiway(), and KIWAY::Prj().

Referenced by SCH_EDIT_FRAME::AnnotateComponents(), SCH_EDIT_FRAME::AppendOneEEProject(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), SCH_EDIT_FRAME::backAnnotateFootprints(), LIB_VIEW_FRAME::BestZoom(), DIALOG_MODULE_MODULE_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_MODULE_BOARD_EDITOR::BrowseAndAdd3DShapeFile(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::BrowseAndSelectDocFile(), DIALOG_EXCHANGE_MODULE::BrowseAndSelectFootprint(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_MODULE_MODULE_EDITOR::Cfg3DPath(), DIALOG_MODULE_BOARD_EDITOR::Cfg3DPath(), SCH_EDIT_FRAME::CheckAnnotate(), SCH_SCREEN::CheckComponentsToPartsLinks(), SCH_EDIT_FRAME::ConvertPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions(), SCH_EDIT_FRAME::CreateArchiveLibrary(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromCurrentLibrary(), LIB_EDIT_FRAME::DeleteOnePart(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_EESCHEMA_CONFIG::DIALOG_EESCHEMA_CONFIG(), DIALOG_FP_LIB_TABLE::DIALOG_FP_LIB_TABLE(), DIALOG_MODULE_BOARD_EDITOR::DIALOG_MODULE_BOARD_EDITOR(), DIALOG_MODULE_MODULE_EDITOR::DIALOG_MODULE_MODULE_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SCH_EDIT_ONE_FIELD::DIALOG_SCH_EDIT_ONE_FIELD(), DIALOG_SYMBOL_LIB_TABLE::DIALOG_SYMBOL_LIB_TABLE(), LIB_VIEW_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), DIALOG_MODULE_MODULE_EDITOR::Edit3DShapeFileName(), DIALOG_MODULE_BOARD_EDITOR::Edit3DShapeFileName(), SCH_EDIT_FRAME::EditComponentFieldText(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportToGenCAD(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), LIB_EDIT_FRAME::GetCurPart(), FOOTPRINT_EDIT_FRAME::GetCurrentLib(), FOOTPRINT_EDIT_FRAME::getLibPath(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers(), DIALOG_MODULE_MODULE_EDITOR::initModeditProperties(), DIALOG_MODULE_BOARD_EDITOR::InitModeditProperties(), LIB_EDIT_FRAME::InstallConfigFrame(), SCH_EDIT_FRAME::InstallConfigFrame(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), DIALOG_BOM_EDITOR::LoadComponents(), CVPCB_MAINFRAME::LoadFootprintFiles(), SCH_EDIT_FRAME::LoadOneEEFile(), LIB_EDIT_FRAME::LoadOneLibraryPart(), LIB_EDIT_FRAME::LoadOneSymbol(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_EESCHEMA_CONFIG::OnAddOrInsertLibClick(), DIALOG_EESCHEMA_CONFIG::OnAddOrInsertPath(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), LIB_EDIT_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), DIALOG_GENDRILL::OnGenReportFile(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), PCB_EDIT_FRAME::OnLeftClick(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_SVG_PRINT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), OnOutputDirectoryBrowseClicked(), DIALOG_GEN_MODULE_POSITION::OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), DIALOG_BOM::OnRunPlugin(), DIALOG_NETLIST::OnSaveMessagesToFile(), SCH_EDIT_FRAME::OnSaveProject(), DIALOG_SPICE_MODEL::onSelectIcLib(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OnSelectUnit(), DIALOG_SPICE_MODEL::onSemiSelectLib(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnTestChipName(), FOOTPRINT_EDIT_FRAME::OnUpdateSelectCurrentLib(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_EDITOR_CONTROL::PlaceModule(), SCH_EDIT_FRAME::prepareForNetlist(), SCH_EDIT_FRAME::Process_Config(), PCB_EDIT_FRAME::Process_Config(), SCH_EDIT_FRAME::Process_Special_Functions(), SCH_EDIT_FRAME::ProcessCmpToFootprintLinkFile(), FOOTPRINT_EDIT_FRAME::ProcessPreferences(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_VIEW_FRAME::ReCreateHToolbar(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), LIB_VIEW_FRAME::RedrawActiveWindow(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SCH_EDIT_FRAME::RescueProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_SCREEN::Save(), LIB_EDIT_FRAME::SaveActiveLibrary(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibrary(), FOOTPRINT_VIEWER_FRAME::SelectCurrentFootprint(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_ERC::TestErc(), DIALOG_SPICE_MODEL::updateFromFile(), SIM_PLOT_FRAME::updateNetlistExporter(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), CVPCB_MAINFRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_MODULE_BOARD_EDITOR::~DIALOG_MODULE_BOARD_EDITOR(), and DIALOG_MODULE_MODULE_EDITOR::~DIALOG_MODULE_MODULE_EDITOR().

35 {
36  return Kiway().Prj();
37 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_player.h:60
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:144
bool DIALOG_PLOT_SCHEMATIC::PrjConfigChanged ( )
inline

Definition at line 62 of file dialog_plot_schematic.h.

References m_configChanged.

Referenced by SCH_EDIT_FRAME::PlotSchematic().

62 { return m_configChanged; } // return true if the prj config was modified
void DIALOG_PLOT_SCHEMATIC::restoreEnvironment ( PDF_PLOTTER aPlotter,
SCH_SHEET_PATH aOldsheetpath 
)
private

Everything done, close the plot and restore the environment.

Parameters
aPlotterthe plotter to close and destroy
aOldsheetpaththe stored old sheet path for the current sheet before the plot started

Definition at line 133 of file plot_schematic_PDF.cpp.

References PDF_PLOTTER::EndPlot(), SCH_EDIT_FRAME::GetCurrentSheet(), m_parent, SCH_EDIT_FRAME::SetCurrentSheet(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), and SCH_SHEET_PATH::UpdateAllScreenReferences().

Referenced by createPDFFile().

135 {
136  aPlotter->EndPlot();
137  delete aPlotter;
138 
139  // Restore the previous sheet
140  m_parent->SetCurrentSheet( aOldsheetpath );
143 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Definition: schframe.cpp:581
virtual bool EndPlot() override
void UpdateAllScreenReferences()
Function UpdateAllScreenReferences updates the reference and the m_Multi parameter (part selection) f...
SCH_SHEET_PATH & GetCurrentSheet()
Definition: schframe.cpp:573
void SetSheetNumberAndCount()
Function SetSheetNumberAndCount Set the m_ScreenNumber and m_NumberOfScreens members for screens must...
Definition: schframe.cpp:493
void DIALOG_PLOT_SCHEMATIC::SetHPGLPenWidth ( )
private

Definition at line 99 of file plot_schematic_HPGL.cpp.

References m_HPGLPenSize, DIALOG_PLOT_SCHEMATIC_BASE::m_penHPGLWidthCtrl, and ValueFromTextCtrl().

Referenced by createHPGLFile().

100 {
102 
103  if( m_HPGLPenSize > Millimeter2iu( 2 ) )
104  m_HPGLPenSize = Millimeter2iu( 2 );
105 
106  if( m_HPGLPenSize < Millimeter2iu( 0.01 ) )
107  m_HPGLPenSize = Millimeter2iu( 0.01 );
108 }
int ValueFromTextCtrl(const wxTextCtrl &aTextCtr)
Convert the number Value in a string according to the internal units and the selected unit (g_UserUni...
Definition: base_units.cpp:384
void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

Function SetKiway.

Parameters
aDestis the recipient of aKiway pointer. It is only used for debugging, since "this" is not a wxWindow*. "this" is a KIWAY_HOLDER mix-in.
aKiwayis often from a parent window, or from KIFACE::CreateWindow().

Definition at line 41 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

42 {
43 #if defined(DEBUG)
44  // offer a trap point for debugging most any window
45  wxASSERT( aDest );
46  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
47  {
48  int breakhere=1;
49  (void) breakhere;
50  }
51 #endif
52 
53  (void) aDest;
54 
55  m_kiway = aKiway;
56 }
KIWAY * m_kiway
Definition: kiway_player.h:85
const char * name
void DIALOG_PLOT_SCHEMATIC::setModeColor ( bool  aColor)
inlineprivate

Definition at line 79 of file dialog_plot_schematic.h.

References DIALOG_PLOT_SCHEMATIC_BASE::m_ModeColorOption.

Referenced by initDlg().

80  { m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); }
void DIALOG_PLOT_SCHEMATIC::setPlotFrameRef ( bool  aPlot)
inlineprivate

Definition at line 90 of file dialog_plot_schematic.h.

References DIALOG_PLOT_SCHEMATIC_BASE::m_PlotFrameRefOpt.

Referenced by initDlg().

90 {m_PlotFrameRefOpt->SetValue( aPlot ); }
void DIALOG_PLOT_SCHEMATIC::SetPlotOriginCenter ( bool  aCenter)
inlineprivate

Definition at line 117 of file dialog_plot_schematic.h.

References DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginOpt.

Referenced by initDlg().

118  {
119  m_plotOriginOpt->SetSelection( aCenter ? 1 : 0 );
120  }
void DIALOG_PLOT_SCHEMATIC::setupPlotPagePDF ( PLOTTER aPlotter,
SCH_SCREEN aScreen 
)
private

Definition at line 164 of file plot_schematic_PDF.cpp.

References PAGE_INFO::GetHeightMils(), SCH_SCREEN::GetPageSettings(), PAGE_INFO::GetWidthMils(), PAGE_INFO::IsPortrait(), m_pageSizeSelect, min, PAGE_SIZE_A, PAGE_SIZE_A4, PAGE_SIZE_AUTO, scale, PLOTTER::SetPageSettings(), PAGE_INFO::SetPortrait(), PAGE_INFO::SetType(), and PLOTTER::SetViewport().

Referenced by createPDFFile().

165 {
166  PAGE_INFO plotPage; // page size selected to plot
167  // Considerations on page size and scaling requests
168  PAGE_INFO actualPage = aScreen->GetPageSettings(); // page size selected in schematic
169 
170  switch( m_pageSizeSelect )
171  {
172  case PAGE_SIZE_A:
173  plotPage.SetType( wxT( "A" ) );
174  plotPage.SetPortrait( actualPage.IsPortrait() );
175  break;
176 
177  case PAGE_SIZE_A4:
178  plotPage.SetType( wxT( "A4" ) );
179  plotPage.SetPortrait( actualPage.IsPortrait() );
180  break;
181 
182  case PAGE_SIZE_AUTO:
183  default:
184  plotPage = actualPage;
185  break;
186  }
187 
188  double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
189  double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
190  double scale = std::min( scalex, scaley );
191  aPlotter->SetPageSettings( plotPage );
192  // Currently, plot units are in decimil
193  aPlotter->SetViewport( wxPoint( 0, 0 ), IU_PER_MILS/10, scale, false );
194 }
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
bool IsPortrait() const
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
bool SetType(const wxString &aStandardPageDescriptionName, bool IsPortrait=false)
Function SetType sets the name of the page type and also the sizes and margins commonly associated wi...
int GetWidthMils() const
void SetPortrait(bool isPortrait)
Function SetPortrait will rotate the paper page 90 degrees.
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror)=0
Set the plot offset and scaling for the current plot.
const int scale
const PAGE_INFO & GetPageSettings() const
int GetHeightMils() const
#define min(a, b)
Definition: auxiliary.h:85
bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 139 of file dialog_shim.cpp.

References class_map, DIALOG_SHIM::FixOSXCancelButtonIssue(), EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, wxPoint::x, and wxPoint::y.

Referenced by DisplayHotkeyList(), DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), DIALOG_ANNOTATE::OnApplyClick(), DIALOG_SCH_FIND::OnCancel(), DIALOG_ANNOTATE::OnCancelClick(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), DIALOG_DRC_CONTROL::OnPopupMenu(), DIALOG_EXCHANGE_MODULE::OnQuit(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), and DIALOG_SHIM::ShowQuasiModal().

140 {
141  bool ret;
142  const char* hash_key;
143 
144  if( m_hash_key.size() )
145  {
146  // a special case like EDA_LIST_DIALOG, which has multiple uses.
147  hash_key = m_hash_key.c_str();
148  }
149  else
150  {
151  hash_key = typeid(*this).name();
152  }
153 
154  // Show or hide the window. If hiding, save current position and size.
155  // If showing, use previous position and size.
156  if( show )
157  {
158  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
159  ret = wxDialog::Show( show );
160 
161  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
162  EDA_RECT r = class_map[ hash_key ];
163 
164  if( r.GetSize().x != 0 && r.GetSize().y != 0 )
165  SetSize( r.GetPosition().x, r.GetPosition().y, r.GetSize().x, r.GetSize().y, 0 );
166  }
167  else
168  {
169  // Save the dialog's position & size before hiding, using classname as key
170  EDA_RECT r( wxDialog::GetPosition(), wxDialog::GetSize() );
171  class_map[ hash_key ] = r;
172 
173  ret = wxDialog::Show( show );
174  }
175 
177 
178  return ret;
179 }
std::string m_hash_key
Definition: dialog_shim.h:128
void FixOSXCancelButtonIssue()
A ugly hack to fix an issue on OSX: when typing ctrl+c in a wxTextCtrl inside a dialog, it is closed instead of copying a text if a button with wxID_CANCEL is used in a wxStdDialogButtonSizer, when the dlg is created by wxFormBuilder: the label is &Cancel, and this accelerator key has priority to copy text standard accelerator, and the dlg is closed when trying to copy text this function do nothing on other platforms.
static RECT_MAP class_map
const wxPoint & GetPosition() const
Class EDA_RECT handles the component boundary box.
const wxSize & GetSize() const
int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 495 of file dialog_shim.cpp.

References DBG, DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, and DIALOG_SHIM::Show().

Referenced by LIB_EDIT_FRAME::DeleteOnePart(), SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), LIB_EDIT_FRAME::InstallFieldsEditorDialog(), SCH_EDIT_FRAME::InstallHierarchyFrame(), InvokeDialogCreateBOMEditor(), LIB_VIEW_FRAME::OnSelectSymbol(), and SCH_BASE_FRAME::SelectComponentFromLibrary().

496 {
497  // This is an exception safe way to zero a pointer before returning.
498  // Yes, even though DismissModal() clears this first normally, this is
499  // here in case there's an exception before the dialog is dismissed.
500  struct NULLER
501  {
502  void*& m_what;
503  NULLER( void*& aPtr ) : m_what( aPtr ) {}
504  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
505  } clear_this( (void*&) m_qmodal_loop );
506 
507  // release the mouse if it's currently captured as the window having it
508  // will be disabled when this dialog is shown -- but will still keep the
509  // capture making it impossible to do anything in the modal dialog itself
510  wxWindow* win = wxWindow::GetCapture();
511  if( win )
512  win->ReleaseMouse();
513 
514  // Get the optimal parent
515  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
516 
517  // Show the optimal parent
518  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
519 
520  wxASSERT_MSG( !m_qmodal_parent_disabler,
521  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
522 
523  // quasi-modal: disable only my "optimal" parent
525 
526  Show( true );
527 
528  m_qmodal_showing = true;
529 
530  EVENT_LOOP event_loop;
531 
532  m_qmodal_loop = &event_loop;
533 
534  event_loop.Run();
535 
536  return GetReturnCode();
537 }
bool m_qmodal_showing
Definition: dialog_shim.h:132
EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:131
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:133
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:33
#define DBG(x)
Definition: fctsys.h:33

Member Data Documentation

wxButton* DIALOG_PLOT_SCHEMATIC_BASE::m_browseButton
protectedinherited
wxButton* DIALOG_PLOT_SCHEMATIC_BASE::m_buttonPlotAll
protectedinherited
wxButton* DIALOG_PLOT_SCHEMATIC_BASE::m_buttonPlotCurrent
protectedinherited
wxButton* DIALOG_PLOT_SCHEMATIC_BASE::m_buttonQuit
protectedinherited
wxBoxSizer* DIALOG_PLOT_SCHEMATIC_BASE::m_ButtonsSizer
protectedinherited
wxConfigBase* DIALOG_PLOT_SCHEMATIC::m_config
private

Definition at line 50 of file dialog_plot_schematic.h.

Referenced by DIALOG_PLOT_SCHEMATIC(), getPlotOptions(), and initDlg().

bool DIALOG_PLOT_SCHEMATIC::m_configChanged
private

Definition at line 51 of file dialog_plot_schematic.h.

Referenced by DIALOG_PLOT_SCHEMATIC(), getPlotOptions(), and PrjConfigChanged().

wxTextCtrl* DIALOG_PLOT_SCHEMATIC_BASE::m_DefaultLineSizeCtrl
protectedinherited
wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_defaultLineWidthTitle
protectedinherited
std::string DIALOG_SHIM::m_hash_key
protectedinherited
wxChoice* DIALOG_PLOT_SCHEMATIC_BASE::m_HPGLPaperSizeOption
protectedinherited
int DIALOG_PLOT_SCHEMATIC::m_HPGLPaperSizeSelect
private

Definition at line 55 of file dialog_plot_schematic.h.

Referenced by getPlotOptions(), and initDlg().

double DIALOG_PLOT_SCHEMATIC::m_HPGLPenSize
private

Definition at line 56 of file dialog_plot_schematic.h.

Referenced by getPlotOptions(), initDlg(), Plot_1_Page_HPGL(), and SetHPGLPenWidth().

WX_HTML_REPORT_PANEL* DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox
protectedinherited
wxRadioBox* DIALOG_PLOT_SCHEMATIC_BASE::m_ModeColorOption
protectedinherited
wxBoxSizer* DIALOG_PLOT_SCHEMATIC_BASE::m_optionsSizer
protectedinherited
wxTextCtrl* DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName
protectedinherited
int DIALOG_PLOT_SCHEMATIC::m_pageSizeSelect = PAGE_SIZE_AUTO
staticprivate

Definition at line 52 of file dialog_plot_schematic.h.

Referenced by createPSFile(), getPlotOptions(), initDlg(), and setupPlotPagePDF().

wxStaticBoxSizer* DIALOG_PLOT_SCHEMATIC_BASE::m_paperHPGLSizer
protectedinherited
wxStaticBoxSizer* DIALOG_PLOT_SCHEMATIC_BASE::m_paperOptionsSizer
protectedinherited
wxRadioBox* DIALOG_PLOT_SCHEMATIC_BASE::m_PaperSizeOption
protectedinherited
wxTextCtrl* DIALOG_PLOT_SCHEMATIC_BASE::m_penHPGLWidthCtrl
protectedinherited
wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_penHPLGWidthTitle
protectedinherited
wxRadioBox* DIALOG_PLOT_SCHEMATIC_BASE::m_plotFormatOpt
protectedinherited
wxCheckBox* DIALOG_PLOT_SCHEMATIC_BASE::m_PlotFrameRefOpt
protectedinherited
wxRadioBox* DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginOpt
protectedinherited
EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 131 of file dialog_shim.h.

Referenced by DIALOG_SHIM::EndQuasiModal(), and DIALOG_SHIM::ShowQuasiModal().

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited
bool DIALOG_SHIM::m_qmodal_showing
protectedinherited
wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_staticText4
protectedinherited
wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_staticTextOutputDirectory
protectedinherited

The documentation for this class was generated from the following files: