void PL_EDITOR_FRAME::ToPrinter( bool doPreview ) { // static print data and page setup data, to remember settings during the session static wxPrintData* s_PrintData; static wxPageSetupDialogData* s_pageSetupData = (wxPageSetupDialogData*) NULL; const PAGE_INFO& pageInfo = GetPageSettings(); if( s_PrintData == NULL ) // First print { s_PrintData = new wxPrintData(); s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH; } if( !s_PrintData->Ok() ) { wxMessageBox( _( "Error Init Printer info" ) ); return; } if( s_pageSetupData == NULL ) s_pageSetupData = new wxPageSetupDialogData( *s_PrintData ); s_pageSetupData->SetPaperId( pageInfo.GetPaperId() ); s_pageSetupData->GetPrintData().SetOrientation( pageInfo.GetWxOrientation() ); if( pageInfo.IsCustom() ) { if( pageInfo.IsPortrait() ) s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetWidthMils() ), Mils2mm( pageInfo.GetHeightMils() ) ) ); else s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ), Mils2mm( pageInfo.GetWidthMils() ) ) ); } *s_PrintData = s_pageSetupData->GetPrintData(); if( doPreview ) InvokeDialogPrintPreview( this, s_PrintData ); else InvokeDialogPrint( this, s_PrintData, s_pageSetupData ); }
void PCB_EDIT_FRAME::ToPrinter( wxCommandEvent& event ) { const PAGE_INFO& pageInfo = GetPageSettings(); if( s_PrintData == NULL ) // First print { s_PrintData = new wxPrintData(); if( !s_PrintData->Ok() ) { DisplayError( this, _( "Error Init Printer info" ) ); } s_PrintData->SetQuality( wxPRINT_QUALITY_HIGH ); // Default resolution = HIGH; } if( s_pageSetupData == NULL ) s_pageSetupData = new wxPageSetupDialogData( *s_PrintData ); s_pageSetupData->SetPaperId( pageInfo.GetPaperId() ); s_pageSetupData->GetPrintData().SetOrientation( pageInfo.GetWxOrientation() ); if( pageInfo.IsCustom() ) { if( pageInfo.IsPortrait() ) s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetWidthMils() ), Mils2mm( pageInfo.GetHeightMils() ) ) ); else s_pageSetupData->SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ), Mils2mm( pageInfo.GetWidthMils() ) ) ); } *s_PrintData = s_pageSetupData->GetPrintData(); DIALOG_PRINT_USING_PRINTER dlg( this ); dlg.ShowModal(); }
bool DIALOG_PRINT_USING_PRINTER::TransferDataToWindow() { SCH_EDIT_FRAME* parent = GetParent(); // Initialize page specific print setup dialog settings. const PAGE_INFO& pageInfo = parent->GetScreen()->GetPageSettings(); wxPageSetupDialogData& pageSetupDialogData = parent->GetPageSetupData(); pageSetupDialogData.SetPaperId( pageInfo.GetPaperId() ); if( pageInfo.IsCustom() ) { if( pageInfo.IsPortrait() ) pageSetupDialogData.SetPaperSize( wxSize( Mils2mm( pageInfo.GetWidthMils() ), Mils2mm( pageInfo.GetHeightMils() ) ) ); else pageSetupDialogData.SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ), Mils2mm( pageInfo.GetWidthMils() ) ) ); } pageSetupDialogData.GetPrintData().SetOrientation( pageInfo.GetWxOrientation() ); return true; }
void DIALOG_PRINT_USING_PRINTER::initDialog() { SCH_EDIT_FRAME* parent = GetParent(); // Initialize page specific print setup dialog settings. const PAGE_INFO& pageInfo = parent->GetScreen()->GetPageSettings(); wxPageSetupDialogData& pageSetupDialogData = parent->GetPageSetupData(); pageSetupDialogData.SetPaperId( pageInfo.GetPaperId() ); if( pageInfo.IsCustom() ) { if( pageInfo.IsPortrait() ) pageSetupDialogData.SetPaperSize( wxSize( Mils2mm( pageInfo.GetWidthMils() ), Mils2mm( pageInfo.GetHeightMils() ) ) ); else pageSetupDialogData.SetPaperSize( wxSize( Mils2mm( pageInfo.GetHeightMils() ), Mils2mm( pageInfo.GetWidthMils() ) ) ); } pageSetupDialogData.GetPrintData().SetOrientation( pageInfo.GetWxOrientation() ); if ( GetSizer() ) GetSizer()->SetSizeHints( this ); // Rely on the policy in class DIALOG_SHIM, which centers the dialog // initially during a runtime session but gives user the ability to move it in // that session. // This dialog may get moved and resized in Show(), but in case this is // the first time, center it for starters. Center(); m_buttonPrint->SetDefault(); // on linux, this is inadequate to determine // what ENTER does. Must also SetFocus(). m_buttonPrint->SetFocus(); }