int ioPagePreProcessing(PrintingLogicPtr printJob) { OSStatus status = noErr; PrOpenPage(printJob->thePrPort, nil); status = PrError(); return status; }
bool MacPrinterCanvas::start() { #if carbon return false; #else //debugfile("MacPrinter::init\n"); GetPort(&oldPort); PrOpen(); if (!prRecHdl) { prRecHdl = THPrint(NewHandleClear(sizeof(TPrint))); if (PrError() != noErr) { return false; } PrintDefault(prRecHdl); if (PrError() != noErr) { return false; } PrStlDialog(prRecHdl); }else{ PrValidate(prRecHdl); } gPrinterPort = PrOpenDoc(prRecHdl, nil, nil); if (PrError() != noErr) { return false; } PrOpenPage(gPrinterPort, nil); if (PrError() != noErr) { return false; } damage_all(); beginPaint(); return true; #endif }
void wxMacClassicPrinterDC::StartPage( wxPrinterDC* dc ) { if ( m_err ) return ; wxMacClassicPrintData *native = (wxMacClassicPrintData*) dc->GetPrintData().m_nativePrintData ; PrOpenPage( m_macPrintingPort , NULL ) ; dc->m_macLocalOrigin.x = (**native->m_macPrintSettings).rPaper.left ; dc->m_macLocalOrigin.y = (**native->m_macPrintSettings).rPaper.top ; // m_macPrintingPort is now the current port Rect clip = { -32000 , -32000 , 32000 , 32000 } ; ::ClipRect( &clip ) ; m_err = PrError() ; if ( m_err != noErr ) ::PrCloseDoc( m_macPrintingPort ) ; }
boolean shellprint (WindowPtr w, boolean fldialog) { /* 9/5/90 dmb: open and close print resources each time we're called. also, make sure we close each page opened, even when errors occur 9/28/91 dmb: for exit of edit mode before printing 4/24/92 dmb: make sure bJDocLoop is bSpoolLoop before calling PrPicFile, as per IM II-155. otherwise, we can get bogus PrErrors */ // classic mac TPPrPort printport; TPrStatus printstatus; THPrint hp = shellprintinfo.printhandle; SInt32 firstPage = 1; SInt32 lastPage = 9999; short i; boolean fl = false; if (w == nil) /*defensive driving*/ return (false); PrOpen (); if (!shellcheckprinterror (true)) return (false); fl = false; /*until sucessfull print, this is return value*/ if (fldialog) { if (!PrJobDialog (hp)) goto exit; } else PrValidate (hp); setcursortype (cursoriswatch); shellupdateallnow (); /*update all windows that were dirtied by the print dialog*/ shellpushglobals (w); (*shellglobals.settextmoderoutine) (false); /*make sure editing changes are accepted*/ pushport (nil); /*save current port on stack*/ shellprintinfo.printport = printport = PrOpenDoc (hp, nil, nil); currentprintport = w; /*prepares for printing*/ (*shellglobals.beginprintroutine) (); /*fills in fields of printinfo record*/ (*shellglobals.setprintinfoproutine) (); //this only counts the number of pages. // wird in classic lastPage gesetzt? if(lastPage > shellprintinfo.ctpages) lastPage = shellprintinfo.ctpages; for (i = 1; i <= lastPage; i++) { /*print one page*/ if (PrError () != noErr) break; PrOpenPage (printport, nil); if (PrError () == noErr) { SetFractEnable (true); fl = (*shellglobals.printroutine) (i); SetFractEnable (false); } PrClosePage (printport); if (!fl) break; if (keyboardescape ()) { PrSetError (iPrAbort); } } /*for*/ PrCloseDoc (printport); if (fl) { if ( (PrError () == noErr) && ((**hp).prJob.bJDocLoop == bSpoolLoop)) { PrPicFile (hp, nil, nil, nil, &printstatus); } fl = shellcheckprinterror (false); } popport (); (*shellglobals.endprintroutine) (); shellpopglobals (); exit: PrClose (); currentprintport = NULL; return (fl); } /*shellprint*/