- data->SetFromPage( from ) ;
- data->SetToPage( to ) ;
-}
-
-void wxMacCarbonPrintData::TransferFrom( wxPrintDialogData* data )
-{
- PMSetPageRange( m_macPrintSettings , data->GetMinPage() , data->GetMaxPage() ) ;
- PMSetCopies( m_macPrintSettings , data->GetNoCopies() , false ) ;
- PMSetFirstPage( m_macPrintSettings , data->GetFromPage() , false ) ;
-
- int toPage = data->GetToPage();
- if (toPage < 1)
- toPage = data->GetFromPage();
- PMSetLastPage( m_macPrintSettings , toPage , false ) ;
-}
-
-void wxMacCarbonPrintData::CopyFrom( wxNativePrintData* d )
-{
- wxMacCarbonPrintData *data = (wxMacCarbonPrintData*) d ;
- if ( data->m_macPrintSession != kPMNoReference )
- PMRetain( data->m_macPrintSession ) ;
- if ( m_macPrintSession != kPMNoReference )
- {
- PMRelease( m_macPrintSession ) ;
- m_macPrintSession = kPMNoReference ;
- }
- if ( data->m_macPrintSession != kPMNoReference )
- m_macPrintSession = data->m_macPrintSession ;
-
- if ( data->m_macPrintSettings != kPMNoPrintSettings )
- PMRetain( data->m_macPrintSettings ) ;
- if ( m_macPrintSettings != kPMNoPrintSettings )
- {
- PMRelease( m_macPrintSettings ) ;
- m_macPrintSettings = kPMNoPrintSettings ;
- }
- if ( data->m_macPrintSettings != kPMNoPrintSettings )
- m_macPrintSettings = data->m_macPrintSettings ;
-
- if ( data->m_macPageFormat != kPMNoPageFormat )
- PMRetain( data->m_macPageFormat ) ;
- if ( m_macPageFormat != kPMNoPageFormat )
- {
- PMRelease( m_macPageFormat ) ;
- m_macPageFormat = kPMNoPageFormat ;
- }
- if ( data->m_macPageFormat != kPMNoPageFormat )
- m_macPageFormat = data->m_macPageFormat ;
-}
-
-int wxMacCarbonPrintData::ShowPrintDialog()
-{
- int result = wxID_CANCEL ;
- OSErr err = noErr ;
- wxString message ;
-
- Boolean accepted;
-
- {
- // Display the Print dialog.
- if (err == noErr)
- {
- err = PMSessionPrintDialog( m_macPrintSession,
- m_macPrintSettings,
- m_macPageFormat,
- &accepted);
- if ((err == noErr) && !accepted)
- {
- err = kPMCancel; // user clicked Cancel button
- }
- }
- if ( err == noErr )
- {
- result = wxID_OK ;
- }
- }
- if ((err != noErr) && (err != kPMCancel))
- {
- message.Printf( wxT("Print Error %d"), err ) ;
- wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
- dialog.ShowModal();
- }
-
- return result ;
-}
-
-int wxMacCarbonPrintData::ShowPageSetupDialog()
-{
- int result = wxID_CANCEL ;
- OSErr err = noErr ;
- wxString message ;
-
- Boolean accepted;
- {
- // Display the Page Setup dialog.
- if (err == noErr)
- {
- err = PMSessionPageSetupDialog( m_macPrintSession,
- m_macPageFormat,
- &accepted);
- if ((err == noErr) && !accepted)
- {
- err = kPMCancel; // user clicked Cancel button
- }
- }
-
- // If the user did not cancel, flatten and save the PageFormat object
- // with our document.
- if (err == noErr) {
- result = wxID_OK ;
- }
- }
- if ((err != noErr) && (err != kPMCancel))