using 64bit APIs, closes #10184
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62749 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -84,13 +84,13 @@ wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data )
|
|||||||
m_maxY = wxCoord(rPage.bottom - rPage.top);
|
m_maxY = wxCoord(rPage.bottom - rPage.top);
|
||||||
|
|
||||||
PMResolution res;
|
PMResolution res;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
|
||||||
if ( PMPrinterGetOutputResolution != NULL )
|
|
||||||
{
|
|
||||||
PMPrinter printer;
|
PMPrinter printer;
|
||||||
m_err = PMSessionGetCurrentPrinter(native->GetPrintSession(), &printer);
|
m_err = PMSessionGetCurrentPrinter(native->GetPrintSession(), &printer);
|
||||||
if ( m_err == noErr )
|
if ( m_err == noErr )
|
||||||
|
{
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||||
|
if ( PMPrinterGetOutputResolution != NULL )
|
||||||
|
{
|
||||||
{
|
{
|
||||||
m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &res) ;
|
m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &res) ;
|
||||||
if ( m_err == -9589 /* kPMKeyNotFound */ )
|
if ( m_err == -9589 /* kPMKeyNotFound */ )
|
||||||
@@ -104,9 +104,13 @@ wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data )
|
|||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
||||||
m_err = PMGetResolution((PMPageFormat) (native->GetPageFormat()), &res);
|
m_err = PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &res);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_maxX = wxCoord((double)m_maxX * res.hRes / 72.0);
|
||||||
|
m_maxY = wxCoord((double)m_maxY * res.vRes / 72.0);
|
||||||
|
|
||||||
m_ppi = wxSize(int(res.hRes), int(res.vRes));
|
m_ppi = wxSize(int(res.hRes), int(res.vRes));
|
||||||
}
|
}
|
||||||
@@ -128,10 +132,7 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& message
|
|||||||
wxPrinterDCImpl *impl = (wxPrinterDCImpl*) dc->GetImpl();
|
wxPrinterDCImpl *impl = (wxPrinterDCImpl*) dc->GetImpl();
|
||||||
wxOSXPrintData *native = (wxOSXPrintData*) impl->GetPrintData().GetNativeData() ;
|
wxOSXPrintData *native = (wxOSXPrintData*) impl->GetPrintData().GetNativeData() ;
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
|
|
||||||
if ( PMPrintSettingsSetJobName != NULL )
|
|
||||||
PMPrintSettingsSetJobName(native->GetPrintSettings(), wxCFStringRef(message));
|
PMPrintSettingsSetJobName(native->GetPrintSettings(), wxCFStringRef(message));
|
||||||
#endif
|
|
||||||
|
|
||||||
m_err = PMSessionBeginCGDocumentNoDialog(native->GetPrintSession(),
|
m_err = PMSessionBeginCGDocumentNoDialog(native->GetPrintSession(),
|
||||||
native->GetPrintSettings(),
|
native->GetPrintSettings(),
|
||||||
@@ -148,12 +149,13 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& message
|
|||||||
m_maxY = wxCoord(rPage.bottom - rPage.top);
|
m_maxY = wxCoord(rPage.bottom - rPage.top);
|
||||||
|
|
||||||
PMResolution res;
|
PMResolution res;
|
||||||
|
PMPrinter printer;
|
||||||
|
|
||||||
|
m_err = PMSessionGetCurrentPrinter(native->GetPrintSession(), &printer);
|
||||||
|
if (m_err == noErr)
|
||||||
|
{
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||||
if ( PMPrinterGetOutputResolution != NULL )
|
if ( PMPrinterGetOutputResolution != NULL )
|
||||||
{
|
|
||||||
PMPrinter printer;
|
|
||||||
m_err = PMSessionGetCurrentPrinter(native->GetPrintSession(), &printer);
|
|
||||||
if ( m_err == noErr )
|
|
||||||
{
|
{
|
||||||
m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &res) ;
|
m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &res) ;
|
||||||
if ( m_err == -9589 /* kPMKeyNotFound */ )
|
if ( m_err == -9589 /* kPMKeyNotFound */ )
|
||||||
@@ -162,14 +164,17 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& message
|
|||||||
res.hRes = res.vRes = 300;
|
res.hRes = res.vRes = 300;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
||||||
m_err = PMGetResolution((PMPageFormat) (native->GetPageFormat()), &res);
|
m_err = PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &res);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_maxX = wxCoord((double)m_maxX * res.hRes / 72.0);
|
||||||
|
m_maxY = wxCoord((double)m_maxY * res.vRes / 72.0);
|
||||||
|
|
||||||
m_ppi = wxSize(int(res.hRes), int(res.vRes));
|
m_ppi = wxSize(int(res.hRes), int(res.vRes));
|
||||||
return true ;
|
return true ;
|
||||||
@@ -196,7 +201,7 @@ void wxMacCarbonPrinterDC::StartPage( wxPrinterDC* dc )
|
|||||||
|
|
||||||
m_err = PMSessionBeginPageNoDialog(native->GetPrintSession(),
|
m_err = PMSessionBeginPageNoDialog(native->GetPrintSession(),
|
||||||
native->GetPageFormat(),
|
native->GetPageFormat(),
|
||||||
nil);
|
NULL);
|
||||||
|
|
||||||
CGContextRef pageContext;
|
CGContextRef pageContext;
|
||||||
|
|
||||||
@@ -212,23 +217,25 @@ void wxMacCarbonPrinterDC::StartPage( wxPrinterDC* dc )
|
|||||||
PMSessionEndDocumentNoDialog(native->GetPrintSession());
|
PMSessionEndDocumentNoDialog(native->GetPrintSession());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
PMRect rPage;
|
|
||||||
|
|
||||||
m_err = PMGetAdjustedPageRect(native->GetPageFormat(), &rPage);
|
|
||||||
if ( !m_err )
|
|
||||||
{
|
{
|
||||||
PMRect paperRect ;
|
PMRect paperRect ;
|
||||||
PMGetAdjustedPaperRect( native->GetPageFormat() , &paperRect ) ;
|
m_err = PMGetAdjustedPaperRect( native->GetPageFormat() , &paperRect ) ;
|
||||||
// make sure (0,0) is at the upper left of the printable area (wx conventions)
|
// make sure (0,0) is at the upper left of the printable area (wx conventions)
|
||||||
// Core Graphics initially has the lower left of the paper as 0,0
|
// Core Graphics initially has the lower left of the paper as 0,0
|
||||||
|
if ( !m_err )
|
||||||
CGContextTranslateCTM( pageContext , (CGFloat) -paperRect.left , (CGFloat) paperRect.bottom ) ;
|
CGContextTranslateCTM( pageContext , (CGFloat) -paperRect.left , (CGFloat) paperRect.bottom ) ;
|
||||||
CGContextScaleCTM( pageContext , 1 , -1 ) ;
|
|
||||||
}
|
|
||||||
// since this is a non-critical error, we set the flag back
|
// since this is a non-critical error, we set the flag back
|
||||||
m_err = noErr ;
|
m_err = noErr ;
|
||||||
}
|
|
||||||
|
// Leopard deprecated PMSetResolution() which will not be available in 64 bit mode, so we avoid using it.
|
||||||
|
// To set the proper drawing resolution, the docs suggest the use of CGContextScaleCTM(), so here we go; as a
|
||||||
|
// consequence though, PMGetAdjustedPaperRect() and PMGetAdjustedPageRect() return unscaled rects, so we
|
||||||
|
// have to manually scale them later.
|
||||||
|
CGContextScaleCTM( pageContext, 72.0 / (double)m_ppi.x, -72.0 / (double)m_ppi.y);
|
||||||
|
|
||||||
impl->SetGraphicsContext( wxGraphicsContext::CreateFromNative( pageContext ) );
|
impl->SetGraphicsContext( wxGraphicsContext::CreateFromNative( pageContext ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacCarbonPrinterDC::EndPage( wxPrinterDC* dc )
|
void wxMacCarbonPrinterDC::EndPage( wxPrinterDC* dc )
|
||||||
@@ -355,6 +362,13 @@ wxRect wxPrinterDCImpl::GetPaperRect() const
|
|||||||
err = PMGetAdjustedPaperRect(native->GetPageFormat(), &rPaper);
|
err = PMGetAdjustedPaperRect(native->GetPageFormat(), &rPaper);
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
return pageRect;
|
return pageRect;
|
||||||
|
|
||||||
|
wxSize ppi = GetOwner()->GetPPI();
|
||||||
|
rPaper.right *= (ppi.x / 72.0);
|
||||||
|
rPaper.bottom *= (ppi.y / 72.0);
|
||||||
|
rPaper.left *= (ppi.x / 72.0);
|
||||||
|
rPaper.top *= (ppi.y / 72.0);
|
||||||
|
|
||||||
return wxRect(wxCoord(rPaper.left), wxCoord(rPaper.top),
|
return wxRect(wxCoord(rPaper.left), wxCoord(rPaper.top),
|
||||||
wxCoord(rPaper.right - rPaper.left), wxCoord(rPaper.bottom - rPaper.top));
|
wxCoord(rPaper.right - rPaper.left), wxCoord(rPaper.bottom - rPaper.top));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,68 @@
|
|||||||
// move to print_osx.cpp
|
// move to print_osx.cpp
|
||||||
//
|
//
|
||||||
|
|
||||||
|
static int ResolutionSorter(const void *e1, const void *e2)
|
||||||
|
{
|
||||||
|
const PMResolution *res1 = (const PMResolution *)e1;
|
||||||
|
const PMResolution *res2 = (const PMResolution *)e2;
|
||||||
|
int area1 = res1->hRes * res1->vRes;
|
||||||
|
int area2 = res2->hRes * res2->vRes;
|
||||||
|
|
||||||
|
if (area1 < area2)
|
||||||
|
return -1;
|
||||||
|
else if (area1 > area2)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static PMResolution *GetSupportedResolutions(PMPrinter printer, UInt32 *count)
|
||||||
|
{
|
||||||
|
PMResolution res, *resolutions = NULL;
|
||||||
|
OSStatus status = PMPrinterGetPrinterResolutionCount(printer, count);
|
||||||
|
if (status == kPMNotImplemented)
|
||||||
|
{
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
||||||
|
resolutions = (PMResolution *)malloc(sizeof(PMResolution) * 4);
|
||||||
|
*count = 0;
|
||||||
|
if (PMPrinterGetPrinterResolution(printer, kPMMinRange, &res) == noErr)
|
||||||
|
resolutions[(*count)++] = res;
|
||||||
|
if (PMPrinterGetPrinterResolution(printer, kPMMinSquareResolution, &res) == noErr)
|
||||||
|
resolutions[(*count)++] = res;
|
||||||
|
if (PMPrinterGetPrinterResolution(printer, kPMMaxSquareResolution, &res) == noErr)
|
||||||
|
resolutions[(*count)++] = res;
|
||||||
|
if (PMPrinterGetPrinterResolution(printer, kPMMaxRange, &res) == noErr)
|
||||||
|
resolutions[(*count)++] = res;
|
||||||
|
if (*count == 0)
|
||||||
|
{
|
||||||
|
if (PMPrinterGetPrinterResolution(printer, kPMDefaultResolution, &res) == noErr)
|
||||||
|
resolutions[(*count)++] = res;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else if (status == noErr)
|
||||||
|
{
|
||||||
|
resolutions = (PMResolution *)malloc(sizeof(PMResolution) * (*count));
|
||||||
|
UInt32 realCount = 0;
|
||||||
|
for (UInt32 i = 0; i < *count; i++)
|
||||||
|
{
|
||||||
|
if (PMPrinterGetIndexedPrinterResolution(printer, i + 1, &res) == noErr)
|
||||||
|
resolutions[realCount++] = res;
|
||||||
|
}
|
||||||
|
qsort(resolutions, realCount, sizeof(PMResolution), ResolutionSorter);
|
||||||
|
|
||||||
|
*count = realCount;
|
||||||
|
}
|
||||||
|
if ((*count == 0) && (resolutions))
|
||||||
|
{
|
||||||
|
free(resolutions);
|
||||||
|
resolutions = NULL;
|
||||||
|
}
|
||||||
|
return resolutions;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxOSXPrintData, wxPrintNativeDataBase)
|
IMPLEMENT_DYNAMIC_CLASS(wxOSXPrintData, wxPrintNativeDataBase)
|
||||||
|
|
||||||
bool wxOSXPrintData::IsOk() const
|
bool wxOSXPrintData::IsOk() const
|
||||||
@@ -71,6 +133,32 @@ void wxOSXPrintData::UpdateToPMState()
|
|||||||
|
|
||||||
bool wxOSXPrintData::TransferFrom( const wxPrintData &data )
|
bool wxOSXPrintData::TransferFrom( const wxPrintData &data )
|
||||||
{
|
{
|
||||||
|
CFArrayRef printerList;
|
||||||
|
CFIndex index, count;
|
||||||
|
CFStringRef name;
|
||||||
|
|
||||||
|
if (PMServerCreatePrinterList(kPMServerLocal, &printerList) == noErr)
|
||||||
|
{
|
||||||
|
PMPrinter printer = NULL;
|
||||||
|
count = CFArrayGetCount(printerList);
|
||||||
|
for (index = 0; index < count; index++)
|
||||||
|
{
|
||||||
|
printer = (PMPrinter)CFArrayGetValueAtIndex(printerList, index);
|
||||||
|
if ((data.GetPrinterName().empty()) && (PMPrinterIsDefault(printer)))
|
||||||
|
break;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
name = PMPrinterGetName(printer);
|
||||||
|
CFRetain(name);
|
||||||
|
if (data.GetPrinterName() == wxCFStringRef(name).AsString())
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (index < count)
|
||||||
|
PMSessionSetCurrentPMPrinter(m_macPrintSession, printer);
|
||||||
|
CFRelease(printerList);
|
||||||
|
}
|
||||||
|
|
||||||
PMPrinter printer;
|
PMPrinter printer;
|
||||||
PMSessionGetCurrentPrinter(m_macPrintSession, &printer);
|
PMSessionGetCurrentPrinter(m_macPrintSession, &printer);
|
||||||
|
|
||||||
@@ -156,31 +244,6 @@ bool wxOSXPrintData::TransferFrom( const wxPrintData &data )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CFArrayRef printerList;
|
|
||||||
CFIndex index, count;
|
|
||||||
CFStringRef name;
|
|
||||||
|
|
||||||
if (PMServerCreatePrinterList(kPMServerLocal, &printerList) == noErr)
|
|
||||||
{
|
|
||||||
count = CFArrayGetCount(printerList);
|
|
||||||
for (index = 0; index < count; index++)
|
|
||||||
{
|
|
||||||
printer = (PMPrinter)CFArrayGetValueAtIndex(printerList, index);
|
|
||||||
if ((data.GetPrinterName().empty()) && (PMPrinterIsDefault(printer)))
|
|
||||||
break;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
name = PMPrinterGetName(printer);
|
|
||||||
CFRetain(name);
|
|
||||||
if (data.GetPrinterName() == wxCFStringRef(name).AsString())
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (index < count)
|
|
||||||
PMSessionSetCurrentPMPrinter(m_macPrintSession, printer);
|
|
||||||
CFRelease(printerList);
|
|
||||||
}
|
|
||||||
|
|
||||||
PMSetCopies( m_macPrintSettings , data.GetNoCopies() , false ) ;
|
PMSetCopies( m_macPrintSettings , data.GetNoCopies() , false ) ;
|
||||||
PMSetCollate(m_macPrintSettings, data.GetCollate());
|
PMSetCollate(m_macPrintSettings, data.GetCollate());
|
||||||
if ( data.IsOrientationReversed() )
|
if ( data.IsOrientationReversed() )
|
||||||
@@ -206,8 +269,6 @@ bool wxOSXPrintData::TransferFrom( const wxPrintData &data )
|
|||||||
}
|
}
|
||||||
PMSetDuplex( m_macPrintSettings, mode ) ;
|
PMSetDuplex( m_macPrintSettings, mode ) ;
|
||||||
|
|
||||||
// PMQualityMode not yet accessible via API
|
|
||||||
|
|
||||||
|
|
||||||
if ( data.IsOrientationReversed() )
|
if ( data.IsOrientationReversed() )
|
||||||
PMSetOrientation( m_macPageFormat , ( data.GetOrientation() == wxLANDSCAPE ) ?
|
PMSetOrientation( m_macPageFormat , ( data.GetOrientation() == wxLANDSCAPE ) ?
|
||||||
@@ -216,15 +277,28 @@ bool wxOSXPrintData::TransferFrom( const wxPrintData &data )
|
|||||||
PMSetOrientation( m_macPageFormat , ( data.GetOrientation() == wxLANDSCAPE ) ?
|
PMSetOrientation( m_macPageFormat , ( data.GetOrientation() == wxLANDSCAPE ) ?
|
||||||
kPMLandscape : kPMPortrait , false ) ;
|
kPMLandscape : kPMPortrait , false ) ;
|
||||||
|
|
||||||
#ifndef __LP64__
|
UInt32 resCount;
|
||||||
// PMQualityMode not accessible via API
|
PMResolution *resolutions = GetSupportedResolutions(printer, &resCount);
|
||||||
// TODO: use our quality property to determine optimal resolution
|
if (resolutions)
|
||||||
PMResolution res;
|
{
|
||||||
PMTag tag = kPMMaxSquareResolution;
|
wxPrintQuality quality = data.GetQuality();
|
||||||
PMPrinterGetPrinterResolution(printer, tag, &res);
|
if (quality >= 0)
|
||||||
|
quality = wxPRINT_QUALITY_HIGH;
|
||||||
|
|
||||||
|
PMResolution res = resolutions[((quality - wxPRINT_QUALITY_DRAFT) * (resCount - 1)) / 3];
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||||
|
if ( PMPrinterSetOutputResolution != NULL )
|
||||||
|
PMPrinterSetOutputResolution(printer, m_macPrintSettings, &res);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
||||||
PMSetResolution( m_macPageFormat, &res);
|
PMSetResolution( m_macPageFormat, &res);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
free(resolutions);
|
||||||
|
}
|
||||||
// after setting the new resolution the format has to be updated, otherwise the page rect remains
|
// after setting the new resolution the format has to be updated, otherwise the page rect remains
|
||||||
// at the 'old' scaling
|
// at the 'old' scaling
|
||||||
|
|
||||||
@@ -297,7 +371,41 @@ bool wxOSXPrintData::TransferTo( wxPrintData &data )
|
|||||||
data.SetDuplex(wxDUPLEX_SIMPLEX);
|
data.SetDuplex(wxDUPLEX_SIMPLEX);
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
// PMQualityMode not yet accessible via API
|
|
||||||
|
/* assume high quality, will change below if we are able to */
|
||||||
|
data.SetQuality(wxPRINT_QUALITY_HIGH);
|
||||||
|
|
||||||
|
PMResolution *resolutions;
|
||||||
|
UInt32 resCount;
|
||||||
|
resolutions = GetSupportedResolutions(printer, &resCount);
|
||||||
|
if (resolutions)
|
||||||
|
{
|
||||||
|
bool valid = false;
|
||||||
|
PMResolution res;
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||||
|
if ( PMPrinterGetOutputResolution != NULL )
|
||||||
|
{
|
||||||
|
if ( PMPrinterGetOutputResolution(printer, m_macPrintSettings, &res) == noErr )
|
||||||
|
valid = true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
||||||
|
if (PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &res) == noErr)
|
||||||
|
valid = true;
|
||||||
|
#endif
|
||||||
|
if ( valid )
|
||||||
|
{
|
||||||
|
UInt32 i;
|
||||||
|
for (i = 0; i < resCount; i++)
|
||||||
|
{
|
||||||
|
if ((resolutions[i].hRes == res.hRes) && (resolutions[i].vRes = res.vRes))
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (i < resCount)
|
||||||
|
data.SetQuality((((i + 1) * 3) / resCount) + wxPRINT_QUALITY_DRAFT);
|
||||||
|
}
|
||||||
|
free(resolutions);
|
||||||
|
}
|
||||||
|
|
||||||
double height, width;
|
double height, width;
|
||||||
PMPaperGetHeight(m_macPaper, &height);
|
PMPaperGetHeight(m_macPaper, &height);
|
||||||
@@ -492,13 +600,32 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
|
|||||||
|
|
||||||
// on the mac we have always pixels as addressing mode with 72 dpi
|
// on the mac we have always pixels as addressing mode with 72 dpi
|
||||||
printout->SetPPIScreen(72, 72);
|
printout->SetPPIScreen(72, 72);
|
||||||
#ifndef __LP64__
|
|
||||||
PMResolution res;
|
PMResolution res;
|
||||||
|
PMPrinter printer;
|
||||||
wxOSXPrintData* nativeData = (wxOSXPrintData*)
|
wxOSXPrintData* nativeData = (wxOSXPrintData*)
|
||||||
(m_printDialogData.GetPrintData().GetNativeData());
|
(m_printDialogData.GetPrintData().GetNativeData());
|
||||||
PMGetResolution( (nativeData->GetPageFormat()), &res);
|
|
||||||
printout->SetPPIPrinter(int(res.hRes), int(res.vRes));
|
if (PMSessionGetCurrentPrinter(nativeData->GetPrintSession(), &printer) == noErr)
|
||||||
|
{
|
||||||
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
|
||||||
|
if ( PMPrinterGetOutputResolution != NULL )
|
||||||
|
{
|
||||||
|
if (PMPrinterGetOutputResolution( printer, nativeData->GetPrintSettings(), &res) == -9589 /* kPMKeyNotFound */ )
|
||||||
|
{
|
||||||
|
res.hRes = res.vRes = 300;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
|
||||||
|
PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &res);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printout->SetPPIPrinter(int(res.hRes), int(res.vRes));
|
||||||
|
|
||||||
// Set printout parameters
|
// Set printout parameters
|
||||||
printout->SetDC(dc);
|
printout->SetDC(dc);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user