KiCad PCB EDA Suite
invoke_pl_editor_dialog.h File Reference

Go to the source code of this file.

Functions

int InvokeDialogNewItem (PL_EDITOR_FRAME *aCaller, WORKSHEET_DATAITEM *aItem)
 Create and show DIALOG_NEW_DATAITEM and return whatever DIALOG_NEW_DATAITEM::ShowModal() returns. More...
 
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

int InvokeDialogNewItem ( PL_EDITOR_FRAME aCaller,
WORKSHEET_DATAITEM aItem 
)

Create and show DIALOG_NEW_DATAITEM and return whatever DIALOG_NEW_DATAITEM::ShowModal() returns.

Definition at line 53 of file dialog_new_dataitem.cpp.

Referenced by EVT_MENU_RANGE().

54 {
55  DIALOG_NEW_DATAITEM dlg( aCaller, aItem );
56  return dlg.ShowModal();
57 }
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.