]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/core/printmac.cpp
Document that message box with wxYES_NO but without wxCANCEL can't be closed.
[wxWidgets.git] / src / osx / core / printmac.cpp
index 3ed74451c3a1e440393ee30d663ab841c3c91a22..c496c1eeb1c1e118aa67437d41aada02f6329937 100644 (file)
@@ -525,11 +525,11 @@ wxPrintNativeDataBase* wxOSXCreatePrintData()
 {
 #if wxOSX_USE_COCOA
     return new wxOSXCocoaPrintData();
-#endif
-#if wxOSX_USE_CARBON
+#elif wxOSX_USE_CARBON
     return new wxOSXCarbonPrintData();
-#endif
+#else
     return NULL;
+#endif
 }
 
 /*
@@ -553,27 +553,18 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
     sm_abortWindow = NULL;
 
     if (!printout)
+    {
+        sm_lastError = wxPRINTER_ERROR;
         return false;
-
+    }
+    
     printout->SetIsPreview(false);
 
-    // Get some parameters from the printout, if defined
-    int fromPage, toPage;
-    int minPage, maxPage;
-    printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
-
-    if (maxPage == 0) return false;
-
-    // Only set min and max, because from and to will be
-    // set by the user
-    m_printDialogData.SetMinPage(minPage);
-    m_printDialogData.SetMaxPage(maxPage);
-
     if (m_printDialogData.GetMinPage() < 1)
         m_printDialogData.SetMinPage(1);
     if (m_printDialogData.GetMaxPage() < 1)
         m_printDialogData.SetMaxPage(9999);
-
+    
     // Create a suitable device context
     wxPrinterDC *dc = NULL;
     if (prompt)
@@ -642,6 +633,22 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
 
     printout->OnPreparePrinting();
 
+    // Get some parameters from the printout, if defined
+    int fromPage, toPage;
+    int minPage, maxPage;
+    printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage);
+    
+    if (maxPage == 0)
+    {
+        sm_lastError = wxPRINTER_ERROR;
+        return false;
+    }
+    
+    // Only set min and max, because from and to will be
+    // set by the user
+    m_printDialogData.SetMinPage(minPage);
+    m_printDialogData.SetMaxPage(maxPage);
+        
     printout->OnBeginPrinting();
 
     bool keepGoing = true;
@@ -659,7 +666,6 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
     {
         if (sm_abortIt)
         {
-                keepGoing = false;
                 break;
         }
         else
@@ -717,7 +723,7 @@ bool wxMacPrinter::Setup(wxWindow *WXUNUSED(parent))
     return (ret == wxID_OK);
 #endif
 
-    return wxID_CANCEL;
+    return false;
 }
 
 /*