]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/cmndata.cpp
added new text event macros description
[wxWidgets.git] / src / common / cmndata.cpp
index b039641a0759a462200acafca0fac93727897c1b..59361e1baa250efaed676d0b3a0d4dc64abce846 100644 (file)
@@ -82,6 +82,8 @@
     IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
 
 #ifdef __WXMAC__
+    #include "wx/mac/uma.h"
+    
     #define mm2pt            2.83464566929
     #define pt2mm            0.352777777778
 #endif // Mac
@@ -179,6 +181,36 @@ wxPrintData::wxPrintData()
 #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
@@ -226,7 +258,7 @@ wxPrintData::wxPrintData(const wxPrintData& printData)
     m_devNames = (void*) NULL;
 #elif defined( __WXMAC__ )
 #if TARGET_CARBON
-    m_macPageFormat = kPMNoPageFormat;
+    m_macPageFormat    = kPMNoPageFormat;
     m_macPrintSettings = kPMNoPrintSettings;
 #else
     m_macPrintInfo = NULL;
@@ -248,15 +280,24 @@ wxPrintData::~wxPrintData()
 #if TARGET_CARBON
     if (m_macPageFormat != kPMNoPageFormat)
     {
+  #if PM_USE_SESSION_APIS
+        (void)PMRelease(m_macPageFormat);
+  #else
         (void)PMDisposePageFormat(m_macPageFormat);
+  #endif
         m_macPageFormat = kPMNoPageFormat;
     }
 
     if (m_macPrintSettings != kPMNoPrintSettings)
     {
+  #if PM_USE_SESSION_APIS
+        (void)PMRelease(m_macPrintSettings);
+  #else
         (void)PMDisposePrintSettings(m_macPrintSettings);
+  #endif
         m_macPrintSettings = kPMNoPrintSettings;
     }
+    
 #else
     wxASSERT( m_macPrintInfo );
     // we should perhaps delete