X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f896f240a8114051f81ff0f3ebe55259e101f4ba..3570a1c6e596c358848c77c5b37d724097340ce8:/src/mac/carbon/dcprint.cpp diff --git a/src/mac/carbon/dcprint.cpp b/src/mac/carbon/dcprint.cpp index 10c79a07ef..aacf643f19 100644 --- a/src/mac/carbon/dcprint.cpp +++ b/src/mac/carbon/dcprint.cpp @@ -84,13 +84,30 @@ wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data ) m_maxY = wxCoord(rPage.bottom - rPage.top); PMResolution res; -#if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 - PMPrinter printer; - PMSessionGetCurrentPrinter(native->m_macPrintSession, &printer); - PMPrinterGetOutputResolution( printer, native->m_macPrintSettings, &res) ; -#else - m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res); + +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 + if ( PMPrinterGetOutputResolution != NULL ) + { + PMPrinter printer; + m_err = PMSessionGetCurrentPrinter(native->m_macPrintSession, &printer); + if ( m_err == noErr ) + { + m_err = PMPrinterGetOutputResolution( printer, native->m_macPrintSettings, &res) ; + if ( m_err == -9589 /* kPMKeyNotFound */ ) + { + m_err = noErr ; + res.hRes = res.vRes = 300; + } + } + } + else #endif + { +#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 + m_err = PMGetResolution((PMPageFormat) (native->m_macPageFormat), &res); +#endif + } + m_ppi = wxSize(int(res.hRes), int(res.vRes)); } @@ -132,7 +149,14 @@ bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& WXUNUSED PMPrinter printer; m_err = PMSessionGetCurrentPrinter(native->m_macPrintSession, &printer); if ( m_err == noErr ) + { m_err = PMPrinterGetOutputResolution( printer, native->m_macPrintSettings, &res) ; + if ( m_err == -9589 /* kPMKeyNotFound */ ) + { + m_err = noErr ; + res.hRes = res.vRes = 300; + } + } } else #endif