From: Vadim Zeitlin Date: Mon, 14 Mar 2011 11:54:35 +0000 (+0000) Subject: Print everything by default in non-interactive mode. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/32eec436ed2ed090910c44326cc91389a75fa1f2?hp=b95a7c314446677c62f646ce76f9121b4537a81e Print everything by default in non-interactive mode. IF we don't show the dialog allowing the user to select the pages range, we should print everything by default instead of printing nothing at all as we used to do. Closes #12998. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67186 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index ff67a1f4a0..2f08e2d5c3 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -381,6 +381,19 @@ bool wxPrinter::Setup(wxWindow *parent) bool wxPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) { + if ( !prompt && m_printDialogData.GetToPage() == 0 ) + { + // If the dialog is not shown, set the pages range to print everything + // by default (as otherwise we wouldn't print anything at all which is + // certainly not a reasonable default behaviour). + int minPage, maxPage, selFrom, selTo; + printout->GetPageInfo(&minPage, &maxPage, &selFrom, &selTo); + + wxPrintDialogData& pdd = m_pimpl->GetPrintDialogData(); + pdd.SetFromPage(minPage); + pdd.SetToPage(maxPage); + } + return m_pimpl->Print( parent, printout, prompt ); }