From d6e9e150660b6bc1d35e727f46ddecd3d16b3364 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 4 Nov 2012 23:49:42 +0000 Subject: [PATCH] Revert "Fix the pages range in the print dialog in wxOSX." This reverts r72805 (leaving only the changes to printdlg.cpp which seem harmless and potentially useful) as it resulted in crashes when using wxHtmlEasyPrinting because we called wxPrintout::OnPreparePrinting() before setting the DC to be used, which was wrong. In fact it's not clear how can we get the correct range of pages at all because we need a DC to paginate properly (i.e. taking into account its size) but we need to show a dialog, in which we already want to show the pages range, before choosing the DC. Perhaps we could create a dummy DC for pagination purposes but how could this work with printers using different page sizes? The best would probably be to avoid setting any limits on the page range as showing 9999 looks ugly but anything else would be wrong. See #8349, #11779. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72883 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 - src/osx/core/printmac.cpp | 37 +++++++++++++++++++------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/docs/changes.txt b/docs/changes.txt index 0d329b6876..51e3c84f52 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -604,7 +604,6 @@ wxMSW: wxOSX/Cocoa: -- Fix pages range in the print dialog (Auria). - Implement image support in wxNotebook (Malcolm MacLeod). - Add support for button mnemonics (joostn). diff --git a/src/osx/core/printmac.cpp b/src/osx/core/printmac.cpp index c47ec2e9cf..5722b09456 100644 --- a/src/osx/core/printmac.cpp +++ b/src/osx/core/printmac.cpp @@ -549,24 +549,6 @@ 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) @@ -629,8 +611,27 @@ 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; -- 2.45.2