// --------------------------------------------------------------------------------------------- static pascal void MyPrintDialogDoneProc(PMPrintSession printSession, WindowRef documentWindow, Boolean accepted) { OSStatus err = noErr, tempErr; void *ourDataP = GetOurWindowProperty(documentWindow); if(ourDataP) { PMPrintSettings printSettings = GetPrintSettingsFromPrivateData(ourDataP); // only run the print loop if the user accepted the print dialog. if(accepted){ err = MyDoPrintLoop(printSession, GetPageFormatFromPrivateData(ourDataP), printSettings, ourDataP, &gMyPrintingProcsWithStatusDialog); } // We're done with the print settings on our private data so // set them to NULL which causes the print settings to be released tempErr = SetPrintSettingsOnPrivateData(ourDataP, NULL); if(err == noErr) err = tempErr; }// else Assert(...); // now we release the session we created to do the Print dialog tempErr = PMRelease(printSession); if(err == noErr) err = tempErr; DoErrorAlert(err, kMyPrintErrorFormatStrKey); }
// -------------------------------------------------------------------------------------------------------------- static pascal void MyPrintDialogDoneProc(PMPrintSession printSession, WindowRef documentWindow, Boolean accepted) { OSStatus status = noErr, tempErr; void *ourDataP = GetOurWindowProperty(documentWindow); if(ourDataP) { PMPrintSettings printSettings = GetPrintSettingsFromPrivateData(ourDataP); // only run the print loop if the user accepted the print dialog. if(accepted) status = MyDoPrintLoop(printSession, GetPageFormatFromPrivateData(ourDataP), printSettings, ourDataP); SetPrintSettingsOnPrivateData(ourDataP, NULL); tempErr = PMRelease(printSettings); if(status == noErr) status = tempErr; } // now we release the session we created to do the Print dialog tempErr = PMRelease(printSession); if(status == noErr) status = tempErr; DoErrorAlert(status, kMyPrintErrorFormatStrKey); }