From 87df17a11b0017d31c09f767bd921abb27193bee Mon Sep 17 00:00:00 2001 From: Gilles Depeyrot Date: Sat, 23 Jun 2001 20:38:12 +0000 Subject: [PATCH] corrected use of Print Manager Session APIs for Carbon targets git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/dcprint.cpp | 34 ++++++++++++++++++++-------------- src/mac/carbon/uma.cpp | 12 ++++++------ src/mac/dcprint.cpp | 34 ++++++++++++++++++++-------------- src/mac/uma.cpp | 12 ++++++------ 4 files changed, 52 insertions(+), 40 deletions(-) diff --git a/src/mac/carbon/dcprint.cpp b/src/mac/carbon/dcprint.cpp index 2238c6ecfd..904c5eedca 100644 --- a/src/mac/carbon/dcprint.cpp +++ b/src/mac/carbon/dcprint.cpp @@ -42,19 +42,19 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) m_printData = printdata ; m_printData.ConvertToNative() ; -#if !TARGET_CARBON - err = UMAPrOpen() ; -#else +#if PM_USE_SESSION_APIS err = UMAPrOpen(&m_macPrintPort) ; +#else + err = UMAPrOpen() ; #endif if ( err ) { message.Printf( "Print Error %d", err ) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; -#if !TARGET_CARBON - UMAPrClose() ; -#else +#if PM_USE_SESSION_APIS UMAPrClose(&m_macPrintPort) ; +#else + UMAPrClose() ; #endif } @@ -99,7 +99,11 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) { message.Printf( "Print Error %d", err ) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; + #if PM_USE_SESSION_APIS UMAPrClose(&m_macPrintPort) ; + #else + UMAPrClose() ; + #endif } // sets current port ::GetPort( &m_macPort ) ; @@ -153,16 +157,16 @@ wxPrinterDC::~wxPrinterDC(void) { message.Printf( "Print Error %d", err ) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - #if !TARGET_CARBON - UMAPrClose() ; - #else + #if PM_USE_SESSION_APIS UMAPrClose(&m_macPrintPort) ; + #else + UMAPrClose() ; #endif } - #if !TARGET_CARBON - UMAPrClose() ; + #if PM_USE_SESSION_APIS + UMAPrClose(&m_macPrintPort) ; #else - UMAPrClose(&m_macPrintPort) ; + UMAPrClose() ; #endif } #endif @@ -235,11 +239,12 @@ void wxPrinterDC::StartPage(void) #if PM_USE_SESSION_APIS PMSessionEndPage(m_macPrintPort); PMSessionEndDocument(m_macPrintPort); + UMAPrClose(&m_macPrintPort) ; #else PMEndPage(m_macPrintPort); PMEndDocument(m_macPrintPort); + UMAPrClose() ; #endif - UMAPrClose(&m_macPrintPort) ; ::SetPort( macPrintFormerPort ) ; m_ok = FALSE ; } @@ -278,10 +283,11 @@ void wxPrinterDC::EndPage(void) wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; #if PM_USE_SESSION_APIS PMSessionEndDocument(m_macPrintPort); + UMAPrClose(&m_macPrintPort) ; #else PMEndDocument(m_macPrintPort); + UMAPrClose() ; #endif - UMAPrClose(&m_macPrintPort) ; ::SetPort( macPrintFormerPort ) ; m_ok = FALSE ; } diff --git a/src/mac/carbon/uma.cpp b/src/mac/carbon/uma.cpp index 044ef97c96..e0e3bdf35f 100644 --- a/src/mac/carbon/uma.cpp +++ b/src/mac/carbon/uma.cpp @@ -289,10 +289,10 @@ void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) int gPrOpenCounter = 0 ; -#if !TARGET_CARBON -OSStatus UMAPrOpen() -#else +#if PM_USE_SESSION_APIS OSStatus UMAPrOpen(PMPrintSession *macPrintPort) +#else +OSStatus UMAPrOpen() #endif { #if !TARGET_CARBON @@ -321,10 +321,10 @@ OSStatus UMAPrOpen(PMPrintSession *macPrintPort) #endif } -#if !TARGET_CARBON -OSStatus UMAPrClose() -#else +#if PM_USE_SESSION_APIS OSStatus UMAPrClose(PMPrintSession *macPrintPort) +#else +OSStatus UMAPrClose() #endif { #if !TARGET_CARBON diff --git a/src/mac/dcprint.cpp b/src/mac/dcprint.cpp index 2238c6ecfd..904c5eedca 100644 --- a/src/mac/dcprint.cpp +++ b/src/mac/dcprint.cpp @@ -42,19 +42,19 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) m_printData = printdata ; m_printData.ConvertToNative() ; -#if !TARGET_CARBON - err = UMAPrOpen() ; -#else +#if PM_USE_SESSION_APIS err = UMAPrOpen(&m_macPrintPort) ; +#else + err = UMAPrOpen() ; #endif if ( err ) { message.Printf( "Print Error %d", err ) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; -#if !TARGET_CARBON - UMAPrClose() ; -#else +#if PM_USE_SESSION_APIS UMAPrClose(&m_macPrintPort) ; +#else + UMAPrClose() ; #endif } @@ -99,7 +99,11 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata) { message.Printf( "Print Error %d", err ) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; + #if PM_USE_SESSION_APIS UMAPrClose(&m_macPrintPort) ; + #else + UMAPrClose() ; + #endif } // sets current port ::GetPort( &m_macPort ) ; @@ -153,16 +157,16 @@ wxPrinterDC::~wxPrinterDC(void) { message.Printf( "Print Error %d", err ) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; - #if !TARGET_CARBON - UMAPrClose() ; - #else + #if PM_USE_SESSION_APIS UMAPrClose(&m_macPrintPort) ; + #else + UMAPrClose() ; #endif } - #if !TARGET_CARBON - UMAPrClose() ; + #if PM_USE_SESSION_APIS + UMAPrClose(&m_macPrintPort) ; #else - UMAPrClose(&m_macPrintPort) ; + UMAPrClose() ; #endif } #endif @@ -235,11 +239,12 @@ void wxPrinterDC::StartPage(void) #if PM_USE_SESSION_APIS PMSessionEndPage(m_macPrintPort); PMSessionEndDocument(m_macPrintPort); + UMAPrClose(&m_macPrintPort) ; #else PMEndPage(m_macPrintPort); PMEndDocument(m_macPrintPort); + UMAPrClose() ; #endif - UMAPrClose(&m_macPrintPort) ; ::SetPort( macPrintFormerPort ) ; m_ok = FALSE ; } @@ -278,10 +283,11 @@ void wxPrinterDC::EndPage(void) wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; #if PM_USE_SESSION_APIS PMSessionEndDocument(m_macPrintPort); + UMAPrClose(&m_macPrintPort) ; #else PMEndDocument(m_macPrintPort); + UMAPrClose() ; #endif - UMAPrClose(&m_macPrintPort) ; ::SetPort( macPrintFormerPort ) ; m_ok = FALSE ; } diff --git a/src/mac/uma.cpp b/src/mac/uma.cpp index 044ef97c96..e0e3bdf35f 100644 --- a/src/mac/uma.cpp +++ b/src/mac/uma.cpp @@ -289,10 +289,10 @@ void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId ) int gPrOpenCounter = 0 ; -#if !TARGET_CARBON -OSStatus UMAPrOpen() -#else +#if PM_USE_SESSION_APIS OSStatus UMAPrOpen(PMPrintSession *macPrintPort) +#else +OSStatus UMAPrOpen() #endif { #if !TARGET_CARBON @@ -321,10 +321,10 @@ OSStatus UMAPrOpen(PMPrintSession *macPrintPort) #endif } -#if !TARGET_CARBON -OSStatus UMAPrClose() -#else +#if PM_USE_SESSION_APIS OSStatus UMAPrClose(PMPrintSession *macPrintPort) +#else +OSStatus UMAPrClose() #endif { #if !TARGET_CARBON -- 2.45.2