diff --git a/src/mac/carbon/dcprint.cpp b/src/mac/carbon/dcprint.cpp index 8d809ced36..360e54a62a 100644 --- a/src/mac/carbon/dcprint.cpp +++ b/src/mac/carbon/dcprint.cpp @@ -80,9 +80,9 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) // the driver has changed in the mean time, should we pop up a page setup dialog ? if ( !::PrStlDialog( (THPrint) m_printData.m_macPrintSettings ) ) { - UMAPrClose(NULL) ; - m_ok = FALSE; - return; + UMAPrClose(NULL) ; + m_ok = FALSE; + return; } } err = PrError() ; @@ -96,51 +96,6 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) return; } ::GetPort( &macPrintFormerPort ) ; - /* - m_macPrintSessionPort = ::PrOpenDoc( (THPrint) m_printData.m_macPrintSettings , NULL , NULL ) ; - err = PrError() ; - if ( err ) - { - message.Printf( "Print Error %ld", err ) ; - wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - dialog.ShowModal(); - UMAPrClose(NULL) ; - m_ok = FALSE; - return; - } - // sets current port - m_macPort = (GrafPtr ) m_macPrintSessionPort ; - */ -#else - /* - #if PM_USE_SESSION_APIS - err = PMSessionBeginDocument((PMPrintSession)m_macPrintSessionPort, - (PMPrintSettings)m_printData.m_macPrintSettings, - (PMPageFormat)m_printData.m_macPageFormat); - if ( err != noErr ) - #else - m_macPrintSessionPort = kPMNoReference ; - err = PMBeginDocument( - m_printData.m_macPrintSettings, - m_printData.m_macPageFormat, - &m_macPrintSessionPort); - if ( err != noErr || m_macPrintSessionPort == kPMNoReference ) - #endif - { - message.Printf( "Print Error %ld", err ) ; - wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - dialog.ShowModal(); - #if TARGET_CARBON && PM_USE_SESSION_APIS - PMRelease(&m_macPrintSessionPort) ; - #else - UMAPrClose(NULL) ; - #endif - m_ok = FALSE; - return; - } - // sets current port - ::GetPort( (GrafPtr *)&m_macPort ) ; - */ #endif m_ok = TRUE ; m_minY = m_minX = 0 ; @@ -176,45 +131,12 @@ wxPrinterDC::~wxPrinterDC(void) #if !TARGET_CARBON if ( m_ok ) { - /* - ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ; - err = PrError() ; - - if ( err == noErr ) - { - if ( (**(THPrint)m_printData.m_macPrintSettings).prJob.bJDocLoop == bSpoolLoop ) - { - TPrStatus status ; - ::PrPicFile( (THPrint) m_printData.m_macPrintSettings , NULL , NULL , NULL , &status ) ; - } - } - else - { - message.Printf( "Print Error %ld", err ) ; - wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - dialog.ShowModal(); - } - */ ::UMAPrClose(NULL) ; -// ::SetPort( macPrintFormerPort ) ; ::SetPort( LMGetWMgrPort() ) ; } #else if ( m_ok ) { -/* - #if PM_USE_SESSION_APIS - err = PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort); - #else - err = PMEndDocument(m_macPrintSessionPort); - #endif - if ( err != noErr ) - { - message.Printf( "Print Error %ld", err ) ; - wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - dialog.ShowModal(); - } - */ #if TARGET_CARBON && PM_USE_SESSION_APIS PMRelease(&m_macPrintSessionPort) ; #else @@ -307,9 +229,24 @@ void wxPrinterDC::EndDoc(void) #if !TARGET_CARBON if ( m_ok ) { - ::UMAPrClose(NULL) ; -// ::SetPort( macPrintFormerPort ) ; - ::SetPort( LMGetWMgrPort() ) ; + ::PrCloseDoc( (TPrPort*) m_macPrintSessionPort ) ; + err = PrError() ; + + if ( !err ) + { + if ( (** (THPrint) m_printData.m_macPrintSettings).prJob.bJDocLoop == bSpoolLoop ) + { + TPrStatus status ; + ::PrPicFile( (THPrint) m_printData.m_macPrintSettings , NULL , NULL , NULL , &status ) ; + } + } + else + { + message.Printf( "Print Error %d", err ) ; + wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; + UMAPrClose(NULL) ; + m_ok = false ; + } } #else if ( m_ok ) diff --git a/src/mac/dcprint.cpp b/src/mac/dcprint.cpp index 8d809ced36..360e54a62a 100644 --- a/src/mac/dcprint.cpp +++ b/src/mac/dcprint.cpp @@ -80,9 +80,9 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) // the driver has changed in the mean time, should we pop up a page setup dialog ? if ( !::PrStlDialog( (THPrint) m_printData.m_macPrintSettings ) ) { - UMAPrClose(NULL) ; - m_ok = FALSE; - return; + UMAPrClose(NULL) ; + m_ok = FALSE; + return; } } err = PrError() ; @@ -96,51 +96,6 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) return; } ::GetPort( &macPrintFormerPort ) ; - /* - m_macPrintSessionPort = ::PrOpenDoc( (THPrint) m_printData.m_macPrintSettings , NULL , NULL ) ; - err = PrError() ; - if ( err ) - { - message.Printf( "Print Error %ld", err ) ; - wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - dialog.ShowModal(); - UMAPrClose(NULL) ; - m_ok = FALSE; - return; - } - // sets current port - m_macPort = (GrafPtr ) m_macPrintSessionPort ; - */ -#else - /* - #if PM_USE_SESSION_APIS - err = PMSessionBeginDocument((PMPrintSession)m_macPrintSessionPort, - (PMPrintSettings)m_printData.m_macPrintSettings, - (PMPageFormat)m_printData.m_macPageFormat); - if ( err != noErr ) - #else - m_macPrintSessionPort = kPMNoReference ; - err = PMBeginDocument( - m_printData.m_macPrintSettings, - m_printData.m_macPageFormat, - &m_macPrintSessionPort); - if ( err != noErr || m_macPrintSessionPort == kPMNoReference ) - #endif - { - message.Printf( "Print Error %ld", err ) ; - wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - dialog.ShowModal(); - #if TARGET_CARBON && PM_USE_SESSION_APIS - PMRelease(&m_macPrintSessionPort) ; - #else - UMAPrClose(NULL) ; - #endif - m_ok = FALSE; - return; - } - // sets current port - ::GetPort( (GrafPtr *)&m_macPort ) ; - */ #endif m_ok = TRUE ; m_minY = m_minX = 0 ; @@ -176,45 +131,12 @@ wxPrinterDC::~wxPrinterDC(void) #if !TARGET_CARBON if ( m_ok ) { - /* - ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ; - err = PrError() ; - - if ( err == noErr ) - { - if ( (**(THPrint)m_printData.m_macPrintSettings).prJob.bJDocLoop == bSpoolLoop ) - { - TPrStatus status ; - ::PrPicFile( (THPrint) m_printData.m_macPrintSettings , NULL , NULL , NULL , &status ) ; - } - } - else - { - message.Printf( "Print Error %ld", err ) ; - wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - dialog.ShowModal(); - } - */ ::UMAPrClose(NULL) ; -// ::SetPort( macPrintFormerPort ) ; ::SetPort( LMGetWMgrPort() ) ; } #else if ( m_ok ) { -/* - #if PM_USE_SESSION_APIS - err = PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort); - #else - err = PMEndDocument(m_macPrintSessionPort); - #endif - if ( err != noErr ) - { - message.Printf( "Print Error %ld", err ) ; - wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - dialog.ShowModal(); - } - */ #if TARGET_CARBON && PM_USE_SESSION_APIS PMRelease(&m_macPrintSessionPort) ; #else @@ -307,9 +229,24 @@ void wxPrinterDC::EndDoc(void) #if !TARGET_CARBON if ( m_ok ) { - ::UMAPrClose(NULL) ; -// ::SetPort( macPrintFormerPort ) ; - ::SetPort( LMGetWMgrPort() ) ; + ::PrCloseDoc( (TPrPort*) m_macPrintSessionPort ) ; + err = PrError() ; + + if ( !err ) + { + if ( (** (THPrint) m_printData.m_macPrintSettings).prJob.bJDocLoop == bSpoolLoop ) + { + TPrStatus status ; + ::PrPicFile( (THPrint) m_printData.m_macPrintSettings , NULL , NULL , NULL , &status ) ; + } + } + else + { + message.Printf( "Print Error %d", err ) ; + wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; + UMAPrClose(NULL) ; + m_ok = false ; + } } #else if ( m_ok )