28 #include <wx/printdlg.h> 38 m_settings( aSettings )
54 #if defined(__WXMAC__) or defined(__WXGTK__) 120 " Clamped to %f" ),
scale ) );
128 " Clamped to %f" ),
scale ) );
134 wxCHECK(
false, 1.0 );
140 wxASSERT( aValue >= 0.0 );
146 else if( aValue == 1.0 )
166 if( !wxDialog::TransferDataToWindow() )
183 pageSetupDialog.ShowModal();
185 (*s_PrintData) = pageSetupDialog.GetPageSetupDialogData().GetPrintData();
186 (*s_pageSetupData) = pageSetupDialog.GetPageSetupDialogData();
202 wxString title =
_(
"Print Preview" );
203 wxPrintPreview* preview =
206 preview->SetZoom( 100 );
208 wxPreviewFrame* frame =
new wxPreviewFrame( preview,
this, title, m_parent->GetPosition(),
209 m_parent->GetSize() );
210 frame->SetMinSize( wxSize( 550, 350 ) );
216 frame->SetExtraStyle( frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG );
224 frame->InitializeWithModality( wxPreviewFrame_WindowModal );
233 if(
Pgm().m_Printing )
235 DisplayError(
this,
_(
"Previous print job not yet complete." ) );
251 wxPrinter printer( &printDialogData );
252 auto printout = std::unique_ptr<wxPrintout>(
createPrintout(
_(
"Print" ) ) );
254 Pgm().m_Printing =
true;
257 if( !printer.Print(
this, printout.get(), true ) )
259 if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
264 *
s_PrintData = printer.GetPrintDialogData().GetPrintData();
268 Pgm().m_Printing =
false;
276 wxPostEvent(
this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL ) );
302 DisplayError(
this,
_(
"An error occurred initializing the printer information." ) );
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
virtual ~DIALOG_PRINT_GENERIC()
double getScaleValue()
Return scale value selected in the dialog.
const PAGE_INFO & m_pageInfo
wxPrintOrientation GetWxOrientation() const
virtual void Save(APP_SETTINGS_BASE *aConfig)
Handle the parameters used to print a board drawing.
This file is part of the common library.
wxButton * m_sdbSizer1Cancel
int GetHeightMils() const
wxCheckBox * m_titleBlock
void onPageSetup(wxCommandEvent &event) override
wxRadioButton * m_scaleCustom
wxButton * m_sdbSizer1Apply
void onCancelButtonClick(wxCommandEvent &aEvent) override
Class DIALOG_PRINT_GENERIC_BASE.
The base class for create windows for drawing purpose.
KIWAY Kiway & Pgm(), KFCTL_STANDALONE
The global Program "get" accessor.
static constexpr double MIN_SCALE
wxPaperSize GetPaperId() const
virtual void Load(APP_SETTINGS_BASE *aConfig)
double m_scale
Printing scale.
void onPrintButtonClick(wxCommandEvent &event) override
void setScaleValue(double aValue)
Select a corresponding scale radio button and update custom scale value if needed.
bool m_titleBlock
Print frame and title block.
static constexpr double MAX_SCALE
wxTextCtrl * m_scaleCustomText
PRINTOUT_SETTINGS * m_settings
Describe the page size and margins of a paper page on which to eventually print or plot.
static wxPrintData * s_PrintData
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
bool m_blackWhite
Print in B&W or Color.
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
bool TransferDataToWindow() override
int m_pageCount
Number of pages to print.
static wxPageSetupDialogData * s_pageSetupData
DIALOG_PRINT_GENERIC(EDA_DRAW_FRAME *aParent, PRINTOUT_SETTINGS *aSettings)
int Mils2mm(double x)
Convert mils to mm.
wxRadioButton * m_scaleFit
void onClose(wxCloseEvent &event) override
void ForcePrintBorder(bool aValue)
Set 'print border and title block' to a requested value and hides the corresponding checkbox.
void DisplayInfoMessage(wxWindow *aParent, const wxString &aMessage, const wxString &aExtraInfo)
Display an informational message box with aMessage.
void onPrintPreview(wxCommandEvent &event) override
APP_SETTINGS_BASE * m_config
void onSetCustomScale(wxCommandEvent &event) override
wxStdDialogButtonSizer * m_sdbSizer1
virtual wxPrintout * createPrintout(const wxString &aTitle)=0
Create a printout with a requested title.
wxFloatingPointValidator< double > m_scaleValidator
virtual void saveSettings()