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 }
 

Public Member Functions

 DIALOG_PLOT_SCHEMATIC (SCH_EDIT_FRAME *parent)
 
bool PrjConfigChanged ()
 Return true if the project configutation was modified. More...
 
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 () const
 
bool Show (bool show) override
 
bool Enable (bool enable) override
 
void OnPaint (wxPaintEvent &event)
 
void SetPosition (const wxPoint &aNewPosition)
 Force the position of the dialog to a new position. More...
 
EDA_UNITS GetUserUnits () const
 
HOLDER_TYPE GetType () const
 
KIWAYKiway () const
 Return a reference to the KIWAY that this object has an opportunity to participate in. More...
 
PROJECTPrj () const
 Return a reference to the PROJECT associated with this KIWAY. More...
 
void SetKiway (wxWindow *aDest, KIWAY *aKiway)
 It is only used for debugging, since "this" is not a wxWindow*. More...
 

Static Public Member Functions

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) const
 Convert an integer number of dialog units to pixels, horizontally. More...
 
int vertPixelsFromDU (int y) const
 Convert an integer number of dialog units to pixels, vertically. More...
 
void resetSize ()
 Clear the existing dialog size and position. More...
 
virtual void OnCharHook (wxKeyEvent &aEvt)
 

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_plotDrawingSheet
 
wxChoice * m_ModeColorOption
 
wxCheckBox * m_plotBackgroundColor
 
wxStaticText * m_staticText9
 
wxChoice * m_colorTheme
 
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_useCalculatedSize
 
bool m_firstPaintEvent
 
wxWindow * m_initialFocusTarget
 
WX_EVENT_LOOPm_qmodal_loop
 
bool m_qmodal_showing
 
WDO_ENABLE_DISABLEm_qmodal_parent_disabler
 
EDA_BASE_FRAMEm_parentFrame
 
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 (RENDER_SETTINGS *aSettings)
 
bool getModeColor ()
 
void setModeColor (bool aColor)
 
COLOR_SETTINGSgetColorSettings ()
 
void OnOutputDirectoryBrowseClicked (wxCommandEvent &event) override
 Set the m_outputDirectoryName variable to the selected directory from directory dialog. More...
 
PLOT_FORMAT GetPlotFileFormat ()
 
bool getPlotDrawingSheet ()
 
void setPlotDrawingSheet (bool aPlot)
 
void PlotSchematic (bool aPlotAll)
 
void createPDFFile (bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS *aRenderSettings)
 
void plotOneSheetPDF (PLOTTER *aPlotter, SCH_SCREEN *aScreen, bool aPlotDrawingSheet)
 
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 aPlotDrawingSheet, RENDER_SETTINGS *aRenderSettings)
 
bool PlotOneSheetDXF (const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, wxPoint aPlotOffset, double aScale, bool aPlotFrameRef)
 
HPGL_PLOT_ORIGIN_AND_UNITS GetPlotOriginAndUnits ()
 
void SetPlotOriginAndUnits (HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits)
 
void createHPGLFile (bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aRenderSettings)
 
void SetHPGLPenWidth ()
 
bool Plot_1_Page_HPGL (const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, RENDER_SETTINGS *aRenderSettings, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef, HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits)
 
void createPSFile (bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aSettings)
 
bool plotOneSheetPS (const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const PAGE_INFO &aPageInfo, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
 
void createSVGFile (bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aSettings)
 
bool plotOneSheetSVG (const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, bool aPlotBlackAndWhite, bool aPlotFrameRef)
 
wxFileName createPlotFileName (const wxString &aPlotFileName, const wxString &aExtension, REPORTER *aReporter=NULL)
 Create a file name with an absolute path name. More...
 

Private Attributes

SCH_EDIT_FRAMEm_parent
 
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 58 of file dialog_plot_schematic.h.

Member Enumeration Documentation

◆ HOLDER_TYPE

enum KIWAY_HOLDER::HOLDER_TYPE
inherited
Enumerator
DIALOG 
FRAME 
PANEL 

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

48  : DIALOG_PLOT_SCHEMATIC_BASE( parent ),
49  m_parent( parent ),
51  m_HPGLPenSize( 1.0 ),
54 {
55  m_configChanged = false;
56 
58 
59  m_MessagesBox->SetFileName( Prj().GetProjectPath() + wxT( "report.txt" ) );
60 
61  // We use a sdbSizer to get platform-dependent ordering of the action buttons, but
62  // that requires us to correct the button labels here.
63  m_sdbSizer1OK->SetLabel( _( "Plot All Pages" ) );
64  m_sdbSizer1Apply->SetLabel( _( "Plot Current Page" ) );
65  m_sdbSizer1Cancel->SetLabel( _( "Close" ) );
66  m_sdbSizer1->Layout();
67 
68  m_sdbSizer1OK->SetDefault();
69  initDlg();
70 
71  // Now all widgets have the size fixed, call FinishDialogSettings
73 }
wxStdDialogButtonSizer * m_sdbSizer1
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)
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
#define _(s)
Definition: 3d_actions.cpp:33
WX_HTML_REPORT_PANEL * m_MessagesBox
void SetFileName(const wxString &aReportFileName)
wxBitmap KiBitmap(BITMAPS aBitmap)
Construct a wxBitmap from an image identifier Returns the image from the active theme if the image ha...
Definition: bitmap.cpp:104

References _, DIALOG_SHIM::finishDialogSettings(), initDlg(), KiBitmap(), DIALOG_PLOT_SCHEMATIC_BASE::m_browseButton, m_configChanged, DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox, DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1, DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1Apply, DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1Cancel, DIALOG_PLOT_SCHEMATIC_BASE::m_sdbSizer1OK, KIWAY_HOLDER::Prj(), WX_HTML_REPORT_PANEL::SetFileName(), small_folder, and UNDEFINED.

Member Function Documentation

◆ CreateDXFFile()

void DIALOG_PLOT_SCHEMATIC::CreateDXFFile ( bool  aPlotAll,
bool  aPlotDrawingSheet,
RENDER_SETTINGS aRenderSettings 
)
private

Definition at line 41 of file plot_schematic_DXF.cpp.

43 {
44  SCH_EDIT_FRAME* schframe = m_parent;
45  SCH_SHEET_PATH oldsheetpath = schframe->GetCurrentSheet();
46 
47  /* When printing all pages, the printed page is not the current page.
48  * In complex hierarchies, we must setup references and others parameters
49  * in the printed SCH_SCREEN
50  * because in complex hierarchies a SCH_SCREEN (a schematic drawings)
51  * is shared between many sheets
52  */
53  SCH_SHEET_LIST sheetList;
54 
55  if( aPlotAll )
56  {
57  sheetList.BuildSheetList( &schframe->Schematic().Root(), true );
58  sheetList.SortByPageNumbers();
59  }
60  else
61  {
62  sheetList.push_back( schframe->GetCurrentSheet() );
63  }
64 
65  REPORTER& reporter = m_MessagesBox->Reporter();
66 
67  for( unsigned i = 0; i < sheetList.size(); i++ )
68  {
69  schframe->SetCurrentSheet( sheetList[i] );
71  schframe->SetSheetNumberAndCount();
72 
73  SCH_SCREEN* screen = schframe->GetCurrentSheet().LastScreen();
74  wxPoint plot_offset;
75  wxString msg;
76 
77  try
78  {
79  wxString fname = schframe->GetUniqueFilenameForCurrentSheet();
80  // The sub sheet can be in a sub_hierarchy, but we plot the file in the
81  // main project folder (or the folder specified by the caller),
82  // so replace separators to create a unique filename:
83  fname.Replace("/", "_" );
84  fname.Replace("\\", "_" );
85  wxString ext = DXF_PLOTTER::GetDefaultFileExtension();
86  wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
87 
88  if( PlotOneSheetDXF( plotFileName.GetFullPath(), screen, aRenderSettings,
89  plot_offset, 1.0, aPlotDrawingSheet ) )
90  {
91  msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
92  reporter.Report( msg, RPT_SEVERITY_ACTION );
93  }
94  else // Error
95  {
96  msg.Printf( _( "Unable to create file \"%s\".\n" ), plotFileName.GetFullPath() );
97  reporter.Report( msg, RPT_SEVERITY_ERROR );
98  }
99  }
100  catch( IO_ERROR& e )
101  {
102  msg.Printf( wxT( "DXF Plotter exception: %s"), e.What() );
103  reporter.Report( msg, RPT_SEVERITY_ERROR );
104  schframe->SetCurrentSheet( oldsheetpath );
106  schframe->SetSheetNumberAndCount();
107  return;
108  }
109  }
110 
111  schframe->SetCurrentSheet( oldsheetpath );
113  schframe->SetSheetNumberAndCount();
114 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Schematic editor (Eeschema) main window.
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:64
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
static wxString GetDefaultFileExtension()
Definition: plotter_dxf.h:50
wxFileName createPlotFileName(const wxString &aPlotFileName, const wxString &aExtension, REPORTER *aReporter=NULL)
Create a file name with an absolute path name.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
void BuildSheetList(SCH_SHEET *aSheet, bool aCheckIntegrity)
Build the list of sheets and their sheet path from aSheet.
SCHEMATIC & Schematic() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
bool PlotOneSheetDXF(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, wxPoint aPlotOffset, double aScale, bool aPlotFrameRef)
SCH_SHEET & Root() const
Definition: schematic.h:92
SCH_SCREEN * LastScreen()
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
#define _(s)
Definition: 3d_actions.cpp:33
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
wxString GetUniqueFilenameForCurrentSheet()
SCH_SHEET_PATH & GetCurrentSheet() const
WX_HTML_REPORT_PANEL * m_MessagesBox
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75

References _, SCH_SHEET_LIST::BuildSheetList(), createPlotFileName(), SCH_EDIT_FRAME::GetCurrentSheet(), DXF_PLOTTER::GetDefaultFileExtension(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), SCH_SHEET_PATH::LastScreen(), DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox, m_parent, PlotOneSheetDXF(), REPORTER::Report(), WX_HTML_REPORT_PANEL::Reporter(), SCHEMATIC::Root(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, SCH_EDIT_FRAME::Schematic(), SCH_EDIT_FRAME::SetCurrentSheet(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), SCH_SHEET_LIST::SortByPageNumbers(), SCH_SHEET_PATH::UpdateAllScreenReferences(), and IO_ERROR::What().

Referenced by PlotSchematic().

◆ createHPGLFile()

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

Definition at line 90 of file plot_schematic_HPGL.cpp.

92 {
93  SCH_SCREEN* screen = m_parent->GetScreen();
94  SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet();
95 
96  /* When printing all pages, the printed page is not the current page.
97  * In complex hierarchies, we must setup references and other parameters
98  * in the printed SCH_SCREEN
99  * because in complex hierarchies a SCH_SCREEN (a schematic drawings)
100  * is shared between many sheets
101  */
102  SCH_SHEET_LIST sheetList;
103 
104  if( aPlotAll )
105  {
106  sheetList.BuildSheetList( &m_parent->Schematic().Root(), true );
107  sheetList.SortByPageNumbers();
108  }
109  else
110  {
111  sheetList.push_back( m_parent->GetCurrentSheet() );
112  }
113 
114  REPORTER& reporter = m_MessagesBox->Reporter();
115 
116  SetHPGLPenWidth();
117 
118  for( unsigned i = 0; i < sheetList.size(); i++ )
119  {
120  m_parent->SetCurrentSheet( sheetList[i] );
123 
124  screen = m_parent->GetCurrentSheet().LastScreen();
125 
126  if( !screen ) // LastScreen() may return NULL
127  screen = m_parent->GetScreen();
128 
129  const PAGE_INFO& curPage = screen->GetPageSettings();
130 
131  PAGE_INFO plotPage = curPage;
132 
133  // if plotting on a page size other than curPage
134  if( m_paperSizeOption->GetSelection() != PAGE_DEFAULT )
135  plotPage.SetType( plot_sheet_list( m_paperSizeOption->GetSelection() ) );
136 
137  // Calculation of conversion scales.
138  double plot_scale = (double) plotPage.GetWidthMils() / curPage.GetWidthMils();
139 
140  // Calculate offsets
141  wxPoint plotOffset;
142  wxString msg;
143 
145  {
146  plotOffset.x = plotPage.GetWidthIU() / 2;
147  plotOffset.y = -plotPage.GetHeightIU() / 2;
148  }
149 
150  try
151  {
152  wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
153  // The sub sheet can be in a sub_hierarchy, but we plot the file in the
154  // main project folder (or the folder specified by the caller),
155  // so replace separators to create a unique filename:
156  fname.Replace("/", "_" );
157  fname.Replace("\\", "_" );
158  wxString ext = HPGL_PLOTTER::GetDefaultFileExtension();
159  wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
160 
161  LOCALE_IO toggle;
162 
163  if( Plot_1_Page_HPGL( plotFileName.GetFullPath(), screen, plotPage, aRenderSettings,
164  plotOffset, plot_scale, aPlotFrameRef, GetPlotOriginAndUnits() ) )
165  {
166  msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
167  reporter.Report( msg, RPT_SEVERITY_ACTION );
168  }
169  else
170  {
171  msg.Printf( _( "Unable to create file \"%s\".\n" ), plotFileName.GetFullPath() );
172  reporter.Report( msg, RPT_SEVERITY_ERROR );
173  }
174  }
175  catch( IO_ERROR& e )
176  {
177  msg.Printf( wxT( "HPGL Plotter exception: %s"), e.What() );
178  reporter.Report( msg, RPT_SEVERITY_ERROR );
179  }
180 
181  }
182 
183  m_parent->SetCurrentSheet( oldsheetpath );
186 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
bool SetType(const wxString &aStandardPageDescriptionName, bool aIsPortrait=false)
Set the name of the page type and also the sizes and margins commonly associated with that type name.
Definition: page_info.cpp:119
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:64
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:128
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxFileName createPlotFileName(const wxString &aPlotFileName, const wxString &aExtension, REPORTER *aReporter=NULL)
Create a file name with an absolute path name.
static const wxChar * plot_sheet_list(int aSize)
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
void BuildSheetList(SCH_SHEET *aSheet, bool aCheckIntegrity)
Build the list of sheets and their sheet path from aSheet.
SCHEMATIC & Schematic() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
HPGL_PLOT_ORIGIN_AND_UNITS GetPlotOriginAndUnits()
bool Plot_1_Page_HPGL(const wxString &aFileName, SCH_SCREEN *aScreen, const PAGE_INFO &aPageInfo, RENDER_SETTINGS *aRenderSettings, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef, HPGL_PLOT_ORIGIN_AND_UNITS aOriginAndUnits)
SCH_SHEET & Root() const
Definition: schematic.h:92
SCH_SCREEN * LastScreen()
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
#define _(s)
Definition: 3d_actions.cpp:33
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
static wxString GetDefaultFileExtension()
Definition: plotter_hpgl.h:46
wxString GetUniqueFilenameForCurrentSheet()
SCH_SHEET_PATH & GetCurrentSheet() const
WX_HTML_REPORT_PANEL * m_MessagesBox
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
int GetWidthMils() const
Definition: page_info.h:130

References _, SCH_SHEET_LIST::BuildSheetList(), createPlotFileName(), SCH_EDIT_FRAME::GetCurrentSheet(), HPGL_PLOTTER::GetDefaultFileExtension(), SCH_SCREEN::GetPageSettings(), GetPlotOriginAndUnits(), 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_paperSizeOption, m_parent, PAGE_DEFAULT, Plot_1_Page_HPGL(), plot_sheet_list(), PLOTTER_CENTER, REPORTER::Report(), WX_HTML_REPORT_PANEL::Reporter(), SCHEMATIC::Root(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, SCH_EDIT_FRAME::Schematic(), SCH_EDIT_FRAME::SetCurrentSheet(), SetHPGLPenWidth(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), PAGE_INFO::SetType(), SCH_SHEET_LIST::SortByPageNumbers(), SCH_SHEET_PATH::UpdateAllScreenReferences(), and IO_ERROR::What().

Referenced by PlotSchematic().

◆ createPDFFile()

void DIALOG_PLOT_SCHEMATIC::createPDFFile ( bool  aPlotAll,
bool  aPlotDrawingSheet,
RENDER_SETTINGS aRenderSettings 
)
private

Definition at line 45 of file plot_schematic_PDF.cpp.

47 {
48  SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
49 
50  /* When printing all pages, the printed page is not the current page. In
51  * complex hierarchies, we must update component references and others
52  * parameters in the given printed SCH_SCREEN, accordant to the sheet path
53  * because in complex hierarchies a SCH_SCREEN (a drawing ) is shared
54  * between many sheets and component references depend on the actual sheet
55  * path used
56  */
57  SCH_SHEET_LIST sheetList;
58 
59  if( aPlotAll )
60  {
61  sheetList.BuildSheetList( &m_parent->Schematic().Root(), true );
62  sheetList.SortByPageNumbers();
63  }
64  else
65  {
66  sheetList.push_back( m_parent->GetCurrentSheet() );
67  }
68 
69  // Allocate the plotter and set the job level parameter
70  PDF_PLOTTER* plotter = new PDF_PLOTTER();
71  plotter->SetRenderSettings( aRenderSettings );
72  plotter->SetColorMode( getModeColor() );
73  plotter->SetCreator( wxT( "Eeschema-PDF" ) );
74  plotter->SetTitle( m_parent->GetTitleBlock().GetTitle() );
75 
76  wxString msg;
77  wxFileName plotFileName;
78  REPORTER& reporter = m_MessagesBox->Reporter();
79  LOCALE_IO toggle; // Switch the locale to standard C
80 
81  for( unsigned i = 0; i < sheetList.size(); i++ )
82  {
83  m_parent->SetCurrentSheet( sheetList[i] );
87 
88  if( i == 0 )
89  {
90 
91  try
92  {
93  wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
94  // The sub sheet can be in a sub_hierarchy, but we plot the file in the
95  // main project folder (or the folder specified by the caller),
96  // so replace separators to create a unique filename:
97  fname.Replace("/", "_" );
98  fname.Replace("\\", "_" );
99  wxString ext = PDF_PLOTTER::GetDefaultFileExtension();
100  plotFileName = createPlotFileName( fname, ext, &reporter );
101 
102  if( !plotter->OpenFile( plotFileName.GetFullPath() ) )
103  {
104  msg.Printf( _( "Unable to create file \"%s\".\n" ), plotFileName.GetFullPath() );
105  reporter.Report( msg, RPT_SEVERITY_ERROR );
106  delete plotter;
107  return;
108  }
109 
110  // Open the plotter and do the first page
111  setupPlotPagePDF( plotter, screen );
112  plotter->StartPlot();
113  }
114  catch( const IO_ERROR& e )
115  {
116  // Cannot plot PDF file
117  msg.Printf( wxT( "PDF Plotter exception: %s" ), e.What() );
118  reporter.Report( msg, RPT_SEVERITY_ERROR );
119 
120  restoreEnvironment( plotter, oldsheetpath );
121  return;
122  }
123 
124  }
125  else
126  {
127  /* For the following pages you need to close the (finished) page,
128  * reconfigure, and then start a new one */
129  plotter->ClosePage();
130  setupPlotPagePDF( plotter, screen );
131  plotter->StartPage();
132  }
133 
134  plotOneSheetPDF( plotter, screen, aPlotDrawingSheet );
135  }
136 
137  // Everything done, close the plot and restore the environment
138  msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
139  reporter.Report( msg, RPT_SEVERITY_ACTION );
140 
141  restoreEnvironment( plotter, oldsheetpath );
142 }
static wxString GetDefaultFileExtension()
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:172
void plotOneSheetPDF(PLOTTER *aPlotter, SCH_SCREEN *aScreen, bool aPlotDrawingSheet)
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
virtual void StartPage()
Starts a new page in the PDF document.
virtual void SetTitle(const wxString &aTitle)
Definition: plotter.h:174
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:151
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:154
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:64
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
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)
virtual void ClosePage()
Close the current page in the PDF document (and emit its compressed stream)
wxFileName createPlotFileName(const wxString &aPlotFileName, const wxString &aExtension, REPORTER *aReporter=NULL)
Create a file name with an absolute path name.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
void BuildSheetList(SCH_SHEET *aSheet, bool aCheckIntegrity)
Build the list of sheets and their sheet path from aSheet.
SCHEMATIC & Schematic() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SHEET & Root() const
Definition: schematic.h:92
SCH_SCREEN * LastScreen()
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
#define _(s)
Definition: 3d_actions.cpp:33
const TITLE_BLOCK & GetTitleBlock() const override
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
wxString GetUniqueFilenameForCurrentSheet()
virtual bool OpenFile(const wxString &aFullFilename) override
Open or create the plot file aFullFilename.
SCH_SHEET_PATH & GetCurrentSheet() const
const wxString & GetTitle() const
Definition: title_block.h:63
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...
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75

References _, SCH_SHEET_LIST::BuildSheetList(), PDF_PLOTTER::ClosePage(), createPlotFileName(), SCH_EDIT_FRAME::GetCurrentSheet(), PDF_PLOTTER::GetDefaultFileExtension(), getModeColor(), TITLE_BLOCK::GetTitle(), SCH_BASE_FRAME::GetTitleBlock(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), SCH_SHEET_PATH::LastScreen(), DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox, m_parent, PDF_PLOTTER::OpenFile(), plotOneSheetPDF(), REPORTER::Report(), WX_HTML_REPORT_PANEL::Reporter(), restoreEnvironment(), SCHEMATIC::Root(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, SCH_EDIT_FRAME::Schematic(), PLOTTER::SetColorMode(), PLOTTER::SetCreator(), SCH_EDIT_FRAME::SetCurrentSheet(), PLOTTER::SetRenderSettings(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), PLOTTER::SetTitle(), setupPlotPagePDF(), SCH_SHEET_LIST::SortByPageNumbers(), PDF_PLOTTER::StartPage(), PDF_PLOTTER::StartPlot(), SCH_SHEET_PATH::UpdateAllScreenReferences(), and IO_ERROR::What().

Referenced by PlotSchematic().

◆ createPlotFileName()

wxFileName DIALOG_PLOT_SCHEMATIC::createPlotFileName ( const wxString &  aPlotFileName,
const wxString &  aExtension,
REPORTER aReporter = NULL 
)
private

Create a file name with an absolute path name.

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

368 {
369  wxString path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() );
370  wxFileName outputDir = wxFileName::DirName( path );
371  wxString plotFileName;
372 
373  if( !aPlotFileName.IsEmpty() )
374  plotFileName = Prj().AbsolutePath( aPlotFileName + wxT( "." ) + aExtension );
375  else
376  plotFileName = Prj().AbsolutePath( _( "Schematic" ) + wxT( "." ) + aExtension );
377 
378  if( !EnsureFileDirectoryExists( &outputDir, plotFileName, aReporter ) )
379  {
380  wxString msg = wxString::Format( _( "Could not write plot files to folder \"%s\"." ),
381  outputDir.GetPath() );
382  aReporter->Report( msg, RPT_SEVERITY_ERROR );
383  }
384 
385  wxFileName fn( plotFileName );
386  fn.SetPath( outputDir.GetFullPath() );
387  return fn;
388 }
const wxString ExpandEnvVarSubstitutions(const wxString &aString, PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition: common.cpp:273
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
Definition: project.cpp:271
PROJECT & Prj() const
Return 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:301
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200
#define _(s)
Definition: 3d_actions.cpp:33

References _, PROJECT::AbsolutePath(), EnsureFileDirectoryExists(), ExpandEnvVarSubstitutions(), Format(), DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, path, KIWAY_HOLDER::Prj(), REPORTER::Report(), and RPT_SEVERITY_ERROR.

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

◆ createPSFile()

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

Definition at line 42 of file plot_schematic_PS.cpp.

44 {
45  SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet(); // sheetpath is saved here
46  PAGE_INFO plotPage; // page size selected to plot
47 
48  /* When printing all pages, the printed page is not the current page.
49  * In complex hierarchies, we must update component references
50  * and others parameters in the given printed SCH_SCREEN, accordant to the sheet path
51  * because in complex hierarchies a SCH_SCREEN (a drawing )
52  * is shared between many sheets and component references depend on the actual sheet path used
53  */
54  SCH_SHEET_LIST sheetList;
55 
56  if( aPlotAll )
57  {
58  sheetList.BuildSheetList( &m_parent->Schematic().Root(), true );
59  sheetList.SortByPageNumbers();
60  }
61  else
62  {
63  sheetList.push_back( m_parent->GetCurrentSheet() );
64  }
65 
66  for( unsigned i = 0; i < sheetList.size(); i++ )
67  {
68  m_parent->SetCurrentSheet( sheetList[i] );
71 
73  PAGE_INFO actualPage = screen->GetPageSettings();
74 
75  switch( m_pageSizeSelect )
76  {
77  case PAGE_SIZE_A:
78  plotPage.SetType( wxT( "A" ) );
79  plotPage.SetPortrait( actualPage.IsPortrait() );
80  break;
81 
82  case PAGE_SIZE_A4:
83  plotPage.SetType( wxT( "A4" ) );
84  plotPage.SetPortrait( actualPage.IsPortrait() );
85  break;
86 
87  case PAGE_SIZE_AUTO:
88  default:
89  plotPage = actualPage;
90  break;
91  }
92 
93  double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
94  double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
95 
96  double scale = std::min( scalex, scaley );
97 
98  wxPoint plot_offset;
99 
100  wxString msg;
101  REPORTER& reporter = m_MessagesBox->Reporter();
102 
103  try
104  {
105  wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
106  // The sub sheet can be in a sub_hierarchy, but we plot the file in the
107  // main project folder (or the folder specified by the caller),
108  // so replace separators to create a unique filename:
109  fname.Replace("/", "_" );
110  fname.Replace("\\", "_" );
111  wxString ext = PS_PLOTTER::GetDefaultFileExtension();
112  wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
113 
114  if( plotOneSheetPS( plotFileName.GetFullPath(), screen, aRenderSettings, plotPage,
115  plot_offset, scale, aPlotFrameRef ) )
116  {
117  msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
118  reporter.Report( msg, RPT_SEVERITY_ACTION );
119  }
120  else
121  {
122  // Error
123  msg.Printf( _( "Unable to create file \"%s\".\n" ), plotFileName.GetFullPath() );
124  reporter.Report( msg, RPT_SEVERITY_ERROR );
125  }
126 
127  }
128  catch( IO_ERROR& e )
129  {
130  msg.Printf( wxT( "PS Plotter exception: %s"), e.What() );
131  reporter.Report( msg, RPT_SEVERITY_ERROR );
132  }
133  }
134 
135  m_parent->SetCurrentSheet( oldsheetpath );
138 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
static wxString GetDefaultFileExtension()
int GetHeightMils() const
Definition: page_info.h:133
bool SetType(const wxString &aStandardPageDescriptionName, bool aIsPortrait=false)
Set the name of the page type and also the sizes and margins commonly associated with that type name.
Definition: page_info.cpp:119
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:64
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:128
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
wxFileName createPlotFileName(const wxString &aPlotFileName, const wxString &aExtension, REPORTER *aReporter=NULL)
Create a file name with an absolute path name.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
bool plotOneSheetPS(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, const PAGE_INFO &aPageInfo, wxPoint aPlot0ffset, double aScale, bool aPlotFrameRef)
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
void BuildSheetList(SCH_SHEET *aSheet, bool aCheckIntegrity)
Build the list of sheets and their sheet path from aSheet.
SCHEMATIC & Schematic() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SHEET & Root() const
Definition: schematic.h:92
const int scale
SCH_SCREEN * LastScreen()
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
bool IsPortrait() const
Definition: page_info.h:117
#define _(s)
Definition: 3d_actions.cpp:33
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
wxString GetUniqueFilenameForCurrentSheet()
SCH_SHEET_PATH & GetCurrentSheet() const
WX_HTML_REPORT_PANEL * m_MessagesBox
void SetPortrait(bool aIsPortrait)
Rotate the paper page 90 degrees.
Definition: page_info.cpp:186
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75
int GetWidthMils() const
Definition: page_info.h:130

References _, SCH_SHEET_LIST::BuildSheetList(), createPlotFileName(), SCH_EDIT_FRAME::GetCurrentSheet(), PS_PLOTTER::GetDefaultFileExtension(), PAGE_INFO::GetHeightMils(), SCH_SCREEN::GetPageSettings(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), PAGE_INFO::GetWidthMils(), PAGE_INFO::IsPortrait(), SCH_SHEET_PATH::LastScreen(), DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox, m_pageSizeSelect, m_parent, PAGE_SIZE_A, PAGE_SIZE_A4, PAGE_SIZE_AUTO, plotOneSheetPS(), REPORTER::Report(), WX_HTML_REPORT_PANEL::Reporter(), SCHEMATIC::Root(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, scale, SCH_EDIT_FRAME::Schematic(), SCH_EDIT_FRAME::SetCurrentSheet(), PAGE_INFO::SetPortrait(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), PAGE_INFO::SetType(), SCH_SHEET_LIST::SortByPageNumbers(), SCH_SHEET_PATH::UpdateAllScreenReferences(), and IO_ERROR::What().

Referenced by PlotSchematic().

◆ createSVGFile()

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

Definition at line 47 of file plot_schematic_SVG.cpp.

49 {
50  wxString msg;
51  REPORTER& reporter = m_MessagesBox->Reporter();
52  SCH_SHEET_PATH oldsheetpath = m_parent->GetCurrentSheet();
53  SCH_SHEET_LIST sheetList;
54 
55  if( aPrintAll )
56  {
57  sheetList.BuildSheetList( &m_parent->Schematic().Root(), true );
58  sheetList.SortByPageNumbers();
59  }
60  else
61  {
62  sheetList.push_back( m_parent->GetCurrentSheet() );
63  }
64 
65  for( unsigned i = 0; i < sheetList.size(); i++ )
66  {
67  SCH_SCREEN* screen;
68  m_parent->SetCurrentSheet( sheetList[i] );
71  screen = m_parent->GetCurrentSheet().LastScreen();
72 
73  try
74  {
75  wxString fname = m_parent->GetUniqueFilenameForCurrentSheet();
76  // The sub sheet can be in a sub_hierarchy, but we plot the file in the
77  // main project folder (or the folder specified by the caller),
78  // so replace separators to create a unique filename:
79  fname.Replace("/", "_" );
80  fname.Replace("\\", "_" );
81  wxString ext = SVG_PLOTTER::GetDefaultFileExtension();
82  wxFileName plotFileName = createPlotFileName( fname, ext, &reporter );
83 
84  bool success = plotOneSheetSVG( plotFileName.GetFullPath(), screen, aRenderSettings,
85  getModeColor() ? false : true, aPrintFrameRef );
86 
87  if( !success )
88  {
89  msg.Printf( _( "Cannot create file \"%s\".\n" ), plotFileName.GetFullPath() );
90  reporter.Report( msg, RPT_SEVERITY_ERROR );
91  }
92  else
93  {
94  msg.Printf( _( "Plot: \"%s\" OK.\n" ), plotFileName.GetFullPath() );
95  reporter.Report( msg, RPT_SEVERITY_ACTION );
96  }
97  }
98  catch( const IO_ERROR& e )
99  {
100  // Cannot plot SVG file
101  msg.Printf( wxT( "SVG Plotter exception: %s" ), e.What() );
102  reporter.Report( msg, RPT_SEVERITY_ERROR );
103  break;
104  }
105  }
106 
107  m_parent->SetCurrentSheet( oldsheetpath );
110 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
A container for handling SCH_SHEET_PATH objects in a flattened hierarchy.
static wxString GetDefaultFileExtension()
bool plotOneSheetSVG(const wxString &aFileName, SCH_SCREEN *aScreen, RENDER_SETTINGS *aRenderSettings, bool aPlotBlackAndWhite, bool aPlotFrameRef)
A pure virtual class used to derive REPORTER objects from.
Definition: reporter.h:64
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
virtual REPORTER & Report(const wxString &aText, SEVERITY aSeverity=RPT_SEVERITY_UNDEFINED)=0
Report a string with a given severity.
wxFileName createPlotFileName(const wxString &aPlotFileName, const wxString &aExtension, REPORTER *aReporter=NULL)
Create a file name with an absolute path name.
virtual const wxString What() const
A composite of Problem() and Where()
Definition: exceptions.cpp:29
void BuildSheetList(SCH_SHEET *aSheet, bool aCheckIntegrity)
Build the list of sheets and their sheet path from aSheet.
SCHEMATIC & Schematic() const
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
SCH_SHEET & Root() const
Definition: schematic.h:92
SCH_SCREEN * LastScreen()
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
#define _(s)
Definition: 3d_actions.cpp:33
void SortByPageNumbers(bool aUpdateVirtualPageNums=true)
Sort the list of sheets by page number.
wxString GetUniqueFilenameForCurrentSheet()
SCH_SHEET_PATH & GetCurrentSheet() const
WX_HTML_REPORT_PANEL * m_MessagesBox
Hold an error message and may be used when throwing exceptions containing meaningful error messages.
Definition: ki_exception.h:75

References _, SCH_SHEET_LIST::BuildSheetList(), createPlotFileName(), SCH_EDIT_FRAME::GetCurrentSheet(), SVG_PLOTTER::GetDefaultFileExtension(), getModeColor(), SCH_EDIT_FRAME::GetUniqueFilenameForCurrentSheet(), SCH_SHEET_PATH::LastScreen(), DIALOG_PLOT_SCHEMATIC_BASE::m_MessagesBox, m_parent, plotOneSheetSVG(), REPORTER::Report(), WX_HTML_REPORT_PANEL::Reporter(), SCHEMATIC::Root(), RPT_SEVERITY_ACTION, RPT_SEVERITY_ERROR, SCH_EDIT_FRAME::Schematic(), SCH_EDIT_FRAME::SetCurrentSheet(), SCH_EDIT_FRAME::SetSheetNumberAndCount(), SCH_SHEET_LIST::SortByPageNumbers(), SCH_SHEET_PATH::UpdateAllScreenReferences(), and IO_ERROR::What().

Referenced by PlotSchematic().

◆ Enable()

bool DIALOG_SHIM::Enable ( bool  enable)
overrideinherited

Definition at line 307 of file dialog_shim.cpp.

308 {
309  // so we can do logging of this state change:
310  return wxDialog::Enable( enable );
311 }

◆ EndQuasiModal()

void DIALOG_SHIM::EndQuasiModal ( int  retCode)
inherited

Definition at line 445 of file dialog_shim.cpp.

446 {
447  // Hook up validator and transfer data from controls handling so quasi-modal dialogs
448  // handle validation in the same way as other dialogs.
449  if( ( retCode == wxID_OK ) && ( !Validate() || !TransferDataFromWindow() ) )
450  return;
451 
452  SetReturnCode( retCode );
453 
454  if( !IsQuasiModal() )
455  {
456  wxFAIL_MSG( "either DIALOG_SHIM::EndQuasiModal called twice or ShowQuasiModal"
457  "wasn't called" );
458  return;
459  }
460 
461  if( m_qmodal_loop )
462  {
463  if( m_qmodal_loop->IsRunning() )
464  m_qmodal_loop->Exit( 0 );
465  else
466  m_qmodal_loop->ScheduleExit( 0 );
467 
469  }
470 
473 
474  Show( false );
475 }
bool IsQuasiModal() const
Definition: dialog_shim.h:107
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:212
#define NULL
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:215

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_LIB_SYMBOL_PROPERTIES::OnCancelButtonClick(), DIALOG_SYMBOL_PROPERTIES::OnCancelButtonClick(), DIALOG_LIB_EDIT_PIN_TABLE::OnClose(), DIALOG_PRINT_GENERIC::onCloseButton(), DIALOG_CHOOSE_FOOTPRINT::OnCloseTimer(), DIALOG_CHOOSE_SYMBOL::OnCloseTimer(), DIALOG_SHIM::OnCloseWindow(), DIALOG_SYMBOL_PROPERTIES::OnEditLibrarySymbol(), DIALOG_SYMBOL_PROPERTIES::OnEditSymbol(), DIALOG_SYMBOL_PROPERTIES::OnExchangeSymbol(), HTML_MESSAGE_BOX::OnOKButtonClick(), DIALOG_SYMBOL_PROPERTIES::OnUpdateSymbol(), DIALOG_CHOOSE_FOOTPRINT::OnUseBrowser(), DIALOG_CHOOSE_SYMBOL::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 after all widgets have been initialized, and therefore their size fixed. If TransferDataToWindow() is used to initialize widgets, at the end of TransferDataToWindow, or better yet, at end of a wxInitDialogEvent handler.

Definition at line 148 of file dialog_shim.cpp.

149 {
150  // must be called from the constructor of derived classes,
151  // when all widgets are initialized, and therefore their size fixed
152 
153  // SetSizeHints fixes the minimal size of sizers in the dialog
154  // (SetSizeHints calls Fit(), so no need to call it)
155  GetSizer()->SetSizeHints( this );
156 }

Referenced by DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOM::DIALOG_BOM(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CLEANUP_TRACKS_AND_VIAS::DIALOG_CLEANUP_TRACKS_AND_VIAS(), DIALOG_COPPER_ZONE::DIALOG_COPPER_ZONE(), DIALOG_DIMENSION_PROPERTIES::DIALOG_DIMENSION_PROPERTIES(), DIALOG_DRC::DIALOG_DRC(), DIALOG_EDIT_COMPONENTS_LIBID::DIALOG_EDIT_COMPONENTS_LIBID(), DIALOG_EDIT_LINE_STYLE::DIALOG_EDIT_LINE_STYLE(), DIALOG_ENUM_PADS::DIALOG_ENUM_PADS(), DIALOG_ERC::DIALOG_ERC(), 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_CHECKER::DIALOG_FOOTPRINT_CHECKER(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(), DIALOG_FOOTPRINT_WIZARD_LIST::DIALOG_FOOTPRINT_WIZARD_LIST(), 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_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR(), DIALOG_IMPORTED_LAYERS::DIALOG_IMPORTED_LAYERS(), DIALOG_INSPECTOR::DIALOG_INSPECTOR(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT(), DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES(), DIALOG_LIST_HOTKEYS::DIALOG_LIST_HOTKEYS(), DIALOG_LOCKED_ITEMS_QUERY::DIALOG_LOCKED_ITEMS_QUERY(), DIALOG_MOVE_EXACT::DIALOG_MOVE_EXACT(), DIALOG_NET_INSPECTOR::DIALOG_NET_INSPECTOR(), 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_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_PLOT_SCHEMATIC(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_PRINT_GENERIC::DIALOG_PRINT_GENERIC(), DIALOG_PRINT_USING_PRINTER::DIALOG_PRINT_USING_PRINTER(), DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES(), DIALOG_REGULATOR_FORM::DIALOG_REGULATOR_FORM(), DIALOG_RULE_AREA_PROPERTIES::DIALOG_RULE_AREA_PROPERTIES(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_SHEET_PROPERTIES::DIALOG_SHEET_PROPERTIES(), DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS(), DIALOG_SYMBOL_PROPERTIES::DIALOG_SYMBOL_PROPERTIES(), 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_UNUSED_PAD_LAYERS::DIALOG_UNUSED_PAD_LAYERS(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), DIALOG_UPDATE_SYMBOL_FIELDS::DIALOG_UPDATE_SYMBOL_FIELDS(), DLG_SELECT_3DMODEL::DLG_SELECT_3DMODEL(), DIALOG_CONSTRAINTS_REPORTER::FinishInitialization(), PAGED_DIALOG::finishInitialization(), DIALOG_EDIT_ONE_FIELD::init(), DIALOG_EDIT_LIBRARY_TABLES::InstallPanel(), NETLIST_DIALOG::NETLIST_DIALOG(), DIALOG_GRAPHIC_ITEM_PROPERTIES::OnInitDlg(), DIALOG_SHEET_PROPERTIES::OnInitDlg(), DIALOG_SYMBOL_PROPERTIES::OnInitDlg(), DIALOG_SPICE_MODEL::onInitDlg(), DIALOG_SIM_SETTINGS::onInitDlg(), DIALOG_SIGNAL_LIST::TransferDataToWindow(), DIALOG_BOARD_STATISTICS::TransferDataToWindow(), and DIALOG_COLOR_PICKER::TransferDataToWindow().

◆ getColorSettings()

COLOR_SETTINGS * DIALOG_PLOT_SCHEMATIC::getColorSettings ( )
private

Definition at line 314 of file dialog_plot_schematic.cpp.

315 {
316  int selection = m_colorTheme->GetSelection();
317 
318  if( selection < 0 )
319  return Pgm().GetSettingsManager().GetColorSettings( "_builtin_default" );
320 
321  return static_cast<COLOR_SETTINGS*>( m_colorTheme->GetClientData( selection ) );
322 }
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106

References DIALOG_PLOT_SCHEMATIC_BASE::m_colorTheme, and Pgm().

Referenced by getPlotOptions(), Plot_1_Page_HPGL(), and PlotOneSheetDXF().

◆ getModeColor()

bool DIALOG_PLOT_SCHEMATIC::getModeColor ( )
inlineprivate

◆ getPlotDrawingSheet()

bool DIALOG_PLOT_SCHEMATIC::getPlotDrawingSheet ( )
inlineprivate

Definition at line 95 of file dialog_plot_schematic.h.

95 { return m_plotDrawingSheet->GetValue(); }

References DIALOG_PLOT_SCHEMATIC_BASE::m_plotDrawingSheet.

Referenced by getPlotOptions(), and PlotSchematic().

◆ GetPlotFileFormat()

PLOT_FORMAT DIALOG_PLOT_SCHEMATIC::GetPlotFileFormat ( )
private

Definition at line 186 of file dialog_plot_schematic.cpp.

187 {
188  switch( m_plotFormatOpt->GetSelection() )
189  {
190  default:
191  case 0:
192  return PLOT_FORMAT::POST;
193  case 1:
194  return PLOT_FORMAT::PDF;
195  case 2:
196  return PLOT_FORMAT::SVG;
197  case 3:
198  return PLOT_FORMAT::DXF;
199  case 4:
200  return PLOT_FORMAT::HPGL;
201  }
202 }

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

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

◆ getPlotOptions()

void DIALOG_PLOT_SCHEMATIC::getPlotOptions ( RENDER_SETTINGS aSettings)
private

Definition at line 270 of file dialog_plot_schematic.cpp.

271 {
273 
274  EESCHEMA_SETTINGS* cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
275  wxASSERT( cfg );
276 
277  COLOR_SETTINGS* colors = getColorSettings();
278 
279  if( cfg )
280  {
282  cfg->m_PlotPanel.color = getModeColor();
283  cfg->m_PlotPanel.color_theme = colors->GetFilename();
285  cfg->m_PlotPanel.format = static_cast<int>( GetPlotFileFormat() );
286  cfg->m_PlotPanel.hpgl_origin = m_plotOriginOpt->GetSelection();
288 
289  // HPGL Pen Size is stored in mm in config
291  }
292 
293  aSettings->LoadColors( colors );
294  aSettings->SetDefaultPenWidth( (int) m_defaultLineWidth.GetValue() );
295 
296  if( m_plotBackgroundColor->GetValue() )
297  aSettings->SetBackgroundColor( colors->GetColor( LAYER_SCHEMATIC_BACKGROUND ) );
298  else
299  aSettings->SetBackgroundColor( COLOR4D::UNSPECIFIED );
300 
301  // Plot directory
302  wxString path = m_outputDirectoryName->GetValue();
303  path.Replace( '\\', '/' );
304 
306 
307  if( settings.m_PlotDirectoryName != path )
308  m_configChanged = true;
309 
310  settings.m_PlotDirectoryName = path;
311 }
static constexpr double IU_PER_MM
Mock up a conversion function.
wxString GetFilename() const
Definition: json_settings.h:66
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:127
COLOR_SETTINGS * getColorSettings()
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
SCHEMATIC & Schematic() const
COLOR4D GetColor(int aLayer) const
virtual void SetBackgroundColor(const COLOR4D &aColor)=0
Set the background color.
These settings were stored in SCH_BASE_FRAME previously.
virtual long long int GetValue()
Return the current value in Internal Units.
Color settings are a bit different than most of the settings objects in that there can be more than o...
void SetDefaultPenWidth(int aWidth)
virtual void LoadColors(const COLOR_SETTINGS *aSettings)

References EESCHEMA_SETTINGS::PANEL_PLOT::background_color, EESCHEMA_SETTINGS::PANEL_PLOT::color, EESCHEMA_SETTINGS::PANEL_PLOT::color_theme, EESCHEMA_SETTINGS::PANEL_PLOT::format, EESCHEMA_SETTINGS::PANEL_PLOT::frame_reference, COLOR_SETTINGS::GetColor(), getColorSettings(), JSON_SETTINGS::GetFilename(), getModeColor(), getPlotDrawingSheet(), GetPlotFileFormat(), UNIT_BINDER::GetValue(), EESCHEMA_SETTINGS::PANEL_PLOT::hpgl_origin, EESCHEMA_SETTINGS::PANEL_PLOT::hpgl_paper_size, EESCHEMA_SETTINGS::PANEL_PLOT::hpgl_pen_size, IU_PER_MM, Kiface(), LAYER_SCHEMATIC_BACKGROUND, KIGFX::RENDER_SETTINGS::LoadColors(), m_configChanged, m_defaultLineWidth, m_HPGLPaperSizeSelect, m_HPGLPenSize, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_parent, m_penWidth, DIALOG_PLOT_SCHEMATIC_BASE::m_plotBackgroundColor, SCHEMATIC_SETTINGS::m_PlotDirectoryName, DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginOpt, EESCHEMA_SETTINGS::m_PlotPanel, path, SCH_EDIT_FRAME::Schematic(), KIGFX::RENDER_SETTINGS::SetBackgroundColor(), KIGFX::RENDER_SETTINGS::SetDefaultPenWidth(), and SCHEMATIC::Settings().

Referenced by PlotSchematic().

◆ GetPlotOriginAndUnits()

◆ GetType()

HOLDER_TYPE KIWAY_HOLDER::GetType ( ) const
inlineinherited

Definition at line 49 of file kiway_holder.h.

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

References KIWAY_HOLDER::m_type.

Referenced by DIALOG_SHIM::DIALOG_SHIM().

◆ GetUserUnits()

◆ horizPixelsFromDU()

int DIALOG_SHIM::horizPixelsFromDU ( int  x) const
protectedinherited

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

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 166 of file dialog_shim.cpp.

167 {
168  wxSize sz( x, 0 );
169  return ConvertDialogToPixels( sz ).x;
170 }

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

◆ initDlg()

void DIALOG_PLOT_SCHEMATIC::initDlg ( )
private

Definition at line 77 of file dialog_plot_schematic.cpp.

78 {
79  auto cfg = dynamic_cast<EESCHEMA_SETTINGS*>( Kiface().KifaceSettings() );
80  wxASSERT( cfg );
81 
82  if( cfg )
83  {
84  for( COLOR_SETTINGS* settings : Pgm().GetSettingsManager().GetColorSettingsList() )
85  {
86  int idx = m_colorTheme->Append( settings->GetName(), static_cast<void*>( settings ) );
87 
88  if( settings->GetFilename() == cfg->m_PlotPanel.color_theme )
89  m_colorTheme->SetSelection( idx );
90  }
91 
92  m_colorTheme->Enable( cfg->m_PlotPanel.color );
93 
94  m_plotBackgroundColor->Enable( cfg->m_PlotPanel.color );
95  m_plotBackgroundColor->SetValue( cfg->m_PlotPanel.background_color );
96 
97  // Set color or B&W plot option
98  setModeColor( cfg->m_PlotPanel.color );
99 
100  // Set plot or not frame reference option
101  setPlotDrawingSheet( cfg->m_PlotPanel.frame_reference );
102 
103  // HPGL plot origin and unit system configuration
104  m_plotOriginOpt->SetSelection( cfg->m_PlotPanel.hpgl_origin );
105 
106  m_HPGLPaperSizeSelect = cfg->m_PlotPanel.hpgl_paper_size;
107 
108  // HPGL Pen Size is stored in mm in config
109  m_HPGLPenSize = cfg->m_PlotPanel.hpgl_pen_size * IU_PER_MM;
110 
111  // Switch to the last save plot format
112  PLOT_FORMAT fmt = static_cast<PLOT_FORMAT>( cfg->m_PlotPanel.format );
113 
114  switch( fmt )
115  {
116  default:
117  case PLOT_FORMAT::POST: m_plotFormatOpt->SetSelection( 0 ); break;
118  case PLOT_FORMAT::PDF: m_plotFormatOpt->SetSelection( 1 ); break;
119  case PLOT_FORMAT::SVG: m_plotFormatOpt->SetSelection( 2 ); break;
120  case PLOT_FORMAT::DXF: m_plotFormatOpt->SetSelection( 3 ); break;
121  case PLOT_FORMAT::HPGL: m_plotFormatOpt->SetSelection( 4 ); break;
122  }
123 
124  if( fmt == PLOT_FORMAT::DXF || fmt == PLOT_FORMAT::HPGL )
125  m_plotBackgroundColor->Disable();
126 
127  // Set the default line width (pen width which should be used for
128  // items that do not have a pen size defined (like frame ref)
129  // the default line width is stored in mils in config
130  m_defaultLineWidth.SetValue( Mils2iu( cfg->m_Drawing.default_line_thickness ) );
131  }
132 
133  // Initialize HPGL specific widgets
135 
136  // Plot directory
138  wxString path = settings.m_PlotDirectoryName;
139 #ifdef __WINDOWS__
140  path.Replace( '/', '\\' );
141 #endif
142  m_outputDirectoryName->SetValue( path );
143 }
static constexpr double IU_PER_MM
Mock up a conversion function.
SCHEMATIC_SETTINGS & Settings() const
Definition: schematic.cpp:127
void setPlotDrawingSheet(bool aPlot)
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
Definition: single_top.cpp:106
PLOT_FORMAT
The set of supported output plot formats.
Definition: plotter.h:67
KIFACE_I & Kiface()
Global KIFACE_I "get" accessor.
SCHEMATIC & Schematic() const
SETTINGS_MANAGER * GetSettingsManager()
virtual void SetValue(int aValue)
Set new value (in Internal Units) for the text field, taking care of units conversion.
These settings were stored in SCH_BASE_FRAME previously.
Color settings are a bit different than most of the settings objects in that there can be more than o...
void setModeColor(bool aColor)

References DXF, GetSettingsManager(), HPGL, IU_PER_MM, Kiface(), DIALOG_PLOT_SCHEMATIC_BASE::m_colorTheme, m_defaultLineWidth, m_HPGLPaperSizeSelect, m_HPGLPenSize, DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_parent, m_penWidth, DIALOG_PLOT_SCHEMATIC_BASE::m_plotBackgroundColor, SCHEMATIC_SETTINGS::m_PlotDirectoryName, DIALOG_PLOT_SCHEMATIC_BASE::m_plotFormatOpt, DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginOpt, path, PDF, Pgm(), POST, SCH_EDIT_FRAME::Schematic(), setModeColor(), setPlotDrawingSheet(), SCHEMATIC::Settings(), 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 125 of file dialog_shim.h.

126  {
127  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
128  !e.ShiftDown() && !e.MetaDown();
129  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook().

◆ IsQuasiModal()

◆ IsShiftCtrl()

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

Definition at line 131 of file dialog_shim.h.

132  {
133  return e.GetKeyCode() == aChar && e.ControlDown() && !e.AltDown() &&
134  e.ShiftDown() && !e.MetaDown();
135  }

Referenced by DIALOG_TEXT_PROPERTIES::OnCharHook().

◆ Kiway()

KIWAY& KIWAY_HOLDER::Kiway ( ) const
inlineinherited

Return 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:78

References KIWAY_HOLDER::m_kiway.

Referenced by PROJECT_TREE_ITEM::Activate(), FOOTPRINT_VIEWER_FRAME::AddFootprintToPCB(), PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_EDITOR_CONTROL::AddSymbolToSchematic(), CVPCB_MAINFRAME::BuildLibrariesListBox(), SYMBOL_EDIT_FRAME::canCloseWindow(), SCH_EDIT_FRAME::canCloseWindow(), KICAD_MANAGER_FRAME::CloseProject(), COMMON_CONTROL::ConfigurePaths(), DIALOG_CHOOSE_FOOTPRINT::ConstructRightPanel(), DIALOG_CHOOSE_SYMBOL::ConstructRightPanel(), PCB_BASE_FRAME::CreateAndShow3D_Frame(), FOOTPRINT_EDITOR_CONTROL::CreateFootprint(), 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(), BOARD_EDITOR_CONTROL::EditFpInFpEditor(), SCH_EDITOR_CONTROL::EditWithSymbolEditor(), BACK_ANNOTATE::FetchNetlistFromPCB(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), KICAD_MANAGER_FRAME::ImportNonKiCadProject(), KICAD_MANAGER_FRAME::language_change(), KIWAY_PLAYER::language_change(), DIALOG_CHANGE_SYMBOLS::launchMatchIdSymbolBrowser(), DIALOG_CHANGE_SYMBOLS::launchNewIdSymbolBrowser(), LIB_TREE_MODEL_ADAPTER::LIB_TREE_MODEL_ADAPTER(), CVPCB_MAINFRAME::LoadFootprintFiles(), TEXT_BUTTON_SYMBOL_CHOOSER::OnButtonClick(), TEXT_BUTTON_FP_CHOOSER::OnButtonClick(), PL_EDITOR_FRAME::OnExit(), SCH_EDIT_FRAME::OnExit(), FOOTPRINT_EDIT_FRAME::OnExitKiCad(), FOOTPRINT_VIEWER_FRAME::OnExitKiCad(), SYMBOL_EDIT_FRAME::OnExitKiCad(), SAVE_AS_TRAVERSER::OnFile(), DIALOG_CHOOSE_SYMBOL::OnInitDialog(), SCH_EDIT_FRAME::OnOpenCvpcb(), SCH_EDIT_FRAME::OnOpenPcbnew(), EDA_BASE_FRAME::OnPreferences(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_EDIT_ONE_FIELD::OnTextValueSelectButtonClick(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), FOOTPRINT_EDIT_FRAME::OnUpdateLoadFootprintFromBoard(), SCH_EDIT_FRAME::OnUpdatePCB(), FOOTPRINT_EDIT_FRAME::OnUpdateSaveFootprintToBoard(), PANEL_PCBNEW_COLOR_SETTINGS::PANEL_PCBNEW_COLOR_SETTINGS(), SCH_BASE_FRAME::PickSymbolFromLibBrowser(), KIWAY_HOLDER::Prj(), SCH_EDIT_TOOL::Properties(), BACK_ANNOTATE::PushNewLinksToPCB(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SCH_EDITOR_CONTROL::rescueProject(), EE_INSPECTION_TOOL::RunSimulation(), SYMBOL_EDIT_FRAME::Save(), CVPCB_MAINFRAME::SaveFootprintAssociation(), FOOTPRINT_EDIT_FRAME::SaveFootprintToBoard(), LIB_TREE_MODEL_ADAPTER::SavePinnedItems(), 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(), SCH_EDIT_FRAME::SetCrossProbeConnection(), SYMBOL_EDIT_FRAME::SetCurPart(), CVPCB_CONTROL::ShowFootprintViewer(), COMMON_CONTROL::ShowLibraryTable(), COMMON_CONTROL::ShowPlayer(), KICAD_MANAGER_CONTROL::ShowPlayer(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), BOARD_EDITOR_CONTROL::UpdateSchematicFromPCB(), and DIALOG_EXCHANGE_FOOTPRINTS::ViewAndSelectFootprint().

◆ OnCharHook()

void DIALOG_SHIM::OnCharHook ( wxKeyEvent &  aEvt)
protectedvirtualinherited

Reimplemented in DIALOG_CHOOSE_SYMBOL, HK_PROMPT_DIALOG, DIALOG_TEXT_PROPERTIES, and HTML_MESSAGE_BOX.

Definition at line 536 of file dialog_shim.cpp.

537 {
538  if( aEvt.GetKeyCode() == 'U' && aEvt.GetModifiers() == wxMOD_CONTROL )
539  {
540  if( m_parentFrame )
541  {
543  return;
544  }
545  }
546  // shift-return (Mac default) or Ctrl-Return (GTK) for OK
547  else if( aEvt.GetKeyCode() == WXK_RETURN && ( aEvt.ShiftDown() || aEvt.ControlDown() ) )
548  {
549  wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
550  return;
551  }
552  else if( aEvt.GetKeyCode() == WXK_TAB && !aEvt.ControlDown() )
553  {
554  wxWindow* currentWindow = wxWindow::FindFocus();
555  int currentIdx = -1;
556  int delta = aEvt.ShiftDown() ? -1 : 1;
557 
558  auto advance = [&]( int& idx )
559  {
560  // Wrap-around modulus
561  int size = m_tabOrder.size();
562  idx = ( ( idx + delta ) % size + size ) % size;
563  };
564 
565  for( size_t i = 0; i < m_tabOrder.size(); ++i )
566  {
567  if( m_tabOrder[i] == currentWindow )
568  {
569  currentIdx = (int) i;
570  break;
571  }
572  }
573 
574  if( currentIdx >= 0 )
575  {
576  advance( currentIdx );
577 
578  //todo: We don't currently have non-textentry dialog boxes but this will break if
579  // we add them.
580 #ifdef __APPLE__
581  while( dynamic_cast<wxTextEntry*>( m_tabOrder[ currentIdx ] ) == nullptr )
582  advance( currentIdx );
583 #endif
584 
585  m_tabOrder[ currentIdx ]->SetFocus();
586  return;
587  }
588  }
589 
590  aEvt.Skip();
591 }
std::vector< wxWindow * > m_tabOrder
Definition: dialog_shim.h:219
EDA_BASE_FRAME * m_parentFrame
Definition: dialog_shim.h:217
virtual void ToggleUserUnits()

References DIALOG_SHIM::m_parentFrame, DIALOG_SHIM::m_tabOrder, and EDA_BASE_FRAME::ToggleUserUnits().

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

151 {
152  // Build the absolute path of current output directory to preselect it in the file browser.
153  wxString path = ExpandEnvVarSubstitutions( m_outputDirectoryName->GetValue(), &Prj() );
154  path = Prj().AbsolutePath( path );
155 
156  wxDirDialog dirDialog( this, _( "Select Output Directory" ), path );
157 
158  if( dirDialog.ShowModal() == wxID_CANCEL )
159  return;
160 
161  wxFileName dirName = wxFileName::DirName( dirDialog.GetPath() );
162 
163  wxFileName fn( Prj().AbsolutePath( m_parent->Schematic().Root().GetFileName() ) );
164  wxString defaultPath = fn.GetPathWithSep();
165  wxString msg;
166  wxFileName relPathTest; // Used to test if we can make the path relative
167 
168  relPathTest.Assign( dirDialog.GetPath() );
169 
170  // Test if making the path relative is possible before asking the user if they want to do it
171  if( relPathTest.MakeRelativeTo( defaultPath ) )
172  {
173  msg.Printf( _( "Do you want to use a path relative to\n\"%s\"" ), defaultPath );
174 
175  wxMessageDialog dialog( this, msg, _( "Plot Output Directory" ),
176  wxYES_NO | wxICON_QUESTION | wxYES_DEFAULT );
177 
178  if( dialog.ShowModal() == wxID_YES )
179  dirName.MakeRelativeTo( defaultPath );
180  }
181 
182  m_outputDirectoryName->SetValue( dirName.GetFullPath() );
183 }
const wxString ExpandEnvVarSubstitutions(const wxString &aString, PROJECT *aProject)
Replace any environment variable & text variable references with their values.
Definition: common.cpp:273
virtual const wxString AbsolutePath(const wxString &aFileName) const
Fix up aFileName if it is relative to the project's directory to be an absolute path and filename.
Definition: project.cpp:271
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
SCHEMATIC & Schematic() const
wxString GetFileName() const
Return the filename corresponding to this sheet.
Definition: sch_sheet.h:315
SCH_SHEET & Root() const
Definition: schematic.h:92
#define _(s)
Definition: 3d_actions.cpp:33

References _, PROJECT::AbsolutePath(), ExpandEnvVarSubstitutions(), SCH_SHEET::GetFileName(), DIALOG_PLOT_SCHEMATIC_BASE::m_outputDirectoryName, m_parent, path, KIWAY_HOLDER::Prj(), SCHEMATIC::Root(), and SCH_EDIT_FRAME::Schematic().

◆ OnPageSizeSelected()

void DIALOG_PLOT_SCHEMATIC::OnPageSizeSelected ( wxCommandEvent &  event)
overrideprivatevirtual

◆ OnPaint()

void DIALOG_SHIM::OnPaint ( wxPaintEvent &  event)
inherited

Definition at line 352 of file dialog_shim.cpp.

353 {
354  if( m_firstPaintEvent )
355  {
357 
358  selectAllInTextCtrls( GetChildren() );
359 
362  else
363  KIPLATFORM::UI::ForceFocus( this ); // Focus the dialog itself
364 
365  m_firstPaintEvent = false;
366  }
367 
368  event.Skip();
369 }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:210
bool m_firstPaintEvent
Definition: dialog_shim.h:209
void ForceFocus(wxWindow *aWindow)
Pass the current focus to the window.
Definition: gtk/ui.cpp:44
void FixupCancelButtonCmdKeyCollision(wxWindow *aWindow)
Definition: gtk/ui.cpp:68
static void selectAllInTextCtrls(wxWindowList &children)

References KIPLATFORM::UI::FixupCancelButtonCmdKeyCollision(), KIPLATFORM::UI::ForceFocus(), 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 331 of file dialog_plot_schematic.cpp.

332 {
333  PlotSchematic( true );
334 }
void PlotSchematic(bool aPlotAll)

References PlotSchematic().

◆ OnPlotCurrent()

void DIALOG_PLOT_SCHEMATIC::OnPlotCurrent ( wxCommandEvent &  event)
overrideprivatevirtual

Reimplemented from DIALOG_PLOT_SCHEMATIC_BASE.

Definition at line 325 of file dialog_plot_schematic.cpp.

326 {
327  PlotSchematic( false );
328 }
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 214 of file dialog_plot_schematic.cpp.

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

References _, UNIT_BINDER::Enable(), GetPlotFileFormat(), HPGL, DIALOG_PLOT_SCHEMATIC_BASE::m_colorTheme, m_defaultLineWidth, m_HPGLPaperSizeSelect, DIALOG_PLOT_SCHEMATIC_BASE::m_ModeColorOption, m_pageSizeSelect, DIALOG_PLOT_SCHEMATIC_BASE::m_paperSizeOption, m_penWidth, DIALOG_PLOT_SCHEMATIC_BASE::m_plotBackgroundColor, 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,
RENDER_SETTINGS aRenderSettings,
wxPoint  aPlot0ffset,
double  aScale,
bool  aPlotFrameRef,
HPGL_PLOT_ORIGIN_AND_UNITS  aOriginAndUnits 
)
private

Definition at line 189 of file plot_schematic_HPGL.cpp.

197 {
198  HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
199  // Currently, plot units are in decimil
200 
201  plotter->SetPageSettings( aPageInfo );
202  plotter->SetRenderSettings( aRenderSettings );
203  plotter->RenderSettings()->LoadColors( getColorSettings() );
204  plotter->SetColorMode( getModeColor() );
205  plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
206 
207  // TODO this could be configurable
208  plotter->SetTargetChordLength( Millimeter2iu( 0.6 ) );
209 
210  switch( aOriginAndUnits )
211  {
214  default:
215  plotter->SetUserCoords( false );
216  break;
218  plotter->SetUserCoords( true );
219  plotter->SetUserCoordsFit( false );
220  break;
222  plotter->SetUserCoords( true );
223  plotter->SetUserCoordsFit( true );
224  break;
225  }
226 
227  // Init :
228  plotter->SetCreator( wxT( "Eeschema-HPGL" ) );
229 
230  if( ! plotter->OpenFile( aFileName ) )
231  {
232  delete plotter;
233  return false;
234  }
235 
236  LOCALE_IO toggle;
237 
238  // Pen num and pen speed are not initialized here.
239  // Default HPGL driver values are used
240  plotter->SetPenDiameter( m_HPGLPenSize );
241  plotter->StartPlot();
242 
243  if( aPlotFrameRef )
244  {
245  PlotDrawingSheet( plotter, &m_parent->Prj(), m_parent->GetTitleBlock(), aPageInfo,
246  aScreen->GetPageNumber(), aScreen->GetPageCount(),
248  aScreen->GetVirtualPageNumber() == 1 );
249  }
250 
251  aScreen->Plot( plotter );
252 
253  plotter->EndPlot();
254  delete plotter;
255 
256  return true;
257 }
virtual bool EndPlot() override
HPGL end of plot: sort and emit graphics, pen return and release.
void Plot(PLOTTER *aPlotter) const
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:755
const wxString & GetFileName() const
Definition: sch_screen.h:133
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:172
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:76
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:151
int GetVirtualPageNumber() const
Definition: base_screen.h:79
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:154
virtual void SetPenDiameter(double diameter)
COLOR_SETTINGS * getColorSettings()
int GetPageCount() const
Definition: base_screen.h:76
Definition: color4d.h:44
virtual bool StartPlot() override
At the start of the HPGL plot pen speed and number are requested.
const wxString & GetPageNumber() const
Definition: base_screen.cpp:78
virtual void SetViewport(const wxPoint &aOffset, double aIusPerDecimil, double aScale, bool aMirror) override
Set the plot offset and scaling for the current plot.
void SetUserCoordsFit(bool user_coords_fit)
Set whether the user coordinate system is fit to content.
Definition: plotter_hpgl.h:61
wxString GetScreenDesc() const override
Return a human-readable description of the current screen.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
void SetTargetChordLength(double chord_len)
Set the target length of chords used to draw approximated circles and arcs.
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:155
void SetUserCoords(bool user_coords)
Switch to the user coordinate system.
Definition: plotter_hpgl.h:58
const TITLE_BLOCK & GetTitleBlock() const override
void PlotDrawingSheet(PLOTTER *plotter, const PROJECT *aProject, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, const wxString &aSheetNumber, int aSheetCount, const wxString &aSheetDesc, const wxString &aFilename, COLOR4D aColor, bool aIsFirstPage)
#define IU_PER_MILS
Definition: plotter.cpp:137
virtual void LoadColors(const COLOR_SETTINGS *aSettings)
static constexpr int Millimeter2iu(double mm)
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.h:157

References BLACK, HPGL_PLOTTER::EndPlot(), getColorSettings(), SCH_SCREEN::GetFileName(), getModeColor(), BASE_SCREEN::GetPageCount(), BASE_SCREEN::GetPageNumber(), SCH_EDIT_FRAME::GetScreenDesc(), SCH_BASE_FRAME::GetTitleBlock(), BASE_SCREEN::GetVirtualPageNumber(), IU_PER_MILS, KIGFX::RENDER_SETTINGS::LoadColors(), m_HPGLPenSize, m_parent, Millimeter2iu(), PLOTTER::OpenFile(), SCH_SCREEN::Plot(), PlotDrawingSheet(), PLOTTER_BOT_LEFT, PLOTTER_CENTER, KIWAY_HOLDER::Prj(), PLOTTER::RenderSettings(), PLOTTER::SetColorMode(), PLOTTER::SetCreator(), PLOTTER::SetPageSettings(), HPGL_PLOTTER::SetPenDiameter(), PLOTTER::SetRenderSettings(), HPGL_PLOTTER::SetTargetChordLength(), HPGL_PLOTTER::SetUserCoords(), HPGL_PLOTTER::SetUserCoordsFit(), HPGL_PLOTTER::SetViewport(), HPGL_PLOTTER::StartPlot(), USER_FIT_CONTENT, and USER_FIT_PAGE.

Referenced by createHPGLFile().

◆ PlotOneSheetDXF()

bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF ( const wxString &  aFileName,
SCH_SCREEN aScreen,
RENDER_SETTINGS aRenderSettings,
wxPoint  aPlotOffset,
double  aScale,
bool  aPlotFrameRef 
)
private

Definition at line 117 of file plot_schematic_DXF.cpp.

123 {
124  aRenderSettings->LoadColors( getColorSettings() );
125  aRenderSettings->SetDefaultPenWidth( 0 );
126 
127  const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
128  DXF_PLOTTER* plotter = new DXF_PLOTTER();
129 
130  plotter->SetRenderSettings( aRenderSettings );
131  plotter->SetPageSettings( pageInfo );
132  plotter->SetColorMode( getModeColor() );
133  // Currently, plot units are in decimil
134  plotter->SetViewport( aPlotOffset, IU_PER_MILS/10, aScale, false );
135 
136  // Init :
137  plotter->SetCreator( wxT( "Eeschema-DXF" ) );
138 
139  if( ! plotter->OpenFile( aFileName ) )
140  {
141  delete plotter;
142  return false;
143  }
144 
145  LOCALE_IO toggle;
146 
147  plotter->StartPlot();
148 
149  if( aPlotFrameRef )
150  {
151  PlotDrawingSheet( plotter, &m_parent->Prj(), m_parent->GetTitleBlock(), pageInfo,
152  aScreen->GetPageNumber(), aScreen->GetPageCount(),
153  m_parent->GetScreenDesc(), aScreen->GetFileName(),
154  plotter->GetColorMode() ?
156  COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
157  }
158 
159  aScreen->Plot( plotter );
160 
161  // finish
162  plotter->EndPlot();
163  delete plotter;
164 
165  return true;
166 }
void Plot(PLOTTER *aPlotter) const
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:755
const wxString & GetFileName() const
Definition: sch_screen.h:133
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:172
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
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:76
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:151
int GetVirtualPageNumber() const
Definition: base_screen.h:79
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:154
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
COLOR_SETTINGS * getColorSettings()
int GetPageCount() const
Definition: base_screen.h:76
Definition: color4d.h:44
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:128
const wxString & GetPageNumber() const
Definition: base_screen.cpp:78
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.
PROJECT & Prj() const
Return a reference to the PROJECT associated with this KIWAY.
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
virtual bool EndPlot() override
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:155
const TITLE_BLOCK & GetTitleBlock() const override
void PlotDrawingSheet(PLOTTER *plotter, const PROJECT *aProject, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, const wxString &aSheetNumber, int aSheetCount, const wxString &aSheetDesc, const wxString &aFilename, COLOR4D aColor, bool aIsFirstPage)
#define IU_PER_MILS
Definition: plotter.cpp:137
void SetDefaultPenWidth(int aWidth)
virtual void LoadColors(const COLOR_SETTINGS *aSettings)
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.h:157
bool GetColorMode() const
Definition: plotter.h:152

References BLACK, DXF_PLOTTER::EndPlot(), PLOTTER::GetColorMode(), getColorSettings(), SCH_SCREEN::GetFileName(), KIGFX::RENDER_SETTINGS::GetLayerColor(), getModeColor(), BASE_SCREEN::GetPageCount(), BASE_SCREEN::GetPageNumber(), SCH_SCREEN::GetPageSettings(), SCH_EDIT_FRAME::GetScreenDesc(), SCH_BASE_FRAME::GetTitleBlock(), BASE_SCREEN::GetVirtualPageNumber(), IU_PER_MILS, LAYER_SCHEMATIC_DRAWINGSHEET, KIGFX::RENDER_SETTINGS::LoadColors(), m_parent, PLOTTER::OpenFile(), SCH_SCREEN::Plot(), PlotDrawingSheet(), KIWAY_HOLDER::Prj(), PLOTTER::RenderSettings(), PLOTTER::SetColorMode(), PLOTTER::SetCreator(), KIGFX::RENDER_SETTINGS::SetDefaultPenWidth(), PLOTTER::SetPageSettings(), PLOTTER::SetRenderSettings(), DXF_PLOTTER::SetViewport(), and DXF_PLOTTER::StartPlot().

Referenced by CreateDXFFile().

◆ plotOneSheetPDF()

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

Definition at line 158 of file plot_schematic_PDF.cpp.

160 {
161  if( m_plotBackgroundColor->GetValue() )
162  {
163  aPlotter->SetColor( aPlotter->RenderSettings()->GetBackgroundColor() );
164  wxPoint end( aPlotter->PageSettings().GetWidthIU(),
165  aPlotter->PageSettings().GetHeightIU() );
166  aPlotter->Rect( wxPoint( 0, 0 ), end, FILL_TYPE::FILLED_SHAPE, 1.0 );
167  }
168 
169  if( aPlotDrawingSheet )
170  {
172 
173  if( aPlotter->GetColorMode() )
175 
176  PlotDrawingSheet( aPlotter, &aScreen->Schematic()->Prj(), m_parent->GetTitleBlock(),
177  m_parent->GetPageSettings(), aScreen->GetPageNumber(),
178  aScreen->GetPageCount(), m_parent->GetScreenDesc(),
179  aScreen->GetFileName(), color, aScreen->GetVirtualPageNumber() == 1 );
180  }
181 
182  aScreen->Plot( aPlotter );
183 }
void Plot(PLOTTER *aPlotter) const
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:755
const wxString & GetFileName() const
Definition: sch_screen.h:133
virtual const COLOR4D & GetBackgroundColor()=0
Return current background color settings.
virtual void SetColor(COLOR4D color)=0
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_TYPE fill, int width=USE_DEFAULT_LINE_WIDTH)=0
int color
Definition: DXF_plotter.cpp:60
int GetVirtualPageNumber() const
Definition: base_screen.h:79
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
int GetPageCount() const
Definition: base_screen.h:76
Definition: color4d.h:44
const wxString & GetPageNumber() const
Definition: base_screen.cpp:78
wxString GetScreenDesc() const override
Return a human-readable description of the current screen.
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:75
const PAGE_INFO & GetPageSettings() const override
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:155
SCHEMATIC * Schematic() const
Definition: sch_screen.cpp:88
const TITLE_BLOCK & GetTitleBlock() const override
void PlotDrawingSheet(PLOTTER *plotter, const PROJECT *aProject, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, const wxString &aSheetNumber, int aSheetCount, const wxString &aSheetDesc, const wxString &aFilename, COLOR4D aColor, bool aIsFirstPage)
PAGE_INFO & PageSettings()
Definition: plotter.h:158
A color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:98
bool GetColorMode() const
Definition: plotter.h:152

References BLACK, color, FILLED_SHAPE, KIGFX::RENDER_SETTINGS::GetBackgroundColor(), PLOTTER::GetColorMode(), SCH_SCREEN::GetFileName(), KIGFX::RENDER_SETTINGS::GetLayerColor(), BASE_SCREEN::GetPageCount(), BASE_SCREEN::GetPageNumber(), SCH_BASE_FRAME::GetPageSettings(), SCH_EDIT_FRAME::GetScreenDesc(), SCH_BASE_FRAME::GetTitleBlock(), BASE_SCREEN::GetVirtualPageNumber(), LAYER_SCHEMATIC_DRAWINGSHEET, m_parent, DIALOG_PLOT_SCHEMATIC_BASE::m_plotBackgroundColor, PLOTTER::PageSettings(), SCH_SCREEN::Plot(), PlotDrawingSheet(), SCHEMATIC::Prj(), PLOTTER::Rect(), PLOTTER::RenderSettings(), SCH_SCREEN::Schematic(), and PLOTTER::SetColor().

Referenced by createPDFFile().

◆ plotOneSheetPS()

bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS ( const wxString &  aFileName,
SCH_SCREEN aScreen,
RENDER_SETTINGS aRenderSettings,
const PAGE_INFO aPageInfo,
wxPoint  aPlot0ffset,
double  aScale,
bool  aPlotFrameRef 
)
private

Definition at line 141 of file plot_schematic_PS.cpp.

148 {
149  PS_PLOTTER* plotter = new PS_PLOTTER();
150  plotter->SetRenderSettings( aRenderSettings );
151  plotter->SetPageSettings( aPageInfo );
152  plotter->SetColorMode( getModeColor() );
153  // Currently, plot units are in decimil
154  plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
155 
156  // Init :
157  plotter->SetCreator( wxT( "Eeschema-PS" ) );
158 
159  if( ! plotter->OpenFile( aFileName ) )
160  {
161  delete plotter;
162  return false;
163  }
164 
165  LOCALE_IO toggle; // Switch the locale to standard C
166 
167  plotter->StartPlot();
168 
169  if( m_plotBackgroundColor->GetValue() )
170  {
172  wxPoint end( plotter->PageSettings().GetWidthIU(),
173  plotter->PageSettings().GetHeightIU() );
174  plotter->Rect( wxPoint( 0, 0 ), end, FILL_TYPE::FILLED_SHAPE, 1.0 );
175  }
176 
177  if( aPlotFrameRef )
178  {
179  PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(), m_parent->GetTitleBlock(),
180  aPageInfo, aScreen->GetPageNumber(), aScreen->GetPageCount(),
181  m_parent->GetScreenDesc(), aScreen->GetFileName(),
182  plotter->GetColorMode() ?
184  COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
185  }
186 
187  aScreen->Plot( plotter );
188 
189  plotter->EndPlot();
190  delete plotter;
191 
192  return true;
193 }
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:420
void Plot(PLOTTER *aPlotter) const
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:755
const wxString & GetFileName() const
Definition: sch_screen.h:133
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:172
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
virtual bool OpenFile(const wxString &aFullFilename)
Open or create the plot file aFullFilename.
Definition: plotter.cpp:76
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:151
int GetVirtualPageNumber() const
Definition: base_screen.h:79
virtual bool EndPlot() override
Definition: PS_plotter.cpp:983
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:154
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
int GetPageCount() const
Definition: base_screen.h:76
Definition: color4d.h:44
const wxString & GetPageNumber() const
Definition: base_screen.cpp:78
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:826
virtual void SetColor(COLOR4D color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
Definition: PS_plotter.cpp:65
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:75
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:155
SCHEMATIC * Schematic() const
Definition: sch_screen.cpp:88
const TITLE_BLOCK & GetTitleBlock() const override
void PlotDrawingSheet(PLOTTER *plotter, const PROJECT *aProject, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, const wxString &aSheetNumber, int aSheetCount, const wxString &aSheetDesc, const wxString &aFilename, COLOR4D aColor, bool aIsFirstPage)
#define IU_PER_MILS
Definition: plotter.cpp:137
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_TYPE fill, int width=USE_DEFAULT_LINE_WIDTH) override
Definition: PS_plotter.cpp:590
PAGE_INFO & PageSettings()
Definition: plotter.h:158
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.h:157
bool GetColorMode() const
Definition: plotter.h:152

References BLACK, PS_PLOTTER::EndPlot(), FILLED_SHAPE, PLOTTER::GetColorMode(), SCH_SCREEN::GetFileName(), KIGFX::RENDER_SETTINGS::GetLayerColor(), getModeColor(), BASE_SCREEN::GetPageCount(), BASE_SCREEN::GetPageNumber(), SCH_EDIT_FRAME::GetScreenDesc(), SCH_BASE_FRAME::GetTitleBlock(), BASE_SCREEN::GetVirtualPageNumber(), IU_PER_MILS, LAYER_SCHEMATIC_BACKGROUND, LAYER_SCHEMATIC_DRAWINGSHEET, m_parent, DIALOG_PLOT_SCHEMATIC_BASE::m_plotBackgroundColor, PLOTTER::OpenFile(), PLOTTER::PageSettings(), SCH_SCREEN::Plot(), PlotDrawingSheet(), SCHEMATIC::Prj(), PS_PLOTTER::Rect(), PLOTTER::RenderSettings(), SCH_SCREEN::Schematic(), PSLIKE_PLOTTER::SetColor(), PLOTTER::SetColorMode(), PLOTTER::SetCreator(), PLOTTER::SetPageSettings(), PLOTTER::SetRenderSettings(), PS_PLOTTER::SetViewport(), and PS_PLOTTER::StartPlot().

Referenced by createPSFile().

◆ plotOneSheetSVG()

bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG ( const wxString &  aFileName,
SCH_SCREEN aScreen,
RENDER_SETTINGS aRenderSettings,
bool  aPlotBlackAndWhite,
bool  aPlotFrameRef 
)
private

Definition at line 113 of file plot_schematic_SVG.cpp.

118 {
119  const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
120 
121  SVG_PLOTTER* plotter = new SVG_PLOTTER();
122  plotter->SetRenderSettings( aRenderSettings );
123  plotter->SetPageSettings( pageInfo );
124  plotter->SetColorMode( aPlotBlackAndWhite ? false : true );
125  wxPoint plot_offset;
126  double scale = 1.0;
127  // Currently, plot units are in decimil
128  plotter->SetViewport( plot_offset, IU_PER_MILS/10, scale, false );
129 
130  // Init :
131  plotter->SetCreator( wxT( "Eeschema-SVG" ) );
132 
133  if( ! plotter->OpenFile( aFileName ) )
134  {
135  delete plotter;
136  return false;
137  }
138 
139  LOCALE_IO toggle;
140 
141  plotter->StartPlot();
142 
143  if( m_plotBackgroundColor->GetValue() )
144  {
146  wxPoint end( plotter->PageSettings().GetWidthIU(),
147  plotter->PageSettings().GetHeightIU() );
148  plotter->Rect( wxPoint( 0, 0 ), end, FILL_TYPE::FILLED_SHAPE, 1.0 );
149  }
150 
151  if( aPlotFrameRef )
152  {
153  PlotDrawingSheet( plotter, &aScreen->Schematic()->Prj(), m_parent->GetTitleBlock(),
154  pageInfo, aScreen->GetPageNumber(), aScreen->GetPageCount(),
155  m_parent->GetScreenDesc(), aScreen->GetFileName(),
156  plotter->GetColorMode() ?
158  COLOR4D::BLACK, aScreen->GetVirtualPageNumber() == 1 );
159  }
160 
161  aScreen->Plot( plotter );
162 
163  plotter->EndPlot();
164  delete plotter;
165 
166  return true;
167 }
void Plot(PLOTTER *aPlotter) const
Plot all the schematic objects to aPlotter.
Definition: sch_screen.cpp:755
const wxString & GetFileName() const
Definition: sch_screen.h:133
virtual void SetCreator(const wxString &aCreator)
Definition: plotter.h:172
Instantiate the current locale within a scope in which you are expecting exceptions to be thrown.
Definition: locale_io.h:40
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:76
virtual void SetColorMode(bool aColorMode)
Plot in B/W or color.
Definition: plotter.h:151
int GetVirtualPageNumber() const
Definition: base_screen.h:79
void SetRenderSettings(RENDER_SETTINGS *aSettings)
Definition: plotter.h:154
const COLOR4D & GetLayerColor(int aLayer) const
Return the color used to draw a layer.
int GetPageCount() const
Definition: base_screen.h:76
Definition: color4d.h:44
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:128
const wxString & GetPageNumber() const
Definition: base_screen.cpp:78
wxString GetScreenDesc() const override
Return a human-readable description of the current screen.
virtual bool EndPlot() override
virtual void SetColor(COLOR4D color) override
The SetColor implementation is split with the subclasses: The PSLIKE computes the rgb values,...
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
virtual bool StartPlot() override
The code within this function creates SVG files header.
PROJECT & Prj() const override
Return a reference to the project this schematic is part of.
Definition: schematic.h:75
RENDER_SETTINGS * RenderSettings()
Definition: plotter.h:155
const int scale
SCHEMATIC * Schematic() const
Definition: sch_screen.cpp:88
const TITLE_BLOCK & GetTitleBlock() const override
virtual void Rect(const wxPoint &p1, const wxPoint &p2, FILL_TYPE fill, int width=USE_DEFAULT_LINE_WIDTH) override
void PlotDrawingSheet(PLOTTER *plotter, const PROJECT *aProject, const TITLE_BLOCK &aTitleBlock, const PAGE_INFO &aPageInfo, const wxString &aSheetNumber, int aSheetCount, const wxString &aSheetDesc, const wxString &aFilename, COLOR4D aColor, bool aIsFirstPage)
#define IU_PER_MILS
Definition: plotter.cpp:137
PAGE_INFO & PageSettings()
Definition: plotter.h:158
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.h:157
bool GetColorMode() const
Definition: plotter.h:152

References BLACK, SVG_PLOTTER::EndPlot(), FILLED_SHAPE, PLOTTER::GetColorMode(), SCH_SCREEN::GetFileName(), KIGFX::RENDER_SETTINGS::GetLayerColor(), BASE_SCREEN::GetPageCount(), BASE_SCREEN::GetPageNumber(), SCH_SCREEN::GetPageSettings(), SCH_EDIT_FRAME::GetScreenDesc(), SCH_BASE_FRAME::GetTitleBlock(), BASE_SCREEN::GetVirtualPageNumber(), IU_PER_MILS, LAYER_SCHEMATIC_BACKGROUND, LAYER_SCHEMATIC_DRAWINGSHEET, m_parent, DIALOG_PLOT_SCHEMATIC_BASE::m_plotBackgroundColor, PLOTTER::OpenFile(), PLOTTER::PageSettings(), SCH_SCREEN::Plot(), PlotDrawingSheet(), SCHEMATIC::Prj(), SVG_PLOTTER::Rect(), PLOTTER::RenderSettings(), scale, SCH_SCREEN::Schematic(), SVG_PLOTTER::SetColor(), PLOTTER::SetColorMode(), PLOTTER::SetCreator(), PLOTTER::SetPageSettings(), PLOTTER::SetRenderSettings(), SVG_PLOTTER::SetViewport(), and SVG_PLOTTER::StartPlot().

Referenced by createSVGFile().

◆ PlotSchematic()

void DIALOG_PLOT_SCHEMATIC::PlotSchematic ( bool  aPlotAll)
private

Definition at line 337 of file dialog_plot_schematic.cpp.

338 {
340 
341  getPlotOptions( &renderSettings );
342 
343  switch( GetPlotFileFormat() )
344  {
345  default:
346  case PLOT_FORMAT::POST:
347  createPSFile( aPlotAll, getPlotDrawingSheet(), &renderSettings );
348  break;
349  case PLOT_FORMAT::DXF:
350  CreateDXFFile( aPlotAll, getPlotDrawingSheet(), &renderSettings );
351  break;
352  case PLOT_FORMAT::PDF:
353  createPDFFile( aPlotAll, getPlotDrawingSheet(), &renderSettings );
354  break;
355  case PLOT_FORMAT::SVG:
356  createSVGFile( aPlotAll, getPlotDrawingSheet(), &renderSettings );
357  break;
358  case PLOT_FORMAT::HPGL:
359  createHPGLFile( aPlotAll, getPlotDrawingSheet(), &renderSettings );
360  break;
361  }
362 }
KIGFX::SCH_RENDER_SETTINGS * GetRenderSettings()
void createPDFFile(bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS *aRenderSettings)
void getPlotOptions(RENDER_SETTINGS *aSettings)
void createSVGFile(bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aSettings)
void CreateDXFFile(bool aPlotAll, bool aPlotDrawingSheet, RENDER_SETTINGS *aRenderSettings)
void createPSFile(bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aSettings)
Store schematic specific render settings.
Definition: sch_painter.h:70
void createHPGLFile(bool aPlotAll, bool aPlotFrameRef, RENDER_SETTINGS *aRenderSettings)

References CreateDXFFile(), createHPGLFile(), createPDFFile(), createPSFile(), createSVGFile(), DXF, getPlotDrawingSheet(), GetPlotFileFormat(), getPlotOptions(), SCH_BASE_FRAME::GetRenderSettings(), HPGL, m_parent, PDF, POST, and SVG.

Referenced by OnPlotAll(), and OnPlotCurrent().

◆ Prj()

PROJECT & KIWAY_HOLDER::Prj ( ) const
inherited

Return 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
Return a reference to the KIWAY that this object has an opportunity to participate in.
Definition: kiway_holder.h:56
virtual PROJECT & Prj() const
Return the PROJECT associated with this KIWAY.
Definition: kiway.cpp:173

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

Referenced by PCB_BASE_EDIT_FRAME::AddLibrary(), SYMBOL_LIBRARY_MANAGER::addLibrary(), SYMBOL_EDIT_FRAME::addLibTableEntry(), SCH_EDIT_FRAME::AppendSchematic(), AskSaveBoardFileName(), DIALOG_SYMBOL_REMAP::backupProject(), CVPCB_MAINFRAME::buildEquivalenceList(), CVPCB_MAINFRAME::BuildLibrariesListBox(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::Cfg3DPath(), DIALOG_FOOTPRINT_PROPERTIES::Cfg3DPath(), KICAD_MANAGER_FRAME::CloseProject(), DIALOG_GEN_FOOTPRINT_POSITION::CreateAsciiFiles(), DIALOG_GEN_FOOTPRINT_POSITION::CreateGerberFiles(), PCB_BASE_EDIT_FRAME::CreateNewLibrary(), createPlotFileName(), DIALOG_SYMBOL_REMAP::createProjectSymbolLibTable(), SCH_EDIT_FRAME::CreateScreens(), FOOTPRINT_EDIT_FRAME::DeleteFootprintFromLibrary(), DIALOG_ANNOTATE::DIALOG_ANNOTATE(), DIALOG_BOARD_REANNOTATE::DIALOG_BOARD_REANNOTATE(), DIALOG_BOARD_SETUP::DIALOG_BOARD_SETUP(), DIALOG_BOARD_STATISTICS::DIALOG_BOARD_STATISTICS(), DIALOG_CHANGE_SYMBOLS::DIALOG_CHANGE_SYMBOLS(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), DIALOG_CONFIG_EQUFILES::DIALOG_CONFIG_EQUFILES(), DIALOG_EXCHANGE_FOOTPRINTS::DIALOG_EXCHANGE_FOOTPRINTS(), DIALOG_EXPORT_SVG::DIALOG_EXPORT_SVG(), DIALOG_FOOTPRINT_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(), DIALOG_GEN_FOOTPRINT_POSITION::DIALOG_GEN_FOOTPRINT_POSITION(), DIALOG_NETLIST::DIALOG_NETLIST(), DIALOG_PAGES_SETTINGS::DIALOG_PAGES_SETTINGS(), DIALOG_PLOT::DIALOG_PLOT(), DIALOG_PLOT_SCHEMATIC(), DIALOG_SCHEMATIC_SETUP::DIALOG_SCHEMATIC_SETUP(), DIALOG_SYMBOL_REMAP::DIALOG_SYMBOL_REMAP(), DIALOG_UPDATE_FROM_PCB::DIALOG_UPDATE_FROM_PCB(), DIALOG_UPDATE_PCB::DIALOG_UPDATE_PCB(), FOOTPRINT_PREVIEW_PANEL::DisplayFootprint(), SYMBOL_VIEWER_FRAME::DisplayLibInfos(), CVPCB_MAINFRAME::DisplayStatus(), PL_DRAW_PANEL_GAL::DisplayWorksheet(), PCB_EDIT_FRAME::doAutoSave(), SCH_EDIT_FRAME::doAutoSave(), PCB_BASE_EDIT_FRAME::doCloseWindow(), FOOTPRINT_EDIT_FRAME::doCloseWindow(), SCH_EDIT_FRAME::doCloseWindow(), FIELDS_GRID_TRICKS::doPopupSelection(), FIELDS_EDITOR_GRID_TRICKS::doPopupSelection(), KICAD_MANAGER_CONTROL::Execute(), PCB_EDIT_FRAME::Export_IDF3(), PCB_EDIT_FRAME::ExportFootprintsToLibrary(), BOARD_EDITOR_CONTROL::ExportNetlist(), DIALOG_EXPORT_SVG::ExportSVGFile(), SYMBOL_EDITOR_CONTROL::ExportSymbolAsSVG(), SYMBOL_EDITOR_CONTROL::ExportView(), PCB_EDIT_FRAME::ExportVRML_File(), BACK_ANNOTATE::FetchNetlistFromPCB(), PCB_EDIT_FRAME::Files_io_from_id(), PCB_EDIT_FRAME::GenD356File(), DIALOG_GENDRILL::GenDrillAndMapFiles(), FOOTPRINT_VIEWER_FRAME::getCurFootprintName(), SYMBOL_EDIT_FRAME::GetCurLib(), FOOTPRINT_VIEWER_FRAME::getCurNickname(), PCB_BASE_EDIT_FRAME::GetDesignRulesPath(), DISPLAY_FOOTPRINTS_FRAME::GetFootprint(), SCH_BASE_FRAME::GetLibPart(), DIALOG_SYMBOL_REMAP::getLibsNotInGlobalSymbolLibTable(), KICAD_MANAGER_FRAME::GetProjectFileName(), SYMBOL_VIEWER_FRAME::GetSelectedSymbol(), SCH_EDIT_FRAME::importFile(), SCH_EDITOR_CONTROL::ImportFPAssignments(), DIALOG_CONFIG_EQUFILES::Init(), FOOTPRINT_EDIT_FRAME::initLibraryTree(), SCH_EDIT_FRAME::KiwayMailIn(), SYMBOL_EDIT_FRAME::KiwayMailIn(), EDA_DRAW_FRAME::LibraryFileBrowser(), CVPCB_MAINFRAME::LoadFootprintFiles(), DIALOG_SPICE_MODEL::loadLibrary(), KICAD_MANAGER_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProject(), SCH_EDIT_FRAME::LoadProjectSettings(), PCB_EDIT_FRAME::LoadProjectSettings(), SIM_PLOT_FRAME::LoadSettings(), SCH_EDIT_FRAME::LoadSheetFromFile(), SYMBOL_EDIT_FRAME::LoadSymbolFromCurrentLib(), EDA_BASE_FRAME::LoadWindowState(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::On3DModelCellChanged(), DIALOG_FOOTPRINT_PROPERTIES::On3DModelCellChanged(), FOOTPRINT_VIEWER_FRAME::OnActivate(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::OnAdd3DModel(), DIALOG_FOOTPRINT_PROPERTIES::OnAdd3DModel(), DIALOG_BOARD_SETUP::OnAuxiliaryAction(), KICAD_MANAGER_FRAME::OnBrowseInFileExplorer(), TEXT_BUTTON_URL::OnButtonClick(), TEXT_BUTTON_FILE_BROWSER::OnButtonClick(), DIALOG_EDIT_COMPONENTS_LIBID::onClickOrphansButton(), DIALOG_GENDRILL::OnGenReportFile(), KICAD_MANAGER_FRAME::OnIdle(), SCH_EDIT_FRAME::OnImportProject(), DIALOG_CHOOSE_SYMBOL::OnInitDialog(), DIALOG_CONFIG_EQUFILES::OnOkClick(), SCH_EDIT_FRAME::OnOpenCvpcb(), KICAD_MANAGER_FRAME::OnOpenFileInTextEditor(), DIALOG_NETLIST::OnOpenNetlistClick(), SCH_EDIT_FRAME::OnOpenPcbnew(), DIALOG_EXPORT_SVG::OnOutputDirectoryBrowseClicked(), DIALOG_PLOT::OnOutputDirectoryBrowseClicked(), DIALOG_GEN_FOOTPRINT_POSITION::OnOutputDirectoryBrowseClicked(), OnOutputDirectoryBrowseClicked(), DIALOG_GENDRILL::OnOutputDirectoryBrowseClicked(), DIALOG_BOARD_SETUP::OnPageChange(), DIALOG_SYMBOL_REMAP::OnRemapSymbols(), DIALOG_BOM::OnRunGenerator(), FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng(), DIALOG_ERC::OnSaveReport(), DIALOG_DRC::OnSaveReport(), DIALOG_LABEL_EDITOR::onScintillaCharAdded(), PROPERTIES_FRAME::onScintillaCharAdded(), DIALOG_SCH_EDIT_ONE_FIELD::onScintillaCharAdded(), DIALOG_SPICE_MODEL::onSelectLibrary(), SYMBOL_VIEWER_FRAME::OnSelectSymbol(), KICAD_MANAGER_FRAME::OnUnarchiveFiles(), SCH_EDIT_FRAME::OnUpdatePCB(), PCB_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_FRAME::OpenProjectFiles(), PANEL_PREV_3D::PANEL_PREV_3D(), SCH_EDITOR_CONTROL::Paste(), FOOTPRINT_EDITOR_CONTROL::PasteFootprint(), SCH_BASE_FRAME::PickSymbolFromLibTree(), DIALOG_PLOT::Plot(), Plot_1_Page_HPGL(), PlotOneSheetDXF(), DIALOG_CHOOSE_SYMBOL::PopulateFootprintSelector(), SCH_EDITOR_CONTROL::Print(), EDA_DRAW_FRAME::PrintDrawingSheet(), SCH_EDIT_FRAME::PrintPage(), KICAD_MANAGER_FRAME::PrintPrjInfo(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), PCB_EDIT_FRAME::RecreateCmpFileFromBoard(), FOOTPRINT_VIEWER_FRAME::ReCreateFootprintList(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_VIEWER_FRAME::ReCreateLibraryList(), SYMBOL_VIEWER_FRAME::ReCreateSymbolList(), EDA_3D_VIEWER::ReloadRequest(), DIALOG_SYMBOL_REMAP::remapSymbolToLibTable(), SYMBOL_EDIT_FRAME::replaceLibTableEntry(), SCH_EDITOR_CONTROL::RescueLegacyProject(), SCH_EDITOR_CONTROL::RescueSymbolLibTableProject(), FOOTPRINT_EDIT_FRAME::restoreLastFootprint(), FOOTPRINT_EDIT_FRAME::retainLastFootprint(), SCH_EDIT_FRAME::Save_File(), FOOTPRINT_EDITOR_CONTROL::SaveAs(), SCH_EDIT_FRAME::SaveEEFile(), FOOTPRINT_EDIT_FRAME::SaveFootprint(), FOOTPRINT_EDIT_FRAME::SaveFootprintAs(), FOOTPRINT_EDIT_FRAME::SaveFootprintInLibrary(), SYMBOL_EDIT_FRAME::saveLibrary(), SYMBOL_EDIT_FRAME::savePartAs(), SCH_EDIT_FRAME::SaveProject(), PCB_EDIT_FRAME::SaveProjectSettings(), DIALOG_BOARD_STATISTICS::saveReportClicked(), SIM_PLOT_FRAME::SaveSettings(), EDA_BASE_FRAME::SaveSettings(), SCH_BASE_FRAME::saveSymbolLibTables(), FOOTPRINT_VIEWER_FRAME::SelectAndViewFootprint(), PCB_BASE_FRAME::SelectLibrary(), SYMBOL_EDIT_FRAME::SelectLibraryFromList(), PCB_BASE_EDIT_FRAME::selectLibTable(), SYMBOL_EDIT_FRAME::selectSymLibTable(), FOOTPRINT_VIEWER_FRAME::setCurFootprintName(), SYMBOL_EDIT_FRAME::SetCurLib(), FOOTPRINT_VIEWER_FRAME::setCurNickname(), SYMBOL_EDIT_FRAME::SetCurPart(), GERBVIEW_FRAME::SetPageSettings(), EE_INSPECTION_TOOL::ShowDatasheet(), DIALOG_CHOOSE_SYMBOL::ShowFootprintFor(), COMMON_CONTROL::ShowHelp(), SYMBOL_VIEWER_FRAME::ShowModal(), FOOTPRINT_VIEWER_FRAME::ShowModal(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), SIM_PLOT_FRAME::SIM_PLOT_FRAME(), SYMBOL_LIBRARY_MANAGER::symTable(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), FOOTPRINT_EDIT_FRAME::SyncLibraryTree(), EDA_3D_VIEWER::takeScreenshot(), PANEL_SETUP_RULES::TransferDataFromWindow(), NETLIST_DIALOG::TransferDataFromWindow(), DIALOG_EDIT_COMPONENTS_LIBID::TransferDataFromWindow(), PANEL_SETUP_RULES::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::TransferDataToWindow(), DIALOG_FOOTPRINT_PROPERTIES::TransferDataToWindow(), DIALOG_PAGES_SETTINGS::UpdatePageLayoutExample(), FOOTPRINT_VIEWER_FRAME::UpdateTitle(), FOOTPRINT_EDIT_FRAME::UpdateTitle(), SCH_EDIT_FRAME::UpdateTitle(), SCH_EDIT_FRAME::WriteNetListFile(), DIALOG_FOOTPRINT_PROPERTIES::~DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::~DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(), and SCH_EDIT_FRAME::~SCH_EDIT_FRAME().

◆ PrjConfigChanged()

bool DIALOG_PLOT_SCHEMATIC::PrjConfigChanged ( )
inline

Return true if the project configutation was modified.

Definition at line 67 of file dialog_plot_schematic.h.

References m_configChanged.

Referenced by SCH_EDITOR_CONTROL::Plot().

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

283 {
284  const char* hash_key;
285 
286  if( m_hash_key.size() )
287  {
288  // a special case like EDA_LIST_DIALOG, which has multiple uses.
289  hash_key = m_hash_key.c_str();
290  }
291  else
292  {
293  hash_key = typeid(*this).name();
294  }
295 
296  RECT_MAP::iterator it = class_map.find( hash_key );
297 
298  if( it == class_map.end() )
299  return;
300 
301  EDA_RECT rect = it->second;
302  rect.SetSize( 0, 0 );
303  class_map[ hash_key ] = rect;
304 }
std::string m_hash_key
Definition: dialog_shim.h:200
static RECT_MAP class_map
void SetSize(const wxSize &size)
Definition: eda_rect.h:139
Handle the component boundary box.
Definition: eda_rect.h:42

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

Referenced by DIALOG_LIB_SYMBOL_PROPERTIES::DIALOG_LIB_SYMBOL_PROPERTIES().

◆ 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 145 of file plot_schematic_PDF.cpp.

147 {
148  aPlotter->EndPlot();
149  delete aPlotter;
150 
151  // Restore the previous sheet
152  m_parent->SetCurrentSheet( aOldsheetpath );
155 }
void SetCurrentSheet(const SCH_SHEET_PATH &aSheet)
virtual bool EndPlot() override
void UpdateAllScreenReferences()
Update all the symbol references for this sheet path.
void SetSheetNumberAndCount()
Set the m_ScreenNumber and m_NumberOfScreens members for screens.
SCH_SHEET_PATH & GetCurrentSheet() const

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 78 of file plot_schematic_HPGL.cpp.

79 {
81 
82  if( m_HPGLPenSize > Millimeter2iu( 2 ) )
84 
85  if( m_HPGLPenSize < Millimeter2iu( 0.01 ) )
86  m_HPGLPenSize = Millimeter2iu( 0.01 );
87 }
virtual long long int GetValue()
Return the current value in Internal Units.
static constexpr int Millimeter2iu(double mm)

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

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

99  {
100  m_initialFocusTarget = aWindow;
101  }
wxWindow * m_initialFocusTarget
Definition: dialog_shim.h:210

References DIALOG_SHIM::m_initialFocusTarget.

Referenced by DIALOG_BOM::DIALOG_BOM(), DIALOG_CHOOSE_FOOTPRINT::DIALOG_CHOOSE_FOOTPRINT(), DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL(), 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_PROPERTIES::DIALOG_FOOTPRINT_PROPERTIES(), DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR::DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR(), DIALOG_FP_PLUGIN_OPTIONS::DIALOG_FP_PLUGIN_OPTIONS(), DIALOG_GRAPHIC_ITEM_PROPERTIES::DIALOG_GRAPHIC_ITEM_PROPERTIES(), DIALOG_GRID_SETTINGS::DIALOG_GRID_SETTINGS(), DIALOG_GROUP_PROPERTIES::DIALOG_GROUP_PROPERTIES(), DIALOG_IMPORT_GFX::DIALOG_IMPORT_GFX(), DIALOG_INSPECTION_REPORTER::DIALOG_INSPECTION_REPORTER(), DIALOG_JUNCTION_PROPS::DIALOG_JUNCTION_PROPS(), DIALOG_LABEL_EDITOR::DIALOG_LABEL_EDITOR(), DIALOG_LIB_EDIT_DRAW_ITEM::DIALOG_LIB_EDIT_DRAW_ITEM(), DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT(), DIALOG_PAD_PRIMITIVES_PROPERTIES::DIALOG_PAD_PRIMITIVES_PROPERTIES(), DIALOG_PAD_PROPERTIES::DIALOG_PAD_PROPERTIES(), DIALOG_PIN_PROPERTIES::DIALOG_PIN_PROPERTIES(), DIALOG_POSITION_RELATIVE::DIALOG_POSITION_RELATIVE(), DIALOG_SCH_FIND::DIALOG_SCH_FIND(), DIALOG_SHEET_PIN_PROPERTIES::DIALOG_SHEET_PIN_PROPERTIES(), DIALOG_TARGET_PROPERTIES::DIALOG_TARGET_PROPERTIES(), DIALOG_TEXT_PROPERTIES::DIALOG_TEXT_PROPERTIES(), DIALOG_TRACK_VIA_PROPERTIES::DIALOG_TRACK_VIA_PROPERTIES(), EDA_VIEW_SWITCHER::EDA_VIEW_SWITCHER(), HK_PROMPT_DIALOG::HK_PROMPT_DIALOG(), 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(), SYMBOL_EDIT_FRAME::savePartAs(), DIALOG_RULE_AREA_PROPERTIES::TransferDataToWindow(), DIALOG_NON_COPPER_ZONES_EDITOR::TransferDataToWindow(), DIALOG_COPPER_ZONE::TransferDataToWindow(), and WX_TEXT_ENTRY_DIALOG::WX_TEXT_ENTRY_DIALOG().

◆ SetKiway()

void KIWAY_HOLDER::SetKiway ( wxWindow *  aDest,
KIWAY aKiway 
)
inherited

It is only used for debugging, since "this" is not a wxWindow*.

"this" is a KIWAY_HOLDER mix-in.

Parameters
aDestis the recipient of aKiway pointer.
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:78
const char * name
Definition: DXF_plotter.cpp:59

References KIWAY_HOLDER::m_kiway, and name.

Referenced by BM2CMP_FRAME::BM2CMP_FRAME(), PCB::IFACE::CreateWindow(), InvokePcbLibTableEditor(), InvokeSchEditSymbolLibTable(), 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 83 of file dialog_plot_schematic.h.

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

References DIALOG_PLOT_SCHEMATIC_BASE::m_ModeColorOption.

Referenced by initDlg().

◆ setPlotDrawingSheet()

void DIALOG_PLOT_SCHEMATIC::setPlotDrawingSheet ( bool  aPlot)
inlineprivate

Definition at line 96 of file dialog_plot_schematic.h.

96 { m_plotDrawingSheet->SetValue( aPlot ); }

References DIALOG_PLOT_SCHEMATIC_BASE::m_plotDrawingSheet.

Referenced by initDlg().

◆ SetPlotOriginAndUnits()

void DIALOG_PLOT_SCHEMATIC::SetPlotOriginAndUnits ( HPGL_PLOT_ORIGIN_AND_UNITS  aOriginAndUnits)
inlineprivate

Definition at line 133 of file dialog_plot_schematic.h.

134  {
135  switch( aOriginAndUnits )
136  {
138  default:
139  m_plotOriginOpt->SetSelection( 0 );
140  break;
141 
143  m_plotOriginOpt->SetSelection( 1 );
144  break;
145 
147  m_plotOriginOpt->SetSelection( 2 );
148  break;
149 
151  m_plotOriginOpt->SetSelection( 3 );
152  break;
153  }
154  }

References DIALOG_PLOT_SCHEMATIC_BASE::m_plotOriginOpt, PLOTTER_BOT_LEFT, PLOTTER_CENTER, USER_FIT_CONTENT, and USER_FIT_PAGE.

◆ SetPosition()

void DIALOG_SHIM::SetPosition ( const wxPoint &  aNewPosition)
inherited

Force the position of the dialog to a new position.

Parameters
aNewPositionis the new forced position

Definition at line 187 of file dialog_shim.cpp.

188 {
189  wxDialog::SetPosition( aNewPosition );
190 
191  // Now update the stored position:
192  const char* hash_key;
193 
194  if( m_hash_key.size() )
195  {
196  // a special case like EDA_LIST_DIALOG, which has multiple uses.
197  hash_key = m_hash_key.c_str();
198  }
199  else
200  {
201  hash_key = typeid(*this).name();
202  }
203 
204  RECT_MAP::iterator it = class_map.find( hash_key );
205 
206  if( it == class_map.end() )
207  return;
208 
209  EDA_RECT rect = it->second;
210  rect.SetOrigin( aNewPosition );
211 
212  class_map[ hash_key ] = rect;
213 }
void SetPosition(wxString aStr, const wxString &aDefaultMeasurementUnit, int *aX, int *aY, const wxString &aActualConversion)
std::string m_hash_key
Definition: dialog_shim.h:200
void SetOrigin(const wxPoint &pos)
Definition: eda_rect.h:126
static RECT_MAP class_map
Handle the component boundary box.
Definition: eda_rect.h:42

References class_map, DIALOG_SHIM::m_hash_key, EDA_RECT::SetOrigin(), and PCAD2KICAD::SetPosition().

Referenced by DIALOG_SCH_FIND::DIALOG_SCH_FIND(), and PCB_BASE_FRAME::SelectOneLayer().

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

160 {
161  wxSize sz( x, y );
162  SetSize( ConvertDialogToPixels( sz ) );
163 }

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 186 of file plot_schematic_PDF.cpp.

187 {
188  PAGE_INFO plotPage; // page size selected to plot
189  // Considerations on page size and scaling requests
190  const PAGE_INFO& actualPage = aScreen->GetPageSettings(); // page size selected in schematic
191 
192  switch( m_pageSizeSelect )
193  {
194  case PAGE_SIZE_A:
195  plotPage.SetType( wxT( "A" ) );
196  plotPage.SetPortrait( actualPage.IsPortrait() );
197  break;
198 
199  case PAGE_SIZE_A4:
200  plotPage.SetType( wxT( "A4" ) );
201  plotPage.SetPortrait( actualPage.IsPortrait() );
202  break;
203 
204  case PAGE_SIZE_AUTO:
205  default:
206  plotPage = actualPage;
207  break;
208  }
209 
210  double scalex = (double) plotPage.GetWidthMils() / actualPage.GetWidthMils();
211  double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
212  double scale = std::min( scalex, scaley );
213  aPlotter->SetPageSettings( plotPage );
214  // Currently, plot units are in decimil
215  aPlotter->SetViewport( wxPoint( 0, 0 ), IU_PER_MILS/10, scale, false );
216 }
int GetHeightMils() const
Definition: page_info.h:133
bool SetType(const wxString &aStandardPageDescriptionName, bool aIsPortrait=false)
Set the name of the page type and also the sizes and margins commonly associated with that type name.
Definition: page_info.cpp:119
const PAGE_INFO & GetPageSettings() const
Definition: sch_screen.h:128
Describe the page size and margins of a paper page on which to eventually print or plot.
Definition: page_info.h:53
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:117
#define IU_PER_MILS
Definition: plotter.cpp:137
void SetPortrait(bool aIsPortrait)
Rotate the paper page 90 degrees.
Definition: page_info.cpp:186
int GetWidthMils() const
Definition: page_info.h:130
virtual void SetPageSettings(const PAGE_INFO &aPageSettings)
Definition: plotter.h:157

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

217 {
218  bool ret;
219  const char* hash_key;
220 
221  if( m_hash_key.size() )
222  {
223  // a special case like EDA_LIST_DIALOG, which has multiple uses.
224  hash_key = m_hash_key.c_str();
225  }
226  else
227  {
228  hash_key = typeid(*this).name();
229  }
230 
231  // Show or hide the window. If hiding, save current position and size.
232  // If showing, use previous position and size.
233  if( show )
234  {
235 #ifndef __WINDOWS__
236  wxDialog::Raise(); // Needed on OS X and some other window managers (i.e. Unity)
237 #endif
238  ret = wxDialog::Show( show );
239 
240  // classname is key, returns a zeroed out default EDA_RECT if none existed before.
241  EDA_RECT savedDialogRect = class_map[ hash_key ];
242 
243  if( savedDialogRect.GetSize().x != 0 && savedDialogRect.GetSize().y != 0 )
244  {
245  if( m_useCalculatedSize )
246  {
247  SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
248  wxDialog::GetSize().x, wxDialog::GetSize().y, 0 );
249  }
250  else
251  {
252  SetSize( savedDialogRect.GetPosition().x, savedDialogRect.GetPosition().y,
253  std::max( wxDialog::GetSize().x, savedDialogRect.GetSize().x ),
254  std::max( wxDialog::GetSize().y, savedDialogRect.GetSize().y ),
255  0 );
256  }
257  }
258 
259  // Be sure that the dialog appears in a visible area
260  // (the dialog position might have been stored at the time when it was
261  // shown on another display)
262  if( wxDisplay::GetFromWindow( this ) == wxNOT_FOUND )
263  Centre();
264  }
265  else
266  {
267  // Save the dialog's position & size before hiding, using classname as key
268  class_map[ hash_key ] = EDA_RECT( wxDialog::GetPosition(), wxDialog::GetSize() );
269 
270 #ifdef __WXMAC__
271  if ( m_eventLoop )
272  m_eventLoop->Exit( GetReturnCode() ); // Needed for APP-MODAL dlgs on OSX
273 #endif
274 
275  ret = wxDialog::Show( show );
276  }
277 
278  return ret;
279 }
std::string m_hash_key
Definition: dialog_shim.h:200
static RECT_MAP class_map
const wxPoint GetPosition() const
Definition: eda_rect.h:107
Handle the component boundary box.
Definition: eda_rect.h:42
bool m_useCalculatedSize
Definition: dialog_shim.h:204
const wxSize GetSize() const
Definition: eda_rect.h:96

References class_map, EDA_RECT::GetPosition(), EDA_RECT::GetSize(), DIALOG_SHIM::m_hash_key, and DIALOG_SHIM::m_useCalculatedSize.

Referenced by FOOTPRINT_EDITOR_CONTROL::CheckFootprint(), DIALOG_SHIM::EndQuasiModal(), GROUP_TOOL::GroupProperties(), EE_INSPECTION_TOOL::NextMarker(), DRC_TOOL::NextMarker(), SCH_EDIT_FRAME::OnAnnotate(), DIALOG_DRC::OnDRCItemDClick(), DIALOG_ERC::OnERCItemDClick(), DIALOG_CLEANUP_GRAPHICS::OnLeftDClickItem(), DIALOG_CLEANUP_TRACKS_AND_VIAS::OnLeftDClickItem(), DIALOG_FOOTPRINT_CHECKER::OnLeftDClickItem(), GROUP_TOOL::PickNewMember(), POSITION_RELATIVE_TOOL::PositionRelative(), EE_INSPECTION_TOOL::PrevMarker(), DRC_TOOL::PrevMarker(), CVPCB_MAINFRAME::ReadNetListAndFpFiles(), EDA_VIEW_SWITCHER::Show(), DIALOG_PAD_PROPERTIES::Show(), DRC_TOOL::ShowDRCDialog(), EE_INSPECTION_TOOL::ShowERCDialog(), SCH_EDIT_FRAME::ShowFindReplaceDialog(), HTML_MESSAGE_BOX::ShowModeless(), DIALOG_SHIM::ShowQuasiModal(), DIALOG_POSITION_RELATIVE::UpdateAnchor(), and SCH_EDIT_FRAME::UpdateHierarchyNavigator().

◆ ShowQuasiModal()

int DIALOG_SHIM::ShowQuasiModal ( )
inherited

Definition at line 395 of file dialog_shim.cpp.

396 {
397  // This is an exception safe way to zero a pointer before returning.
398  // Yes, even though DismissModal() clears this first normally, this is
399  // here in case there's an exception before the dialog is dismissed.
400  struct NULLER
401  {
402  void*& m_what;
403  NULLER( void*& aPtr ) : m_what( aPtr ) {}
404  ~NULLER() { m_what = 0; } // indeed, set it to NULL on destruction
405  } clear_this( (void*&) m_qmodal_loop );
406 
407  // release the mouse if it's currently captured as the window having it
408  // will be disabled when this dialog is shown -- but will still keep the
409  // capture making it impossible to do anything in the modal dialog itself
410  wxWindow* win = wxWindow::GetCapture();
411  if( win )
412  win->ReleaseMouse();
413 
414  // Get the optimal parent
415  wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
416 
417  wxASSERT_MSG( !m_qmodal_parent_disabler,
418  wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
419 
420  // quasi-modal: disable only my "optimal" parent
422 
423  // Apple in its infinite wisdom will raise a disabled window before even passing
424  // us the event, so we have no way to stop it. Instead, we must set an order on
425  // the windows so that the quasi-modal will be pushed in front of the disabled
426  // window when it is raised.
428 
429  Show( true );
430 
431  m_qmodal_showing = true;
432 
433  WX_EVENT_LOOP event_loop;
434 
435  m_qmodal_loop = &event_loop;
436 
437  event_loop.Run();
438 
439  m_qmodal_showing = false;
440 
441  return GetReturnCode();
442 }
bool m_qmodal_showing
Definition: dialog_shim.h:214
#define WX_EVENT_LOOP
Definition: kiway_player.h:43
WX_EVENT_LOOP * m_qmodal_loop
Definition: dialog_shim.h:212
bool Show(bool show) override
WDO_ENABLE_DISABLE * m_qmodal_parent_disabler
Definition: dialog_shim.h:215
Toggle a window's "enable" status to disabled, then enabled on destruction.
Definition: dialog_shim.cpp:42
void ReparentQuasiModal(wxNonOwnedWindow *aWindow)
Move a window's parent to be the top-level window and force the window to be on top.
Definition: gtk/ui.cpp:62

References DIALOG_SHIM::m_qmodal_loop, DIALOG_SHIM::m_qmodal_parent_disabler, DIALOG_SHIM::m_qmodal_showing, KIPLATFORM::UI::ReparentQuasiModal(), DIALOG_SHIM::Show(), and WX_EVENT_LOOP.

Referenced by SCH_EDIT_TOOL::ChangeSymbols(), S3D::Configure3DPaths(), COMMON_CONTROL::ConfigurePaths(), MICROWAVE_TOOL::createFootprint(), MICROWAVE_TOOL::createMicrowaveInductor(), SCH_DRAWING_TOOLS::createNewText(), SYMBOL_EDITOR_EDIT_TOOL::editFieldProperties(), SCH_EDIT_TOOL::editFieldText(), SCH_EDITOR_CONTROL::EditSymbolFields(), SYMBOL_EDITOR_EDIT_TOOL::editSymbolProperties(), GLOBAL_EDIT_TOOL::EditTracksAndVias(), GLOBAL_EDIT_TOOL::ExchangeFootprints(), InvokeCopperZonesEditor(), InvokeDialogCreateBOM(), InvokeDialogEditComponentsLibId(), InvokeDialogRescueEach(), InvokeNonCopperZonesEditor(), SYMBOL_VIEWER_FRAME::OnSelectSymbol(), SCH_EDIT_FRAME::OpenProjectFiles(), SCH_EDIT_TOOL::Properties(), EDIT_TOOL::Properties(), SCH_EDITOR_CONTROL::RemapSymbols(), S3D::Select3DModel(), PCB_BASE_FRAME::SelectFootprintFromLibTree(), PCB_EDIT_FRAME::ShowBoardSetupDialog(), PCB_EDIT_FRAME::ShowDimensionPropertiesDialog(), PCB_EDIT_FRAME::ShowExchangeFootprintsDialog(), PCB_EDIT_FRAME::ShowFootprintPropertiesDialog(), PCB_BASE_EDIT_FRAME::ShowGraphicItemPropertiesDialog(), PCB_BASE_FRAME::ShowPadPropertiesDialog(), SCH_EDIT_FRAME::ShowSchematicSetupDialog(), and PCB_BASE_EDIT_FRAME::ShowTextPropertiesDialog().

◆ vertPixelsFromDU()

int DIALOG_SHIM::vertPixelsFromDU ( int  y) const
protectedinherited

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

See SetSizeInDU or wxDialog documentation for more information.

Definition at line 173 of file dialog_shim.cpp.

174 {
175  wxSize sz( 0, y );
176  return ConvertDialogToPixels( sz ).y;
177 }

Referenced by DIALOG_CHOOSE_SYMBOL::DIALOG_CHOOSE_SYMBOL().

Member Data Documentation

◆ m_browseButton

wxBitmapButton* DIALOG_PLOT_SCHEMATIC_BASE::m_browseButton
protectedinherited

◆ m_colorTheme

wxChoice* DIALOG_PLOT_SCHEMATIC_BASE::m_colorTheme
protectedinherited

◆ m_configChanged

bool DIALOG_PLOT_SCHEMATIC::m_configChanged
private

◆ m_defaultLineWidth

UNIT_BINDER DIALOG_PLOT_SCHEMATIC::m_defaultLineWidth
private

Definition at line 194 of file dialog_plot_schematic.h.

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

◆ m_firstPaintEvent

bool DIALOG_SHIM::m_firstPaintEvent
protectedinherited

Definition at line 209 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 191 of file dialog_plot_schematic.h.

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

◆ m_HPGLPenSize

double DIALOG_PLOT_SCHEMATIC::m_HPGLPenSize
private

◆ m_initialFocusTarget

wxWindow* DIALOG_SHIM::m_initialFocusTarget
protectedinherited

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

◆ 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_parentFrame

EDA_BASE_FRAME* DIALOG_SHIM::m_parentFrame
protectedinherited

Definition at line 217 of file dialog_shim.h.

Referenced by DIALOG_SHIM::OnCharHook().

◆ m_penWidth

UNIT_BINDER DIALOG_PLOT_SCHEMATIC::m_penWidth
private

Definition at line 195 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_plotBackgroundColor

wxCheckBox* DIALOG_PLOT_SCHEMATIC_BASE::m_plotBackgroundColor
protectedinherited

◆ m_plotDrawingSheet

wxCheckBox* DIALOG_PLOT_SCHEMATIC_BASE::m_plotDrawingSheet
protectedinherited

◆ m_plotFormat

PLOT_FORMAT DIALOG_PLOT_SCHEMATIC::m_plotFormat
private

Definition at line 189 of file dialog_plot_schematic.h.

Referenced by OnUpdateUI().

◆ m_plotFormatOpt

wxRadioBox* DIALOG_PLOT_SCHEMATIC_BASE::m_plotFormatOpt
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 212 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 214 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_staticText9

wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_staticText9
protectedinherited

◆ m_staticTextOutputDirectory

wxStaticText* DIALOG_PLOT_SCHEMATIC_BASE::m_staticTextOutputDirectory
protectedinherited

◆ m_tabOrder

◆ m_units

◆ m_useCalculatedSize

bool DIALOG_SHIM::m_useCalculatedSize
protectedinherited

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