m_printData = printdata ;
m_printData.ConvertToNative() ;
-
+
+#if !TARGET_CARBON
err = UMAPrOpen() ;
+#else
+ err = UMAPrOpen(&m_macPrintPort) ;
+#endif
if ( err )
{
message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+#if !TARGET_CARBON
UMAPrClose() ;
+#else
+ UMAPrClose(&m_macPrintPort) ;
+#endif
}
#if !TARGET_CARBON
m_macPort = (GrafPtr ) m_macPrintPort ;
#else
m_macPrintPort = kPMNoReference ;
+ #if PM_USE_SESSION_APIS
+ err = PMSessionBeginDocument(
+ m_macPrintPort,
+ m_printData.m_macPrintSettings,
+ m_printData.m_macPageFormat);
+ #else
err = PMBeginDocument(
m_printData.m_macPrintSettings,
m_printData.m_macPageFormat,
&m_macPrintPort);
+ #endif
if ( err != noErr || m_macPrintPort == kPMNoReference )
{
message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
- UMAPrClose() ;
+ UMAPrClose(&m_macPrintPort) ;
}
// sets current port
::GetPort( &m_macPort ) ;
#else
if ( m_ok )
{
- err = PMEndDocument(m_macPrintPort);
+ #if PM_USE_SESSION_APIS
+ err = PMSessionEndDocument(m_macPrintPort);
+ #else
+ err = PMEndDocument(m_macPrintPort);
+ #endif
if ( !err )
{
message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+ #if !TARGET_CARBON
UMAPrClose() ;
+ #else
+ UMAPrClose(&m_macPrintPort) ;
+ #endif
}
+ #if !TARGET_CARBON
UMAPrClose() ;
+ #else
+ UMAPrClose(&m_macPrintPort) ;
+ #endif
}
#endif
}
m_ok = FALSE ;
}
#else
- err = PMBeginPage(m_macPrintPort, nil);
+ #if PM_USE_SESSION_APIS
+ err = PMSessionBeginPage(m_macPrintPort,
+ m_printData.m_macPageFormat,
+ nil);
+ #else
+ err = PMBeginPage(m_macPrintPort, nil);
+ #endif
if ( err )
{
message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+ #if PM_USE_SESSION_APIS
+ PMSessionEndPage(m_macPrintPort);
+ PMSessionEndDocument(m_macPrintPort);
+ #else
PMEndPage(m_macPrintPort);
PMEndDocument(m_macPrintPort);
- UMAPrClose() ;
+ #endif
+ UMAPrClose(&m_macPrintPort) ;
::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ;
}
m_ok = FALSE ;
}
#else
+ #if PM_USE_SESSION_APIS
+ err = PMSessionEndPage(m_macPrintPort);
+ #else
err = PMEndPage(m_macPrintPort);
+ #endif
if ( err )
{
message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+ #if PM_USE_SESSION_APIS
+ PMSessionEndDocument(m_macPrintPort);
+ #else
PMEndDocument(m_macPrintPort);
- UMAPrClose() ;
+ #endif
+ UMAPrClose(&m_macPrintPort) ;
::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ;
}
#include "wx/mac/uma.h"
#include "wx/mac/aga.h"
-#ifdef __UNIX__
- #include <Carbon/Carbon.h>
-#else
+#ifndef __UNIX__
#include <Navigation.h>
#endif
int gPrOpenCounter = 0 ;
-OSStatus UMAPrOpen()
+#if !TARGET_CARBON
+OSStatus UMAPrOpen()
+#else
+OSStatus UMAPrOpen(PMPrintSession *macPrintPort)
+#endif
{
#if !TARGET_CARBON
OSErr err = noErr ;
++gPrOpenCounter ;
if ( gPrOpenCounter == 1 )
{
- err = PMBegin() ;
+ #if PM_USE_SESSION_APIS
+ err = PMCreateSession(macPrintPort) ;
+ #else
+ err = PMBegin() ;
+ #endif
wxASSERT( err == noErr ) ;
}
return err ;
#endif
}
-OSStatus UMAPrClose()
+#if !TARGET_CARBON
+OSStatus UMAPrClose()
+#else
+OSStatus UMAPrClose(PMPrintSession *macPrintPort)
+#endif
{
#if !TARGET_CARBON
OSErr err = noErr ;
wxASSERT( gPrOpenCounter >= 1 ) ;
if ( gPrOpenCounter == 1 )
{
- err = PMEnd() ;
+ #if PM_USE_SESSION_APIS
+ err = PMRelease(*macPrintPort) ;
+ #else
+ err = PMEnd() ;
+ #endif
}
--gPrOpenCounter ;
return err ;
m_printData = printdata ;
m_printData.ConvertToNative() ;
-
+
+#if !TARGET_CARBON
err = UMAPrOpen() ;
+#else
+ err = UMAPrOpen(&m_macPrintPort) ;
+#endif
if ( err )
{
message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+#if !TARGET_CARBON
UMAPrClose() ;
+#else
+ UMAPrClose(&m_macPrintPort) ;
+#endif
}
#if !TARGET_CARBON
m_macPort = (GrafPtr ) m_macPrintPort ;
#else
m_macPrintPort = kPMNoReference ;
+ #if PM_USE_SESSION_APIS
+ err = PMSessionBeginDocument(
+ m_macPrintPort,
+ m_printData.m_macPrintSettings,
+ m_printData.m_macPageFormat);
+ #else
err = PMBeginDocument(
m_printData.m_macPrintSettings,
m_printData.m_macPageFormat,
&m_macPrintPort);
+ #endif
if ( err != noErr || m_macPrintPort == kPMNoReference )
{
message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
- UMAPrClose() ;
+ UMAPrClose(&m_macPrintPort) ;
}
// sets current port
::GetPort( &m_macPort ) ;
#else
if ( m_ok )
{
- err = PMEndDocument(m_macPrintPort);
+ #if PM_USE_SESSION_APIS
+ err = PMSessionEndDocument(m_macPrintPort);
+ #else
+ err = PMEndDocument(m_macPrintPort);
+ #endif
if ( !err )
{
message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+ #if !TARGET_CARBON
UMAPrClose() ;
+ #else
+ UMAPrClose(&m_macPrintPort) ;
+ #endif
}
+ #if !TARGET_CARBON
UMAPrClose() ;
+ #else
+ UMAPrClose(&m_macPrintPort) ;
+ #endif
}
#endif
}
m_ok = FALSE ;
}
#else
- err = PMBeginPage(m_macPrintPort, nil);
+ #if PM_USE_SESSION_APIS
+ err = PMSessionBeginPage(m_macPrintPort,
+ m_printData.m_macPageFormat,
+ nil);
+ #else
+ err = PMBeginPage(m_macPrintPort, nil);
+ #endif
if ( err )
{
message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+ #if PM_USE_SESSION_APIS
+ PMSessionEndPage(m_macPrintPort);
+ PMSessionEndDocument(m_macPrintPort);
+ #else
PMEndPage(m_macPrintPort);
PMEndDocument(m_macPrintPort);
- UMAPrClose() ;
+ #endif
+ UMAPrClose(&m_macPrintPort) ;
::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ;
}
m_ok = FALSE ;
}
#else
+ #if PM_USE_SESSION_APIS
+ err = PMSessionEndPage(m_macPrintPort);
+ #else
err = PMEndPage(m_macPrintPort);
+ #endif
if ( err )
{
message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
+ #if PM_USE_SESSION_APIS
+ PMSessionEndDocument(m_macPrintPort);
+ #else
PMEndDocument(m_macPrintPort);
- UMAPrClose() ;
+ #endif
+ UMAPrClose(&m_macPrintPort) ;
::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ;
}
#include "wx/mac/uma.h"
#include "wx/mac/aga.h"
-#ifdef __UNIX__
- #include <Carbon/Carbon.h>
-#else
+#ifndef __UNIX__
#include <Navigation.h>
#endif
int gPrOpenCounter = 0 ;
-OSStatus UMAPrOpen()
+#if !TARGET_CARBON
+OSStatus UMAPrOpen()
+#else
+OSStatus UMAPrOpen(PMPrintSession *macPrintPort)
+#endif
{
#if !TARGET_CARBON
OSErr err = noErr ;
++gPrOpenCounter ;
if ( gPrOpenCounter == 1 )
{
- err = PMBegin() ;
+ #if PM_USE_SESSION_APIS
+ err = PMCreateSession(macPrintPort) ;
+ #else
+ err = PMBegin() ;
+ #endif
wxASSERT( err == noErr ) ;
}
return err ;
#endif
}
-OSStatus UMAPrClose()
+#if !TARGET_CARBON
+OSStatus UMAPrClose()
+#else
+OSStatus UMAPrClose(PMPrintSession *macPrintPort)
+#endif
{
#if !TARGET_CARBON
OSErr err = noErr ;
wxASSERT( gPrOpenCounter >= 1 ) ;
if ( gPrOpenCounter == 1 )
{
- err = PMEnd() ;
+ #if PM_USE_SESSION_APIS
+ err = PMRelease(*macPrintPort) ;
+ #else
+ err = PMEnd() ;
+ #endif
}
--gPrOpenCounter ;
return err ;