+ PMRelease( m_macPrintSessionPort ) ;
+#else
+ UMAPrClose(NULL) ;
+#endif
+ m_ok = FALSE;
+ return;
+ }
+
+#if !TARGET_CARBON
+ if ( ::PrValidate( (THPrint) m_printData.m_macPrintSettings ) )
+ {
+ // the driver has changed in the mean time, should we pop up a page setup dialog ?
+ if ( !::PrStlDialog( (THPrint) m_printData.m_macPrintSettings ) )
+ {
+ UMAPrClose(NULL) ;
+ m_ok = FALSE;
+ return;
+ }
+ }
+ err = PrError() ;
+ if ( err != noErr )
+ {
+ message.Printf( wxT("Print Error %ld"), err ) ;
+ wxMessageDialog dialog( NULL , message , wxEmptyString , wxICON_HAND | wxOK) ;
+ dialog.ShowModal();
+ UMAPrClose(NULL) ;
+ m_ok = FALSE;
+ return;
+ }
+ ::GetPort( &macPrintFormerPort ) ;
+#endif
+ m_ok = TRUE ;
+ m_minY = m_minX = 0 ;
+#if TARGET_CARBON
+ PMRect rPage;
+
+ err = PMGetAdjustedPageRect((PMPageFormat)m_printData.m_macPageFormat, &rPage);
+ if ( err != noErr )
+ {
+ message.Printf( wxT("Print Error %ld"), err ) ;
+ wxMessageDialog dialog( NULL , message , wxEmptyString, wxICON_HAND | wxOK) ;
+ dialog.ShowModal();
+ #if TARGET_CARBON && PM_USE_SESSION_APIS
+ PMRelease(&m_macPrintSessionPort) ;
+ #else
+ UMAPrClose(NULL) ;
+ #endif
+ m_ok = FALSE;
+ return;
+ }
+ m_maxX = wxCoord(rPage.right - rPage.left) ;
+ m_maxY = wxCoord(rPage.bottom - rPage.top);