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 ()
 
void SetInitialFocus (wxWindow *aWindow)
 Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown. More...
 
int ShowQuasiModal ()
 
void EndQuasiModal (int retCode)
 
bool IsQuasiModal ()
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
EDA_UNITS_T GetUserUnits () const 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 Member Functions

virtual void OnCloseWindow (wxCloseEvent &event)
 
virtual void OnPlotFormatSelection (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 SetSizeInDU (int x, int y)
 Set the dialog to the given dimensions in "dialog units". More...
 
int HorizPixelsFromDU (int x)
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int VertPixelsFromDU (int y)
 Convert an integer number of dialog units to pixels, vertically. More...
 

Protected Attributes

wxStaticText * m_staticTextOutputDirectory
 
wxTextCtrl * m_outputDirectoryName
 
wxBitmapButton * m_browseButton
 
wxBoxSizer * m_optionsSizer
 
wxRadioBox * m_plotFormatOpt
 
wxStaticText * m_staticText4
 
wxChoice * m_paperSizeOption
 
wxCheckBox * m_PlotFrameRefOpt
 
wxChoice * m_ModeColorOption
 
wxStaticText * m_lineWidthLabel
 
wxTextCtrl * m_lineWidthCtrl
 
wxStaticText * m_lineWidthUnits
 
wxStaticBoxSizer * m_HPGLOptionsSizer
 
wxStaticText * m_plotOriginTitle
 
wxChoice * m_plotOriginOpt
 
wxStaticText * m_penWidthLabel
 
wxTextCtrl * m_penWidthCtrl
 
wxStaticText * m_penWidthUnits
 
WX_HTML_REPORT_PANELm_MessagesBox
 
wxStdDialogButtonSizer * m_sdbSizer1
 
wxButton * m_sdbSizer1OK
 
wxButton * m_sdbSizer1Apply
 
wxButton * m_sdbSizer1Cancel
 
EDA_UNITS_T m_units
 
std::string m_hash_key
 
bool m_firstPaintEvent
 
wxWindow * m_initialFocusTarget
 
WX_EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 

Private Member Functions

void OnPageSizeSelected (wxCommandEvent &event) override
 
void OnPlotCurrent (wxCommandEvent &event) override
 
void OnPlotAll (wxCommandEvent &event) override
 
void OnUpdateUI (wxUpdateUIEvent &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
 
PlotFormat m_plotFormat
 
double m_HPGLPenSize
 
UNIT_BINDER m_defaultLineWidth
 
UNIT_BINDER m_penWidth
 

Static Private Attributes

static int m_pageSizeSelect = PAGE_SIZE_AUTO
 
static int m_HPGLPaperSizeSelect = PAGE_SIZE_AUTO
 

Detailed Description

Definition at line 46 of file dialog_plot_schematic.h.

Constructor & Destructor Documentation

DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC ( SCH_EDIT_FRAME parent)

Definition at line 65 of file dialog_plot_schematic.cpp.

References DIALOG_SHIM::FinishDialogSettings(), initDlg(), KiBitmap(), Kiface(), KIFACE_I::KifaceSettings(), DIALOG_PLOT_SCHEMATIC_BASE::m_browseButton, m_config, m_configChanged, DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1, DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1Apply, DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1Cancel, and DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1OK.

65  :
67  m_parent( parent ),
71 {
73  m_configChanged = false;
74 
75  m_browseButton->SetBitmap( KiBitmap( folder_xpm ) );
76 
77  // We use a sdbSizer to get platform-dependent ordering of the action buttons, but
78  // that requires us to correct the button labels here.
79  m_sdbSizer1OK->SetLabel( _( "Plot All Pages" ) );
80  m_sdbSizer1Apply->SetLabel( _( "Plot Current Page" ) );
81  m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
82  m_sdbSizer1->Layout();
83 
84  m_sdbSizer1OK->SetDefault();
85  initDlg();
86 
87  // Now all widgets have the size fixed, call FinishDialogSettings
89 }
wxStdDialogButtonSizer * m_sdbSizer1
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)
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103

Member Function Documentation

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

Definition at line 38 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(), i, 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(), and setPlotFrameRef().

39 {
40  SCH_EDIT_FRAME* schframe = m_parent;
41  SCH_SCREEN* screen = schframe->GetScreen();
42  SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
43 
44  /* When printing all pages, the printed page is not the current page.
45  * In complex hierarchies, we must setup references and others parameters
46  * in the printed SCH_SCREEN
47  * because in complex hierarchies a SCH_SCREEN (a schematic drawings)
48  * is shared between many sheets
49  */
50  SCH_SHEET_LIST sheetList;
51 
52  if( aPlotAll )
53  sheetList.BuildSheetList( g_RootSheet );
54  else
55  sheetList.push_back( schframe->GetCurrentSheet() );
56 
57  REPORTER& reporter = m_MessagesBox->Reporter();
58 
59  for( unsigned i = 0; i < sheetList.size(); i++ )
60  {
61  schframe->SetCurrentSheet( sheetList[i] );
63  schframe->SetSheetNumberAndCount();
64  screen = schframe->GetCurrentSheet().LastScreen();
65 
66  wxPoint plot_offset;
67  wxString msg;
68 
69  try
70  {
71  wxString fname = schframe->GetUniqueFilenameForCurrentSheet();
72  wxString ext = DXF_PLOTTER::GetDefaultFileExtension();
73  wxFileName plotFileName = createPlotFileName( m_outputDirectoryName, fname,
74  ext, &reporter );
75 
76  if( PlotOneSheetDXF( plotFileName.GetFullPath(), screen, plot_offset, 1.0,
77  aPlotFrameRef ) )
78  {
79  msg.Printf( _( "Plot: \"%s\" OK.\n" ), GetChars( plotFileName.GetFullPath() ) );
80  reporter.Report( msg, REPORTER::RPT_ACTION );
81  }
82  else // Error
83  {
84  msg.Printf( _( "Unable to create file \"%s\".\n" ),
85  GetChars( plotFileName.GetFullPath() ) );
86  reporter.Report( msg, REPORTER::RPT_ERROR );
87  }
88  }
89  catch( IO_ERROR& e )
90  {
91  msg.Printf( wxT( "DXF Plotter exception: %s"), GetChars( e.What() ) );
92  reporter.Report( msg, REPORTER::RPT_ERROR );
93  schframe->SetCurrentSheet( oldsheetpath );
95  schframe->SetSheetNumberAndCount();
96  return;
97  }
98  }
99 
100  schframe->SetCurrentSheet( oldsheetpath );
102  schframe->SetSheetNumberAndCount();
103 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Class SCH_SHEET_LIST.
Schematic editor (Eeschema) main window.
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: plotter.h:1247
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
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()
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()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
size_t i
Definition: json11.cpp:597
wxString GetUniqueFilenameForCurrentSheet()
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:76
void DIALOG_PLOT_SCHEMATIC::createHPGLFile ( bool  aPlotAll,
bool  aPlotFrameRef 
)
private

Definition at line 85 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(), i, SCH_SHEET_PATH::LastScreen(), DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, DIALOG_PLOT_SCHEMATIC_BASE::m_paperSizeOption, 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(), and SetPlotOriginCenter().

86 {
87  SCH_SCREEN* screen = m_parent->GetScreen();
88  SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet();
89 
90  /* When printing all pages, the printed page is not the current page.
91  * In complex hierarchies, we must setup references and other parameters
92  * in the printed SCH_SCREEN
93  * because in complex hierarchies a SCH_SCREEN (a schematic drawings)
94  * is shared between many sheets
95  */
96  SCH_SHEET_LIST sheetList;
97 
98  if( aPlotAll )
99  sheetList.BuildSheetList( g_RootSheet );
100  else
101  sheetList.push_back( m_parent->GetCurrentSheet() );
102 
103  REPORTER& reporter = m_MessagesBox->Reporter();
104 
105  SetHPGLPenWidth();
106 
107  for( unsigned i = 0; i < sheetList.size(); i++ )
108  {
109  m_parent->SetCurrentSheet( sheetList[i] );
112 
113  screen = m_parent->GetCurrentSheet().LastScreen();
114 
115  if( !screen ) // LastScreen() may return NULL
116  screen = m_parent->GetScreen();
117 
118  const PAGE_INFO& curPage = screen->GetPageSettings();
119 
120  PAGE_INFO plotPage = curPage;
121 
122  // if plotting on a page size other than curPage
123  if( m_paperSizeOption->GetSelection() != PAGE_DEFAULT )
124  plotPage.SetType( plot_sheet_list( m_paperSizeOption->GetSelection() ) );
125 
126  // Calculation of conversion scales.
127  double plot_scale = (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
128 
129  // Calculate offsets
130  wxPoint plotOffset;
131  wxString msg;
132 
133  if( GetPlotOriginCenter() )
134  {
135  plotOffset.x = plotPage.GetWidthIU() / 2;
136  plotOffset.y = -plotPage.GetHeightIU() / 2;
137  }
138 
139  try
140  {
141  wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
142  wxString ext = HPGL_PLOTTER::GetDefaultFileExtension();
143  wxFileName plotFileName = createPlotFileName( m_outputDirectoryName, fname,
144  ext, &reporter );
145 
146  LOCALE_IO toggle;
147 
148  if( Plot_1_Page_HPGL( plotFileName.GetFullPath(), screen, plotPage, plotOffset,
149  plot_scale, aPlotFrameRef ) )
150  {
151  msg.Printf( _( "Plot: \"%s\" OK.\n" ), GetChars( plotFileName.GetFullPath() ) );
152  reporter.Report( msg, REPORTER::RPT_ACTION );
153  }
154  else
155  {
156  msg.Printf( _( "Unable to create file \"%s\".\n" ),
157  GetChars( plotFileName.GetFullPath() ) );
158  reporter.Report( msg, REPORTER::RPT_ERROR );
159  }
160  }
161  catch( IO_ERROR& e )
162  {
163  msg.Printf( wxT( "HPGL Plotter exception: %s"), GetChars( e.What() ) );
164  reporter.Report( msg, REPORTER::RPT_ERROR );
165  }
166 
167  }
168 
169  m_parent->SetCurrentSheet( oldsheetpath );
172 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Class SCH_SHEET_LIST.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown...
Definition: common.h:179
bool SetType(const wxString &aStandardPageDescriptionName, bool aIsPortrait=false)
Function SetType sets the name of the page type and also the sizes and margins commonly associated wi...
Definition: page_info.cpp: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...
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
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...
Definition: page_info.h:54
REPORTER & Reporter()
returns the reporter object that reports to this panel
SCH_SHEET_PATH & GetCurrentSheet()
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
Definition: page_info.h:137
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()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
size_t i
Definition: json11.cpp:597
static wxString GetDefaultFileExtension()
Definition: plotter.h:586
wxString GetUniqueFilenameForCurrentSheet()
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
Definition: sch_screen.h:126
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:76
void DIALOG_PLOT_SCHEMATIC::createPDFFile ( bool  aPlotAll,
bool  aPlotFrameRef 
)
private

Definition at line 40 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(), i, 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(), and setPlotFrameRef().

41 {
42  SCH_SCREEN* screen = m_parent->GetScreen();
43  SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
44 
45  /* When printing all pages, the printed page is not the current page. In
46  * complex hierarchies, we must update component references and others
47  * parameters in the given printed SCH_SCREEN, accordint to the sheet path
48  * because in complex hierarchies a SCH_SCREEN (a drawing ) is shared
49  * between many sheets and component references depend on the actual sheet
50  * 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  // Allocate the plotter and set the job level parameter
60  PDF_PLOTTER* plotter = new PDF_PLOTTER();
62  plotter->SetColorMode( getModeColor() );
63  plotter->SetCreator( wxT( "Eeschema-PDF" ) );
64  plotter->SetTitle( m_parent->GetTitleBlock().GetTitle() );
65 
66  wxString msg;
67  wxFileName plotFileName;
68  REPORTER& reporter = m_MessagesBox->Reporter();
69  LOCALE_IO toggle; // Switch the locale to standard C
70 
71  for( unsigned i = 0; i < sheetList.size(); i++ )
72  {
73  m_parent->SetCurrentSheet( sheetList[i] );
76  screen = m_parent->GetCurrentSheet().LastScreen();
77 
78  if( i == 0 )
79  {
80 
81  try
82  {
83  wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
84  wxString ext = PDF_PLOTTER::GetDefaultFileExtension();
86  fname, ext, &reporter );
87 
88  if( !plotter->OpenFile( plotFileName.GetFullPath() ) )
89  {
90  msg.Printf( _( "Unable to create file \"%s\".\n" ),
91  GetChars( plotFileName.GetFullPath() ) );
92  reporter.Report( msg, REPORTER::RPT_ERROR );
93  delete plotter;
94  return;
95  }
96 
97  // Open the plotter and do the first page
98  setupPlotPagePDF( plotter, screen );
99  plotter->StartPlot();
100  }
101  catch( const IO_ERROR& e )
102  {
103  // Cannot plot PDF file
104  msg.Printf( wxT( "PDF Plotter exception: %s" ), GetChars( e.What() ) );
105  reporter.Report( msg, REPORTER::RPT_ERROR );
106 
107  restoreEnvironment( plotter, oldsheetpath );
108  return;
109  }
110 
111  }
112  else
113  {
114  /* For the following pages you need to close the (finished) page,
115  * reconfigure, and then start a new one */
116  plotter->ClosePage();
117  setupPlotPagePDF( plotter, screen );
118  plotter->StartPage();
119  }
120 
121  plotOneSheetPDF( plotter, screen, aPlotFrameRef );
122  }
123 
124  // Everything done, close the plot and restore the environment
125  msg.Printf( _( "Plot: \"%s\" OK.\n" ), GetChars( plotFileName.GetFullPath() ) );
126  reporter.Report( msg, REPORTER::RPT_ACTION );
127 
128  restoreEnvironment( plotter, oldsheetpath );
129 }
static wxString GetDefaultFileExtension()
Definition: plotter.h:827
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Class SCH_SHEET_LIST.
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:161
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown...
Definition: common.h:179
virtual void StartPage()
Starts a new page in the PDF document.
virtual void SetTitle(const wxString &aTitle)
Definition: plotter.h:166
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:126
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
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual void ClosePage()
Close the current page in the PDF document (and emit its compressed stream)
const wxString & GetTitle() const
Definition: title_block.h:65
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
Definition: PS_plotter.cpp:52
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()
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()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
const TITLE_BLOCK & GetTitleBlock() const override
size_t i
Definition: json11.cpp:597
wxString GetUniqueFilenameForCurrentSheet()
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.
Definition: PDF_plotter.cpp:49
WX_HTML_REPORT_PANEL * m_MessagesBox
virtual bool StartPlot() override
The PDF engine supports multiple pages; the first one is opened &#39;for free&#39; 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:76
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 308 of file dialog_plot_schematic.cpp.

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

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

312 {
313  wxString outputDirName = aOutputDirectoryName->GetValue();
314  wxFileName outputDir = wxFileName::DirName( outputDirName );
315 
316  wxString plotFileName = Prj().AbsolutePath( aPlotFileName + wxT( "." ) + aExtension);
317 
318  if( !EnsureFileDirectoryExists( &outputDir, plotFileName, aReporter ) )
319  {
320  wxString msg = wxString::Format( _( "Could not write plot files to folder \"%s\"." ),
321  outputDir.GetPath() );
322  aReporter->Report( msg, REPORTER::RPT_ERROR );
323  }
324 
325  wxFileName fn( plotFileName );
326  fn.SetPath( outputDir.GetFullPath() );
327  return fn;
328 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
bool EnsureFileDirectoryExists(wxFileName *aTargetFullFileName, const wxString &aBaseFilename, REPORTER *aReporter)
Make aTargetFullFileName absolute and create the path of this file if it doesn&#39;t yet exist...
Definition: common.cpp:469
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project&#39;s directory to be an absolu...
Definition: project.cpp:380
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, CPTREE &aTree)
Function Format outputs a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:205
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 38 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(), i, 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(), and SetPlotOriginCenter().

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

Definition at line 43 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(), i, 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(), and SetPlotOriginCenter().

44 {
45  wxString msg;
46  REPORTER& reporter = m_MessagesBox->Reporter();
47  SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet();
48  SCH_SHEET_LIST sheetList;
49 
50  if( aPrintAll )
51  sheetList.BuildSheetList( g_RootSheet );
52  else
53  sheetList.push_back( m_parent->GetCurrentSheet() );
54 
55  for( unsigned i = 0; i < sheetList.size(); i++ )
56  {
57  SCH_SCREEN* screen;
58  m_parent->SetCurrentSheet( sheetList[i] );
61  screen = m_parent->GetCurrentSheet().LastScreen();
62 
63  try
64  {
65  wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
66  wxString ext = SVG_PLOTTER::GetDefaultFileExtension();
67  wxFileName plotFileName = createPlotFileName( m_outputDirectoryName,
68  fname, ext, &reporter );
69 
70  bool success = plotOneSheetSVG( m_parent, plotFileName.GetFullPath(), screen,
71  getModeColor() ? false : true,
72  aPrintFrameRef );
73 
74  if( !success )
75  {
76  msg.Printf( _( "Cannot create file \"%s\".\n" ),
77  GetChars( plotFileName.GetFullPath() ) );
78  reporter.Report( msg, REPORTER::RPT_ERROR );
79  }
80  else
81  {
82  msg.Printf( _( "Plot: \"%s\" OK.\n" ),
83  GetChars( plotFileName.GetFullPath() ) );
84  reporter.Report( msg, REPORTER::RPT_ACTION );
85  }
86  }
87  catch( const IO_ERROR& e )
88  {
89  // Cannot plot SVG file
90  msg.Printf( wxT( "SVG Plotter exception: %s" ), GetChars( e.What() ) );
91  reporter.Report( msg, REPORTER::RPT_ERROR );
92  break;
93  }
94  }
95 
96  m_parent->SetCurrentSheet( oldsheetpath );
99 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
Class SCH_SHEET_LIST.
static wxString GetDefaultFileExtension()
Definition: plotter.h:906
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:56
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()
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()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
size_t i
Definition: json11.cpp:597
wxString GetUniqueFilenameForCurrentSheet()
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:76
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 221 of file dialog_shim.cpp.

Referenced by DIALOG_SHIM::IsQuasiModal().

222 {
223  // so we can do logging of this state change:
224 
225 #if defined(DEBUG)
226  const char* type_id = typeid( *this ).name();
227  printf( "wxDialog %s: %s\n", type_id, enable ? "enabled" : "disabled" );
228 #endif
229 
230  return wxDialog::Enable( enable );
231 }
void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 381 of file dialog_shim.cpp.

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

Referenced by DIALOG_SHIM::OnButton(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_COMPONENT::OnUseBrowser(), DIALOG_SHIM::SetInitialFocus(), and DIALOG_SHIM::~DIALOG_SHIM().

382 {
383  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
384  // handle validation in the same way as other dialogs.
385  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
386  return;
387 
388  SetReturnCode( retCode );
389 
390  if( !IsQuasiModal() )
391  {
392  wxFAIL_MSG( wxT( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal wasn't called" ) );
393  return;
394  }
395 
396  if( m_qmodal_loop )
397  {
398  if( m_qmodal_loop->IsRunning() )
399  m_qmodal_loop->Exit( 0 );
400  else
401  m_qmodal_loop->ScheduleExit( 0 );
402 
403  m_qmodal_loop = NULL;
404  }
405 
408 
409  Show( false );
410 }
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:153
bool IsQuasiModal()
Definition: dialog_shim.h:95
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:155
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 120 of file dialog_shim.cpp.

References PCAD2KICAD::Center.

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOM::DIALOG_BOM(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DRC_CONTROL::DIALOG_DRC_CONTROL(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_3DFILE::DIALOG_EXPORT_3DFILE(), DIALOG_EXPORT_IDF3::DIALOG_EXPORT_IDF3(), DIALOG_EXPORT_STEP::DIALOG_EXPORT_STEP(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), DIALOG_FOOTPRINTS_DISPLAY_OPTIONS::DIALOG_FOOTPRINTS_DISPLAY_OPTIONS(), DIALOG_FP_BROWSER_DISPLAY_OPTIONS::DIALOG_FP_BROWSER_DISPLAY_OPTIONS(), DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(), DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG::DIALOG_GLOBAL_SYM_LIB_TABLE_CONFIG(), DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), 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_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_NON_COPPER_ZONES_EDITOR::DIALOG_NON_COPPER_ZONES_EDITOR(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_SCH_EDIT_SHEET_PIN::DIALOG_SCH_EDIT_SHEET_PIN(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), DIALOG_SELECT_NET_FROM_LIST::DIALOG_SELECT_NET_FROM_LIST(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), PAGED_DIALOG::finishInitialization(), DIALOG_SHIM::GetUserUnits(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), and DIALOG_COLOR_PICKER::TransferDataToWindow().

121 {
122  // must be called from the constructor of derived classes,
123  // when all widgets are initialized, and therefore their size fixed
124 
125  // SetSizeHints fixes the minimal size of sizers in the dialog
126  // (SetSizeHints calls Fit(), so no need to call it)
127  GetSizer()->SetSizeHints( this );
128 
129  // the default position, when calling the first time the dlg
130  Center();
131 }
bool DIALOG_PLOT_SCHEMATIC::getModeColor ( )
inlineprivate
PlotFormat DIALOG_PLOT_SCHEMATIC::GetPlotFileFormat ( )
private

Definition at line 182 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(), OnPageSizeSelected(), OnUpdateUI(), PlotSchematic(), and setModeColor().

183 {
184  switch( m_plotFormatOpt->GetSelection() )
185  {
186  default:
187  case 0: return PLOT_FORMAT_POST;
188  case 1: return PLOT_FORMAT_PDF;
189  case 2: return PLOT_FORMAT_SVG;
190  case 3: return PLOT_FORMAT_DXF;
191  case 4: return PLOT_FORMAT_HPGL;
192  }
193 }
bool DIALOG_PLOT_SCHEMATIC::getPlotFrameRef ( )
inlineprivate
void DIALOG_PLOT_SCHEMATIC::getPlotOptions ( )
private

Definition at line 254 of file dialog_plot_schematic.cpp.

References getModeColor(), SCH_EDIT_FRAME::GetPlotDirectoryName(), GetPlotFileFormat(), getPlotFrameRef(), GetPlotOriginCenter(), UNIT_BINDER::GetValue(), m_config, m_configChanged, m_defaultLineWidth, m_HPGLPaperSizeSelect, m_HPGLPenSize, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_parent, m_penWidth, PLOT_FORMAT_KEY, PLOT_FRAME_REFERENCE_KEY, PLOT_HPGL_ORIGIN_KEY, PLOT_HPGL_PAPERSIZE_KEY, PLOT_HPGL_PEN_SIZE_KEY, PLOT_MODECOLOR_KEY, SetDefaultLineThickness(), and SCH_EDIT_FRAME::SetPlotDirectoryName().

Referenced by PlotSchematic(), and PrjConfigChanged().

255 {
257 
260  m_config->Write( PLOT_FORMAT_KEY, (long) GetPlotFileFormat() );
263 
264  // HPGL Pen Size is stored in mm in config
265  m_config->Write( PLOT_HPGL_PEN_SIZE_KEY, m_HPGLPenSize/IU_PER_MM );
266 
268 
269  // Plot directory
270  wxString path = m_outputDirectoryName->GetValue();
271  path.Replace( '\\', '/' );
272 
273  if( m_parent->GetPlotDirectoryName() != path )
274  m_configChanged = true;
275 
277 }
void SetPlotDirectoryName(const wxString &aDirName)
#define PLOT_HPGL_ORIGIN_KEY
void SetDefaultLineThickness(int aThickness)
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
#define PLOT_MODECOLOR_KEY
const wxString & GetPlotDirectoryName() const
accessor to the destination directory to use when generating plot files.
#define PLOT_FRAME_REFERENCE_KEY
#define PLOT_HPGL_PEN_SIZE_KEY
#define PLOT_HPGL_PAPERSIZE_KEY
#define PLOT_FORMAT_KEY
bool DIALOG_PLOT_SCHEMATIC::GetPlotOriginCenter ( )
inlineprivate

Definition at line 114 of file dialog_plot_schematic.h.

References DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginOpt.

Referenced by createHPGLFile(), and getPlotOptions().

115  {
116  return m_plotOriginOpt->GetSelection() == 1;
117  }
int DIALOG_SHIM::HorizPixelsFromDU ( int  x)
protectedinherited

Convert an integer number of dialog units to pixels, horizontally.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 141 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), and DIALOG_SHIM::GetUserUnits().

142 {
143  wxSize sz( x, 0 );
144  return ConvertDialogToPixels( sz ).x;
145 }
void DIALOG_PLOT_SCHEMATIC::initDlg ( )
private

Definition at line 93 of file dialog_plot_schematic.cpp.

References GetDefaultLineThickness(), SCH_EDIT_FRAME::GetPlotDirectoryName(), m_config, m_defaultLineWidth, m_HPGLPaperSizeSelect, m_HPGLPenSize, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_parent, m_penWidth, DIALOG_PLOT_SCHEMATIC_BASE::m_plotFormatOpt, 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, setModeColor(), setPlotFrameRef(), SetPlotOriginCenter(), and UNIT_BINDER::SetValue().

Referenced by DIALOG_PLOT_SCHEMATIC(), and PrjConfigChanged().

94 {
95  // Set color or B&W plot option
96  bool tmp;
97  m_config->Read( PLOT_MODECOLOR_KEY, &tmp, true );
98  setModeColor( tmp );
99 
100  // Set plot or not frame reference option
101  m_config->Read( PLOT_FRAME_REFERENCE_KEY, &tmp, true );
102  setPlotFrameRef( tmp );
103 
104  // Set HPGL plot origin to center of paper of left bottom corner
105  m_config->Read( PLOT_HPGL_ORIGIN_KEY, &tmp, false );
106  SetPlotOriginCenter( tmp );
107 
109 
110  // HPGL Pen Size is stored in mm in config
112  m_HPGLPenSize *= IU_PER_MM;
113 
114  // Switch to the last save plot format
115  long plotfmt;
116  m_config->Read( PLOT_FORMAT_KEY, &plotfmt, 0 );
117 
118  switch( plotfmt )
119  {
120  default:
121  case PLOT_FORMAT_POST: m_plotFormatOpt->SetSelection( 0 ); break;
122  case PLOT_FORMAT_PDF: m_plotFormatOpt->SetSelection( 1 ); break;
123  case PLOT_FORMAT_SVG: m_plotFormatOpt->SetSelection( 2 ); break;
124  case PLOT_FORMAT_DXF: m_plotFormatOpt->SetSelection( 3 ); break;
125  case PLOT_FORMAT_HPGL: m_plotFormatOpt->SetSelection( 4 ); break;
126  }
127 
128  // Set the default line width (pen width which should be used for
129  // items that do not have a pen size defined (like frame ref)
131 
132  // Initialize HPGL specific widgets
134 
135  // Plot directory
136  wxString path = m_parent->GetPlotDirectoryName();
137 #ifdef __WINDOWS__
138  path.Replace( '/', '\\' );
139 #endif
140  m_outputDirectoryName->SetValue( path );
141 }
void SetPlotOriginCenter(bool aCenter)
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
#define PLOT_HPGL_ORIGIN_KEY
#define PLOT_MODECOLOR_KEY
const wxString & GetPlotDirectoryName() const
accessor to the destination directory to use when generating plot files.
void setPlotFrameRef(bool aPlot)
#define PLOT_FRAME_REFERENCE_KEY
#define PLOT_HPGL_PEN_SIZE_KEY
virtual void SetValue(int aValue)
Function SetValue Sets new value (in Internal Units) for the text field, taking care of units convers...
#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::GetUserUnits(), KIWAY_HOLDER::m_kiway, KIWAY_HOLDER::Prj(), KIWAY_HOLDER::SetKiway(), and VTBL_ENTRY.

Referenced by TREEPROJECT_ITEM::Activate(), PCB_BASE_EDIT_FRAME::AddLibrary(), SCH_EDIT_FRAME::AppendSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), CVPCB_MAINFRAME::CreateScreenCmp(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), EDIT_TOOL::editFootprintInFpEditor(), SCH_EDIT_FRAME::EditSheet(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), LIB_MANAGER::GetBufferedPart(), LIB_MANAGER::getLibraryBuffer(), FOOTPRINT_EDIT_FRAME::GetPlotSettings(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::KiwayMailIn(), KIWAY_PLAYER::language_change(), KICAD_MANAGER_FRAME::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), KICAD_MANAGER_FRAME::OnEditFpLibTable(), SCH_BASE_FRAME::OnEditSymbolLibTable(), KICAD_MANAGER_FRAME::OnEditSymLibTable(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnLeftClick(), SCH_BASE_FRAME::OnOpenLibraryViewer(), KICAD_MANAGER_FRAME::OnRunPcbFpEditor(), KICAD_MANAGER_FRAME::OnRunSchLibEditor(), SCH_EDIT_FRAME::OnSimulate(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), 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(), FOOTPRINT_WIZARD_FRAME::ReCreateVToolbar(), LIB_EDIT_FRAME::refreshSchematic(), KICAD_MANAGER_FRAME::RunEeschema(), KICAD_MANAGER_FRAME::RunPcbNew(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlist(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), FOOTPRINT_VIEWER_FRAME::Show3D_Frame(), FOOTPRINT_WIZARD_FRAME::Show3D_Frame(), EDA_BASE_FRAME::ShowPreferences(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::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:94
virtual void DIALOG_PLOT_SCHEMATIC_BASE::OnCloseWindow ( wxCloseEvent &  event)
inlineprotectedvirtualinherited
void DIALOG_PLOT_SCHEMATIC::OnOutputDirectoryBrowseClicked ( wxCommandEvent &  event)
overrideprivatevirtual

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

Todo:
Copy of DIALOG_PLOT::OnOutputDirectoryBrowseClicked in dialog_plot.cpp, maybe merge to a common method.

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 148 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().

Referenced by setModeColor().

149 {
150  // Build the absolute path of current output plot directory
151  // to preselect it when opening the dialog.
152  wxFileName fn( m_outputDirectoryName->GetValue() );
153  wxString path = Prj().AbsolutePath( m_outputDirectoryName->GetValue() );
154 
155  wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
156 
157  if( dirDialog.ShowModal() == wxID_CANCEL )
158  return;
159 
160  wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
161 
163  wxString defaultPath = fn.GetPathWithSep();
164  wxString msg;
165  msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ), GetChars( defaultPath ) );
166 
167  wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
168  wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
169 
170  // relative directory selected
171  if( dialog.ShowModal() == wxID_YES )
172  {
173  if( !dirName.MakeRelativeTo( defaultPath ) )
174  wxMessageBox( _( "Cannot make path relative (target volume different from file "
175  "volume)!" ), _( "Plot Output Directory" ), wxOK | wxICON_ERROR );
176  }
177 
178  m_outputDirectoryName->SetValue( dirName.GetFullPath() );
179 }
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
SCH_SHEET * g_RootSheet
Definition: eeschema.cpp:56
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project&#39;s directory to be an absolu...
Definition: project.cpp:380
wxString GetFileName(void) const
Return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:661
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::OnPageSizeSelected ( wxCommandEvent &  event)
overrideprivatevirtual
void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 283 of file dialog_shim.cpp.

References DIALOG_SHIM::m_firstPaintEvent, and DIALOG_SHIM::m_initialFocusTarget.

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

284 {
285  if( m_firstPaintEvent )
286  {
287 #ifdef __WXMAC__
288  fixOSXCancelButtonIssue( this );
289  selectAllInTextCtrls( GetChildren() );
290 #endif
291 
293  m_initialFocusTarget->SetFocus();
294  else
295  SetFocus(); // Focus the dialog itself
296 
297  m_firstPaintEvent = false;
298  }
299 
300  event.Skip();
301 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:150
bool m_firstPaintEvent
Definition: dialog_shim.h:149
void DIALOG_PLOT_SCHEMATIC::OnPlotAll ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 286 of file dialog_plot_schematic.cpp.

References PlotSchematic().

Referenced by PrjConfigChanged().

287 {
288  PlotSchematic( true );
289 }
void PlotSchematic(bool aPlotAll)
void DIALOG_PLOT_SCHEMATIC::OnPlotCurrent ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 280 of file dialog_plot_schematic.cpp.

References PlotSchematic().

Referenced by PrjConfigChanged().

281 {
282  PlotSchematic( false );
283 }
void PlotSchematic(bool aPlotAll)
virtual void DIALOG_PLOT_SCHEMATIC_BASE::OnPlotFormatSelection ( wxCommandEvent &  event)
inlineprotectedvirtualinherited
void DIALOG_PLOT_SCHEMATIC::OnUpdateUI ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 205 of file dialog_plot_schematic.cpp.

References UNIT_BINDER::Enable(), GetPlotFileFormat(), m_defaultLineWidth, m_HPGLPaperSizeSelect, m_pageSizeSelect, DIALOG_PLOT_SCHEMATIC_BASE::m_paperSizeOption, m_penWidth, m_plotFormat, DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginOpt, DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginTitle, PLOT_FORMAT_HPGL, PLOT_FORMAT_PDF, PLOT_FORMAT_POST, and PLOT_FORMAT_SVG.

Referenced by PrjConfigChanged().

206 {
208 
209  if( fmt != m_plotFormat )
210  {
211  m_plotFormat = fmt;
212 
213  wxArrayString paperSizes;
214  paperSizes.push_back( _( "Schematic size" ) );
215 
216  int selection;
217 
218  if( fmt == PLOT_FORMAT_HPGL )
219  {
220  paperSizes.push_back( _( "A4" ) );
221  paperSizes.push_back( _( "A3" ) );
222  paperSizes.push_back( _( "A2" ) );
223  paperSizes.push_back( _( "A1" ) );
224  paperSizes.push_back( _( "A0" ) );
225  paperSizes.push_back( _( "A" ) );
226  paperSizes.push_back( _( "B" ) );
227  paperSizes.push_back( _( "C" ) );
228  paperSizes.push_back( _( "D" ) );
229  paperSizes.push_back( _( "E" ) );
230 
231  selection = m_HPGLPaperSizeSelect;
232  }
233  else
234  {
235  paperSizes.push_back( _( "A4" ) );
236  paperSizes.push_back( _( "A" ) );
237 
238  selection = m_pageSizeSelect;
239  }
240 
241  m_paperSizeOption->Set( paperSizes );
242  m_paperSizeOption->SetSelection( selection );
243 
245  || fmt == PLOT_FORMAT_SVG );
246 
247  m_plotOriginTitle->Enable( fmt == PLOT_FORMAT_HPGL );
248  m_plotOriginOpt->Enable( fmt == PLOT_FORMAT_HPGL );
250  }
251 }
PlotFormat
Enum PlotFormat is the set of supported output plot formats.
Definition: plotter.h:50
void Enable(bool aEnable)
Function Enable Enables/diasables the label, widget and units label.
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 175 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(), IU_PER_MILS, 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(), and SetPlotOriginCenter().

181 {
182  HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
183 
184  plotter->SetPageSettings( aPageInfo );
185  // Currently, plot units are in decimil
186  plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
187 
188  // Init :
189  plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
190 
191  if( ! plotter->OpenFile( aFileName ) )
192  {
193  delete plotter;
194  return false;
195  }
196 
197  LOCALE_IO toggle;
198 
199  // Pen num and pen speed are not initialized here.
200  // Default HPGL driver values are used
201  plotter->SetPenDiameter( m_HPGLPenSize );
202  plotter->StartPlot();
203 
204  plotter->SetColor( BLACK );
205 
206  if( getPlotFrameRef() )
207  PlotWorkSheet( plotter, m_parent->GetTitleBlock(),
209  aScreen->m_ScreenNumber, aScreen->m_NumberOfScreens,
211  aScreen->GetFileName() );
212 
213  aScreen->Plot( plotter );
214 
215  plotter->EndPlot();
216  delete plotter;
217 
218  return true;
219 }
virtual bool EndPlot() override
HPGL end of plot: pen return and release.
virtual void SetColor(COLOR4D color) override
Definition: plotter.h:604
int m_ScreenNumber
Definition: base_screen.h:216
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:161
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown...
Definition: common.h:179
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:79
const wxString & GetFileName() const
Definition: sch_screen.h:131
virtual void SetPenDiameter(double diameter)
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.cpp:537
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
void Plot(PLOTTER *aPlotter)
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:533
const PAGE_INFO & GetPageSettings() const override
const TITLE_BLOCK & GetTitleBlock() const override
#define IU_PER_MILS
Definition: plotter.cpp:134
int m_NumberOfScreens
Definition: base_screen.h:217
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 106 of file plot_schematic_DXF.cpp.

References DXF_PLOTTER::EndPlot(), SCH_SCREEN::GetFileName(), getModeColor(), SCH_SCREEN::GetPageSettings(), SCH_BASE_FRAME::GetPageSettings(), SCH_EDIT_FRAME::GetScreenDesc(), SCH_BASE_FRAME::GetTitleBlock(), IU_PER_MILS, 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(), and setPlotFrameRef().

111 {
112  DXF_PLOTTER* plotter = new DXF_PLOTTER();
113 
114  const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
115  plotter->SetPageSettings( pageInfo );
116  plotter->SetColorMode( getModeColor() );
117  // Currently, plot units are in decimil
118  plotter->SetViewport( aPlotOffset, IU_PER_MILS/10, aScale, false );
119 
120  // Init :
121  plotter->SetCreator( wxT( "Eeschema-DXF" ) );
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  PlotWorkSheet( plotter, m_parent->GetTitleBlock(),
137  aScreen->m_ScreenNumber, aScreen->m_NumberOfScreens,
139  aScreen->GetFileName() );
140  }
141 
142  aScreen->Plot( plotter );
143 
144  // finish
145  plotter->EndPlot();
146  delete plotter;
147 
148  return true;
149 }
int m_ScreenNumber
Definition: base_screen.h:216
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:161
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown...
Definition: common.h:179
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&#39;t support line widths and mirroring...
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:79
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:126
const wxString & GetFileName() const
Definition: sch_screen.h:131
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.cpp:537
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
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...
Definition: page_info.h:54
virtual bool EndPlot() override
void Plot(PLOTTER *aPlotter)
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:533
const PAGE_INFO & GetPageSettings() const override
const TITLE_BLOCK & GetTitleBlock() const override
#define IU_PER_MILS
Definition: plotter.cpp:134
int m_NumberOfScreens
Definition: base_screen.h:217
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:126
void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF ( PLOTTER aPlotter,
SCH_SCREEN aScreen,
bool  aPlotFrameRef 
)
private

Definition at line 145 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(), and setPlotFrameRef().

148 {
149  if( aPlotFrameRef )
150  {
151  aPlotter->SetColor( BLACK );
152  PlotWorkSheet( aPlotter, m_parent->GetTitleBlock(),
154  aScreen->m_ScreenNumber, aScreen->m_NumberOfScreens,
156  aScreen->GetFileName() );
157  }
158 
159  aScreen->Plot( aPlotter );
160 }
int m_ScreenNumber
Definition: base_screen.h:216
virtual void SetColor(COLOR4D color)=0
const wxString & GetFileName() const
Definition: sch_screen.h:131
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
void Plot(PLOTTER *aPlotter)
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:533
const PAGE_INFO & GetPageSettings() const override
const TITLE_BLOCK & GetTitleBlock() const override
int m_NumberOfScreens
Definition: base_screen.h:217
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 131 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(), IU_PER_MILS, 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(), and SetPlotOriginCenter().

137 {
138  PS_PLOTTER* plotter = new PS_PLOTTER();
139  plotter->SetPageSettings( aPageInfo );
141  plotter->SetColorMode( getModeColor() );
142  // Currently, plot units are in decimil
143  plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
144 
145  // Init :
146  plotter->SetCreator( wxT( "Eeschema-PS" ) );
147 
148  if( ! plotter->OpenFile( aFileName ) )
149  {
150  delete plotter;
151  return false;
152  }
153 
154  LOCALE_IO toggle; // Switch the locale to standard C
155 
156  plotter->StartPlot();
157 
158  if( aPlotFrameRef )
159  {
160  plotter->SetColor( BLACK );
161  PlotWorkSheet( plotter, m_parent->GetTitleBlock(),
163  aScreen->m_ScreenNumber, aScreen->m_NumberOfScreens,
165  aScreen->GetFileName() );
166  }
167 
168  aScreen->Plot( plotter );
169 
170  plotter->EndPlot();
171  delete plotter;
172 
173  return true;
174 }
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
Definition: PS_plotter.cpp:403
int m_ScreenNumber
Definition: base_screen.h:216
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:161
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown...
Definition: common.h:179
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:79
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:126
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
const wxString & GetFileName() const
Definition: sch_screen.h:131
virtual bool EndPlot() override
Definition: PS_plotter.cpp:928
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.cpp:537
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
virtual bool StartPlot() override
The code within this function (and the CloseFilePS function) creates postscript files whose contents ...
Definition: PS_plotter.cpp:774
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
Definition: PS_plotter.cpp:52
virtual void SetColor(COLOR4D color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values...
Definition: PS_plotter.cpp:59
void Plot(PLOTTER *aPlotter)
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:533
const PAGE_INFO & GetPageSettings() const override
const TITLE_BLOCK & GetTitleBlock() const override
#define IU_PER_MILS
Definition: plotter.cpp:134
int m_NumberOfScreens
Definition: base_screen.h:217
Definition: colors.h:45
bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG ( EDA_DRAW_FRAME aFrame,
const wxString &  aFileName,
SCH_SCREEN aScreen,
bool  aPlotBlackAndWhite,
bool  aPlotFrameRef 
)
static

Definition at line 102 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(), IU_PER_MILS, 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(), and SetPlotOriginCenter().

107 {
108  SVG_PLOTTER* plotter = new SVG_PLOTTER();
109 
110  const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
111  plotter->SetPageSettings( pageInfo );
113  plotter->SetColorMode( aPlotBlackAndWhite ? false : true );
114  wxPoint plot_offset;
115  double scale = 1.0;
116  // Currently, plot units are in decimil
117  plotter->SetViewport( plot_offset, IU_PER_MILS/10, scale, false );
118 
119  // Init :
120  plotter->SetCreator( wxT( "Eeschema-SVG" ) );
121 
122  if( ! plotter->OpenFile( aFileName ) )
123  {
124  delete plotter;
125  return false;
126  }
127 
128  LOCALE_IO toggle;
129 
130  plotter->StartPlot();
131 
132  if( aPlotFrameRef )
133  {
134  plotter->SetColor( BLACK );
135  PlotWorkSheet( plotter, aFrame->GetTitleBlock(),
136  aFrame->GetPageSettings(),
137  aScreen->m_ScreenNumber, aScreen->m_NumberOfScreens,
138  aFrame->GetScreenDesc(),
139  aScreen->GetFileName() );
140  }
141 
142  aScreen->Plot( plotter );
143 
144  plotter->EndPlot();
145  delete plotter;
146 
147  return true;
148 }
int m_ScreenNumber
Definition: base_screen.h:216
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:161
virtual const TITLE_BLOCK & GetTitleBlock() const =0
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown...
Definition: common.h:179
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.
Definition: plotter.cpp:79
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:126
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i...
const wxString & GetFileName() const
Definition: sch_screen.h:131
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.cpp:537
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.
Definition: PS_plotter.cpp:52
virtual wxString GetScreenDesc() const
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
virtual bool StartPlot() override
The code within this function creates SVG files header.
void Plot(PLOTTER *aPlotter)
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:533
const int scale
#define IU_PER_MILS
Definition: plotter.cpp:134
int m_NumberOfScreens
Definition: base_screen.h:217
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:126
Definition: colors.h:45
void DIALOG_PLOT_SCHEMATIC::PlotSchematic ( bool  aPlotAll)
private

Definition at line 292 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 OnPlotAll(), OnPlotCurrent(), and setPlotFrameRef().

293 {
294  getPlotOptions();
295 
296  switch( GetPlotFileFormat() )
297  {
298  default:
299  case PLOT_FORMAT_POST: createPSFile( aPlotAll, getPlotFrameRef() ); break;
300  case PLOT_FORMAT_DXF: CreateDXFFile( aPlotAll, getPlotFrameRef() ); break;
301  case PLOT_FORMAT_PDF: createPDFFile( aPlotAll, getPlotFrameRef() ); break;
302  case PLOT_FORMAT_SVG: createSVGFile( aPlotAll, getPlotFrameRef() ); break;
303  case PLOT_FORMAT_HPGL: createHPGLFile( aPlotAll, getPlotFrameRef() ); break;
304  }
305 }
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 PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), LIB_VIEW_FRAME::BestZoom(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::checkAliasName(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), LIB_VIEW_FRAME::DisplayLibInfos(), SCH_BASE_FRAME::DisplayListComponentsInLib(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::EditSheet(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::Files_io_from_id(), NETLIST_DIALOG::GenNetlist(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibAlias(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), DIALOG_BOM::getPluginFileName(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::getSelectedAlias(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), PCB_EDIT_FRAME::InstallNetlistFrame(), SCH_EDIT_FRAME::IsSearchCacheObsolete(), KIWAY_HOLDER::Kiway(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), SCH_EDIT_FRAME::Load_Component(), SCH_EDIT_FRAME::LoadCmpToFootprintLinkFile(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), CVPCB_MAINFRAME::LoadProjectFile(), SCH_EDIT_FRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), DIALOG_DRC_CONTROL::makeValidFileNameReport(), DIALOG_FOOTPRINT_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_BOARD_EDITOR::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_BOARD_EDITOR::OnAdd3DModel(), DIALOG_GENCAD_EXPORT_OPTIONS::onBrowse(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), CVPCB_MAINFRAME::OnConfigurePaths(), FOOTPRINT_EDIT_FRAME::OnConfigurePaths(), KICAD_MANAGER_FRAME::OnCreateProjectFromTemplate(), CVPCB_MAINFRAME::OnEditFootprintLibraryTable(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), OnOutputDirectoryBrowseClicked(), LIB_EDIT_FRAME::OnPlotCurrentComponent(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), SCH_EDIT_FRAME::OnRightClick(), KICAD_MANAGER_FRAME::OnRunGerbview(), DIALOG_BOM::OnRunPlugin(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), KICAD_MANAGER_FRAME::OnSaveProject(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), LIB_EDIT_FRAME::OnViewEntryDoc(), LIB_VIEW_FRAME::onViewSymbolDocument(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDIT_FRAME::PasteListOfItems(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Process_Config(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), LIB_VIEW_FRAME::ReCreateListCmp(), LIB_VIEW_FRAME::ReCreateListLib(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::saveFootprintInLibrary(), LIB_EDIT_FRAME::saveLibrary(), LIB_EDIT_FRAME::SaveOneSymbol(), LIB_EDIT_FRAME::savePartAs(), SCH_EDIT_FRAME::SaveProject(), CVPCB_MAINFRAME::SaveProjectFile(), SCH_EDIT_FRAME::SaveProjectSettings(), PCB_EDIT_FRAME::SaveProjectSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectComponentFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), SCH_BASE_FRAME::SelectLibraryFromList(), LIB_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), LIB_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), LIB_EDIT_FRAME::SetCurPart(), KICAD_MANAGER_FRAME::SetProjectFileName(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::Validate(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_BOARD_EDITOR::~DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::~DIALOG_FOOTPRINT_FP_EDITOR(), LAUNCHER_PANEL::~LAUNCHER_PANEL(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

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:142
bool DIALOG_PLOT_SCHEMATIC::PrjConfigChanged ( )
inline

Definition at line 64 of file dialog_plot_schematic.h.

References getPlotOptions(), initDlg(), m_configChanged, OnPageSizeSelected(), OnPlotAll(), OnPlotCurrent(), and OnUpdateUI().

Referenced by SCH_EDIT_FRAME::PlotSchematic().

64 { 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 132 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(), and setPlotFrameRef().

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

Definition at line 73 of file plot_schematic_HPGL.cpp.

References UNIT_BINDER::GetValue(), m_HPGLPenSize, and m_penWidth.

Referenced by createHPGLFile(), and SetPlotOriginCenter().

74 {
76 
77  if( m_HPGLPenSize > Millimeter2iu( 2 ) )
78  m_HPGLPenSize = Millimeter2iu( 2 );
79 
80  if( m_HPGLPenSize < Millimeter2iu( 0.01 ) )
81  m_HPGLPenSize = Millimeter2iu( 0.01 );
82 }
virtual int GetValue()
Function GetValue Returns the current value in Internal Units.
void DIALOG_SHIM::SetInitialFocus ( wxWindow *  aWindow)
inlineinherited

Sets the window (usually a wxTextCtrl) that should be focused when the dialog is shown.

Definition at line 86 of file dialog_shim.h.

References DIALOG_SHIM::EndQuasiModal(), DIALOG_SHIM::m_initialFocusTarget, and DIALOG_SHIM::ShowQuasiModal().

Referenced by DIALOG_BOM::DIALOG_BOM(), DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CONFIGURE_PATHS::DIALOG_CONFIGURE_PATHS(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_FIELDS_EDITOR_GLOBAL::DIALOG_FIELDS_EDITOR_GLOBAL(), DIALOG_FOOTPRINT_BOARD_EDITOR::DIALOG_FOOTPRINT_BOARD_EDITOR(), DIALOG_FOOTPRINT_FP_EDITOR::DIALOG_FOOTPRINT_FP_EDITOR(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_PIN::DIALOG_LIB_EDIT_PIN(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_SET_GRID::DIALOG_SET_GRID(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchAllClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchIDClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchRefClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchSelectedClicked(), DIALOG_EXCHANGE_FOOTPRINTS::OnMatchValueClicked(), PANEL_FP_LIB_TABLE::PANEL_FP_LIB_TABLE(), PANEL_SYM_LIB_TABLE::PANEL_SYM_LIB_TABLE(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), and LIB_EDIT_FRAME::savePartAs().

87  {
88  m_initialFocusTarget = aWindow;
89  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:150
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 47 of file kiway_holder.cpp.

References KIWAY_HOLDER::m_kiway, and name.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), InvokePcbLibTableEditor(), KIWAY_HOLDER::Kiway(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

48 {
49 #if defined(DEBUG)
50  // offer a trap point for debugging most any window
51  wxASSERT( aDest );
52  if( !strcmp( typeid(aDest).name(), "DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB" ) )
53  {
54  int breakhere=1;
55  (void) breakhere;
56  }
57 #endif
58 
59  (void) aDest;
60 
61  m_kiway = aKiway;
62 }
KIWAY * m_kiway
Definition: kiway_player.h:94
const char * name
Definition: DXF_plotter.cpp:61
void DIALOG_PLOT_SCHEMATIC::setModeColor ( bool  aColor)
inlineprivate

Definition at line 81 of file dialog_plot_schematic.h.

References GetPlotFileFormat(), DIALOG_PLOT_SCHEMATIC_BASE::m_ModeColorOption, and OnOutputDirectoryBrowseClicked().

Referenced by initDlg().

82  { m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); }
void DIALOG_PLOT_SCHEMATIC::setPlotFrameRef ( bool  aPlot)
inlineprivate
void DIALOG_PLOT_SCHEMATIC::SetPlotOriginCenter ( bool  aCenter)
inlineprivate
void DIALOG_SHIM::SetSizeInDU ( int  x,
int  y 
)
protectedinherited

Set the dialog to the given dimensions in "dialog units".

These are units equivalent to 4* the average character width and 8* the average character height, allowing a dialog to be sized in a way that scales it with the system font.

Definition at line 134 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::GetUserUnits(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

135 {
136  wxSize sz( x, y );
137  SetSize( ConvertDialogToPixels( sz ) );
138 }
void DIALOG_PLOT_SCHEMATIC::setupPlotPagePDF ( PLOTTER aPlotter,
SCH_SCREEN aScreen 
)
private

Definition at line 163 of file plot_schematic_PDF.cpp.

References PAGE_INFO::GetHeightMils(), SCH_SCREEN::GetPageSettings(), PAGE_INFO::GetWidthMils(), PAGE_INFO::IsPortrait(), IU_PER_MILS, 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(), and setPlotFrameRef().

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

Definition at line 162 of file dialog_shim.cpp.

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

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), DIALOG_SHIM::IsQuasiModal(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_SCH_FIND::OnCancel(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), DIALOG_SHIM::ShowQuasiModal(), and DIALOG_POSITION_RELATIVE::UpdateAnchor().

163 {
164  bool ret;
165  const char* hash_key;
166 
167  if( m_hash_key.size() )
168  {
169  // a special case like EDA_LIST_DIALOG, which has multiple uses.
170  hash_key = m_hash_key.c_str();
171  }
172  else
173  {
174  hash_key = typeid(*this).name();
175  }
176 
177  // Show or hide the window. If hiding, save current position and size.
178  // If showing, use previous position and size.
179  if( show )
180  {
181 #ifndef __WINDOWS__
182  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
183 #endif
184  ret = wxDialog::Show( show );
185 
186  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
187  EDA_RECT savedDialogRect = class_map[ hash_key ];
188 
189  if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
190  {
191  SetSize( savedDialogRect.GetPosition().x,
192  savedDialogRect.GetPosition().y,
193  std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
194  std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
195  0 );
196  }
197 
198  // Be sure that the dialog appears in a visible area
199  // (the dialog position might have been stored at the time when it was
200  // shown on another display)
201  if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
202  Centre();
203  }
204  else
205  {
206  // Save the dialog's position & size before hiding, using classname as key
207  class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
208 
209 #ifdef __WXMAC__
210  if ( m_eventLoop )
211  m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
212 #endif
213 
214  ret = wxDialog::Show( show );
215  }
216 
217  return ret;
218 }
const wxSize GetSize() const
Definition: eda_rect.h:101
std::string m_hash_key
Definition: dialog_shim.h:144
static RECT_MAP class_map
const wxPoint GetPosition() const
Definition: eda_rect.h:113
#define max(a, b)
Definition: auxiliary.h:86
Class EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44
int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 327 of file dialog_shim.cpp.

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

Referenced by SCH_EDIT_FRAME::EditComponent(), SCH_EDIT_FRAME::EditComponentFieldText(), LIB_EDIT_FRAME::EditField(), EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), SCH_EDIT_FRAME::InstallHierarchyFrame(), PCB_BASE_FRAME::InstallPadOptionsFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogUpdateFields(), LIB_EDIT_FRAME::OnEditComponentProperties(), PCB_EDIT_FRAME::OnEditTracksAndVias(), SCH_EDIT_FRAME::OnLaunchBomManager(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), EDIT_TOOL::Properties(), SCH_BASE_FRAME::SelectComponentFromLibTree(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), and DIALOG_SHIM::SetInitialFocus().

328 {
329  // This is an exception safe way to zero a pointer before returning.
330  // Yes, even though DismissModal() clears this first normally, this is
331  // here in case there's an exception before the dialog is dismissed.
332  struct NULLER
333  {
334  void*& m_what;
335  NULLER( void*& aPtr ) : m_what( aPtr ) {}
336  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
337  } clear_this( (void*&) m_qmodal_loop );
338 
339  // release the mouse if it's currently captured as the window having it
340  // will be disabled when this dialog is shown -- but will still keep the
341  // capture making it impossible to do anything in the modal dialog itself
342  wxWindow* win = wxWindow::GetCapture();
343  if( win )
344  win->ReleaseMouse();
345 
346  // Get the optimal parent
347  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
348 
349  // Show the optimal parent
350  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
351 
352  wxASSERT_MSG( !m_qmodal_parent_disabler,
353  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
354 
355  // quasi-modal: disable only my "optimal" parent
357 
358 #ifdef __WXMAC__
359  // Apple in its infinite wisdom will raise a disabled window before even passing
360  // us the event, so we have no way to stop it. Instead, we must set an order on
361  // the windows so that the quasi-modal will be pushed in front of the disabled
362  // window when it is raised.
363  ReparentQuasiModal();
364 #endif
365  Show( true );
366 
367  m_qmodal_showing = true;
368 
369  WX_EVENT_LOOP event_loop;
370 
371  m_qmodal_loop = &event_loop;
372 
373  event_loop.Run();
374 
375  m_qmodal_showing = false;
376 
377  return GetReturnCode();
378 }
bool m_qmodal_showing
Definition: dialog_shim.h:154
#define WX_EVENT_LOOP
Definition: kiway_player.h:100
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:153
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:155
Toggle a window&#39;s "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:33
#define DBG(x)
Definition: fctsys.h:33
int DIALOG_SHIM::VertPixelsFromDU ( int  y)
protectedinherited

Convert an integer number of dialog units to pixels, vertically.

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 148 of file dialog_shim.cpp.

Referenced by DIALOG_CHOOSE_COMPONENT::DIALOG_CHOOSE_COMPONENT(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), and DIALOG_SHIM::GetUserUnits().

149 {
150  wxSize sz( 0, y );
151  return ConvertDialogToPixels( sz ).y;
152 }

Member Data Documentation

wxBitmapButton* DIALOG_PLOT_SCHEMATIC_BASE::m_browseButton
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().

UNIT_BINDER DIALOG_PLOT_SCHEMATIC::m_defaultLineWidth
private

Definition at line 57 of file dialog_plot_schematic.h.

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

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 149 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

wxStaticBoxSizer* DIALOG_PLOT_SCHEMATIC_BASE::m_HPGLOptionsSizer
protectedinherited
int DIALOG_PLOT_SCHEMATIC::m_HPGLPaperSizeSelect = PAGE_SIZE_AUTO
staticprivate

Definition at line 54 of file dialog_plot_schematic.h.

Referenced by getPlotOptions(), initDlg(), OnPageSizeSelected(), and OnUpdateUI().

double DIALOG_PLOT_SCHEMATIC::m_HPGLPenSize
private

Definition at line 55 of file dialog_plot_schematic.h.

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

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 150 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint(), and DIALOG_SHIM::SetInitialFocus().

wxTextCtrl* DIALOG_PLOT_SCHEMATIC_BASE::m_lineWidthCtrl
protectedinherited
wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_lineWidthLabel
protectedinherited
wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_lineWidthUnits
protectedinherited
WX_HTML_REPORT_PANEL* DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox
protectedinherited
wxChoice* 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
wxChoice* DIALOG_PLOT_SCHEMATIC_BASE::m_paperSizeOption
protectedinherited
UNIT_BINDER DIALOG_PLOT_SCHEMATIC::m_penWidth
private

Definition at line 58 of file dialog_plot_schematic.h.

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

wxTextCtrl* DIALOG_PLOT_SCHEMATIC_BASE::m_penWidthCtrl
protectedinherited
wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_penWidthLabel
protectedinherited
wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_penWidthUnits
protectedinherited
PlotFormat DIALOG_PLOT_SCHEMATIC::m_plotFormat
private

Definition at line 52 of file dialog_plot_schematic.h.

Referenced by OnUpdateUI().

wxRadioBox* DIALOG_PLOT_SCHEMATIC_BASE::m_plotFormatOpt
protectedinherited
wxCheckBox* DIALOG_PLOT_SCHEMATIC_BASE::m_PlotFrameRefOpt
protectedinherited
wxChoice* DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginOpt
protectedinherited
wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginTitle
protectedinherited
WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 153 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

Definition at line 154 of file dialog_shim.h.

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

wxStdDialogButtonSizer* DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1
protectedinherited
wxButton* DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1Apply
protectedinherited
wxButton* DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1Cancel
protectedinherited
wxButton* DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1OK
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: