39#include <wx/printdlg.h>
78 const wxString& aTitle,
const wxPoint& aPos = wxDefaultPosition,
79 const wxSize& aSize = wxDefaultSize ) :
80 wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
84 bool Show(
bool show )
override
92 ret = wxPreviewFrame::Show( show );
101 s_pos = GetPosition();
103 ret = wxPreviewFrame::Show( show );
127 { wxID_APPLY,
_(
"Print Preview" ) },
128 { wxID_CANCEL,
_(
"Close" ) } } );
134#if defined(__WXGTK__)
172 int minwidth = width;
178 int pos =
m_colorTheme->Append( settings->GetName(),
static_cast<void*
>( settings ) );
180 if( settings->GetFilename() == target )
183 m_colorTheme->GetTextExtent( settings->GetName(), &width, &height );
184 minwidth = std::max( minwidth, width );
187 m_colorTheme->SetMinSize( wxSize( minwidth + 50, -1 ) );
195 pageSetupDialogData.SetPaperId( pageInfo.
GetPaperId() );
207 pageSetupDialogData.GetPrintData().SetOrientation( pageInfo.
GetWxOrientation() );
223 long sel =
event.GetSelection();
258 pageSetupDialog.ShowModal();
269 wxString title =
_(
"Preview" );
274 preview->SetZoom( 100 );
281 frame->SetExtraStyle( frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG );
289 frame->InitializeWithModality( wxPreviewFrame_WindowModal );
295 frame->SetMinSize( wxSize( 650, 500 ) );
296 frame->SetSize( (
m_parent->GetSize() * 3) / 4 );
305 if(
Pgm().m_Printing )
307 DisplayError(
this,
_(
"Previous print job not yet complete." ) );
317#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 2, 3 )
327 wxPaperSize paperId = data.GetPaperId();
328 const wxChar* paperType =
nullptr;
331 std::set<wxPaperSize> letterSizes = {
336 wxPAPER_LETTER_TRANSVERSE,
337 wxPAPER_LETTER_ROTATED
340 std::set<wxPaperSize> legalSizes = {
345 std::set<wxPaperSize> a4Sizes = {
349 wxPAPER_A4_TRANSVERSE,
354 if( letterSizes.count( paperId ) )
356 else if( legalSizes.count( paperId ) )
358 else if( a4Sizes.count( paperId ) )
363 PAGE_INFO pageInfo( paperType, data.GetOrientation() == wxPORTRAIT );
373 data.SetPaperId( wxPAPER_NONE );
377 wxPrintDialogData printDialogData( data );
378 printDialogData.SetMaxPage( sheet_count );
380 if( sheet_count > 1 )
381 printDialogData.EnablePageNumbers(
true );
383 wxPrinter printer( &printDialogData );
388 if( !printer.Print(
this, &printout,
true ) )
390 if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
391 DisplayError(
this,
_(
"An error occurred attempting to print the schematic." ) );
409 return dlg.ShowModal();
static const ADVANCED_CFG & GetCfg()
Get the singleton instance's config, which is shared by all consumers.
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...
Class DIALOG_PRINT_USING_PRINTER_BASE.
wxCheckBox * m_checkReference
wxButton * m_sdbSizer1Apply
wxCheckBox * m_checkBackgroundColor
wxCheckBox * m_checkUseColorTheme
void OnPrintPreview(wxCommandEvent &event) override
DIALOG_PRINT_USING_PRINTER(SCH_EDIT_FRAME *aParent)
void OnUseColorThemeChecked(wxCommandEvent &event) override
bool TransferDataToWindow() override
~DIALOG_PRINT_USING_PRINTER() override
bool TransferDataFromWindow() override
void OnPageSetup(wxCommandEvent &event) override
SCH_EDIT_FRAME * m_parent
void OnOutputChoice(wxCommandEvent &event) 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
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.
int InvokeDialogPrintUsingPrinter(SCH_EDIT_FRAME *aCaller)
Create and show DIALOG_PRINT_USING_PRINTER and return whatever DIALOG_PRINT_USING_PRINTER::ShowModal(...
bool m_EnableEeschemaPrintCairo
Enable Eeschema printing using Cairo.
KICOMMON_API int Mils2mm(double aVal)
Convert mils to mm.
SETTINGS_MANAGER * GetSettingsManager()
PGM_BASE & Pgm()
The global Program "get" accessor.
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
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.