KiCad PCB EDA Suite
dialogs_for_printing.cpp File Reference
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <base_units.h>
#include <pl_editor_frame.h>
#include <pl_editor_id.h>
#include <dialog_helpers.h>
#include <worksheet_shape_builder.h>
#include <class_worksheet_dataitem.h>
#include <dialog_page_settings.h>
#include <invoke_pl_editor_dialog.h>

Go to the source code of this file.

Classes

class  PLEDITOR_PRINTOUT
 Custom print out for printing schematics. More...
 
class  PLEDITOR_PREVIEW_FRAME
 Custom print preview frame. More...
 

Macros

#define MAX_VALUE   (INT_MAX/2)
 

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...
 

Macro Definition Documentation

#define MAX_VALUE   (INT_MAX/2)

Function Documentation

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 207 of file dialogs_for_printing.cpp.

Referenced by PL_EDITOR_FRAME::ToPrinter().

209 {
210  int pageCount = 2;
211 
212  wxPrintDialogData printDialogData( *aPrintData );
213  printDialogData.SetMaxPage( pageCount );
214 
215  if( pageCount > 1 )
216  printDialogData.EnablePageNumbers( true );
217 
218  wxPrinter printer( &printDialogData );
219  PLEDITOR_PRINTOUT printout( aCaller, _( "Print Page Layout" ) );
220 
221  if( !printer.Print( aCaller, &printout, true ) )
222  {
223  if( wxPrinter::GetLastError() == wxPRINTER_ERROR )
224  wxMessageBox( _( "An error occurred attempting to print the page layout." ),
225  _( "Printing" ), wxOK );
226  return 0;
227  }
228 
229  *aPageSetupData = printer.GetPrintDialogData().GetPrintData();
230 
231  return 1;
232 }
Custom print out for printing schematics.
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 234 of file dialogs_for_printing.cpp.

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

Referenced by PL_EDITOR_FRAME::ToPrinter().

235 {
236  // Pass two printout objects: for preview, and possible printing.
237  wxString title = _( "Preview" );
238  wxPrintPreview* preview = new wxPrintPreview( new PLEDITOR_PRINTOUT( aCaller, title ),
239  new PLEDITOR_PRINTOUT( aCaller, title ),
240  aPrintData );
241 
242  preview->SetZoom( 70 );
243 
244  PLEDITOR_PREVIEW_FRAME* frame = new PLEDITOR_PREVIEW_FRAME( preview, aCaller, title );
245 
246  frame->Initialize();
247  frame->Show( true );
248 
249  return 1;
250 }
bool Show(bool show) override
Custom print preview frame.
Custom print out for printing schematics.