unified UMAPrOpen/UMAPrClose prototypes for session and non-session printing

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13492 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Gilles Depeyrot
2002-01-10 21:31:35 +00:00
parent 925ee99f10
commit a3d3d3bf6c
7 changed files with 100 additions and 81 deletions

View File

@@ -54,13 +54,8 @@ void UMAInsertMenuItem( MenuRef menu , StringPtr label , MenuItemIndex item ,
void UMAShowWatchCursor() ; void UMAShowWatchCursor() ;
void UMAShowArrowCursor() ; void UMAShowArrowCursor() ;
#if TARGET_CARBON && PM_USE_SESSION_APIS OSStatus UMAPrOpen(void *macPrintSession) ;
OSStatus UMAPrOpen(PMPrintSession *macPrintSession) ; OSStatus UMAPrClose(void *macPrintSession) ;
OSStatus UMAPrClose(PMPrintSession *macPrintSession) ;
#else
OSStatus UMAPrOpen() ;
OSStatus UMAPrClose() ;
#endif
// window manager // window manager

View File

@@ -28,6 +28,13 @@
#include <math.h> #include <math.h>
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
#if defined(TARGET_CARBON) && !defined(__DARWIN__)
# if PM_USE_SESSION_APIS
# include <PMCore.h>
# endif
# include <PMApplication.h>
#endif
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxPrinterDC, wxDC) IMPLEMENT_CLASS(wxPrinterDC, wxDC)
#endif #endif
@@ -43,10 +50,10 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
m_printData.ConvertToNative() ; m_printData.ConvertToNative() ;
#if TARGET_CARBON && PM_USE_SESSION_APIS #if TARGET_CARBON && PM_USE_SESSION_APIS
err = UMAPrOpen((PMPrintSession *)&m_macPrintSessionPort) ; err = UMAPrOpen(&m_macPrintSessionPort) ;
if ( err != noErr || m_macPrintSessionPort == kPMNoData ) if ( err != noErr || m_macPrintSessionPort == kPMNoData )
#else #else
err = UMAPrOpen() ; err = UMAPrOpen(NULL) ;
if ( err != noErr ) if ( err != noErr )
#endif #endif
{ {
@@ -54,9 +61,9 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
#if TARGET_CARBON && PM_USE_SESSION_APIS #if TARGET_CARBON && PM_USE_SESSION_APIS
UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ; UMAPrClose(&m_macPrintSessionPort) ;
#else #else
UMAPrClose() ; UMAPrClose(NULL) ;
#endif #endif
m_ok = FALSE; m_ok = FALSE;
return; return;
@@ -74,7 +81,7 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
message.Printf( "Print Error %d", err ) ; message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
UMAPrClose() ; UMAPrClose(NULL) ;
m_ok = FALSE; m_ok = FALSE;
return; return;
} }
@@ -86,7 +93,7 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
message.Printf( "Print Error %d", err ) ; message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
UMAPrClose() ; UMAPrClose(NULL) ;
m_ok = FALSE; m_ok = FALSE;
return; return;
} }
@@ -111,9 +118,9 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
#if TARGET_CARBON && PM_USE_SESSION_APIS #if TARGET_CARBON && PM_USE_SESSION_APIS
UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ; UMAPrClose(&m_macPrintSessionPort) ;
#else #else
UMAPrClose() ; UMAPrClose(NULL) ;
#endif #endif
m_ok = FALSE; m_ok = FALSE;
return; return;
@@ -133,9 +140,9 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
#if TARGET_CARBON && PM_USE_SESSION_APIS #if TARGET_CARBON && PM_USE_SESSION_APIS
UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ; UMAPrClose(&m_macPrintSessionPort) ;
#else #else
UMAPrClose() ; UMAPrClose(NULL) ;
#endif #endif
m_ok = FALSE; m_ok = FALSE;
return; return;
@@ -172,7 +179,7 @@ wxPrinterDC::~wxPrinterDC(void)
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
} }
::UMAPrClose() ; ::UMAPrClose(NULL) ;
// ::SetPort( macPrintFormerPort ) ; // ::SetPort( macPrintFormerPort ) ;
::SetPort( LMGetWMgrPort() ) ; ::SetPort( LMGetWMgrPort() ) ;
} }
@@ -191,9 +198,9 @@ wxPrinterDC::~wxPrinterDC(void)
dialog.ShowModal(); dialog.ShowModal();
} }
#if TARGET_CARBON && PM_USE_SESSION_APIS #if TARGET_CARBON && PM_USE_SESSION_APIS
UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ; UMAPrClose(&m_macPrintSessionPort) ;
#else #else
UMAPrClose() ; UMAPrClose(NULL) ;
#endif #endif
} }
#endif #endif
@@ -247,7 +254,7 @@ void wxPrinterDC::StartPage(void)
dialog.ShowModal(); dialog.ShowModal();
::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ; ::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ; ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
::UMAPrClose() ; ::UMAPrClose(NULL) ;
::SetPort( macPrintFormerPort ) ; ::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ; m_ok = FALSE ;
} }
@@ -267,11 +274,11 @@ void wxPrinterDC::StartPage(void)
#if PM_USE_SESSION_APIS #if PM_USE_SESSION_APIS
PMSessionEndPage((PMPrintSession)m_macPrintSessionPort); PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort); PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ; UMAPrClose(&m_macPrintSessionPort) ;
#else #else
PMEndPage(m_macPrintSessionPort); PMEndPage(m_macPrintSessionPort);
PMEndDocument(m_macPrintSessionPort); PMEndDocument(m_macPrintSessionPort);
UMAPrClose() ; UMAPrClose(NULL) ;
#endif #endif
::SetPort( macPrintFormerPort ) ; ::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ; m_ok = FALSE ;
@@ -296,7 +303,7 @@ void wxPrinterDC::EndPage(void)
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ; ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
::UMAPrClose() ; ::UMAPrClose(NULL) ;
::SetPort( macPrintFormerPort ) ; ::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ; m_ok = FALSE ;
} }
@@ -313,10 +320,10 @@ void wxPrinterDC::EndPage(void)
dialog.ShowModal(); dialog.ShowModal();
#if PM_USE_SESSION_APIS #if PM_USE_SESSION_APIS
PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort); PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ; UMAPrClose(&m_macPrintSessionPort) ;
#else #else
PMEndDocument(m_macPrintSessionPort); PMEndDocument(m_macPrintSessionPort);
UMAPrClose() ; UMAPrClose(NULL) ;
#endif #endif
::SetPort( macPrintFormerPort ) ; ::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ; m_ok = FALSE ;

View File

@@ -19,6 +19,13 @@
#include "wx/msgdlg.h" #include "wx/msgdlg.h"
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
#if defined(TARGET_CARBON) && !defined(__DARWIN__)
# if PM_USE_SESSION_APIS
# include <PMCore.h>
# endif
# include <PMApplication.h>
#endif
// Use generic page setup dialog: use your own native one if one exists. // Use generic page setup dialog: use your own native one if one exists.
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
@@ -72,7 +79,7 @@ int wxPrintDialog::ShowModal()
wxString message ; wxString message ;
#if !TARGET_CARBON #if !TARGET_CARBON
err = ::UMAPrOpen() ; err = ::UMAPrOpen(NULL) ;
if ( err == noErr ) if ( err == noErr )
{ {
m_printDialogData.ConvertToNative() ; m_printDialogData.ConvertToNative() ;
@@ -89,7 +96,7 @@ int wxPrintDialog::ShowModal()
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
} }
::UMAPrClose() ; ::UMAPrClose(NULL) ;
#else #else
#if PM_USE_SESSION_APIS #if PM_USE_SESSION_APIS
PMPrintSession macPrintSession = kPMNoReference; PMPrintSession macPrintSession = kPMNoReference;
@@ -224,7 +231,7 @@ int wxPageSetupDialog::ShowModal()
wxString message ; wxString message ;
#if !TARGET_CARBON #if !TARGET_CARBON
err = ::UMAPrOpen() ; err = ::UMAPrOpen(NULL) ;
if ( err == noErr ) if ( err == noErr )
{ {
m_pageSetupData.ConvertToNative() ; m_pageSetupData.ConvertToNative() ;
@@ -241,7 +248,7 @@ int wxPageSetupDialog::ShowModal()
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
} }
::UMAPrClose() ; ::UMAPrClose(NULL) ;
#else #else
#if PM_USE_SESSION_APIS #if PM_USE_SESSION_APIS
PMPrintSession macPrintSession = kPMNoReference; PMPrintSession macPrintSession = kPMNoReference;

View File

@@ -4,7 +4,13 @@
#include <MacTextEditor.h> #include <MacTextEditor.h>
#ifndef __DARWIN__ #ifndef __DARWIN__
#include <Navigation.h> # include <Navigation.h>
# if defined(TARGET_CARBON)
# if PM_USE_SESSION_APIS
# include <PMCore.h>
# endif
# include <PMApplication.h>
# endif
#endif #endif
// since we have decided that we only support 8.6 upwards we are // since we have decided that we only support 8.6 upwards we are
@@ -255,11 +261,7 @@ void UMAInsertMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16
int gPrOpenCounter = 0 ; int gPrOpenCounter = 0 ;
#if TARGET_CARBON && PM_USE_SESSION_APIS OSStatus UMAPrOpen(void *macPrintSession)
OSStatus UMAPrOpen(PMPrintSession *macPrintSession)
#else
OSStatus UMAPrOpen()
#endif
{ {
#if !TARGET_CARBON #if !TARGET_CARBON
OSErr err = noErr ; OSErr err = noErr ;
@@ -277,7 +279,7 @@ OSStatus UMAPrOpen()
if ( gPrOpenCounter == 1 ) if ( gPrOpenCounter == 1 )
{ {
#if PM_USE_SESSION_APIS #if PM_USE_SESSION_APIS
err = PMCreateSession(macPrintSession) ; err = PMCreateSession((PMPrintSession *)macPrintSession) ;
#else #else
err = PMBegin() ; err = PMBegin() ;
#endif #endif
@@ -287,11 +289,7 @@ OSStatus UMAPrOpen()
#endif #endif
} }
#if TARGET_CARBON && PM_USE_SESSION_APIS OSStatus UMAPrClose(void *macPrintSession)
OSStatus UMAPrClose(PMPrintSession *macPrintSession)
#else
OSStatus UMAPrClose()
#endif
{ {
#if !TARGET_CARBON #if !TARGET_CARBON
OSErr err = noErr ; OSErr err = noErr ;
@@ -310,8 +308,8 @@ OSStatus UMAPrClose()
if ( gPrOpenCounter == 1 ) if ( gPrOpenCounter == 1 )
{ {
#if PM_USE_SESSION_APIS #if PM_USE_SESSION_APIS
err = PMRelease(*macPrintSession) ; err = PMRelease(*(PMPrintSession *)macPrintSession) ;
*macPrintSession = kPMNoReference; *(PMPrintSession *)macPrintSession = kPMNoReference;
#else #else
err = PMEnd() ; err = PMEnd() ;
#endif #endif

View File

@@ -28,6 +28,13 @@
#include <math.h> #include <math.h>
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
#if defined(TARGET_CARBON) && !defined(__DARWIN__)
# if PM_USE_SESSION_APIS
# include <PMCore.h>
# endif
# include <PMApplication.h>
#endif
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
IMPLEMENT_CLASS(wxPrinterDC, wxDC) IMPLEMENT_CLASS(wxPrinterDC, wxDC)
#endif #endif
@@ -43,10 +50,10 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
m_printData.ConvertToNative() ; m_printData.ConvertToNative() ;
#if TARGET_CARBON && PM_USE_SESSION_APIS #if TARGET_CARBON && PM_USE_SESSION_APIS
err = UMAPrOpen((PMPrintSession *)&m_macPrintSessionPort) ; err = UMAPrOpen(&m_macPrintSessionPort) ;
if ( err != noErr || m_macPrintSessionPort == kPMNoData ) if ( err != noErr || m_macPrintSessionPort == kPMNoData )
#else #else
err = UMAPrOpen() ; err = UMAPrOpen(NULL) ;
if ( err != noErr ) if ( err != noErr )
#endif #endif
{ {
@@ -54,9 +61,9 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
#if TARGET_CARBON && PM_USE_SESSION_APIS #if TARGET_CARBON && PM_USE_SESSION_APIS
UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ; UMAPrClose(&m_macPrintSessionPort) ;
#else #else
UMAPrClose() ; UMAPrClose(NULL) ;
#endif #endif
m_ok = FALSE; m_ok = FALSE;
return; return;
@@ -74,7 +81,7 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
message.Printf( "Print Error %d", err ) ; message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
UMAPrClose() ; UMAPrClose(NULL) ;
m_ok = FALSE; m_ok = FALSE;
return; return;
} }
@@ -86,7 +93,7 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
message.Printf( "Print Error %d", err ) ; message.Printf( "Print Error %d", err ) ;
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
UMAPrClose() ; UMAPrClose(NULL) ;
m_ok = FALSE; m_ok = FALSE;
return; return;
} }
@@ -111,9 +118,9 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
#if TARGET_CARBON && PM_USE_SESSION_APIS #if TARGET_CARBON && PM_USE_SESSION_APIS
UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ; UMAPrClose(&m_macPrintSessionPort) ;
#else #else
UMAPrClose() ; UMAPrClose(NULL) ;
#endif #endif
m_ok = FALSE; m_ok = FALSE;
return; return;
@@ -133,9 +140,9 @@ wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
#if TARGET_CARBON && PM_USE_SESSION_APIS #if TARGET_CARBON && PM_USE_SESSION_APIS
UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ; UMAPrClose(&m_macPrintSessionPort) ;
#else #else
UMAPrClose() ; UMAPrClose(NULL) ;
#endif #endif
m_ok = FALSE; m_ok = FALSE;
return; return;
@@ -172,7 +179,7 @@ wxPrinterDC::~wxPrinterDC(void)
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
} }
::UMAPrClose() ; ::UMAPrClose(NULL) ;
// ::SetPort( macPrintFormerPort ) ; // ::SetPort( macPrintFormerPort ) ;
::SetPort( LMGetWMgrPort() ) ; ::SetPort( LMGetWMgrPort() ) ;
} }
@@ -191,9 +198,9 @@ wxPrinterDC::~wxPrinterDC(void)
dialog.ShowModal(); dialog.ShowModal();
} }
#if TARGET_CARBON && PM_USE_SESSION_APIS #if TARGET_CARBON && PM_USE_SESSION_APIS
UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ; UMAPrClose(&m_macPrintSessionPort) ;
#else #else
UMAPrClose() ; UMAPrClose(NULL) ;
#endif #endif
} }
#endif #endif
@@ -247,7 +254,7 @@ void wxPrinterDC::StartPage(void)
dialog.ShowModal(); dialog.ShowModal();
::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ; ::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ; ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
::UMAPrClose() ; ::UMAPrClose(NULL) ;
::SetPort( macPrintFormerPort ) ; ::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ; m_ok = FALSE ;
} }
@@ -267,11 +274,11 @@ void wxPrinterDC::StartPage(void)
#if PM_USE_SESSION_APIS #if PM_USE_SESSION_APIS
PMSessionEndPage((PMPrintSession)m_macPrintSessionPort); PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort); PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ; UMAPrClose(&m_macPrintSessionPort) ;
#else #else
PMEndPage(m_macPrintSessionPort); PMEndPage(m_macPrintSessionPort);
PMEndDocument(m_macPrintSessionPort); PMEndDocument(m_macPrintSessionPort);
UMAPrClose() ; UMAPrClose(NULL) ;
#endif #endif
::SetPort( macPrintFormerPort ) ; ::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ; m_ok = FALSE ;
@@ -296,7 +303,7 @@ void wxPrinterDC::EndPage(void)
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ; ::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
::UMAPrClose() ; ::UMAPrClose(NULL) ;
::SetPort( macPrintFormerPort ) ; ::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ; m_ok = FALSE ;
} }
@@ -313,10 +320,10 @@ void wxPrinterDC::EndPage(void)
dialog.ShowModal(); dialog.ShowModal();
#if PM_USE_SESSION_APIS #if PM_USE_SESSION_APIS
PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort); PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
UMAPrClose((PMPrintSession *)&m_macPrintSessionPort) ; UMAPrClose(&m_macPrintSessionPort) ;
#else #else
PMEndDocument(m_macPrintSessionPort); PMEndDocument(m_macPrintSessionPort);
UMAPrClose() ; UMAPrClose(NULL) ;
#endif #endif
::SetPort( macPrintFormerPort ) ; ::SetPort( macPrintFormerPort ) ;
m_ok = FALSE ; m_ok = FALSE ;

View File

@@ -19,6 +19,13 @@
#include "wx/msgdlg.h" #include "wx/msgdlg.h"
#include "wx/mac/uma.h" #include "wx/mac/uma.h"
#if defined(TARGET_CARBON) && !defined(__DARWIN__)
# if PM_USE_SESSION_APIS
# include <PMCore.h>
# endif
# include <PMApplication.h>
#endif
// Use generic page setup dialog: use your own native one if one exists. // Use generic page setup dialog: use your own native one if one exists.
#if !USE_SHARED_LIBRARY #if !USE_SHARED_LIBRARY
@@ -72,7 +79,7 @@ int wxPrintDialog::ShowModal()
wxString message ; wxString message ;
#if !TARGET_CARBON #if !TARGET_CARBON
err = ::UMAPrOpen() ; err = ::UMAPrOpen(NULL) ;
if ( err == noErr ) if ( err == noErr )
{ {
m_printDialogData.ConvertToNative() ; m_printDialogData.ConvertToNative() ;
@@ -89,7 +96,7 @@ int wxPrintDialog::ShowModal()
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
} }
::UMAPrClose() ; ::UMAPrClose(NULL) ;
#else #else
#if PM_USE_SESSION_APIS #if PM_USE_SESSION_APIS
PMPrintSession macPrintSession = kPMNoReference; PMPrintSession macPrintSession = kPMNoReference;
@@ -224,7 +231,7 @@ int wxPageSetupDialog::ShowModal()
wxString message ; wxString message ;
#if !TARGET_CARBON #if !TARGET_CARBON
err = ::UMAPrOpen() ; err = ::UMAPrOpen(NULL) ;
if ( err == noErr ) if ( err == noErr )
{ {
m_pageSetupData.ConvertToNative() ; m_pageSetupData.ConvertToNative() ;
@@ -241,7 +248,7 @@ int wxPageSetupDialog::ShowModal()
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ; wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal(); dialog.ShowModal();
} }
::UMAPrClose() ; ::UMAPrClose(NULL) ;
#else #else
#if PM_USE_SESSION_APIS #if PM_USE_SESSION_APIS
PMPrintSession macPrintSession = kPMNoReference; PMPrintSession macPrintSession = kPMNoReference;

View File

@@ -4,7 +4,13 @@
#include <MacTextEditor.h> #include <MacTextEditor.h>
#ifndef __DARWIN__ #ifndef __DARWIN__
#include <Navigation.h> # include <Navigation.h>
# if defined(TARGET_CARBON)
# if PM_USE_SESSION_APIS
# include <PMCore.h>
# endif
# include <PMApplication.h>
# endif
#endif #endif
// since we have decided that we only support 8.6 upwards we are // since we have decided that we only support 8.6 upwards we are
@@ -255,11 +261,7 @@ void UMAInsertMenuItem( MenuRef menu , StringPtr l , MenuItemIndex item , SInt16
int gPrOpenCounter = 0 ; int gPrOpenCounter = 0 ;
#if TARGET_CARBON && PM_USE_SESSION_APIS OSStatus UMAPrOpen(void *macPrintSession)
OSStatus UMAPrOpen(PMPrintSession *macPrintSession)
#else
OSStatus UMAPrOpen()
#endif
{ {
#if !TARGET_CARBON #if !TARGET_CARBON
OSErr err = noErr ; OSErr err = noErr ;
@@ -277,7 +279,7 @@ OSStatus UMAPrOpen()
if ( gPrOpenCounter == 1 ) if ( gPrOpenCounter == 1 )
{ {
#if PM_USE_SESSION_APIS #if PM_USE_SESSION_APIS
err = PMCreateSession(macPrintSession) ; err = PMCreateSession((PMPrintSession *)macPrintSession) ;
#else #else
err = PMBegin() ; err = PMBegin() ;
#endif #endif
@@ -287,11 +289,7 @@ OSStatus UMAPrOpen()
#endif #endif
} }
#if TARGET_CARBON && PM_USE_SESSION_APIS OSStatus UMAPrClose(void *macPrintSession)
OSStatus UMAPrClose(PMPrintSession *macPrintSession)
#else
OSStatus UMAPrClose()
#endif
{ {
#if !TARGET_CARBON #if !TARGET_CARBON
OSErr err = noErr ; OSErr err = noErr ;
@@ -310,8 +308,8 @@ OSStatus UMAPrClose()
if ( gPrOpenCounter == 1 ) if ( gPrOpenCounter == 1 )
{ {
#if PM_USE_SESSION_APIS #if PM_USE_SESSION_APIS
err = PMRelease(*macPrintSession) ; err = PMRelease(*(PMPrintSession *)macPrintSession) ;
*macPrintSession = kPMNoReference; *(PMPrintSession *)macPrintSession = kPMNoReference;
#else #else
err = PMEnd() ; err = PMEnd() ;
#endif #endif