KiCad PCB EDA Suite
invoke_pl_editor_dialog.h File Reference

Go to the source code of this file.

Functions

int InvokeDialogPrint (PL_EDITOR_FRAME *aCaller, wxPrintData *aPrintData, wxPageSetupDialogData *aPageSetupData)
 Create and show a print dialog returns 1 if OK, 0 , there is a problem. More...
 
int InvokeDialogPrintPreview (PL_EDITOR_FRAME *aCaller, wxPrintData *aPrintData)
 Create and show a print preview dialog returns 1 if OK, 0 , there is a problem. More...
 

Function Documentation

◆ InvokeDialogPrint()

int InvokeDialogPrint ( PL_EDITOR_FRAME aCaller,
wxPrintData *  aPrintData,
wxPageSetupDialogData *  aPageSetupData 
)

Create and show a print dialog returns 1 if OK, 0 , there is a problem.

Definition at line 221 of file dialogs_for_printing.cpp.

223 {
224  int pageCount = 2;
225 
226  wxPrintDialogData printDialogData( *aPrintData );
227  printDialogData.SetMaxPage( pageCount );
228 
229  if( pageCount > 1 )
230  printDialogData.EnablePageNumbers( true );
231 
232  wxPrinter printer( &printDialogData );
233  PLEDITOR_PRINTOUT printout( aCaller, _( "Print Drawing Sheet" ) );
234 
235  if( !printer.Print( aCaller, &printout, true ) )
236  {
237  if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
238  wxMessageBox( _( "An error occurred attempting to print the drawing sheet." ),
239  _( "Printing" ), wxOK );
240  return 0;
241  }
242 
243  *aPageSetupData = printer.GetPrintDialogData().GetPrintData();
244 
245  return 1;
246 }
#define _(s)
Custom print out for printing schematics.

References _.

Referenced by PL_EDITOR_FRAME::ToPrinter().

◆ InvokeDialogPrintPreview()

int InvokeDialogPrintPreview ( PL_EDITOR_FRAME aCaller,
wxPrintData *  aPrintData 
)

Create and show a print preview dialog returns 1 if OK, 0 , there is a problem.

Definition at line 249 of file dialogs_for_printing.cpp.

250 {
251  // Pass two printout objects: for preview, and possible printing.
252  wxString title = _( "Preview" );
253  wxPrintPreview* preview = new wxPrintPreview( new PLEDITOR_PRINTOUT( aCaller, title ),
254  new PLEDITOR_PRINTOUT( aCaller, title ),
255  aPrintData );
256 
257  preview->SetZoom( 70 );
258 
259  PLEDITOR_PREVIEW_FRAME* frame = new PLEDITOR_PREVIEW_FRAME( preview, aCaller, title );
260 
261  frame->Initialize();
262  frame->Show( true );
263 
264  return 1;
265 }
bool Show(bool show) override
Custom print preview frame.
#define _(s)
Custom print out for printing schematics.

References _, PLEDITOR_PREVIEW_FRAME::PLEDITOR_PREVIEW_FRAME(), and PLEDITOR_PREVIEW_FRAME::Show().

Referenced by PL_EDITOR_FRAME::ToPrinter().