- m_macPrintInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
- (**m_macPrintInfo).iPrVersion = 0; // something invalid
-
- (**m_macPrintInfo).prInfo.iHRes = 72;
- (**m_macPrintInfo).prInfo.iVRes = 72;
- Rect r1 = { 0, 0, 8*72 - 2 * 18, 11*72 - 2 * 36 } ;
- (**m_macPrintInfo).prInfo.rPage = r1;// must have its top left & (0,0)
-
- Rect r2 = { -18, -36, 8*72 - 18, 11*72 - 36 } ;
- (**m_macPrintInfo).rPaper = r2;
- (**m_macPrintInfo).prStl.iPageV = 11 * 120 ; // 11 inches in 120th of an inch
- (**m_macPrintInfo).prStl.iPageH = 8 * 120 ; // 8 inches in 120th of an inch
-/*
- UMAPrOpen() ;
- m_macPrintInfo = (THPrint) NewHandleClear( sizeof( TPrint ) ) ;
- ::PrintDefault( m_macPrintInfo ) ;
- OSErr err = PrError() ;
- UMAPrClose() ;
- wxASSERT( err == noErr ) ;
-*/
+#if TARGET_CARBON
+ m_macPageFormat = kPMNoPageFormat;
+ m_macPrintSettings = kPMNoPrintSettings;
+
+ #if PM_USE_SESSION_APIS
+ PMPrintSession macPrintSession = kPMNoReference;
+ OSStatus err;
+
+ err = ::UMAPrOpen(&macPrintSession) ;
+ if ( err == noErr )
+ {
+ err = PMCreatePageFormat(&m_macPageFormat);
+
+ // Note that PMPageFormat is not session-specific, but calling
+ // PMSessionDefaultPageFormat assigns values specific to the printer
+ // associated with the current printing session.
+ if ((err == noErr) && (m_macPageFormat != kPMNoPageFormat))
+ {
+ err = PMSessionDefaultPageFormat(macPrintSession, m_macPageFormat);
+ }
+
+ err = PMCreatePrintSettings(&m_macPrintSettings);
+
+ // Note that PMPrintSettings is not session-specific, but calling
+ // PMSessionDefaultPrintSettings assigns values specific to the printer
+ // associated with the current printing session.
+ if ((err == noErr) && (m_macPrintSettings != kPMNoPrintSettings))
+ {
+ err = PMSessionDefaultPrintSettings(macPrintSession, m_macPrintSettings);
+ }
+ }
+ ::UMAPrClose(&macPrintSession) ;
+ #endif
+#else
+ m_macPrintInfo = (THPrint) NewHandleClear( sizeof( TPrint ) );
+ (**m_macPrintInfo).iPrVersion = 0; // something invalid
+
+ (**m_macPrintInfo).prInfo.iHRes = 72;
+ (**m_macPrintInfo).prInfo.iVRes = 72;
+ Rect r1 = { 0, 0, 8*72 - 2 * 18, 11*72 - 2 * 36 };
+ (**m_macPrintInfo).prInfo.rPage = r1;// must have its top left & (0,0)
+
+ Rect r2 = { -18, -36, 8*72 - 18, 11*72 - 36 };
+ (**m_macPrintInfo).rPaper = r2;
+ (**m_macPrintInfo).prStl.iPageV = 11 * 120 ; // 11 inches in 120th of an inch
+ (**m_macPrintInfo).prStl.iPageH = 8 * 120 ; // 8 inches in 120th of an inch
+#endif