From: Vadim Zeitlin Date: Sat, 29 Jan 2011 13:55:40 +0000 (+0000) Subject: Revert "Set up pages range in the wxMSW print dialog correctly." X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/ff4713940d16f0866f0931112ccb86e6a7642648 Revert "Set up pages range in the wxMSW print dialog correctly." This patch changed the relative order of calls to wxPrintout::GetPageInfo() and OnPreparePrinting(), breaking the existing code and the documentation promise about OnPreparePrinting() being called first, so revert it. Reverts r66549. See #12819. Closes #12911. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66813 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/printwin.cpp b/src/msw/printwin.cpp index dd8c25b420..9018f7de70 100644 --- a/src/msw/printwin.cpp +++ b/src/msw/printwin.cpp @@ -91,16 +91,10 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt return false; } - // Get some parameters from the printout, if defined - int fromPage, toPage; - int minPage, maxPage; - printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage); - - m_printDialogData.SetFromPage(fromPage); - m_printDialogData.SetToPage(toPage); - m_printDialogData.SetMinPage(minPage); - m_printDialogData.SetMaxPage(maxPage); - m_printDialogData.SetAllPages((fromPage == minPage) && (toPage == 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 wxDUMMY_INITIALIZE(NULL); @@ -157,6 +151,11 @@ bool wxWindowsPrinter::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;