33#include <wx/printdlg.h>
46 const wxString& aTitle,
const wxPoint& aPos = wxDefaultPosition,
47 const wxSize& aSize = wxDefaultSize ) :
48 wxPreviewFrame( aPreview, aParent, aTitle, aPos, aSize )
52 bool Show(
bool show )
override
60 ret = wxPreviewFrame::Show( show );
69 s_pos = GetPosition();
71 ret = wxPreviewFrame::Show( show );
95 { wxID_APPLY,
_(
"Print Preview" ) },
96 { wxID_CANCEL,
_(
"Close" ) } } );
102#if defined(__WXGTK__)
140 int minwidth = width;
146 int pos =
m_colorTheme->Append( settings->GetName(),
static_cast<void*
>( settings ) );
148 if( settings->GetFilename() == target )
151 m_colorTheme->GetTextExtent( settings->GetName(), &width, &height );
152 minwidth = std::max( minwidth, width );
155 m_colorTheme->SetMinSize( wxSize( minwidth + 50, -1 ) );
163 pageSetupDialogData.SetPaperId( pageInfo.
GetPaperId() );
179 pageSetupDialogData.GetPrintData().SetOrientation( pageInfo.
GetWxOrientation() );
195 long sel =
event.GetSelection();
230 pageSetupDialog.ShowModal();
241 wxString title =
_(
"Preview" );
246 preview->SetZoom( 100 );
253 frame->SetExtraStyle( frame->GetExtraStyle() | wxTOPLEVEL_EX_DIALOG );
261 frame->InitializeWithModality( wxPreviewFrame_WindowModal );
267 frame->SetMinSize( wxSize( 650, 500 ) );
268 frame->SetSize( (
m_parent->GetSize() * 3) / 4 );
277 if(
Pgm().m_Printing )
279 DisplayError(
this,
_(
"Previous print job not yet complete." ) );
289#if defined( __WXGTK__ ) && !wxCHECK_VERSION( 3, 2, 3 )
299 wxPaperSize paperId = data.GetPaperId();
300 const wxChar* paperType =
nullptr;
303 std::set<wxPaperSize> letterSizes = {
308 wxPAPER_LETTER_TRANSVERSE,
309 wxPAPER_LETTER_ROTATED
312 std::set<wxPaperSize> legalSizes = {
317 std::set<wxPaperSize> a4Sizes = {
321 wxPAPER_A4_TRANSVERSE,
326 if( letterSizes.count( paperId ) )
328 else if( legalSizes.count( paperId ) )
330 else if( a4Sizes.count( paperId ) )
335 PAGE_INFO pageInfo( paperType, data.GetOrientation() == wxPORTRAIT );
345 data.SetPaperId( wxPAPER_NONE );
349 wxPrintDialogData printDialogData( data );
350 printDialogData.SetMaxPage( sheet_count );
352 if( sheet_count > 1 )
353 printDialogData.EnablePageNumbers(
true );
355 wxPrinter printer( &printDialogData );
360 if( !printer.Print(
this, &printout,
true ) )
362 if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
363 DisplayError(
this,
_(
"An error occurred attempting to print the schematic." ) );
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...
wxCheckBox * m_checkBackgroundColor
wxButton * m_sdbSizer1Apply
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
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.
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.
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.