- if ( !m_macPrintInfo )
- {
- m_macPrintInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
- if ( m_macPrintInfo )
- {
- ::PrintDefault( m_macPrintInfo ) ;
- // todo setup the global pagesetup ?
- }
- }
- if ( m_macPrintInfo )
- {
- (**m_macPrintInfo).prJob.iCopies = m_printNoCopies ;
- (**m_macPrintInfo).prJob.iFstPage = 0 ;
- (**m_macPrintInfo).prJob.iLstPage = 0 ;
- }
+ ValidateOrCreateNative() ;
+#if TARGET_CARBON
+ PMSetCopies( (PMPrintSettings) m_macPrintSettings , m_printNoCopies , false ) ;
+ PMSetOrientation( (PMPageFormat) m_macPageFormat , ( m_printOrientation == 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 ) ) ;
+#endif
+ PMColorMode color ;
+ PMGetColorMode( (PMPrintSettings) m_macPrintSettings, &color ) ;
+ if (m_colour)
+ {
+ 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
+#else
+ // on mac the paper rect has a negative top left corner, because the page rect (printable area) is at 0,0
+ (**(THPrint)m_macPrintSettings).prJob.iCopies = m_printNoCopies;
+ (**(THPrint)m_macPrintSettings).rPaper.left = int( ((double) m_minMarginTopLeft.x)*mm2pt );
+ (**(THPrint)m_macPrintSettings).rPaper.top = int( ((double) m_minMarginTopLeft.y)*mm2pt );
+
+ (**(THPrint)m_macPrintSettings).rPaper.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x)*mm2pt );
+ (**(THPrint)m_macPrintSettings).rPaper.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y)*mm2pt );
+
+ (**(THPrint)m_macPrintSettings).prInfo.rPage.left = 0;
+ (**(THPrint)m_macPrintSettings).prInfo.rPage.top = 0;
+ (**(THPrint)m_macPrintSettings).prInfo.rPage.right = int( ((double) m_paperSize.x - m_minMarginTopLeft.x - m_minMarginBottomRight.x)*mm2pt );
+ (**(THPrint)m_macPrintSettings).prInfo.rPage.bottom = int( ((double) m_paperSize.y - m_minMarginTopLeft.y - m_minMarginBottomRight.y)*mm2pt );
+#endif