]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/uma.cpp
Fixed compile errors, warnings and other DSMs, and improved comments.
[wxWidgets.git] / src / mac / uma.cpp
index 49ce364221e11998dfcf7cb990791dc5113b4e6e..2c70ef47b762087471d27444223f1671164acb1b 100644 (file)
@@ -3,9 +3,7 @@
 #include "wx/mac/uma.h"
 #include "wx/mac/aga.h"
 
-#ifdef __UNIX__
-  #include <Carbon/Carbon.h>
-#else
+#ifndef __DARWIN__
   #include <Navigation.h>
 #endif
 
@@ -86,7 +84,7 @@ void UMAInitToolbox( UInt16 inMoreMastersCalls )
 #endif // UMA_USE_WINDOWMGR
 #endif
                
-#ifndef __UNIX__
+#ifndef __DARWIN__
 #if TARGET_CARBON
 // Call currently implicitely done :           InitFloatingWindows() ;
 #else
@@ -291,7 +289,11 @@ void UMAInsertMenu( MenuRef insertMenu , SInt16 afterId )
 
 int gPrOpenCounter = 0 ;
 
-OSStatus UMAPrOpen() 
+#if TARGET_CARBON && PM_USE_SESSION_APIS
+OSStatus UMAPrOpen(PMPrintSession *macPrintSession)
+#else
+OSStatus UMAPrOpen()
+#endif
 {
 #if !TARGET_CARBON
        OSErr err = noErr ;
@@ -308,14 +310,22 @@ OSStatus UMAPrOpen()
        ++gPrOpenCounter ;
        if ( gPrOpenCounter == 1 )
        {
-               err = PMBegin() ;
+  #if PM_USE_SESSION_APIS
+           err = PMCreateSession(macPrintSession) ;
+  #else
+           err = PMBegin() ;
+  #endif
                wxASSERT( err == noErr ) ;
        }
        return err ;
 #endif
 }
 
-OSStatus UMAPrClose() 
+#if TARGET_CARBON && PM_USE_SESSION_APIS
+OSStatus UMAPrClose(PMPrintSession *macPrintSession)
+#else
+OSStatus UMAPrClose()
+#endif
 {
 #if !TARGET_CARBON
        OSErr err = noErr ;
@@ -333,7 +343,12 @@ OSStatus UMAPrClose()
        wxASSERT( gPrOpenCounter >= 1 ) ;
        if ( gPrOpenCounter == 1 )
        {
-               err = PMEnd() ;
+  #if PM_USE_SESSION_APIS
+           err = PMRelease(*macPrintSession) ;
+           *macPrintSession = kPMNoReference;
+  #else
+           err = PMEnd() ;
+  #endif
        }
        --gPrOpenCounter ;
        return err ;