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 Types

enum  HOLDER_TYPE { DIALOG, FRAME, PANEL, SCREEN }
 

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 GetUserUnits () const
 
HOLDER_TYPE GetType ()
 
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)
 
static bool IsCtrl (int aChar, const wxKeyEvent &e)
 
static bool IsShiftCtrl (int aChar, const wxKeyEvent &e)
 

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...
 
void ResetSize ()
 Clear the existing dialog size and position. 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 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
 
std::vector< wxWindow * > m_tabOrder
 

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...
 
PLOT_FORMAT 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
 
PLOT_FORMAT 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.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 
SCREEN 

Definition at line 42 of file kiway_holder.h.

Constructor & Destructor Documentation

◆ DIALOG_PLOT_SCHEMATIC()

DIALOG_PLOT_SCHEMATIC::DIALOG_PLOT_SCHEMATIC ( SCH_EDIT_FRAME parent)

Definition at line 65 of file dialog_plot_schematic.cpp.

66  : DIALOG_PLOT_SCHEMATIC_BASE( parent ),
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 }
const BITMAP_OPAQUE folder_xpm[1]
Definition: folder.cpp:20
wxStdDialogButtonSizer * m_sdbSizer1
wxConfigBase * KifaceSettings() const
Definition: kiface_i.h:103
void FinishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
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
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
#define _(s)
Definition: 3d_actions.cpp:31

References _, DIALOG_SHIM::FinishDialogSettings(), folder_xpm, 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, DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1OK, and UNDEFINED.

Member Function Documentation

◆ CreateDXFFile()

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

Definition at line 38 of file plot_schematic_DXF.cpp.

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)
SCH_SHEET_LIST.
Schematic editor (Eeschema) main window.
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:1406
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
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)
SCH_SHEET_PATH.
void BuildSheetList(SCH_SHEET *aSheet)
Function BuildSheetList builds the list of sheets and their sheet path from aSheet.
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:101
SCH_SCREEN * LastScreen()
Function LastScreen.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
#define _(s)
Definition: 3d_actions.cpp:31
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.
SCH_SHEET * g_RootSheet
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

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

Referenced by PlotSchematic().

◆ createHPGLFile()

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

Definition at line 85 of file plot_schematic_HPGL.cpp.

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)
SCH_SHEET_LIST.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:90
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
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...
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:152
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
static const wxChar * plot_sheet_list(int aSize)
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
wxFileName createPlotFileName(wxTextCtrl *aOutputDirectoryName, wxString &aPlotFileName, wxString &aExtension, REPORTER *aReporter=NULL)
Create a file name with an absolute path name.
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
REPORTER & Reporter()
returns the reporter object that reports to this panel
SCH_SHEET_PATH & GetCurrentSheet()
SCH_SHEET_PATH.
void BuildSheetList(SCH_SHEET *aSheet)
Function BuildSheetList builds the list of sheets and their sheet path from aSheet.
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:101
SCH_SCREEN * LastScreen()
Function LastScreen.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
#define _(s)
Definition: 3d_actions.cpp:31
static wxString GetDefaultFileExtension()
Definition: plotter.h:616
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.
bool Plot_1_Page_HPGL(const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
SCH_SHEET * g_RootSheet
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
int GetWidthMils() const
Definition: page_info.h:137

References _, SCH_SHEET_LIST::BuildSheetList(), createPlotFileName(), g_RootSheet, GetChars(), SCH_EDIT_FRAME::GetCurrentSheet(), HPGL_PLOTTER::GetDefaultFileExtension(), SCH_SCREEN::GetPageSettings(), GetPlotOriginCenter(), SCH_EDIT_FRAME::GetScreen(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), PAGE_INFO::GetWidthMils(), SCH_SHEET_PATH::LastScreen(), DIALOG_PLOT_SCHEMATIC_BASE::m_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().

◆ createPDFFile()

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

Definition at line 41 of file plot_schematic_PDF.cpp.

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

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

Referenced by PlotSchematic().

◆ createPlotFileName()

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 directory name to plot, this can be a relative name of the current project directory 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 333 of file dialog_plot_schematic.cpp.

337 {
338  wxString outputDirName = aOutputDirectoryName->GetValue();
339  wxFileName outputDir = wxFileName::DirName( outputDirName );
340 
341  wxString plotFileName = Prj().AbsolutePath( aPlotFileName + wxT( "." ) + aExtension);
342 
343  if( !EnsureFileDirectoryExists( &outputDir, plotFileName, aReporter ) )
344  {
345  wxString msg = wxString::Format( _( "Could not write plot files to folder \"%s\"." ),
346  outputDir.GetPath() );
347  aReporter->Report( msg, REPORTER::RPT_ERROR );
348  }
349 
350  wxFileName fn( plotFileName );
351  fn.SetPath( outputDir.GetFullPath() );
352  return fn;
353 }
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project's directory to be an absolu...
Definition: project.cpp:386
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't yet exist.
Definition: common.cpp:456
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
#define _(s)
Definition: 3d_actions.cpp:31
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_UNDEFINED)=0
Function Report is a pure virtual function to override in the derived object.

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

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

◆ createPSFile()

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

Definition at line 38 of file plot_schematic_PS.cpp.

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)
SCH_SHEET_LIST.
static wxString GetDefaultFileExtension()
Definition: plotter.h:797
int GetHeightMils() const
Definition: page_info.h:140
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
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...
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:152
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
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.
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
REPORTER & Reporter()
returns the reporter object that reports to this panel
SCH_SHEET_PATH & GetCurrentSheet()
SCH_SHEET_PATH.
void BuildSheetList(SCH_SHEET *aSheet)
Function BuildSheetList builds the list of sheets and their sheet path from aSheet.
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:101
SCH_SCREEN * LastScreen()
Function LastScreen.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
bool IsPortrait() const
Definition: page_info.h:121
#define _(s)
Definition: 3d_actions.cpp:31
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.
SCH_SHEET * g_RootSheet
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 GetWidthMils() const
Definition: page_info.h:137

References _, SCH_SHEET_LIST::BuildSheetList(), createPlotFileName(), g_RootSheet, GetChars(), SCH_EDIT_FRAME::GetCurrentSheet(), PS_PLOTTER::GetDefaultFileExtension(), PAGE_INFO::GetHeightMils(), SCH_SCREEN::GetPageSettings(), SCH_EDIT_FRAME::GetScreen(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), PAGE_INFO::GetWidthMils(), PAGE_INFO::IsPortrait(), SCH_SHEET_PATH::LastScreen(), DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_pageSizeSelect, m_parent, 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().

◆ createSVGFile()

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

Definition at line 43 of file plot_schematic_SVG.cpp.

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)
SCH_SHEET_LIST.
static wxString GetDefaultFileExtension()
Definition: plotter.h:939
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...
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:33
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()
SCH_SHEET_PATH.
void BuildSheetList(SCH_SHEET *aSheet)
Function BuildSheetList builds the list of sheets and their sheet path from aSheet.
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:101
SCH_SCREEN * LastScreen()
Function LastScreen.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
#define _(s)
Definition: 3d_actions.cpp:31
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.
SCH_SHEET * g_RootSheet
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)

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

Referenced by PlotSchematic().

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 262 of file dialog_shim.cpp.

263 {
264  // so we can do logging of this state change:
265 
266 #if 0 && defined(DEBUG)
267  const char* type_id = typeid( *this ).name();
268  printf( "DIALOG_SHIM %s: %s\n", type_id, enable ? "enabled" : "disabled" );
269  fflush(0); //Needed on msys2 to immediately print the message
270 #endif
271 
272  return wxDialog::Enable( enable );
273 }

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 419 of file dialog_shim.cpp.

420 {
421  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
422  // handle validation in the same way as other dialogs.
423  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
424  return;
425 
426  SetReturnCode( retCode );
427 
428  if( !IsQuasiModal() )
429  {
430  wxFAIL_MSG( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal"
431  "wasn't called" );
432  return;
433  }
434 
435  if( m_qmodal_loop )
436  {
437  if( m_qmodal_loop->IsRunning() )
438  m_qmodal_loop->Exit( 0 );
439  else
440  m_qmodal_loop->ScheduleExit( 0 );
441 
443  }
444 
447 
448  Show( false );
449 }
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:205
#define NULL
bool IsQuasiModal()
Definition: dialog_shim.h:124
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:208

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

Referenced by HK_PROMPT_DIALOG::EndFlexible(), DIALOG_SHIM::OnButton(), DIALOG_EDIT_COMPONENTS_LIBID::onCancel(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick(), DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnCancelButtonClick(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_COMPONENT::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), HTML_MESSAGE_BOX::OnOKButtonClick(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_COMPONENT::OnUseBrowser(), and DIALOG_SHIM::~DIALOG_SHIM().

◆ FinishDialogSettings()

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 137 of file dialog_shim.cpp.

138 {
139  // must be called from the constructor of derived classes,
140  // when all widgets are initialized, and therefore their size fixed
141 
142  // SetSizeHints fixes the minimal size of sizers in the dialog
143  // (SetSizeHints calls Fit(), so no need to call it)
144  GetSizer()->SetSizeHints( this );
145 
146  // the default position, when calling the first time the dlg
147  Center();
148 }

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_EDIT_SHEET_PIN::DIALOG_EDIT_SHEET_PIN(), DIALOG_EDITOR_DATA::DIALOG_EDITOR_DATA(), 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_GENCAD_EXPORT_OPTIONS::DIALOG_GENCAD_EXPORT_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_LIB_TABLE_CONFIG::DIALOG_GLOBAL_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_PRIMITIVE_POLY_PROPS::DIALOG_PAD_PRIMITIVE_POLY_PROPS(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PASTE_SPECIAL::DIALOG_PASTE_SPECIAL(), 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_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_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_UPDATE_FIELDS::TransferDataToWindow(), DIALOG_COLOR_PICKER::TransferDataToWindow(), and DIALOG_BOARD_STATISTICS::TransferDataToWindow().

◆ getModeColor()

bool DIALOG_PLOT_SCHEMATIC::getModeColor ( )
inlineprivate

◆ GetPlotFileFormat()

PLOT_FORMAT DIALOG_PLOT_SCHEMATIC::GetPlotFileFormat ( )
private

Definition at line 192 of file dialog_plot_schematic.cpp.

193 {
194  switch( m_plotFormatOpt->GetSelection() )
195  {
196  default:
197  case 0:
198  return PLOT_FORMAT::POST;
199  case 1:
200  return PLOT_FORMAT::PDF;
201  case 2:
202  return PLOT_FORMAT::SVG;
203  case 3:
204  return PLOT_FORMAT::DXF;
205  case 4:
206  return PLOT_FORMAT::HPGL;
207  }
208 }

References DXF, HPGL, DIALOG_PLOT_SCHEMATIC_BASE::m_plotFormatOpt, PDF, POST, and SVG.

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

◆ getPlotFrameRef()

bool DIALOG_PLOT_SCHEMATIC::getPlotFrameRef ( )
inlineprivate

◆ getPlotOptions()

void DIALOG_PLOT_SCHEMATIC::getPlotOptions ( )
private

Definition at line 269 of file dialog_plot_schematic.cpp.

270 {
272 
275  m_config->Write( PLOT_FORMAT_KEY, (long) GetPlotFileFormat() );
278 
279  // HPGL Pen Size is stored in mm in config
280  m_config->Write( PLOT_HPGL_PEN_SIZE_KEY, m_HPGLPenSize/IU_PER_MM );
281 
283 
284  // Plot directory
285  wxString path = m_outputDirectoryName->GetValue();
286  path.Replace( '\\', '/' );
287 
288  if( m_parent->GetPlotDirectoryName() != path )
289  m_configChanged = true;
290 
292 }
void SetPlotDirectoryName(const wxString &aDirName)
#define PLOT_HPGL_ORIGIN_KEY
void SetDefaultLineThickness(int aThickness)
#define PLOT_MODECOLOR_KEY
#define PLOT_FRAME_REFERENCE_KEY
const wxString & GetPlotDirectoryName() const
accessor to the destination directory to use when generating plot files.
#define PLOT_HPGL_PEN_SIZE_KEY
virtual long long int GetValue()
Function GetValue Returns the current value in Internal Units.
#define PLOT_HPGL_PAPERSIZE_KEY
#define PLOT_FORMAT_KEY

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().

◆ GetPlotOriginCenter()

bool DIALOG_PLOT_SCHEMATIC::GetPlotOriginCenter ( )
inlineprivate

Definition at line 114 of file dialog_plot_schematic.h.

115  {
116  return m_plotOriginOpt->GetSelection() == 1;
117  }

References DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginOpt.

Referenced by createHPGLFile(), and getPlotOptions().

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( )
inlineinherited

Definition at line 49 of file kiway_holder.h.

49 { return m_type; }
HOLDER_TYPE m_type
Definition: kiway_holder.h:82

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM(), and GERBVIEW_FRAME::SaveSettings().

◆ GetUserUnits()

◆ HorizPixelsFromDU()

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 158 of file dialog_shim.cpp.

159 {
160  wxSize sz( x, 0 );
161  return ConvertDialogToPixels( sz ).x;
162 }

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

◆ initDlg()

void DIALOG_PLOT_SCHEMATIC::initDlg ( )
private

Definition at line 93 of file dialog_plot_schematic.cpp.

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  int plotfmt;
116  m_config->Read( PLOT_FORMAT_KEY, &plotfmt, 0 );
117 
118  switch( static_cast<PLOT_FORMAT>( plotfmt ) )
119  {
120  default:
121  case PLOT_FORMAT::POST:
122  m_plotFormatOpt->SetSelection( 0 );
123  break;
124  case PLOT_FORMAT::PDF:
125  m_plotFormatOpt->SetSelection( 1 );
126  break;
127  case PLOT_FORMAT::SVG:
128  m_plotFormatOpt->SetSelection( 2 );
129  break;
130  case PLOT_FORMAT::DXF:
131  m_plotFormatOpt->SetSelection( 3 );
132  break;
133  case PLOT_FORMAT::HPGL:
134  m_plotFormatOpt->SetSelection( 4 );
135  break;
136  }
137 
138  // Set the default line width (pen width which should be used for
139  // items that do not have a pen size defined (like frame ref)
141 
142  // Initialize HPGL specific widgets
144 
145  // Plot directory
146  wxString path = m_parent->GetPlotDirectoryName();
147 #ifdef __WINDOWS__
148  path.Replace( '/', '\\' );
149 #endif
150  m_outputDirectoryName->SetValue( path );
151 }
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
void setPlotFrameRef(bool aPlot)
#define PLOT_FRAME_REFERENCE_KEY
const wxString & GetPlotDirectoryName() const
accessor to the destination directory to use when generating plot files.
#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)

References DXF, GetDefaultLineThickness(), SCH_EDIT_FRAME::GetPlotDirectoryName(), HPGL, m_config, m_defaultLineWidth, m_HPGLPaperSizeSelect, m_HPGLPenSize, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_parent, m_penWidth, DIALOG_PLOT_SCHEMATIC_BASE::m_plotFormatOpt, PDF, PLOT_FORMAT_KEY, PLOT_FRAME_REFERENCE_KEY, PLOT_HPGL_ORIGIN_KEY, PLOT_HPGL_PAPERSIZE_KEY, PLOT_HPGL_PEN_SIZE_KEY, PLOT_MODECOLOR_KEY, POST, setModeColor(), setPlotFrameRef(), SetPlotOriginCenter(), UNIT_BINDER::SetValue(), and SVG.

Referenced by DIALOG_PLOT_SCHEMATIC().

◆ IsCtrl()

static bool DIALOG_SHIM::IsCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 137 of file dialog_shim.h.

138  {
139  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
140  !e.ShiftDown() && !e.MetaDown();
141  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook(), and DIALOG_LABEL_EDITOR::OnCharHook().

◆ IsQuasiModal()

◆ IsShiftCtrl()

static bool DIALOG_SHIM::IsShiftCtrl ( int  aChar,
const wxKeyEvent &  e 
)
inlinestaticinherited

Definition at line 143 of file dialog_shim.h.

144  {
145  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
146  e.ShiftDown() && !e.MetaDown();
147  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook(), and DIALOG_LABEL_EDITOR::OnCharHook().

◆ Kiway()

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 56 of file kiway_holder.h.

57  {
58  wxASSERT( m_kiway ); // smoke out bugs in Debug build, then Release runs fine.
59  return *m_kiway;
60  }
KIWAY * m_kiway
Definition: kiway_holder.h:81

References KIWAY_HOLDER::m_kiway.

Referenced by TREEPROJECT_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_CONTROL::AddSymbolToSchematic(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_COMPONENT::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), SCH_EDIT_FRAME::CreateScreens(), CVPCB_MAINFRAME::CVPCB_MAINFRAME(), DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), DIALOG_SHIM::DIALOG_SHIM(), CVPCB_MAINFRAME::DisplayStatus(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), EDIT_TOOL::EditFpInFpEditor(), SCH_EDIT_FRAME::EditSheet(), SCH_EDITOR_CONTROL::EditWithLibEdit(), 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::InitSheet(), KICAD_MANAGER_FRAME::language_change(), KIWAY_PLAYER::language_change(), CVPCB_MAINFRAME::LoadFootprintFiles(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadSheetFromFile(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), KICAD_MANAGER_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnCloseWindow(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), LIB_EDIT_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), KICAD_MANAGER_FRAME::OnImportEagleFiles(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDITOR_CONTROL::Paste(), KIWAY_HOLDER::Prj(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), LIB_EDIT_FRAME::refreshSchematic(), SCH_EDIT_FRAME::rescueProject(), EE_INSPECTION_TOOL::RunSimulation(), SCH_EDIT_FRAME::SaveEEFile(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), SCH_BASE_FRAME::SelectComponentFromLibBrowser(), SCH_EDIT_FRAME::SendCrossProbeClearHighlight(), SCH_EDIT_FRAME::SendCrossProbeNetName(), PCB_EDIT_FRAME::SendCrossProbeNetName(), CVPCB_MAINFRAME::SendMessageToEESCHEMA(), PCB_EDIT_FRAME::SendMessageToEESCHEMA(), SCH_EDIT_FRAME::SendMessageToPCBNEW(), SCH_EDIT_FRAME::sendNetlistToCvpcb(), FOOTPRINT_EDIT_FRAME::SetPlotSettings(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::UpdatePart(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ OnCloseWindow()

virtual void DIALOG_PLOT_SCHEMATIC_BASE::OnCloseWindow ( wxCloseEvent &  event)
inlineprotectedvirtualinherited

◆ OnOutputDirectoryBrowseClicked()

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 158 of file dialog_plot_schematic.cpp.

159 {
160  // Build the absolute path of current output plot directory
161  // to preselect it when opening the dialog.
162  wxFileName fn( m_outputDirectoryName->GetValue() );
163  wxString path = Prj().AbsolutePath( m_outputDirectoryName->GetValue() );
164 
165  wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
166 
167  if( dirDialog.ShowModal() == wxID_CANCEL )
168  return;
169 
170  wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
171 
173  wxString defaultPath = fn.GetPathWithSep();
174  wxString msg;
175  msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ), GetChars( defaultPath ) );
176 
177  wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
178  wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
179 
180  // relative directory selected
181  if( dialog.ShowModal() == wxID_YES )
182  {
183  if( !dirName.MakeRelativeTo( defaultPath ) )
184  wxMessageBox( _( "Cannot make path relative (target volume different from file "
185  "volume)!" ), _( "Plot Output Directory" ), wxOK | wxICON_ERROR );
186  }
187 
188  m_outputDirectoryName->SetValue( dirName.GetFullPath() );
189 }
VTBL_ENTRY const wxString AbsolutePath(const wxString &aFileName) const
Function AbsolutePath fixes up aFileName if it is relative to the project's directory to be an absolu...
Definition: project.cpp:386
PROJECT & Prj() const
Function Prj returns a reference to the PROJECT "associated with" this KIWAY.
wxString GetFileName(void) const
Return the filename corresponding to this sheet.
Definition: sch_sheet.cpp:616
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:101
#define _(s)
Definition: 3d_actions.cpp:31
SCH_SHEET * g_RootSheet

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

◆ OnPageSizeSelected()

void DIALOG_PLOT_SCHEMATIC::OnPageSizeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 320 of file dialog_shim.cpp.

321 {
322  if( m_firstPaintEvent )
323  {
324 #ifdef __WXMAC__
325  fixOSXCancelButtonIssue( this );
326 #endif
327 
328  selectAllInTextCtrls( GetChildren() );
329 
331  m_initialFocusTarget->SetFocus();
332  else
333  SetFocus(); // Focus the dialog itself
334 
335  m_firstPaintEvent = false;
336  }
337 
338  event.Skip();
339 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:203
bool m_firstPaintEvent
Definition: dialog_shim.h:202
static void selectAllInTextCtrls(wxWindowList &children)

References DIALOG_SHIM::m_firstPaintEvent, DIALOG_SHIM::m_initialFocusTarget, and selectAllInTextCtrls().

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ OnPlotAll()

void DIALOG_PLOT_SCHEMATIC::OnPlotAll ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 301 of file dialog_plot_schematic.cpp.

302 {
303  PlotSchematic( true );
304 }
void PlotSchematic(bool aPlotAll)

References PlotSchematic().

◆ OnPlotCurrent()

void DIALOG_PLOT_SCHEMATIC::OnPlotCurrent ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 295 of file dialog_plot_schematic.cpp.

296 {
297  PlotSchematic( false );
298 }
void PlotSchematic(bool aPlotAll)

References PlotSchematic().

◆ OnPlotFormatSelection()

virtual void DIALOG_PLOT_SCHEMATIC_BASE::OnPlotFormatSelection ( wxCommandEvent &  event)
inlineprotectedvirtualinherited

◆ OnUpdateUI()

void DIALOG_PLOT_SCHEMATIC::OnUpdateUI ( wxUpdateUIEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 220 of file dialog_plot_schematic.cpp.

221 {
223 
224  if( fmt != m_plotFormat )
225  {
226  m_plotFormat = fmt;
227 
228  wxArrayString paperSizes;
229  paperSizes.push_back( _( "Schematic size" ) );
230 
231  int selection;
232 
233  if( fmt == PLOT_FORMAT::HPGL )
234  {
235  paperSizes.push_back( _( "A4" ) );
236  paperSizes.push_back( _( "A3" ) );
237  paperSizes.push_back( _( "A2" ) );
238  paperSizes.push_back( _( "A1" ) );
239  paperSizes.push_back( _( "A0" ) );
240  paperSizes.push_back( _( "A" ) );
241  paperSizes.push_back( _( "B" ) );
242  paperSizes.push_back( _( "C" ) );
243  paperSizes.push_back( _( "D" ) );
244  paperSizes.push_back( _( "E" ) );
245 
246  selection = m_HPGLPaperSizeSelect;
247  }
248  else
249  {
250  paperSizes.push_back( _( "A4" ) );
251  paperSizes.push_back( _( "A" ) );
252 
253  selection = m_pageSizeSelect;
254  }
255 
256  m_paperSizeOption->Set( paperSizes );
257  m_paperSizeOption->SetSelection( selection );
258 
260  fmt == PLOT_FORMAT::POST || fmt == PLOT_FORMAT::PDF || fmt == PLOT_FORMAT::SVG );
261 
262  m_plotOriginTitle->Enable( fmt == PLOT_FORMAT::HPGL );
263  m_plotOriginOpt->Enable( fmt == PLOT_FORMAT::HPGL );
265  }
266 }
PLOT_FORMAT
Enum PlotFormat is the set of supported output plot formats.
Definition: plotter.h:50
#define _(s)
Definition: 3d_actions.cpp:31
void Enable(bool aEnable)
Function Enable Enables/diasables the label, widget and units label.

References _, UNIT_BINDER::Enable(), GetPlotFileFormat(), HPGL, 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, PDF, POST, and SVG.

◆ Plot_1_Page_HPGL()

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.

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(),
213 
214  aScreen->Plot( plotter );
215 
216  plotter->EndPlot();
217  delete plotter;
218 
219  return true;
220 }
virtual bool EndPlot() override
HPGL end of plot: pen return and release.
const wxString & GetFileName() const
Definition: sch_screen.h:157
virtual void SetColor(COLOR4D color) override
Definition: plotter.h:634
int m_ScreenNumber
Definition: base_screen.h:135
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:167
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:90
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:82
virtual void SetPenDiameter(double diameter)
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.cpp:591
virtual bool StartPlot() override
At the start of the HPGL plot pen speed and number are requested.
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
void PlotWorkSheet(PLOTTER *plotter, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, int aSheetNumber, int aNumberOfSheets, const wxString &aSheetDesc, const wxString &aFilename, const COLOR4D aColor)
wxString GetScreenDesc() const override
Return a human-readable description of the current screen.
SCH_LAYER_ID
Eeschema drawing layers.
void Plot(PLOTTER *aPlotter)
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:569
const PAGE_INFO & GetPageSettings() const override
const TITLE_BLOCK & GetTitleBlock() const override
#define IU_PER_MILS
Definition: plotter.cpp:137
int m_NumberOfScreens
Definition: base_screen.h:136
Definition: colors.h:45

References BLACK, HPGL_PLOTTER::EndPlot(), SCH_SCREEN::GetFileName(), GetLayerColor(), SCH_BASE_FRAME::GetPageSettings(), getPlotFrameRef(), SCH_EDIT_FRAME::GetScreenDesc(), SCH_BASE_FRAME::GetTitleBlock(), IU_PER_MILS, LAYER_WORKSHEET, 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().

◆ PlotOneSheetDXF()

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.

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(),
141  }
142 
143  aScreen->Plot( plotter );
144 
145  // finish
146  plotter->EndPlot();
147  delete plotter;
148 
149  return true;
150 }
const wxString & GetFileName() const
Definition: sch_screen.h:157
int m_ScreenNumber
Definition: base_screen.h:135
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:167
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:90
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the scale/position for the DXF plot The DXF engine doesn't support line widths and mirroring.
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:82
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:132
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.cpp:591
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:152
void PlotWorkSheet(PLOTTER *plotter, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, int aSheetNumber, int aNumberOfSheets, const wxString &aSheetDesc, const wxString &aFilename, const COLOR4D aColor)
wxString GetScreenDesc() const override
Return a human-readable description of the current screen.
virtual bool StartPlot() override
Opens the DXF plot with a skeleton header.
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
virtual bool EndPlot() override
SCH_LAYER_ID
Eeschema drawing layers.
void Plot(PLOTTER *aPlotter)
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:569
const PAGE_INFO & GetPageSettings() const override
const TITLE_BLOCK & GetTitleBlock() const override
#define IU_PER_MILS
Definition: plotter.cpp:137
int m_NumberOfScreens
Definition: base_screen.h:136

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

◆ plotOneSheetPDF()

void DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF ( PLOTTER aPlotter,
SCH_SCREEN aScreen,
bool  aPlotFrameRef 
)
private

Definition at line 146 of file plot_schematic_PDF.cpp.

149 {
150  if( aPlotFrameRef )
151  {
152  aPlotter->SetColor( BLACK );
153  PlotWorkSheet( aPlotter, m_parent->GetTitleBlock(),
155  aScreen->m_ScreenNumber, aScreen->m_NumberOfScreens,
157  aScreen->GetFileName(),
159  }
160 
161  aScreen->Plot( aPlotter );
162 }
const wxString & GetFileName() const
Definition: sch_screen.h:157
int m_ScreenNumber
Definition: base_screen.h:135
virtual void SetColor(COLOR4D color)=0
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
void PlotWorkSheet(PLOTTER *plotter, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, int aSheetNumber, int aNumberOfSheets, const wxString &aSheetDesc, const wxString &aFilename, const COLOR4D aColor)
wxString GetScreenDesc() const override
Return a human-readable description of the current screen.
SCH_LAYER_ID
Eeschema drawing layers.
void Plot(PLOTTER *aPlotter)
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:569
const PAGE_INFO & GetPageSettings() const override
const TITLE_BLOCK & GetTitleBlock() const override
int m_NumberOfScreens
Definition: base_screen.h:136
Definition: colors.h:45

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

Referenced by createPDFFile().

◆ plotOneSheetPS()

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.

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(),
167  }
168 
169  aScreen->Plot( plotter );
170 
171  plotter->EndPlot();
172  delete plotter;
173 
174  return true;
175 }
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
Definition: PS_plotter.cpp:412
const wxString & GetFileName() const
Definition: sch_screen.h:157
int m_ScreenNumber
Definition: base_screen.h:135
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:167
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: common.h:90
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:82
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:132
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i....
virtual bool EndPlot() override
Definition: PS_plotter.cpp:967
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.cpp:591
void PlotWorkSheet(PLOTTER *plotter, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, int aSheetNumber, int aNumberOfSheets, const wxString &aSheetDesc, const wxString &aFilename, const COLOR4D aColor)
wxString GetScreenDesc() const override
Return a human-readable description of the current screen.
virtual bool StartPlot() override
The code within this function (and the CloseFilePS function) creates postscript files whose contents ...
Definition: PS_plotter.cpp:813
virtual void SetDefaultLineWidth(int width) override
Set the default line width.
Definition: PS_plotter.cpp:53
virtual void SetColor(COLOR4D color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
Definition: PS_plotter.cpp:60
SCH_LAYER_ID
Eeschema drawing layers.
void Plot(PLOTTER *aPlotter)
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:569
const PAGE_INFO & GetPageSettings() const override
const TITLE_BLOCK & GetTitleBlock() const override
#define IU_PER_MILS
Definition: plotter.cpp:137
int m_NumberOfScreens
Definition: base_screen.h:136
Definition: colors.h:45

References BLACK, PS_PLOTTER::EndPlot(), GetDefaultLineThickness(), SCH_SCREEN::GetFileName(), GetLayerColor(), getModeColor(), SCH_BASE_FRAME::GetPageSettings(), SCH_EDIT_FRAME::GetScreenDesc(), SCH_BASE_FRAME::GetTitleBlock(), IU_PER_MILS, LAYER_WORKSHEET, 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().

◆ plotOneSheetSVG()

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.

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(),
141  }
142 
143  aScreen->Plot( plotter );
144 
145  plotter->EndPlot();
146  delete plotter;
147 
148  return true;
149 }
const wxString & GetFileName() const
Definition: sch_screen.h:157
int m_ScreenNumber
Definition: base_screen.h:135
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:167
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:90
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:82
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:132
int GetDefaultLineThickness()
Default line thickness used to draw/plot items having a default thickness line value (i....
COLOR4D GetLayerColor(SCH_LAYER_ID aLayer)
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.cpp:591
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:152
void PlotWorkSheet(PLOTTER *plotter, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, int aSheetNumber, int aNumberOfSheets, const wxString &aSheetDesc, const wxString &aFilename, const COLOR4D aColor)
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:53
PAGE_INFO describes the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:54
virtual bool StartPlot() override
The code within this function creates SVG files header.
SCH_LAYER_ID
Eeschema drawing layers.
void Plot(PLOTTER *aPlotter)
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:569
const int scale
#define IU_PER_MILS
Definition: plotter.cpp:137
int m_NumberOfScreens
Definition: base_screen.h:136
Definition: colors.h:45
virtual wxString GetScreenDesc() const

References BLACK, SVG_PLOTTER::EndPlot(), GetDefaultLineThickness(), SCH_SCREEN::GetFileName(), GetLayerColor(), SCH_SCREEN::GetPageSettings(), EDA_DRAW_FRAME::GetPageSettings(), EDA_DRAW_FRAME::GetScreenDesc(), EDA_DRAW_FRAME::GetTitleBlock(), IU_PER_MILS, LAYER_WORKSHEET, 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().

◆ PlotSchematic()

void DIALOG_PLOT_SCHEMATIC::PlotSchematic ( bool  aPlotAll)
private

Definition at line 307 of file dialog_plot_schematic.cpp.

308 {
309  getPlotOptions();
310 
311  switch( GetPlotFileFormat() )
312  {
313  default:
314  case PLOT_FORMAT::POST:
315  createPSFile( aPlotAll, getPlotFrameRef() );
316  break;
317  case PLOT_FORMAT::DXF:
318  CreateDXFFile( aPlotAll, getPlotFrameRef() );
319  break;
320  case PLOT_FORMAT::PDF:
321  createPDFFile( aPlotAll, getPlotFrameRef() );
322  break;
323  case PLOT_FORMAT::SVG:
324  createSVGFile( aPlotAll, getPlotFrameRef() );
325  break;
326  case PLOT_FORMAT::HPGL:
327  createHPGLFile( aPlotAll, getPlotFrameRef() );
328  break;
329  }
330 }
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)

References CreateDXFFile(), createHPGLFile(), createPDFFile(), createPSFile(), createSVGFile(), DXF, GetPlotFileFormat(), getPlotFrameRef(), getPlotOptions(), HPGL, PDF, POST, and SVG.

Referenced by OnPlotAll(), and OnPlotCurrent().

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

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

Definition at line 35 of file kiway_holder.cpp.

36 {
37  return Kiway().Prj();
38 }
KIWAY & Kiway() const
Function Kiway returns a reference to the KIWAY that this object has an opportunity to participate in...
Definition: kiway_holder.h:56
VTBL_ENTRY PROJECT & Prj() const
Function Prj returns the PROJECT associated with this KIWAY.
Definition: kiway.cpp:171

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

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), LIB_MANAGER::addLibrary(), LIB_CONTROL::AddSymbolToSchematic(), SCH_EDIT_FRAME::AppendSchematic(), PCB_EDIT_FRAME::ArchiveModulesOnBoard(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX(), DIALOG_FOOTPRINT_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_BOARD_EDITOR::Cfg3DPath(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), KICAD_MANAGER_FRAME::CreateNewProject(), createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), FOOTPRINT_EDIT_FRAME::DeleteModuleFromLibrary(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), 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(), CVPCB_MAINFRAME::DisplayStatus(), PCB_EDIT_FRAME::doAutoSave(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), LIB_CONTROL::ExportSymbolAsSVG(), LIB_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DISPLAY_FOOTPRINTS_FRAME::Get_Module(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), LIB_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), KICAD_MANAGER_FRAME::GetProjectFileName(), LIB_VIEW_FRAME::GetSelectedSymbol(), FP_THREAD_IFACE::GetTable(), PCB_EDIT_FRAME::importFile(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), LIB_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), LIB_EDIT_FRAME::LoadComponentFromCurrentLib(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), LIB_EDIT_FRAME::LoadOneSymbol(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectFile(), CVPCB_MAINFRAME::LoadProjectFile(), PCB_EDIT_FRAME::LoadProjectSettings(), SCH_EDIT_FRAME::LoadSheetFromFile(), 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_SCH_SHEET_PROPS::OnBrowseClicked(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), DIALOG_DRC_CONTROL::OnButtonBrowseRptFileClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), SCH_EDIT_FRAME::OnCloseWindow(), DIALOG_GENDRILL::OnGenReportFile(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_COMPONENT::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_BOM::OnRunGenerator(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), DIALOG_SPICE_MODEL::onSelectLibrary(), LIB_VIEW_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), SCH_EDIT_FRAME::OpenProjectFiles(), PCB_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDITOR_CONTROL::Paste(), MODULE_EDITOR_TOOLS::PasteFootprint(), PCB_BASE_EDIT_FRAME::PCB_BASE_EDIT_FRAME(), SCH_DRAWING_TOOLS::PlaceComponent(), DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector(), SCH_EDIT_FRAME::Print(), SCH_EDIT_FRAME::PrintPage(), 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(), SCH_EDIT_FRAME::RescueLegacyProject(), SCH_EDIT_FRAME::RescueSymbolLibTableProject(), 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(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), SCH_BASE_FRAME::SelectCompFromLibTree(), PCB_BASE_FRAME::SelectLibrary(), LIB_EDIT_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(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_COMPONENT::ShowFootprintFor(), LIB_VIEW_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), LIB_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_FOOTPRINT_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_BOARD_EDITOR::TransferDataToWindow(), DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::UpdateFieldsFromLibrary(), SIM_PLOT_FRAME::updateNetlistExporter(), SCH_SCREEN::UpdateSymbolLinks(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::updateTitle(), SCH_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(), and PCB_BASE_EDIT_FRAME::~PCB_BASE_EDIT_FRAME().

◆ PrjConfigChanged()

bool DIALOG_PLOT_SCHEMATIC::PrjConfigChanged ( )
inline

Definition at line 64 of file dialog_plot_schematic.h.

64 { return m_configChanged; } // return true if the prj config was modified

References m_configChanged.

Referenced by SCH_EDIT_FRAME::PlotSchematic().

◆ ResetSize()

void DIALOG_SHIM::ResetSize ( )
protectedinherited

Clear the existing dialog size and position.

This will cause the dialog size to be clear so the next time the dialog is shown the sizers will layout the dialog accordingly. This useful when there are dialog windows that size changes due to layout dependency hidden controls.

Definition at line 237 of file dialog_shim.cpp.

238 {
239  const char* hash_key;
240 
241  if( m_hash_key.size() )
242  {
243  // a special case like EDA_LIST_DIALOG, which has multiple uses.
244  hash_key = m_hash_key.c_str();
245  }
246  else
247  {
248  hash_key = typeid(*this).name();
249  }
250 
251  RECT_MAP::iterator it = class_map.find( hash_key );
252 
253  if( it == class_map.end() )
254  return;
255 
256  EDA_RECT rect = it->second;
257  rect.SetSize( 0, 0 );
258  class_map[ hash_key ] = rect;
259 }
std::string m_hash_key
Definition: dialog_shim.h:197
static RECT_MAP class_map
void SetSize(const wxSize &size)
Definition: eda_rect.h:144
EDA_RECT handles the component boundary box.
Definition: eda_rect.h:44

References class_map, DIALOG_SHIM::m_hash_key, and EDA_RECT::SetSize().

Referenced by DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY().

◆ restoreEnvironment()

void DIALOG_PLOT_SCHEMATIC::restoreEnvironment ( PDF_PLOTTER aPlotter,
SCH_SHEET_PATH aOldsheetpath 
)
private

Everything done, close the plot and restore the environment.

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

Definition at line 133 of file plot_schematic_PDF.cpp.

135 {
136  aPlotter->EndPlot();
137  delete aPlotter;
138 
139  // Restore the previous sheet
140  m_parent->SetCurrentSheet( aOldsheetpath );
143 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
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.

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().

◆ SetHPGLPenWidth()

void DIALOG_PLOT_SCHEMATIC::SetHPGLPenWidth ( )
private

Definition at line 73 of file plot_schematic_HPGL.cpp.

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 long long int GetValue()
Function GetValue Returns the current value in Internal Units.

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

Referenced by createHPGLFile().

◆ SetInitialFocus()

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 115 of file dialog_shim.h.

116  {
117  m_initialFocusTarget = aWindow;
118  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:203

References DIALOG_SHIM::m_initialFocusTarget.

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_FIND::DIALOG_FIND(), 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_IMPORT_GFX::DIALOG_IMPORT_GFX(), 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_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_SCH_FIND::DIALOG_SCH_FIND(), DIALOG_SCH_SHEET_PROPS::DIALOG_SCH_SHEET_PROPS(), 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(), LIB_EDIT_FRAME::savePartAs(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow(), DIALOG_KEEPOUT_AREA_PROPERTIES::TransferDataToWindow(), and DIALOG_COPPER_ZONE::TransferDataToWindow().

◆ SetKiway()

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 42 of file kiway_holder.cpp.

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

References KIWAY_HOLDER::m_kiway, and name.

Referenced by BM2CMP_FRAME::BM2CMP_FRAME(), InvokePcbLibTableEditor(), PCB_CALCULATOR_FRAME::PCB_CALCULATOR_FRAME(), and SIM_PLOT_FRAME::SIM_PLOT_FRAME().

◆ setModeColor()

void DIALOG_PLOT_SCHEMATIC::setModeColor ( bool  aColor)
inlineprivate

Definition at line 81 of file dialog_plot_schematic.h.

82  { m_ModeColorOption->SetSelection( aColor ? 0 : 1 ); }

References DIALOG_PLOT_SCHEMATIC_BASE::m_ModeColorOption.

Referenced by initDlg().

◆ setPlotFrameRef()

void DIALOG_PLOT_SCHEMATIC::setPlotFrameRef ( bool  aPlot)
inlineprivate

Definition at line 92 of file dialog_plot_schematic.h.

92 {m_PlotFrameRefOpt->SetValue( aPlot ); }

References DIALOG_PLOT_SCHEMATIC_BASE::m_PlotFrameRefOpt.

Referenced by initDlg().

◆ SetPlotOriginCenter()

void DIALOG_PLOT_SCHEMATIC::SetPlotOriginCenter ( bool  aCenter)
inlineprivate

Definition at line 119 of file dialog_plot_schematic.h.

120  {
121  m_plotOriginOpt->SetSelection( aCenter ? 1 : 0 );
122  }

References DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginOpt.

Referenced by initDlg().

◆ SetSizeInDU()

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 151 of file dialog_shim.cpp.

152 {
153  wxSize sz( x, y );
154  SetSize( ConvertDialogToPixels( sz ) );
155 }

Referenced by DIALOG_RESCUE_EACH::DIALOG_RESCUE_EACH(), HTML_MESSAGE_BOX::HTML_MESSAGE_BOX(), and HTML_MESSAGE_BOX::SetDialogSizeInDU().

◆ setupPlotPagePDF()

void DIALOG_PLOT_SCHEMATIC::setupPlotPagePDF ( PLOTTER aPlotter,
SCH_SCREEN aScreen 
)
private

Definition at line 165 of file plot_schematic_PDF.cpp.

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

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

Referenced by createPDFFile().

◆ Show()

bool DIALOG_SHIM::Show ( bool  show)
overrideinherited

Definition at line 178 of file dialog_shim.cpp.

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

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

Referenced by DIALOG_SHIM::EndQuasiModal(), InvokeDialogERC(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_DRC_CONTROL::OnLeftDClickClearance(), DIALOG_DRC_CONTROL::OnLeftDClickFootprints(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem(), DIALOG_DRC_CONTROL::OnLeftDClickUnconnected(), POSITION_RELATIVE_TOOL::PositionRelative(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), DRC::ShowDRCDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), DIALOG_SHIM::ShowQuasiModal(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), and SCH_EDIT_FRAME::UpdateHierarchyNavigator().

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 365 of file dialog_shim.cpp.

366 {
367  // This is an exception safe way to zero a pointer before returning.
368  // Yes, even though DismissModal() clears this first normally, this is
369  // here in case there's an exception before the dialog is dismissed.
370  struct NULLER
371  {
372  void*& m_what;
373  NULLER( void*& aPtr ) : m_what( aPtr ) {}
374  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
375  } clear_this( (void*&) m_qmodal_loop );
376 
377  // release the mouse if it's currently captured as the window having it
378  // will be disabled when this dialog is shown -- but will still keep the
379  // capture making it impossible to do anything in the modal dialog itself
380  wxWindow* win = wxWindow::GetCapture();
381  if( win )
382  win->ReleaseMouse();
383 
384  // Get the optimal parent
385  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
386 
387  // Show the optimal parent
388  DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
389 
390  wxASSERT_MSG( !m_qmodal_parent_disabler,
391  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
392 
393  // quasi-modal: disable only my "optimal" parent
395 
396 #ifdef __WXMAC__
397  // Apple in its infinite wisdom will raise a disabled window before even passing
398  // us the event, so we have no way to stop it. Instead, we must set an order on
399  // the windows so that the quasi-modal will be pushed in front of the disabled
400  // window when it is raised.
401  ReparentQuasiModal();
402 #endif
403  Show( true );
404 
405  m_qmodal_showing = true;
406 
407  WX_EVENT_LOOP event_loop;
408 
409  m_qmodal_loop = &event_loop;
410 
411  event_loop.Run();
412 
413  m_qmodal_showing = false;
414 
415  return GetReturnCode();
416 }
bool m_qmodal_showing
Definition: dialog_shim.h:207
#define WX_EVENT_LOOP
Definition: kiway_player.h:41
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:205
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:208
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:35
#define DBG(x)
Definition: fctsys.h:33

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 LIB_EDIT_TOOL::editFieldProperties(), SCH_EDITOR_CONTROL::EditSymbolFields(), LIB_EDIT_TOOL::editSymbolProperties(), GLOBAL_EDIT_TOOL::EditTracksAndVias(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), PCB_EDIT_FRAME::InstallExchangeModuleFrame(), PCB_BASE_FRAME::InstallPadOptionsFrame(), InvokeDialogEditComponentsLibId(), InvokeDialogRescueEach(), InvokeDialogUpdateFields(), SCH_EDIT_FRAME::OnRemapSymbols(), LIB_VIEW_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_BASE_FRAME::SelectCompFromLibTree(), and PCB_BASE_FRAME::SelectFootprintFromLibTree().

◆ VertPixelsFromDU()

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 165 of file dialog_shim.cpp.

166 {
167  wxSize sz( 0, y );
168  return ConvertDialogToPixels( sz ).y;
169 }

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

Member Data Documentation

◆ m_browseButton

wxBitmapButton* DIALOG_PLOT_SCHEMATIC_BASE::m_browseButton
protectedinherited

◆ m_config

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().

◆ m_configChanged

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().

◆ m_defaultLineWidth

UNIT_BINDER DIALOG_PLOT_SCHEMATIC::m_defaultLineWidth
private

Definition at line 57 of file dialog_plot_schematic.h.

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

◆ m_firstPaintEvent

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 202 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnPaint().

◆ m_hash_key

◆ m_HPGLOptionsSizer

wxStaticBoxSizer* DIALOG_PLOT_SCHEMATIC_BASE::m_HPGLOptionsSizer
protectedinherited

◆ m_HPGLPaperSizeSelect

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().

◆ m_HPGLPenSize

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().

◆ m_initialFocusTarget

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

Definition at line 203 of file dialog_shim.h.

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

◆ m_lineWidthCtrl

wxTextCtrl* DIALOG_PLOT_SCHEMATIC_BASE::m_lineWidthCtrl
protectedinherited

◆ m_lineWidthLabel

wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_lineWidthLabel
protectedinherited

◆ m_lineWidthUnits

wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_lineWidthUnits
protectedinherited

◆ m_MessagesBox

WX_HTML_REPORT_PANEL* DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox
protectedinherited

◆ m_ModeColorOption

wxChoice* DIALOG_PLOT_SCHEMATIC_BASE::m_ModeColorOption
protectedinherited

◆ m_optionsSizer

wxBoxSizer* DIALOG_PLOT_SCHEMATIC_BASE::m_optionsSizer
protectedinherited

◆ m_outputDirectoryName

wxTextCtrl* DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName
protectedinherited

◆ m_pageSizeSelect

int DIALOG_PLOT_SCHEMATIC::m_pageSizeSelect = PAGE_SIZE_AUTO
staticprivate

◆ m_paperSizeOption

wxChoice* DIALOG_PLOT_SCHEMATIC_BASE::m_paperSizeOption
protectedinherited

◆ m_parent

◆ m_penWidth

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().

◆ m_penWidthCtrl

wxTextCtrl* DIALOG_PLOT_SCHEMATIC_BASE::m_penWidthCtrl
protectedinherited

◆ m_penWidthLabel

wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_penWidthLabel
protectedinherited

◆ m_penWidthUnits

wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_penWidthUnits
protectedinherited

◆ m_plotFormat

PLOT_FORMAT DIALOG_PLOT_SCHEMATIC::m_plotFormat
private

Definition at line 52 of file dialog_plot_schematic.h.

Referenced by OnUpdateUI().

◆ m_plotFormatOpt

wxRadioBox* DIALOG_PLOT_SCHEMATIC_BASE::m_plotFormatOpt
protectedinherited

◆ m_PlotFrameRefOpt

wxCheckBox* DIALOG_PLOT_SCHEMATIC_BASE::m_PlotFrameRefOpt
protectedinherited

◆ m_plotOriginOpt

wxChoice* DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginOpt
protectedinherited

◆ m_plotOriginTitle

wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginTitle
protectedinherited

◆ m_qmodal_loop

WX_EVENT_LOOP* DIALOG_SHIM::m_qmodal_loop
protectedinherited

Definition at line 205 of file dialog_shim.h.

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

◆ m_qmodal_parent_disabler

WDO_ENABLE_DISABLE* DIALOG_SHIM::m_qmodal_parent_disabler
protectedinherited

◆ m_qmodal_showing

bool DIALOG_SHIM::m_qmodal_showing
protectedinherited

Definition at line 207 of file dialog_shim.h.

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

◆ m_sdbSizer1

wxStdDialogButtonSizer* DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1
protectedinherited

◆ m_sdbSizer1Apply

wxButton* DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1Apply
protectedinherited

◆ m_sdbSizer1Cancel

wxButton* DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1Cancel
protectedinherited

◆ m_sdbSizer1OK

wxButton* DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1OK
protectedinherited

◆ m_staticText4

wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_staticText4
protectedinherited

◆ m_staticTextOutputDirectory

wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_staticTextOutputDirectory
protectedinherited

◆ m_tabOrder

◆ m_units


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