33#include <wx/printdlg.h>
52 const wxString& aTitle,
const wxPoint& aPos = wxDefaultPosition,
53 const wxSize& aSize = wxDefaultSize ) :
54 wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
58 bool Show(
bool show )
override
66 ret = wxPreviewFrame::Show( show );
75 s_pos = GetPosition();
77 ret = wxPreviewFrame::Show( show );
103 { wxID_APPLY,
_(
"Print Preview" ) },
104 { wxID_CANCEL,
_(
"Close" ) } } );
110#if defined(__WXGTK__)
149 int minwidth = width;
155 int pos =
m_colorTheme->Append( settings->GetName(),
static_cast<void*
>( settings ) );
157 if( settings->GetFilename() == target )
160 m_colorTheme->GetTextExtent( settings->GetName(), &width, &height );
161 minwidth = std::max( minwidth, width );
164 m_colorTheme->SetMinSize( wxSize( minwidth + 50, -1 ) );
172 pageSetupDialogData.SetPaperId( pageInfo.
GetPaperId() );
188 pageSetupDialogData.GetPrintData().SetOrientation( pageInfo.
GetWxOrientation() );
204 long sel =
event.GetSelection();
239 pageSetupDialog.ShowModal();
250 wxString selectedPrinterName;
255 prn_data.SetPrinterName( selectedPrinterName );
258 wxString title =
_(
"Preview" );
262 preview->SetZoom( 100 );
269 frame->SetExtraStyle( frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG );
277 frame->InitializeWithModality( wxPreviewFrame_WindowModal );
283 frame->SetMinSize( wxSize( 650, 500 ) );
284 frame->SetSize( (
m_parent->GetSize() * 3) / 4 );
293 if(
Pgm().m_Printing )
295 DisplayError(
this,
_(
"Previous print job not yet complete." ) );
305#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 2, 3 )
315 wxPaperSize paperId = data.GetPaperId();
316 const wxChar* paperType =
nullptr;
319 std::set<wxPaperSize> letterSizes = {
324 wxPAPER_LETTER_TRANSVERSE,
325 wxPAPER_LETTER_ROTATED
328 std::set<wxPaperSize> legalSizes = {
333 std::set<wxPaperSize> a4Sizes = {
337 wxPAPER_A4_TRANSVERSE,
342 if( letterSizes.count( paperId ) )
344 else if( legalSizes.count( paperId ) )
346 else if( a4Sizes.count( paperId ) )
351 PAGE_INFO pageInfo( paperType, data.GetOrientation() == wxPORTRAIT );
361 data.SetPaperId( wxPAPER_NONE );
365 wxString selectedPrinterName;
369 data.SetPrinterName( selectedPrinterName );
371 wxPrintDialogData printDialogData( data );
372 printDialogData.SetMaxPage( sheet_count );
374 if( sheet_count > 1 )
375 printDialogData.EnablePageNumbers(
true );
377 wxPrinter printer( &printDialogData );
382 if( !printer.Print(
this, &printout,
true ) )
384 if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
385 DisplayError(
this,
_(
"An error occurred attempting to print the schematic." ) );
wxString m_ColorTheme
Active color theme name.
Color settings are a bit different than most of the settings objects in that there can be more than o...
wxCheckBox * m_checkBackgroundColor
wxButton * m_sdbSizerApply
PANEL_PRINTER_LIST * m_panelPrinters
wxCheckBox * m_checkUseColorTheme
wxCheckBox * m_checkReference
void OnPrintPreview(wxCommandEvent &event) override
void OnPageSetup(wxCommandEvent &event) override
void OnOutputChoice(wxCommandEvent &event) override
bool TransferDataFromWindow() override
SCH_EDIT_FRAME * m_parent
DIALOG_PRINT(SCH_EDIT_FRAME *aParent)
void OnUseColorThemeChecked(wxCommandEvent &event) override
bool TransferDataToWindow() override
void SetupStandardButtons(std::map< int, wxString > aLabels={})
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
wxString GetFilename() const
Describe the page size and margins of a paper page on which to eventually print or plot.
static const wxChar USLetter[]
static const wxChar USLegal[]
wxPrintOrientation GetWxOrientation() const
double GetHeightMils() const
wxPaperSize GetPaperId() const
double GetWidthMils() const
wxString GetSelectedPrinterName()
bool AsPrintersAvailable()
bool m_Printing
wxWidgets on MSW tends to crash if you spool up more than one print job at a time.
EESCHEMA_SETTINGS * eeconfig() const
Schematic editor (Eeschema) main window.
SCH_SCREEN * GetScreen() const override
Return a pointer to a BASE_SCREEN or one of its derivatives.
wxPageSetupDialogData & GetPageSetupData()
SCHEMATIC & Schematic() const
Custom schematic print preview frame.
bool Show(bool show) override
SCH_PREVIEW_FRAME(wxPrintPreview *aPreview, wxWindow *aParent, const wxString &aTitle, const wxPoint &aPos=wxDefaultPosition, const wxSize &aSize=wxDefaultSize)
Custom print out for printing schematics.
const PAGE_INFO & GetPageSettings() const
int CountSheets() const
Count the number of sheets found in "this" sheet including all of the subsheets.
void DisplayError(wxWindow *aParent, const wxString &aText, int aDisplayTime)
Display an error or warning message box with aMessage.
This file is part of the common library.
KICOMMON_API int Mils2mm(double aVal)
Convert mils to mm.
SETTINGS_MANAGER * GetSettingsManager()
PGM_BASE & Pgm()
The global program "get" accessor.
bool monochrome
Whether or not to print in monochrome.
bool background
Whether or not to print background color.
wxString color_theme
Color theme to use for printing.
bool title_block
Whether or not to print title block.
bool use_theme
If false, display color theme will be used.