]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/printdlg.cpp
compilation warning fix
[wxWidgets.git] / src / mac / carbon / printdlg.cpp
index 5fd25c56da379eb19f774b98aead95e3751994e2..1b18c1d49b4131880ebc962c05fc73cda4eb3ed9 100644 (file)
 #include "wx/dcprint.h"
 #include "wx/msgdlg.h"
 #include "wx/mac/uma.h"
 #include "wx/dcprint.h"
 #include "wx/msgdlg.h"
 #include "wx/mac/uma.h"
+#ifndef __DARWIN__
+    #include "Printing.h"
+#endif
+
+#if defined(TARGET_CARBON) && !defined(__DARWIN__)
+#  if PM_USE_SESSION_APIS
+#    include <PMCore.h>
+#  endif
+#  include <PMApplication.h>
+#endif
 
 // Use generic page setup dialog: use your own native one if one exists.
 
 
 // Use generic page setup dialog: use your own native one if one exists.
 
@@ -61,8 +71,10 @@ bool wxPrintDialog::Create(wxWindow *p, wxPrintDialogData* data)
 
 wxPrintDialog::~wxPrintDialog()
 {
 
 wxPrintDialog::~wxPrintDialog()
 {
-    if (m_destroyDC && m_printerDC)
+    if (m_destroyDC && m_printerDC) {
         delete m_printerDC;
         delete m_printerDC;
+        m_printerDC = NULL;
+    }
 }
 
 int wxPrintDialog::ShowModal()
 }
 
 int wxPrintDialog::ShowModal()
@@ -72,11 +84,11 @@ int wxPrintDialog::ShowModal()
        wxString message ;
 
 #if !TARGET_CARBON     
        wxString message ;
 
 #if !TARGET_CARBON     
-       err = ::UMAPrOpen() ;
+       err = ::UMAPrOpen(NULL) ;
        if ( err == noErr )
        {
                m_printDialogData.ConvertToNative() ;
        if ( err == noErr )
        {
                m_printDialogData.ConvertToNative() ;
-               if  ( ::PrJobDialog( (THPrint) m_printDialogData.GetPrintData().m_macPrintInfo ) )
+               if  ( ::PrJobDialog( (THPrint) m_printDialogData.GetPrintData().m_macPrintSettings ) )
                {
                        m_printDialogData.ConvertFromNative() ;
                        result = wxID_OK ;
                {
                        m_printDialogData.ConvertFromNative() ;
                        result = wxID_OK ;
@@ -89,14 +101,11 @@ int wxPrintDialog::ShowModal()
                wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
                dialog.ShowModal();
        }
                wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
                dialog.ShowModal();
        }
-       ::UMAPrClose() ;
+       ::UMAPrClose(NULL) ;
 #else
   #if PM_USE_SESSION_APIS
 #else
   #if PM_USE_SESSION_APIS
-    PMPrintSession macPrintSession = kPMNoReference;
     Boolean        accepted;
     
     Boolean        accepted;
     
-    err = ::UMAPrOpen(&macPrintSession) ;
-    if ( err == noErr )
     {
         m_printDialogData.ConvertToNative() ;
         
     {
         m_printDialogData.ConvertToNative() ;
         
@@ -111,13 +120,13 @@ int wxPrintDialog::ShowModal()
             if ((err == noErr) &&
                 (m_printDialogData.GetPrintData().m_macPageFormat != kPMNoPageFormat))
             {
             if ((err == noErr) &&
                 (m_printDialogData.GetPrintData().m_macPageFormat != kPMNoPageFormat))
             {
-                err = PMSessionDefaultPageFormat((PMPrintSession)macPrintSession,
+                err = PMSessionDefaultPageFormat((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
                                                  (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat);
             }
         }
         else
         {
                                                  (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat);
             }
         }
         else
         {
-            err = PMSessionValidatePageFormat((PMPrintSession)macPrintSession,
+            err = PMSessionValidatePageFormat((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
                                               (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
                                               kPMDontWantBoolean);
         }
                                               (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
                                               kPMDontWantBoolean);
         }
@@ -133,13 +142,13 @@ int wxPrintDialog::ShowModal()
             if ((err == noErr) &&
                 (m_printDialogData.GetPrintData().m_macPrintSettings != kPMNoPrintSettings))
             {
             if ((err == noErr) &&
                 (m_printDialogData.GetPrintData().m_macPrintSettings != kPMNoPrintSettings))
             {
-                err = PMSessionDefaultPrintSettings((PMPrintSession)macPrintSession,
+                err = PMSessionDefaultPrintSettings((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
                                                     (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings);
             }
         }
         else
         {
                                                     (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings);
             }
         }
         else
         {
-            err = PMSessionValidatePrintSettings((PMPrintSession)macPrintSession,
+            err = PMSessionValidatePrintSettings((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
                                                  (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
                                                  kPMDontWantBoolean);
         }
                                                  (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
                                                  kPMDontWantBoolean);
         }
@@ -153,7 +162,7 @@ int wxPrintDialog::ShowModal()
         //  Display the Print dialog.
         if (err == noErr)
         {
         //  Display the Print dialog.
         if (err == noErr)
         {
-            err = PMSessionPrintDialog((PMPrintSession)macPrintSession,
+            err = PMSessionPrintDialog((PMPrintSession)m_printDialogData.GetPrintData().m_macPrintSession,
                                        (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
                                        (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
                                        &accepted);
                                        (PMPrintSettings)m_printDialogData.GetPrintData().m_macPrintSettings,
                                        (PMPageFormat)m_printDialogData.GetPrintData().m_macPageFormat,
                                        &accepted);
@@ -174,7 +183,6 @@ int wxPrintDialog::ShowModal()
         wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
         wxMessageDialog dialog( NULL , message  , "", wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
-    ::UMAPrClose(&macPrintSession) ;
   #else
     #pragma warning "TODO: Printing for carbon without session apis"
   #endif
   #else
     #pragma warning "TODO: Printing for carbon without session apis"
   #endif
@@ -224,11 +232,11 @@ int wxPageSetupDialog::ShowModal()
        wxString message ;
 
 #if !TARGET_CARBON
        wxString message ;
 
 #if !TARGET_CARBON
-       err = ::UMAPrOpen() ;
+       err = ::UMAPrOpen(NULL) ;
        if ( err == noErr )
        {
                m_pageSetupData.ConvertToNative() ;
        if ( err == noErr )
        {
                m_pageSetupData.ConvertToNative() ;
-               if  ( ::PrStlDialog(  (THPrint) m_pageSetupData.GetPrintData().m_macPrintInfo ) )
+               if  ( ::PrStlDialog(  (THPrint) m_pageSetupData.GetPrintData().m_macPrintSettings ) )
                {
                        m_pageSetupData.ConvertFromNative() ;
                        result = wxID_OK ;
                {
                        m_pageSetupData.ConvertFromNative() ;
                        result = wxID_OK ;
@@ -241,14 +249,11 @@ int wxPageSetupDialog::ShowModal()
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
                dialog.ShowModal();
        }
                wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
                dialog.ShowModal();
        }
-       ::UMAPrClose() ;
+       ::UMAPrClose(NULL) ;
 #else
   #if PM_USE_SESSION_APIS
 #else
   #if PM_USE_SESSION_APIS
-    PMPrintSession macPrintSession = kPMNoReference;
     Boolean        accepted;
     
     Boolean        accepted;
     
-    err = ::UMAPrOpen(&macPrintSession) ;
-    if ( err == noErr )
     {
         m_pageSetupData.ConvertToNative() ;
         
     {
         m_pageSetupData.ConvertToNative() ;
         
@@ -263,13 +268,13 @@ int wxPageSetupDialog::ShowModal()
             if ((err == noErr) &&
                 (m_pageSetupData.GetPrintData().m_macPageFormat != kPMNoPageFormat))
             {
             if ((err == noErr) &&
                 (m_pageSetupData.GetPrintData().m_macPageFormat != kPMNoPageFormat))
             {
-                err = PMSessionDefaultPageFormat((PMPrintSession)macPrintSession,
+                err = PMSessionDefaultPageFormat((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
                                                  (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat);
             }
         }
         else
         {
                                                  (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat);
             }
         }
         else
         {
-            err = PMSessionValidatePageFormat((PMPrintSession)macPrintSession,
+            err = PMSessionValidatePageFormat((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
                                               (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
                                               kPMDontWantBoolean);
         }
                                               (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
                                               kPMDontWantBoolean);
         }
@@ -277,7 +282,7 @@ int wxPageSetupDialog::ShowModal()
         //  Display the Page Setup dialog.
         if (err == noErr)
         {
         //  Display the Page Setup dialog.
         if (err == noErr)
         {
-            err = PMSessionPageSetupDialog((PMPrintSession)macPrintSession,
+            err = PMSessionPageSetupDialog((PMPrintSession)m_pageSetupData.GetPrintData().m_macPrintSession,
                                            (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
                                            &accepted);
             if ((err == noErr) && !accepted)
                                            (PMPageFormat)m_pageSetupData.GetPrintData().m_macPageFormat,
                                            &accepted);
             if ((err == noErr) && !accepted)
@@ -300,7 +305,6 @@ int wxPageSetupDialog::ShowModal()
         wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
         wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
         dialog.ShowModal();
     }
-    ::UMAPrClose(&macPrintSession) ;
   #else
     #pragma warning "TODO: Printing for carbon without session apis"
   #endif
   #else
     #pragma warning "TODO: Printing for carbon without session apis"
   #endif