From 41514cc474a69b7ff554f1d5c529f079a30acfe7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 3 Jan 2011 18:44:36 +0000 Subject: [PATCH] Set up pages range in the wxMSW print dialog correctly. Propagate the information about the number of pages from the printout to the print dialog in wxWindowsPrinter::Print(). Closes #12819. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66549 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/printwin.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/msw/printwin.cpp b/src/msw/printwin.cpp index 9018f7de70..dd8c25b420 100644 --- a/src/msw/printwin.cpp +++ b/src/msw/printwin.cpp @@ -91,10 +91,16 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt return false; } - if (m_printDialogData.GetMinPage() < 1) - m_printDialogData.SetMinPage(1); - if (m_printDialogData.GetMaxPage() < 1) - m_printDialogData.SetMaxPage(9999); + // 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)); // Create a suitable device context wxPrinterDC *dc wxDUMMY_INITIALIZE(NULL); @@ -151,11 +157,6 @@ 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; -- 2.45.2