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
This commit is contained in:
Vadim Zeitlin
2011-03-14 11:54:35 +00:00
parent b95a7c3144
commit 32eec436ed

View File

@@ -381,6 +381,19 @@ bool wxPrinter::Setup(wxWindow *parent)
bool wxPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) 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 ); return m_pimpl->Print( parent, printout, prompt );
} }