{
const PMResolution *res1 = (const PMResolution *)e1;
const PMResolution *res2 = (const PMResolution *)e2;
- int area1 = res1->hRes * res1->vRes;
- int area2 = res2->hRes * res2->vRes;
-
+ const double area1 = res1->hRes * res1->vRes;
+ const double area2 = res2->hRes * res2->vRes;
+
if (area1 < area2)
return -1;
else if (area1 > area2)
resolutions[realCount++] = res;
}
qsort(resolutions, realCount, sizeof(PMResolution), ResolutionSorter);
-
+
*count = realCount;
}
if ((*count == 0) && (resolutions))
CFArrayRef printerList;
CFIndex index, count;
CFStringRef name;
-
+
if (PMServerCreatePrinterList(kPMServerLocal, &printerList) == noErr)
{
PMPrinter printer = NULL;
PMSessionSetCurrentPMPrinter(m_macPrintSession, printer);
CFRelease(printerList);
}
-
+
PMPrinter printer;
PMSessionGetCurrentPrinter(m_macPrintSession, &printer);
wxPrintQuality quality = data.GetQuality();
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 )
/* assume high quality, will change below if we are able to */
data.SetQuality(wxPRINT_QUALITY_HIGH);
-
+
PMResolution *resolutions;
UInt32 resCount;
resolutions = GetSupportedResolutions(printer, &resCount);
data.SetQuality((((i + 1) * 3) / resCount) + wxPRINT_QUALITY_DRAFT);
}
free(resolutions);
- }
-
+ }
+
double height, width;
PMPaperGetHeight(m_macPaper, &height);
PMPaperGetWidth(m_macPaper, &width);
}
void wxOSXPrintData::TransferTo( wxPrintDialogData* data )
-{
+{
#if wxOSX_USE_COCOA
UpdateToPMState();
#endif
sm_lastError = wxPRINTER_ERROR;
return false;
}
-
+
printout->SetIsPreview(false);
if (m_printDialogData.GetMinPage() < 1)
m_printDialogData.SetMinPage(1);
if (m_printDialogData.GetMaxPage() < 1)
m_printDialogData.SetMaxPage(9999);
-
+
// Create a suitable device context
wxPrinterDC *dc = NULL;
if (prompt)
if (PMSessionGetCurrentPrinter(nativeData->GetPrintSession(), &printer) == 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( printer, nativeData->GetPrintSettings(), &res) == -9589 /* kPMKeyNotFound */ )
else
#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
PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &res);
#endif
}
int fromPage, toPage;
int minPage, maxPage;
printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
-
+
if (maxPage == 0)
{
sm_lastError = wxPRINTER_ERROR;
return false;
}
-
+
// Only set min and max, because from and to will be
// set by the user
m_printDialogData.SetMinPage(minPage);
m_printDialogData.SetMaxPage(maxPage);
-
+
printout->OnBeginPrinting();
bool keepGoing = true;