void wxOSXPrintData::TransferResolutionTo( wxPrintData &data ) { PMPrinter printer ; PMSessionGetCurrentPrinter( m_macPrintSession, &printer ); /* 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 ( PMPrinterGetOutputResolution(printer, m_macPrintSettings, &res) == noErr ) valid = true; 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); } }
wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data ) { #if !wxMAC_USE_CORE_GRAPHICS ::GetPort( & m_macPrintFormerPort ) ; #endif m_err = noErr ; wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) data->GetNativeData() ; PMRect rPage; m_err = PMGetAdjustedPageRect(native->m_macPageFormat, &rPage); if ( m_err != noErr ) return; m_maxX = wxCoord(rPage.right - rPage.left) ; 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); #endif m_ppi = wxSize(int(res.hRes), int(res.vRes)); }
wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data ) { m_err = noErr ; wxOSXPrintData *native = (wxOSXPrintData*) data->GetNativeData() ; PMRect rPage; m_err = PMGetAdjustedPageRect(native->GetPageFormat(), &rPage); if ( m_err != noErr ) return; m_maxX = wxCoord(rPage.right - rPage.left) ; m_maxY = wxCoord(rPage.bottom - rPage.top); PMResolution res; PMPrinter printer; m_err = PMSessionGetCurrentPrinter(native->GetPrintSession(), &printer); if ( m_err == noErr ) { m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &res) ; if ( m_err == -9589 /* kPMKeyNotFound */ ) { m_err = noErr ; res.hRes = res.vRes = 300; } } else { res.hRes = res.vRes = 300; } 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)); }
bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& message ) { if ( m_err ) return false ; wxPrinterDCImpl *impl = (wxPrinterDCImpl*) dc->GetImpl(); wxOSXPrintData *native = (wxOSXPrintData*) impl->GetPrintData().GetNativeData() ; PMPrintSettingsSetJobName(native->GetPrintSettings(), wxCFStringRef(message)); m_err = PMSessionBeginCGDocumentNoDialog(native->GetPrintSession(), native->GetPrintSettings(), native->GetPageFormat()); if ( m_err != noErr ) return false; PMRect rPage; m_err = PMGetAdjustedPageRect(native->GetPageFormat(), &rPage); if ( m_err != noErr ) return false ; m_maxX = wxCoord(rPage.right - rPage.left) ; m_maxY = wxCoord(rPage.bottom - rPage.top); 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 ( PMPrinterGetOutputResolution != NULL ) { m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &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 if ( PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &res) != noErr ) { res.hRes = res.vRes = 300; } #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)); return true ; }
wxMacCarbonPrinterDC::wxMacCarbonPrinterDC( wxPrintData* data ) { m_err = noErr ; wxOSXPrintData *native = (wxOSXPrintData*) data->GetNativeData() ; PMRect rPage; m_err = PMGetAdjustedPageRect(native->GetPageFormat(), &rPage); if ( m_err != noErr ) return; m_maxX = wxCoord(rPage.right - rPage.left) ; m_maxY = wxCoord(rPage.bottom - rPage.top); 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 ( PMPrinterGetOutputResolution != NULL ) { { m_err = PMPrinterGetOutputResolution( printer, native->GetPrintSettings(), &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 = PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &res); if ( m_err != noErr ) { m_err = PMGetResolution((PMPageFormat) (native->GetPageFormat()), &res); } #endif } } else { res.hRes = res.vRes = 300; } 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)); }
bool wxMacCarbonPrinterDC::StartDoc( wxPrinterDC* dc , const wxString& WXUNUSED(message) ) { if ( m_err ) return false ; wxMacCarbonPrintData *native = (wxMacCarbonPrintData*) dc->GetPrintData().GetNativeData() ; #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_4 && wxMAC_USE_CORE_GRAPHICS { CFStringRef s[1] = { kPMGraphicsContextCoreGraphics }; CFArrayRef graphicsContextsArray = CFArrayCreate(NULL, (const void**)s, 1, &kCFTypeArrayCallBacks); PMSessionSetDocumentFormatGeneration(native->m_macPrintSession, kPMDocumentFormatPDF, graphicsContextsArray, NULL); CFRelease(graphicsContextsArray); } #endif #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_4 && wxMAC_USE_CORE_GRAPHICS m_err = PMSessionBeginCGDocument(native->m_macPrintSession, native->m_macPrintSettings, native->m_macPageFormat); #else m_err = PMSessionBeginDocument(native->m_macPrintSession, native->m_macPrintSettings, native->m_macPageFormat); #endif if ( m_err != noErr ) return false; PMRect rPage; m_err = PMGetAdjustedPageRect(native->m_macPageFormat, &rPage); if ( m_err != noErr ) return false ; m_maxX = wxCoord(rPage.right - rPage.left) ; 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); #endif m_ppi = wxSize(int(res.hRes), int(res.vRes)); return true ; }
bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) { sm_abortIt = false; sm_abortWindow = NULL; if (!printout) { sm_lastError = wxPRINTER_ERROR; return 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) { wxMacPrintDialog dialog(parent, & m_printDialogData); if (dialog.ShowModal() == wxID_OK) { dc = wxDynamicCast(dialog.GetPrintDC(), wxPrinterDC); wxASSERT(dc); m_printDialogData = dialog.GetPrintDialogData(); } } else { dc = new wxPrinterDC( m_printDialogData.GetPrintData() ) ; } // May have pressed cancel. if (!dc || !dc->IsOk()) { delete dc; return false; } PMResolution res; PMPrinter printer; wxOSXPrintData* nativeData = (wxOSXPrintData*) (m_printDialogData.GetPrintData().GetNativeData()); if (PMSessionGetCurrentPrinter(nativeData->GetPrintSession(), &printer) == noErr) { if (PMPrinterGetOutputResolution( printer, nativeData->GetPrintSettings(), &res) == -9589 /* kPMKeyNotFound */ ) { res.hRes = res.vRes = 300; } } else { // fallback res.hRes = res.vRes = 300; } printout->SetPPIPrinter(int(res.hRes), int(res.vRes)); // Set printout parameters printout->SetUp(*dc); // Create an abort window wxBeginBusyCursor(); printout->OnPreparePrinting(); // Get some parameters from the printout, if defined 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 if prompted for the print dialog above m_printDialogData.SetMinPage(minPage); m_printDialogData.SetMaxPage(maxPage); // Set from and to pages if bypassing the print dialog if ( !prompt ) { m_printDialogData.SetFromPage(fromPage); if( m_printDialogData.GetAllPages() ) m_printDialogData.SetToPage(maxPage); else m_printDialogData.SetToPage(toPage); } printout->OnBeginPrinting(); bool keepGoing = true; if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage())) { wxEndBusyCursor(); wxMessageBox(wxT("Could not start printing."), wxT("Print Error"), wxOK, parent); } int pn; for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn); pn++) { if (sm_abortIt) { break; } else { dc->StartPage(); keepGoing = printout->OnPrintPage(pn); dc->EndPage(); } } printout->OnEndDocument(); printout->OnEndPrinting(); if (sm_abortWindow) { sm_abortWindow->Show(false); wxDELETE(sm_abortWindow); } wxEndBusyCursor(); delete dc; return true; }
bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) { sm_abortIt = false; sm_abortWindow = NULL; if (!printout) { sm_lastError = wxPRINTER_ERROR; return 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) { wxMacPrintDialog dialog(parent, & m_printDialogData); if (dialog.ShowModal() == wxID_OK) { dc = wxDynamicCast(dialog.GetPrintDC(), wxPrinterDC); wxASSERT(dc); m_printDialogData = dialog.GetPrintDialogData(); } } else { dc = new wxPrinterDC( m_printDialogData.GetPrintData() ) ; } // May have pressed cancel. if (!dc || !dc->IsOk()) { delete dc; return false; } // on the mac we have always pixels as addressing mode with 72 dpi printout->SetPPIScreen(72, 72); PMResolution res; PMPrinter printer; wxOSXPrintData* nativeData = (wxOSXPrintData*) (m_printDialogData.GetPrintData().GetNativeData()); 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 { #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 printout->SetDC(dc); int w, h; dc->GetSize(&w, &h); printout->SetPageSizePixels((int)w, (int)h); printout->SetPaperRectPixels(dc->GetPaperRect()); wxCoord mw, mh; dc->GetSizeMM(&mw, &mh); printout->SetPageSizeMM((int)mw, (int)mh); // Create an abort window wxBeginBusyCursor(); printout->OnPreparePrinting(); // Get some parameters from the printout, if defined 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; if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage())) { wxEndBusyCursor(); wxMessageBox(wxT("Could not start printing."), wxT("Print Error"), wxOK, parent); } int pn; for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn); pn++) { if (sm_abortIt) { break; } else { dc->StartPage(); keepGoing = printout->OnPrintPage(pn); dc->EndPage(); } } printout->OnEndDocument(); printout->OnEndPrinting(); if (sm_abortWindow) { sm_abortWindow->Show(false); wxDELETE(sm_abortWindow); } wxEndBusyCursor(); delete dc; return true; }
bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) { sm_abortIt = false; sm_abortWindow = NULL; if (!printout) 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) { wxMacPrintDialog dialog(parent, & m_printDialogData); if (dialog.ShowModal() == wxID_OK) { dc = wxDynamicCast(dialog.GetPrintDC(), wxPrinterDC); wxASSERT(dc); m_printDialogData = dialog.GetPrintDialogData(); } } else { dc = new wxPrinterDC( m_printDialogData.GetPrintData() ) ; } // May have pressed cancel. if (!dc || !dc->Ok()) { if (dc) delete dc; return false; } // on the mac we have always pixels as addressing mode with 72 dpi printout->SetPPIScreen(72, 72); PMResolution res; wxMacCarbonPrintData* nativeData = (wxMacCarbonPrintData*) (m_printDialogData.GetPrintData().GetNativeData()); #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 PMPrinter printer; PMSessionGetCurrentPrinter(nativeData->m_macPrintSession, &printer); PMPrinterGetOutputResolution( printer, nativeData->m_macPrintSettings, &res) ; #else PMGetResolution((PMPageFormat) (nativeData->m_macPageFormat), &res); #endif printout->SetPPIPrinter(int(res.hRes), int(res.vRes)); // Set printout parameters printout->SetDC(dc); int w, h; dc->GetSize(&w, &h); printout->SetPageSizePixels((int)w, (int)h); printout->SetPaperRectPixels(dc->GetPaperRect()); wxCoord mw, mh; dc->GetSizeMM(&mw, &mh); printout->SetPageSizeMM((int)mw, (int)mh); // Create an abort window wxBeginBusyCursor(); printout->OnPreparePrinting(); // Get some parameters from the printout, if defined int fromPage, toPage; int minPage, maxPage; printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage); if (maxPage == 0) { wxEndBusyCursor(); return false; } // Only set min and max, because from and to have been // set by the user m_printDialogData.SetMinPage(minPage); m_printDialogData.SetMaxPage(maxPage); wxWindow *win = CreateAbortWindow(parent, printout); wxSafeYield(win,true); if (!win) { wxEndBusyCursor(); wxMessageBox(wxT("Sorry, could not create an abort dialog."), wxT("Print Error"), wxOK, parent); delete dc; return false; } sm_abortWindow = win; sm_abortWindow->Show(true); wxSafeYield(win,true); printout->OnBeginPrinting(); bool keepGoing = true; int copyCount; for (copyCount = 1; copyCount <= m_printDialogData.GetNoCopies(); copyCount ++) { if (!printout->OnBeginDocument(m_printDialogData.GetFromPage(), m_printDialogData.GetToPage())) { wxEndBusyCursor(); wxMessageBox(wxT("Could not start printing."), wxT("Print Error"), wxOK, parent); break; } if (sm_abortIt) break; int pn; for (pn = m_printDialogData.GetFromPage(); keepGoing && (pn <= m_printDialogData.GetToPage()) && printout->HasPage(pn); pn++) { if (sm_abortIt) { keepGoing = false; break; } else { #if TARGET_CARBON if ( UMAGetSystemVersion() >= 0x1000 ) #endif { #if !wxMAC_USE_CORE_GRAPHICS GrafPtr thePort ; GetPort( &thePort ) ; #endif wxSafeYield(win,true); #if !wxMAC_USE_CORE_GRAPHICS SetPort( thePort ) ; #endif } dc->StartPage(); keepGoing = printout->OnPrintPage(pn); dc->EndPage(); } } printout->OnEndDocument(); } printout->OnEndPrinting(); if (sm_abortWindow) { sm_abortWindow->Show(false); delete sm_abortWindow; sm_abortWindow = NULL; } wxEndBusyCursor(); delete dc; return true; }
bool wxMacCarbonPrintData::TransferFrom( const wxPrintData &data ) { ValidateOrCreate() ; PMSetCopies( (PMPrintSettings) m_macPrintSettings , data.GetNoCopies() , false ) ; if ( data.IsOrientationReversed() ) PMSetOrientation( (PMPageFormat) m_macPageFormat , ( data.GetOrientation() == wxLANDSCAPE ) ? kPMReverseLandscape : kPMReversePortrait , false ) ; else PMSetOrientation( (PMPageFormat) m_macPageFormat , ( data.GetOrientation() == wxLANDSCAPE ) ? kPMLandscape : kPMPortrait , false ) ; // collate cannot be set #if 0 // not yet tested if ( !m_printerName.empty() ) PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxMacCFStringHolder( m_printerName , wxFont::GetDefaultEncoding() ) ) ; #endif #ifndef __LP64__ PMColorMode color ; PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ; if ( data.GetColour() ) { if ( color == kPMBlackAndWhite ) PMSetColorMode( (PMPrintSettings) m_macPrintSettings, kPMColor ) ; } else PMSetColorMode( (PMPrintSettings) m_macPrintSettings, kPMBlackAndWhite ) ; #endif #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 if ( &PMSetDuplex!=NULL ) { PMDuplexMode mode = 0 ; switch( data.GetDuplex() ) { case wxDUPLEX_HORIZONTAL : mode = kPMDuplexNoTumble ; break ; case wxDUPLEX_VERTICAL : mode = kPMDuplexTumble ; break ; case wxDUPLEX_SIMPLEX : default : mode = kPMDuplexNone ; break ; } PMSetDuplex( (PMPrintSettings) m_macPrintSettings, mode ) ; } #endif // PMQualityMode not yet accessible via API // todo paperSize PMResolution res; PMPrinter printer; PMSessionGetCurrentPrinter(m_macPrintSession, &printer); #if MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_5 PMPrinterGetOutputResolution( printer, (PMPrintSettings) m_macPrintSettings, &res) ; // TODO transfer ? into page format ? #else PMTag tag = kPMMaxSquareResolution; PMPrinterGetPrinterResolution(printer, tag, &res); PMSetResolution((PMPageFormat) m_macPageFormat, &res); #endif // after setting the new resolution the format has to be updated, otherwise the page rect remains // at the 'old' scaling PMSessionValidatePageFormat((PMPrintSession) m_macPrintSession, (PMPageFormat) m_macPageFormat, kPMDontWantBoolean) ; return true ; }
int QMacPrintEngine::metric(QPaintDevice::PaintDeviceMetric m) const { Q_D(const QMacPrintEngine); int val = 1; switch (m) { case QPaintDevice::PdmWidth: if (d->hasCustomPaperSize) { val = qRound(d->customSize.width()); if (d->hasCustomPageMargins) { val -= qRound(d->leftMargin + d->rightMargin); } else { QList<QVariant> margins = property(QPrintEngine::PPK_PageMargins).toList(); val -= qRound(margins.at(0).toDouble() + margins.at(2).toDouble()); } } else { val = qt_get_PDMWidth(d->format, property(PPK_FullPage).toBool(), d->resolution); } break; case QPaintDevice::PdmHeight: if (d->hasCustomPaperSize) { val = qRound(d->customSize.height()); if (d->hasCustomPageMargins) { val -= qRound(d->topMargin + d->bottomMargin); } else { QList<QVariant> margins = property(QPrintEngine::PPK_PageMargins).toList(); val -= qRound(margins.at(1).toDouble() + margins.at(3).toDouble()); } } else { val = qt_get_PDMHeight(d->format, property(PPK_FullPage).toBool(), d->resolution); } break; case QPaintDevice::PdmWidthMM: val = metric(QPaintDevice::PdmWidth); val = int((val * 254 + 5 * d->resolution.hRes) / (10 * d->resolution.hRes)); break; case QPaintDevice::PdmHeightMM: val = metric(QPaintDevice::PdmHeight); val = int((val * 254 + 5 * d->resolution.vRes) / (10 * d->resolution.vRes)); break; case QPaintDevice::PdmPhysicalDpiX: case QPaintDevice::PdmPhysicalDpiY: { PMPrinter printer; if(PMSessionGetCurrentPrinter(d->session, &printer) == noErr) { PMResolution resolution; #if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5) if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_5) { PMPrinterGetOutputResolution(printer, d->settings, &resolution); } else #endif { #ifndef Q_OS_MAC64 PMPrinterGetPrinterResolution(printer, kPMCurrentValue, &resolution); #endif } val = (int)resolution.vRes; break; } //otherwise fall through } case QPaintDevice::PdmDpiY: val = (int)d->resolution.vRes; break; case QPaintDevice::PdmDpiX: val = (int)d->resolution.hRes; break; case QPaintDevice::PdmNumColors: val = (1 << metric(QPaintDevice::PdmDepth)); break; case QPaintDevice::PdmDepth: val = 24; break; default: val = 0; qWarning("QPrinter::metric: Invalid metric command"); } return val; }