]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/printmac.cpp
Warning fixes.
[wxWidgets.git] / src / mac / carbon / printmac.cpp
index b7c8915190776a12a2bab1abb2ede1921f74b4b9..bb1901b3ebbde43df4ce6ac5e8f7a1476e4da589 100644 (file)
@@ -39,6 +39,7 @@
 
 #include "wx/dcprint.h"
 #include "wx/printdlg.h"
+#include "wx/mac/printdlg.h"
 
 #include <stdlib.h>
 
@@ -144,7 +145,7 @@ void wxMacCarbonPrintData::TransferFrom( wxPrintData* data )
     // collate cannot be set
 #if 0 // not yet tested
     if ( m_printerName.Length() > 0 )
-        PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxMacCFStringHolder( m_printerName ) ) ;
+        PMSessionSetCurrentPrinter( (PMPrintSession) m_macPrintSession , wxMacCFStringHolder( m_printerName , wxFont::GetDefaultEncoding() ) ) ;
 #endif
     PMColorMode color ;
     PMGetColorMode(  (PMPrintSettings) m_macPrintSettings, &color ) ;
@@ -261,7 +262,11 @@ void wxMacCarbonPrintData::TransferFrom( wxPrintDialogData* data )
     PMSetPageRange( m_macPrintSettings , data->GetMinPage() , data->GetMaxPage() ) ;
     PMSetCopies( m_macPrintSettings , data->GetNoCopies() , false ) ;
     PMSetFirstPage( m_macPrintSettings , data->GetFromPage() , false ) ;
-    PMSetLastPage( m_macPrintSettings , data->GetToPage() , false ) ;
+
+    int toPage = data->GetToPage();
+    if (toPage < 1)
+        toPage = data->GetFromPage();
+    PMSetLastPage( m_macPrintSettings , toPage , false ) ;
 }
 
 void wxMacCarbonPrintData::CopyFrom( wxNativePrintData* d )
@@ -443,8 +448,11 @@ void wxMacClassicPrintData::TransferTo( wxPageSetupData* data )
 
 void wxMacClassicPrintData::TransferFrom( wxPrintDialogData* data )
 {
+    int toPage = data->GetToPage();
+    if (toPage < 1)
+        toPage = data->GetFromPage();
     (**m_macPrintSettings).prJob.iFstPage = data->GetFromPage() ;
-    (**m_macPrintSettings).prJob.iLstPage = data->GetToPage() ;
+    (**m_macPrintSettings).prJob.iLstPage = toPage;
 }
 
 void wxMacClassicPrintData::TransferTo( wxPrintDialogData* data )
@@ -548,7 +556,7 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
         if (dialog.ShowModal() == wxID_OK)
         {
             dc = dialog.GetPrintDC();
-            m_printDialogData = dialog.GetPrintData();
+            m_printDialogData = dialog.GetPrintDialogData();
         }
     }
     else
@@ -641,12 +649,15 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
             }
             else
             {
-// #if !TARGET_CARBON
-                GrafPtr thePort ;
-                GetPort( &thePort ) ;
-                wxSafeYield(win,true);
-                SetPort( thePort ) ;
-// #endif                
+#if TARGET_CARBON
+                if ( UMAGetSystemVersion() >= 0x1000 )
+#endif
+                {
+                    GrafPtr thePort ;
+                    GetPort( &thePort ) ;
+                    wxSafeYield(win,true);
+                    SetPort( thePort ) ;
+                }
                 dc->StartPage();
                 keepGoing = printout->OnPrintPage(pn);
                 dc->EndPage();
@@ -689,6 +700,7 @@ wxDC* wxMacPrinter::PrintDialog(wxWindow *parent)
 
 bool wxMacPrinter::Setup(wxWindow *parent)
 {
+#if 0
     wxPrintDialog dialog(parent, & m_printDialogData);
     dialog.GetPrintDialogData().SetSetupDialog(TRUE);
     
@@ -700,6 +712,8 @@ bool wxMacPrinter::Setup(wxWindow *parent)
     }
     
     return (ret == wxID_OK);
+#endif
+    return wxID_CANCEL;
 }
 
 /*