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 UMAShowArrowCursor() ;
#if TARGET_CARBON && PM_USE_SESSION_APIS
OSStatus UMAPrOpen(PMPrintSession *macPrintSession) ;
OSStatus UMAPrClose(PMPrintSession *macPrintSession) ;
#else
OSStatus UMAPrOpen() ;
OSStatus UMAPrClose() ;
#endif
OSStatus UMAPrOpen(void *macPrintSession) ;
OSStatus UMAPrClose(void *macPrintSession) ;
// window manager

View File

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

View File

@ -19,6 +19,13 @@
#include "wx/msgdlg.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.
#if !USE_SHARED_LIBRARY
@ -72,7 +79,7 @@ int wxPrintDialog::ShowModal()
wxString message ;
#if !TARGET_CARBON
err = ::UMAPrOpen() ;
err = ::UMAPrOpen(NULL) ;
if ( err == noErr )
{
m_printDialogData.ConvertToNative() ;
@ -89,7 +96,7 @@ int wxPrintDialog::ShowModal()
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
}
::UMAPrClose() ;
::UMAPrClose(NULL) ;
#else
#if PM_USE_SESSION_APIS
PMPrintSession macPrintSession = kPMNoReference;
@ -224,7 +231,7 @@ int wxPageSetupDialog::ShowModal()
wxString message ;
#if !TARGET_CARBON
err = ::UMAPrOpen() ;
err = ::UMAPrOpen(NULL) ;
if ( err == noErr )
{
m_pageSetupData.ConvertToNative() ;
@ -241,7 +248,7 @@ int wxPageSetupDialog::ShowModal()
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
}
::UMAPrClose() ;
::UMAPrClose(NULL) ;
#else
#if PM_USE_SESSION_APIS
PMPrintSession macPrintSession = kPMNoReference;

View File

@ -4,7 +4,13 @@
#include <MacTextEditor.h>
#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
// 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 ;
#if TARGET_CARBON && PM_USE_SESSION_APIS
OSStatus UMAPrOpen(PMPrintSession *macPrintSession)
#else
OSStatus UMAPrOpen()
#endif
OSStatus UMAPrOpen(void *macPrintSession)
{
#if !TARGET_CARBON
OSErr err = noErr ;
@ -277,7 +279,7 @@ OSStatus UMAPrOpen()
if ( gPrOpenCounter == 1 )
{
#if PM_USE_SESSION_APIS
err = PMCreateSession(macPrintSession) ;
err = PMCreateSession((PMPrintSession *)macPrintSession) ;
#else
err = PMBegin() ;
#endif
@ -287,11 +289,7 @@ OSStatus UMAPrOpen()
#endif
}
#if TARGET_CARBON && PM_USE_SESSION_APIS
OSStatus UMAPrClose(PMPrintSession *macPrintSession)
#else
OSStatus UMAPrClose()
#endif
OSStatus UMAPrClose(void *macPrintSession)
{
#if !TARGET_CARBON
OSErr err = noErr ;
@ -310,8 +308,8 @@ OSStatus UMAPrClose()
if ( gPrOpenCounter == 1 )
{
#if PM_USE_SESSION_APIS
err = PMRelease(*macPrintSession) ;
*macPrintSession = kPMNoReference;
err = PMRelease(*(PMPrintSession *)macPrintSession) ;
*(PMPrintSession *)macPrintSession = kPMNoReference;
#else
err = PMEnd() ;
#endif

View File

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

View File

@ -19,6 +19,13 @@
#include "wx/msgdlg.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.
#if !USE_SHARED_LIBRARY
@ -72,7 +79,7 @@ int wxPrintDialog::ShowModal()
wxString message ;
#if !TARGET_CARBON
err = ::UMAPrOpen() ;
err = ::UMAPrOpen(NULL) ;
if ( err == noErr )
{
m_printDialogData.ConvertToNative() ;
@ -89,7 +96,7 @@ int wxPrintDialog::ShowModal()
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
}
::UMAPrClose() ;
::UMAPrClose(NULL) ;
#else
#if PM_USE_SESSION_APIS
PMPrintSession macPrintSession = kPMNoReference;
@ -224,7 +231,7 @@ int wxPageSetupDialog::ShowModal()
wxString message ;
#if !TARGET_CARBON
err = ::UMAPrOpen() ;
err = ::UMAPrOpen(NULL) ;
if ( err == noErr )
{
m_pageSetupData.ConvertToNative() ;
@ -241,7 +248,7 @@ int wxPageSetupDialog::ShowModal()
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
dialog.ShowModal();
}
::UMAPrClose() ;
::UMAPrClose(NULL) ;
#else
#if PM_USE_SESSION_APIS
PMPrintSession macPrintSession = kPMNoReference;

View File

@ -4,7 +4,13 @@
#include <MacTextEditor.h>
#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
// 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 ;
#if TARGET_CARBON && PM_USE_SESSION_APIS
OSStatus UMAPrOpen(PMPrintSession *macPrintSession)
#else
OSStatus UMAPrOpen()
#endif
OSStatus UMAPrOpen(void *macPrintSession)
{
#if !TARGET_CARBON
OSErr err = noErr ;
@ -277,7 +279,7 @@ OSStatus UMAPrOpen()
if ( gPrOpenCounter == 1 )
{
#if PM_USE_SESSION_APIS
err = PMCreateSession(macPrintSession) ;
err = PMCreateSession((PMPrintSession *)macPrintSession) ;
#else
err = PMBegin() ;
#endif
@ -287,11 +289,7 @@ OSStatus UMAPrOpen()
#endif
}
#if TARGET_CARBON && PM_USE_SESSION_APIS
OSStatus UMAPrClose(PMPrintSession *macPrintSession)
#else
OSStatus UMAPrClose()
#endif
OSStatus UMAPrClose(void *macPrintSession)
{
#if !TARGET_CARBON
OSErr err = noErr ;
@ -310,8 +308,8 @@ OSStatus UMAPrClose()
if ( gPrOpenCounter == 1 )
{
#if PM_USE_SESSION_APIS
err = PMRelease(*macPrintSession) ;
*macPrintSession = kPMNoReference;
err = PMRelease(*(PMPrintSession *)macPrintSession) ;
*(PMPrintSession *)macPrintSession = kPMNoReference;
#else
err = PMEnd() ;
#endif