From acec4b363b2ff519967940bf637c69c7fd18732a Mon Sep 17 00:00:00 2001 From: John Roberts Date: Sat, 18 Jul 2015 00:59:24 +0200 Subject: [PATCH] Fix printing all pages without dialog prompt in wxOSX. Do set from and to pages if we're not asking the user to choose them, otherwise nothing is printed at all. Closes #16294. (this is a backport of 896e148da5281ba31b158895faa0a826b0beb426 from master) --- docs/changes.txt | 1 + src/osx/core/printmac.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index fc0acbdba4..1356f4cf58 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -636,6 +636,7 @@ wxOSX: - Fix length of text in wxTextDataObject. - Fix using wxHTTP and wxFTP from worker thread. - Fix wxFileDialog::GetFilterIndex() for file open dialogs (phsilva). +- Fix printing all pages non-interactively (John Roberts). - Fix custom paper support (tijsv). - Return false from wxSound::Create()/IsOk() if the file doesn't exist. diff --git a/src/osx/core/printmac.cpp b/src/osx/core/printmac.cpp index be3eb63aaa..5f33c3ccc3 100644 --- a/src/osx/core/printmac.cpp +++ b/src/osx/core/printmac.cpp @@ -637,10 +637,21 @@ bool wxMacPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt) } // Only set min and max, because from and to will be - // set by the user + // set by the user if prompted for the print dialog above m_printDialogData.SetMinPage(minPage); m_printDialogData.SetMaxPage(maxPage); + // Set from and to pages if bypassing the print dialog + if ( !prompt ) + { + m_printDialogData.SetFromPage(fromPage); + + if( m_printDialogData.GetAllPages() ) + m_printDialogData.SetToPage(maxPage); + else + m_printDialogData.SetToPage(toPage); + } + printout->OnBeginPrinting(); bool keepGoing = true;