carbon printing extended
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20646 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
e99cc06dc6
commit
cfb00da4c4
@ -191,38 +191,7 @@ wxPrintData::wxPrintData()
|
||||
m_macPageFormat = kPMNoPageFormat;
|
||||
m_macPrintSettings = kPMNoPrintSettings;
|
||||
m_macPrintSession = kPMNoReference ;
|
||||
|
||||
#if PM_USE_SESSION_APIS
|
||||
OSStatus err;
|
||||
|
||||
err = PMCreateSession((PMPrintSession *)&m_macPrintSession) ;
|
||||
|
||||
if ( err == noErr )
|
||||
{
|
||||
err = PMCreatePageFormat((PMPageFormat *)&m_macPageFormat);
|
||||
|
||||
// Note that PMPageFormat is not session-specific, but calling
|
||||
// PMSessionDefaultPageFormat assigns values specific to the printer
|
||||
// associated with the current printing session.
|
||||
if ((err == noErr) && (m_macPageFormat != kPMNoPageFormat))
|
||||
{
|
||||
err = PMSessionDefaultPageFormat((PMPrintSession)m_macPrintSession,
|
||||
(PMPageFormat)m_macPageFormat);
|
||||
}
|
||||
|
||||
err = PMCreatePrintSettings((PMPrintSettings *)&m_macPrintSettings);
|
||||
|
||||
// Note that PMPrintSettings is not session-specific, but calling
|
||||
// PMSessionDefaultPrintSettings assigns values specific to the printer
|
||||
// associated with the current printing session.
|
||||
if ((err == noErr) && (m_macPrintSettings != kPMNoPrintSettings))
|
||||
{
|
||||
err = PMSessionDefaultPrintSettings((PMPrintSession)m_macPrintSession,
|
||||
(PMPrintSettings)m_macPrintSettings);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
ValidateOrCreateNative() ;
|
||||
#else
|
||||
m_macPrintSettings = (THPrint) NewHandleClear( sizeof( TPrint ) );
|
||||
(**(THPrint)m_macPrintSettings).iPrVersion = 0; // something invalid
|
||||
@ -783,27 +752,175 @@ void wxPrintData::ConvertFromNative()
|
||||
#endif
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
||||
void wxPrintData::ConvertToNative()
|
||||
{
|
||||
ValidateOrCreateNative() ;
|
||||
#if TARGET_CARBON
|
||||
PMSetCopies( (PMPrintSettings) m_macPrintSettings , m_printNoCopies , false ) ;
|
||||
PMSetOrientation( (PMPageFormat) m_macPageFormat , ( m_printOrientation == wxLANDSCAPE ) ?
|
||||
kPMLandscape : kPMPortrait , false ) ;
|
||||
// collate cannot be set
|
||||
#if 0 // not yet tested
|
||||
if ( m_printerName.Length() > 0 )
|
||||
PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxMacCFStringHolder( m_printerName ) ) ;
|
||||
#endif
|
||||
PMColorMode color ;
|
||||
PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ;
|
||||
if (m_colour)
|
||||
{
|
||||
if ( color == kPMBlackAndWhite )
|
||||
PMSetColorMode( (PMPrintSettings) m_macPrintSettings, kPMColor ) ;
|
||||
}
|
||||
else
|
||||
PMSetColorMode( (PMPrintSettings) m_macPrintSettings, kPMBlackAndWhite ) ;
|
||||
|
||||
// PMDuplexMode not yet accessible via API
|
||||
// PMQualityMode not yet accessible via API
|
||||
// todo paperSize
|
||||
#else
|
||||
// on mac the paper rect has a negative top left corner, because the page rect (printable area) is at 0,0
|
||||
(**(THPrint)m_macPrintSettings).prJob.iCopies = m_printNoCopies;
|
||||
(**(THPrint)m_macPrintSettings).rPaper.left = int( ((double) m_minMarginTopLeft.x)*mm2pt );
|
||||
(**(THPrint)m_macPrintSettings).rPaper.top = int( ((double) m_minMarginTopLeft.y)*mm2pt );
|
||||
|
||||
(**(THPrint)m_macPrintSettings).rPaper.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x)*mm2pt );
|
||||
(**(THPrint)m_macPrintSettings).rPaper.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y)*mm2pt );
|
||||
|
||||
(**(THPrint)m_macPrintSettings).prInfo.rPage.left = 0;
|
||||
(**(THPrint)m_macPrintSettings).prInfo.rPage.top = 0;
|
||||
(**(THPrint)m_macPrintSettings).prInfo.rPage.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x - m_minMarginBottomRight.x)*mm2pt );
|
||||
(**(THPrint)m_macPrintSettings).prInfo.rPage.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y - m_minMarginBottomRight.y)*mm2pt );
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxPrintData::ConvertFromNative()
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
OSStatus err = noErr ;
|
||||
|
||||
UInt32 copies ;
|
||||
err = PMGetCopies( (PMPrintSettings) m_macPrintSettings , &copies ) ;
|
||||
if ( err == noErr )
|
||||
m_printNoCopies = copies ;
|
||||
|
||||
PMOrientation orientation ;
|
||||
err = PMGetOrientation( (PMPageFormat) m_macPageFormat , &orientation ) ;
|
||||
if ( err == noErr )
|
||||
{
|
||||
if ( orientation == kPMPortrait || orientation == kPMReversePortrait )
|
||||
m_printOrientation = wxPORTRAIT ;
|
||||
else
|
||||
m_printOrientation = wxLANDSCAPE ;
|
||||
}
|
||||
|
||||
// collate cannot be set
|
||||
#if 0
|
||||
{
|
||||
wxMacCFStringHolder name ;
|
||||
PMPrinter printer ;
|
||||
PMSessionGetCurrentPrinter( (PMPrintSession) m_macPrintSession ,
|
||||
&printer ) ;
|
||||
m_printerName = name.AsString() ;
|
||||
}
|
||||
#endif
|
||||
|
||||
PMColorMode color ;
|
||||
err = PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ;
|
||||
if ( err == noErr )
|
||||
m_colour = !(color == kPMBlackAndWhite) ;
|
||||
|
||||
// PMDuplexMode not yet accessible via API
|
||||
// PMQualityMode not yet accessible via API
|
||||
// todo paperSize
|
||||
PMRect rPaper;
|
||||
err = PMGetUnadjustedPaperRect((PMPageFormat) m_macPageFormat, &rPaper);
|
||||
if ( err == noErr )
|
||||
{
|
||||
m_paperSize.x = (int)(( rPaper.right - rPaper.left ) * pt2mm + 0.5 );
|
||||
m_paperSize.y = (int)(( rPaper.bottom - rPaper.top ) * pt2mm + 0.5 );
|
||||
}
|
||||
#else
|
||||
m_printNoCopies = (**(THPrint)m_macPrintSettings).prJob.iCopies;
|
||||
|
||||
// paper size
|
||||
m_paperSize.x = ((double) (**(THPrint)m_macPrintSettings).rPaper.right - (**(THPrint)m_macPrintSettings).rPaper.left ) * pt2mm;
|
||||
m_paperSize.y = ((double) (**(THPrint)m_macPrintSettings).rPaper.bottom - (**(THPrint)m_macPrintSettings).rPaper.top ) * pt2mm;
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxPrintData::ValidateOrCreateNative()
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
OSStatus err = noErr ;
|
||||
if ( m_macPrintSession == kPMNoReference )
|
||||
{
|
||||
err = PMCreateSession( (PMPrintSession *) &m_macPrintSession ) ;
|
||||
}
|
||||
// Set up a valid PageFormat object.
|
||||
if ( m_macPageFormat == kPMNoPageFormat)
|
||||
{
|
||||
err = PMCreatePageFormat((PMPageFormat *) &m_macPageFormat);
|
||||
|
||||
// Note that PMPageFormat is not session-specific, but calling
|
||||
// PMSessionDefaultPageFormat assigns values specific to the printer
|
||||
// associated with the current printing session.
|
||||
if ((err == noErr) &&
|
||||
( m_macPageFormat != kPMNoPageFormat))
|
||||
{
|
||||
err = PMSessionDefaultPageFormat((PMPrintSession) m_macPrintSession,
|
||||
(PMPageFormat) m_macPageFormat);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = PMSessionValidatePageFormat((PMPrintSession) m_macPrintSession,
|
||||
(PMPageFormat) m_macPageFormat,
|
||||
kPMDontWantBoolean);
|
||||
}
|
||||
|
||||
// Set up a valid PrintSettings object.
|
||||
if ( m_macPrintSettings == kPMNoPrintSettings)
|
||||
{
|
||||
err = PMCreatePrintSettings((PMPrintSettings *) &m_macPrintSettings);
|
||||
|
||||
// Note that PMPrintSettings is not session-specific, but calling
|
||||
// PMSessionDefaultPrintSettings assigns values specific to the printer
|
||||
// associated with the current printing session.
|
||||
if ((err == noErr) &&
|
||||
( m_macPrintSettings != kPMNoPrintSettings))
|
||||
{
|
||||
err = PMSessionDefaultPrintSettings((PMPrintSession) m_macPrintSession,
|
||||
(PMPrintSettings) m_macPrintSettings);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = PMSessionValidatePrintSettings((PMPrintSession) m_macPrintSession,
|
||||
(PMPrintSettings) m_macPrintSettings,
|
||||
kPMDontWantBoolean);
|
||||
}
|
||||
#else
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void wxPrintData::operator=(const wxPrintData& data)
|
||||
{
|
||||
#ifdef __WXMAC__
|
||||
#if TARGET_CARBON
|
||||
if ( m_macPrintSession != kPMNoPrintSettings )
|
||||
{
|
||||
PMRelease( m_macPrintSession ) ;
|
||||
m_macPrintSession = kPMNoPrintSettings ;
|
||||
}
|
||||
if ( data.m_macPrintSession != kPMNoPrintSettings )
|
||||
{
|
||||
m_macPrintSession = data.m_macPrintSession ;
|
||||
PMRetain( m_macPrintSession ) ;
|
||||
}
|
||||
|
||||
if ( m_macPrintSettings != kPMNoPrintSettings )
|
||||
{
|
||||
PMRelease( m_macPrintSettings ) ;
|
||||
@ -814,6 +931,7 @@ void wxPrintData::operator=(const wxPrintData& data)
|
||||
m_macPrintSettings = data.m_macPrintSettings ;
|
||||
PMRetain( m_macPrintSettings ) ;
|
||||
}
|
||||
|
||||
if ( m_macPageFormat != kPMNoPageFormat )
|
||||
{
|
||||
PMRelease( m_macPageFormat ) ;
|
||||
@ -1109,25 +1227,43 @@ void wxPrintDialogData::SetOwnerWindow(wxWindow* win)
|
||||
#endif // MSW
|
||||
|
||||
#ifdef __WXMAC__
|
||||
|
||||
void wxPrintDialogData::ConvertToNative()
|
||||
{
|
||||
m_printData.ConvertToNative();
|
||||
#if TARGET_CARBON
|
||||
PMSetPageRange( (PMPrintSettings) m_printData.m_macPrintSettings , m_printMinPage , m_printMaxPage ) ;
|
||||
PMSetCopies( (PMPrintSettings) m_printData.m_macPrintSettings , m_printNoCopies , false ) ;
|
||||
PMSetFirstPage( (PMPrintSettings) m_printData.m_macPrintSettings , m_printFromPage , false ) ;
|
||||
PMSetLastPage( (PMPrintSettings) m_printData.m_macPrintSettings , m_printToPage , false ) ;
|
||||
#else
|
||||
(**(THPrint)m_printData.m_macPrintSettings).prJob.iFstPage = m_printFromPage;
|
||||
(**(THPrint)m_printData.m_macPrintSettings).prJob.iLstPage = m_printToPage;
|
||||
m_printData.ConvertToNative();
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxPrintDialogData::ConvertFromNative()
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
#else
|
||||
m_printData.ConvertFromNative();
|
||||
#if TARGET_CARBON
|
||||
UInt32 minPage , maxPage ;
|
||||
PMGetPageRange( (PMPrintSettings) m_printData.m_macPrintSettings , &minPage , &maxPage ) ;
|
||||
m_printMinPage = minPage ;
|
||||
m_printMaxPage = maxPage ;
|
||||
UInt32 copies ;
|
||||
PMGetCopies( (PMPrintSettings) m_printData.m_macPrintSettings , &copies ) ;
|
||||
m_printNoCopies = copies ;
|
||||
UInt32 from , to ;
|
||||
PMGetFirstPage((PMPrintSettings) m_printData.m_macPrintSettings , &from ) ;
|
||||
PMGetLastPage((PMPrintSettings) m_printData.m_macPrintSettings , &to ) ;
|
||||
m_printFromPage = from ;
|
||||
m_printToPage = to ;
|
||||
#else
|
||||
m_printFromPage = (**(THPrint)m_printData.m_macPrintSettings).prJob.iFstPage;
|
||||
m_printToPage = (**(THPrint)m_printData.m_macPrintSettings).prJob.iLstPage;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@ -1441,53 +1577,41 @@ void wxPageSetupDialogData::SetOwnerWindow(wxWindow* win)
|
||||
void wxPageSetupDialogData::ConvertToNative()
|
||||
{
|
||||
m_printData.ConvertToNative();
|
||||
// on mac the paper rect has a negative top left corner, because the page rect (printable area) is at 0,0
|
||||
// should we setup the page rect here ?
|
||||
// since MacOS sometimes has two same paper rects with different
|
||||
// page rects we could make it roundtrip safe perhaps
|
||||
#if TARGET_CARBON
|
||||
#else
|
||||
(**(THPrint)m_printData.m_macPrintSettings).rPaper.left = int( ((double) m_minMarginTopLeft.x)*mm2pt );
|
||||
(**(THPrint)m_printData.m_macPrintSettings).rPaper.top = int( ((double) m_minMarginTopLeft.y)*mm2pt );
|
||||
|
||||
(**(THPrint)m_printData.m_macPrintSettings).rPaper.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x)*mm2pt );
|
||||
(**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y)*mm2pt );
|
||||
|
||||
(**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.left = 0;
|
||||
(**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.top = 0;
|
||||
(**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x - m_minMarginBottomRight.x)*mm2pt );
|
||||
(**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y - m_minMarginBottomRight.y)*mm2pt );
|
||||
#endif
|
||||
}
|
||||
|
||||
void wxPageSetupDialogData::ConvertFromNative()
|
||||
{
|
||||
m_printData.ConvertFromNative ();
|
||||
|
||||
m_paperSize = m_printData.GetPaperSize() ;
|
||||
CalculateIdFromPaperSize();
|
||||
#if TARGET_CARBON
|
||||
PMRect rPaper;
|
||||
|
||||
OSStatus err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
|
||||
OSStatus err = PMGetUnadjustedPaperRect((PMPageFormat) m_printData.m_macPageFormat, &rPaper);
|
||||
if ( err == noErr )
|
||||
{
|
||||
m_paperSize.x = (int)(((double) rPaper.right - rPaper.left ) * pt2mm);
|
||||
m_paperSize.y = (int)(((double) rPaper.bottom - rPaper.top ) * pt2mm);
|
||||
|
||||
m_minMarginTopLeft.x = (int)(((double) - rPaper.left ) * pt2mm);
|
||||
m_minMarginTopLeft.y = (int)(((double) - rPaper.top ) * pt2mm);
|
||||
|
||||
// m_minMarginBottomRight.x = ((double) rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.right ) * pt2mm;
|
||||
// m_minMarginBottomRight.y = ((double)(**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.bottom ) * pt2mm;
|
||||
}
|
||||
PMRect rPage ;
|
||||
err = PMGetUnadjustedPageRect((PMPageFormat) m_printData.m_macPageFormat , &rPage ) ;
|
||||
if ( err == noErr )
|
||||
{
|
||||
m_minMarginTopLeft.x = (int)(((double) rPage.left - rPaper.left ) * pt2mm);
|
||||
m_minMarginTopLeft.y = (int)(((double) rPage.top - rPaper.top ) * pt2mm);
|
||||
m_minMarginBottomRight.x = ((double) rPaper.right - rPage.right ) * pt2mm;
|
||||
m_minMarginBottomRight.y = ((double) rPaper.bottom - rPage.bottom ) * pt2mm;
|
||||
}
|
||||
}
|
||||
#else
|
||||
m_paperSize.x = ((double) (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ) * pt2mm;
|
||||
m_paperSize.y = ((double) (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ) * pt2mm;
|
||||
|
||||
m_minMarginTopLeft.x = ((double) -(**(THPrint)m_printData.m_macPrintSettings).rPaper.left ) * pt2mm;
|
||||
m_minMarginTopLeft.y = ((double) -(**(THPrint)m_printData.m_macPrintSettings).rPaper.top ) * pt2mm;
|
||||
|
||||
m_minMarginBottomRight.x = ((double) (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.right ) * pt2mm;
|
||||
m_minMarginBottomRight.y = ((double)(**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).prInfo.rPage.bottom ) * pt2mm;
|
||||
m_minMarginTopLeft.x = ((double) (**(THPrint)m_macPrintSettings).prInfo.rPage.left )-(**(THPrint)m_macPrintSettings).rPaper.left ) * pt2mm;
|
||||
m_minMarginTopLeft.y = ((double) (**(THPrint)m_macPrintSettings).prInfo.rPage.top )-(**(THPrint)m_macPrintSettings).rPaper.top ) * pt2mm;
|
||||
m_minMarginBottomRight.x = ((double) (**(THPrint)m_macPrintSettings).rPaper.right - (**(THPrint)m_macPrintSettings).prInfo.rPage.right ) * pt2mm;
|
||||
m_minMarginBottomRight.y = ((double)(**(THPrint)m_macPrintSettings).rPaper.bottom - (**(THPrint)m_macPrintSettings).prInfo.rPage.bottom ) * pt2mm;
|
||||
#endif
|
||||
// adjust minimal values
|
||||
//TODO add custom fields in dialog for margins
|
||||
|
||||
if ( m_marginTopLeft.x < m_minMarginTopLeft.x )
|
||||
m_marginTopLeft.x = m_minMarginTopLeft.x;
|
||||
|
@ -80,7 +80,7 @@ wxPrintDialog::~wxPrintDialog()
|
||||
int wxPrintDialog::ShowModal()
|
||||
{
|
||||
int result = wxID_CANCEL ;
|
||||
OSErr err ;
|
||||
OSErr err = noErr ;
|
||||
wxString message ;
|
||||
|
||||
#if !TARGET_CARBON
|
||||
@ -108,57 +108,6 @@ int wxPrintDialog::ShowModal()
|
||||
|
||||
{
|
||||
m_printDialogData.ConvertToNative() ;
|
||||
|
||||
// Set up a valid PageFormat object.
|
||||
if (m_printDialogData.GetPrintData().m_macPageFormat == kPMNoPageFormat)
|
||||
{
|
||||
err = PMCreatePageFormat((PMPageFormat *)&m_printDialogData.GetPrintData().m_macPageFormat);
|
||||
|
||||
// Note that PMPageFormat is not session-specific, but calling
|
||||
// PMSessionDefaultPageFormat assigns values specific to the printer
|
||||
// associated with the current printing session.
|
||||
if ((err == noErr) &&
|
||||
(m_printDialogData.GetPrintData().m_macPageFormat != kPMNoPageFormat))
|
||||
{
|
||||
err = PMSessionDefaultPageFormat((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
|
||||
(PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = PMSessionValidatePageFormat((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
|
||||
(PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
|
||||
kPMDontWantBoolean);
|
||||
}
|
||||
|
||||
// Set up a valid PrintSettings object.
|
||||
if (m_printDialogData.GetPrintData().m_macPrintSettings == kPMNoPrintSettings)
|
||||
{
|
||||
err = PMCreatePrintSettings((PMPrintSettings *)&m_printDialogData.GetPrintData().m_macPrintSettings);
|
||||
|
||||
// Note that PMPrintSettings is not session-specific, but calling
|
||||
// PMSessionDefaultPrintSettings assigns values specific to the printer
|
||||
// associated with the current printing session.
|
||||
if ((err == noErr) &&
|
||||
(m_printDialogData.GetPrintData().m_macPrintSettings != kPMNoPrintSettings))
|
||||
{
|
||||
err = PMSessionDefaultPrintSettings((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
|
||||
(PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = PMSessionValidatePrintSettings((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
|
||||
(PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
|
||||
kPMDontWantBoolean);
|
||||
}
|
||||
// Set a valid page range before displaying the Print dialog
|
||||
if (err == noErr)
|
||||
{
|
||||
// err = PMSetPageRange(m_printDialogData.GetPrintData().m_macPrintSettings,
|
||||
// minPage, maxPage);
|
||||
}
|
||||
|
||||
// Display the Print dialog.
|
||||
if (err == noErr)
|
||||
{
|
||||
@ -228,7 +177,7 @@ wxPageSetupDialog::~wxPageSetupDialog()
|
||||
int wxPageSetupDialog::ShowModal()
|
||||
{
|
||||
int result = wxID_CANCEL ;
|
||||
OSErr err ;
|
||||
OSErr err = noErr ;
|
||||
wxString message ;
|
||||
|
||||
#if !TARGET_CARBON
|
||||
@ -253,32 +202,9 @@ int wxPageSetupDialog::ShowModal()
|
||||
#else
|
||||
#if PM_USE_SESSION_APIS
|
||||
Boolean accepted;
|
||||
|
||||
{
|
||||
m_pageSetupData.ConvertToNative() ;
|
||||
|
||||
// Set up a valid PageFormat object.
|
||||
if (m_pageSetupData.GetPrintData().m_macPageFormat == kPMNoPageFormat)
|
||||
{
|
||||
err = PMCreatePageFormat((PMPageFormat *)&m_pageSetupData.GetPrintData().m_macPageFormat);
|
||||
|
||||
// Note that PMPageFormat is not session-specific, but calling
|
||||
// PMSessionDefaultPageFormat assigns values specific to the printer
|
||||
// associated with the current printing session.
|
||||
if ((err == noErr) &&
|
||||
(m_pageSetupData.GetPrintData().m_macPageFormat != kPMNoPageFormat))
|
||||
{
|
||||
err = PMSessionDefaultPageFormat((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
|
||||
(PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = PMSessionValidatePageFormat((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
|
||||
(PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
|
||||
kPMDontWantBoolean);
|
||||
}
|
||||
|
||||
// Display the Page Setup dialog.
|
||||
if (err == noErr)
|
||||
{
|
||||
|
@ -80,7 +80,7 @@ wxPrintDialog::~wxPrintDialog()
|
||||
int wxPrintDialog::ShowModal()
|
||||
{
|
||||
int result = wxID_CANCEL ;
|
||||
OSErr err ;
|
||||
OSErr err = noErr ;
|
||||
wxString message ;
|
||||
|
||||
#if !TARGET_CARBON
|
||||
@ -108,57 +108,6 @@ int wxPrintDialog::ShowModal()
|
||||
|
||||
{
|
||||
m_printDialogData.ConvertToNative() ;
|
||||
|
||||
// Set up a valid PageFormat object.
|
||||
if (m_printDialogData.GetPrintData().m_macPageFormat == kPMNoPageFormat)
|
||||
{
|
||||
err = PMCreatePageFormat((PMPageFormat *)&m_printDialogData.GetPrintData().m_macPageFormat);
|
||||
|
||||
// Note that PMPageFormat is not session-specific, but calling
|
||||
// PMSessionDefaultPageFormat assigns values specific to the printer
|
||||
// associated with the current printing session.
|
||||
if ((err == noErr) &&
|
||||
(m_printDialogData.GetPrintData().m_macPageFormat != kPMNoPageFormat))
|
||||
{
|
||||
err = PMSessionDefaultPageFormat((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
|
||||
(PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = PMSessionValidatePageFormat((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
|
||||
(PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
|
||||
kPMDontWantBoolean);
|
||||
}
|
||||
|
||||
// Set up a valid PrintSettings object.
|
||||
if (m_printDialogData.GetPrintData().m_macPrintSettings == kPMNoPrintSettings)
|
||||
{
|
||||
err = PMCreatePrintSettings((PMPrintSettings *)&m_printDialogData.GetPrintData().m_macPrintSettings);
|
||||
|
||||
// Note that PMPrintSettings is not session-specific, but calling
|
||||
// PMSessionDefaultPrintSettings assigns values specific to the printer
|
||||
// associated with the current printing session.
|
||||
if ((err == noErr) &&
|
||||
(m_printDialogData.GetPrintData().m_macPrintSettings != kPMNoPrintSettings))
|
||||
{
|
||||
err = PMSessionDefaultPrintSettings((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
|
||||
(PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = PMSessionValidatePrintSettings((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
|
||||
(PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
|
||||
kPMDontWantBoolean);
|
||||
}
|
||||
// Set a valid page range before displaying the Print dialog
|
||||
if (err == noErr)
|
||||
{
|
||||
// err = PMSetPageRange(m_printDialogData.GetPrintData().m_macPrintSettings,
|
||||
// minPage, maxPage);
|
||||
}
|
||||
|
||||
// Display the Print dialog.
|
||||
if (err == noErr)
|
||||
{
|
||||
@ -228,7 +177,7 @@ wxPageSetupDialog::~wxPageSetupDialog()
|
||||
int wxPageSetupDialog::ShowModal()
|
||||
{
|
||||
int result = wxID_CANCEL ;
|
||||
OSErr err ;
|
||||
OSErr err = noErr ;
|
||||
wxString message ;
|
||||
|
||||
#if !TARGET_CARBON
|
||||
@ -253,32 +202,9 @@ int wxPageSetupDialog::ShowModal()
|
||||
#else
|
||||
#if PM_USE_SESSION_APIS
|
||||
Boolean accepted;
|
||||
|
||||
{
|
||||
m_pageSetupData.ConvertToNative() ;
|
||||
|
||||
// Set up a valid PageFormat object.
|
||||
if (m_pageSetupData.GetPrintData().m_macPageFormat == kPMNoPageFormat)
|
||||
{
|
||||
err = PMCreatePageFormat((PMPageFormat *)&m_pageSetupData.GetPrintData().m_macPageFormat);
|
||||
|
||||
// Note that PMPageFormat is not session-specific, but calling
|
||||
// PMSessionDefaultPageFormat assigns values specific to the printer
|
||||
// associated with the current printing session.
|
||||
if ((err == noErr) &&
|
||||
(m_pageSetupData.GetPrintData().m_macPageFormat != kPMNoPageFormat))
|
||||
{
|
||||
err = PMSessionDefaultPageFormat((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
|
||||
(PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err = PMSessionValidatePageFormat((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
|
||||
(PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
|
||||
kPMDontWantBoolean);
|
||||
}
|
||||
|
||||
// Display the Page Setup dialog.
|
||||
if (err == noErr)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user