wxMacCarbonPrintData::wxMacCarbonPrintData() { m_macPageFormat = kPMNoPageFormat; m_macPrintSettings = kPMNoPrintSettings; m_macPrintSession = kPMNoReference ; ValidateOrCreate() ; }
void wxMacClassicPrintData::TransferFrom( wxPrintData* data ) { ValidateOrCreate() ; (**m_macPrintSettings).prJob.iCopies = data->GetNoCopies() ; // on mac the paper rect has a negative top left corner, because the page rect (printable area) is at 0,0 // if all printing data is consolidated in on structure we will be able to set additional infos about pages }
void wxMacCarbonPrintData::TransferFrom( wxPrintData* data ) { ValidateOrCreate() ; PMSetCopies( (PMPrintSettings) m_macPrintSettings , data->GetNoCopies() , false ) ; 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 PMColorMode color ; PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ; if ( data->GetColour() ) { 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 }
bool wxMacCarbonPrintData::TransferFrom( const wxPrintData &data ) { ValidateOrCreate() ; PMSetCopies( (PMPrintSettings) m_macPrintSettings , data.GetNoCopies() , false ) ; PMSetOrientation( (PMPageFormat) m_macPageFormat , ( data.GetOrientation() == 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 , wxFont::GetDefaultEncoding() ) ) ; #endif PMColorMode color ; PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ; if ( data.GetColour() ) { 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 PMResolution res; PMPrinter printer; PMTag tag = kPMMaxSquareResolution; PMSessionGetCurrentPrinter(m_macPrintSession, &printer); PMPrinterGetPrinterResolution(printer, tag, &res); PMSetResolution((PMPageFormat) m_macPageFormat, &res); return true ; }
wxMacClassicPrintData::wxMacClassicPrintData() { m_macPrintSettings = NULL ; ValidateOrCreate() ; }
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 ; }