]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix the pages range in the print dialog in wxOSX.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 28 Oct 2012 01:08:16 +0000 (01:08 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 28 Oct 2012 01:08:16 +0000 (01:08 +0000)
Set the min/max pages earlier for them to be taken into account and also
actually do set them in the print settings.

Closes #8349.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72805 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
src/osx/cocoa/printdlg.mm
src/osx/core/printmac.cpp

index 88dbc74e335563450c7da3cf987d18d78f2e8b59..e7c9a623e3327fc61816351a1f1f92fe7b83ad50 100644 (file)
@@ -600,6 +600,10 @@ wxMSW:
 - Don't send any events from wxSpinCtrl::SetRange() even if the value changed.
 - Display system drag images during drag and drop if available (PeterO).
 
+wxOSX:
+
+- Fix pages range in the print dialog (Auria).
+
 
 2.9.4: (released 2012-07-09)
 ------
index 1a66fe8761d7ebed0e3f634d50f9a81bfa74dbeb..f7301dc70a0d255c699fab3332f15dcf54f7814d 100644 (file)
@@ -65,6 +65,11 @@ int wxMacPrintDialog::ShowModal()
 
     NSPrintPanel* panel = [NSPrintPanel printPanel];
     NSPrintInfo* printInfo = ((wxOSXCocoaPrintData*)m_printDialogData.GetPrintData().GetNativeData())->GetNSPrintInfo();
+
+    NSMutableDictionary* dict = [printInfo printSettings];
+    [dict setValue:[NSNumber numberWithInt:m_printDialogData.GetMinPage()] forKey:@"com_apple_print_PrintSettings_PMFirstPage"];
+    [dict setValue:[NSNumber numberWithInt:m_printDialogData.GetMaxPage()] forKey:@"com_apple_print_PrintSettings_PMLastPage"];
+
     if ( (NSInteger)[panel runModalWithPrintInfo:printInfo] == NSOKButton )
     {
         result = wxID_OK;
index 5722b094566734a44db60c09428ec0e61cf37d6d..c47ec2e9cf4c72fb7d0fe57ab2a8cf1da8ac08ac 100644 (file)
@@ -549,6 +549,24 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
         return false;
     }
 
+    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);
+
     if (m_printDialogData.GetMinPage() < 1)
         m_printDialogData.SetMinPage(1);
     if (m_printDialogData.GetMaxPage() < 1)
@@ -611,27 +629,8 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt)
     dc->GetSizeMM(&mw, &mh);
     printout->SetPageSizeMM((int)mw, (int)mh);
 
-    // Create an abort window
     wxBeginBusyCursor();
 
-    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;