From 097466149ad401e31ecdea1e5c8d5eb6afc22bbf Mon Sep 17 00:00:00 2001 From: Fulvio Senore Date: Tue, 12 May 2015 17:14:40 +0200 Subject: [PATCH] Don't show the last page number when printing if it wasn't defined. Show just the current page in the printing progress messages if the last page has its default "infinitely big" value. Closes #16987. (cherry picked from commit 1cd916fc0a5c4a38af730b11ece9657e90163d44) --- src/common/prntbase.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index ed0d4712f0..553004f7fa 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -72,6 +72,11 @@ #endif #endif // __WXMSW__ +// The value traditionally used as the default max page number and meaning +// "infinitely many". It should probably be documented and exposed, but for now +// at least use it here instead of hardcoding the number. +static const int DEFAULT_MAX_PAGES = 32000; + //---------------------------------------------------------------------------- // wxPrintFactory //---------------------------------------------------------------------------- @@ -541,7 +546,17 @@ void wxPrintAbortDialog::SetProgress(int currentPage, int totalPages, int currentCopy, int totalCopies) { wxString text; - text.Printf(_("Printing page %d of %d"), currentPage, totalPages); + if ( totalPages == DEFAULT_MAX_PAGES ) + { + // This means that the user has not supplied a total number of pages so it + // is better not to show this value. + text.Printf(_("Printing page %d"), currentPage); + } + else + { + // We have a valid total number of pages so we show it. + text.Printf(_("Printing page %d of %d"), currentPage, totalPages); + } if ( totalCopies > 1 ) text += wxString::Format(_(" (copy %d of %d)"), currentCopy, totalCopies); m_progress->SetLabel(text); @@ -607,7 +622,7 @@ bool wxPrintout::HasPage(int page) void wxPrintout::GetPageInfo(int *minPage, int *maxPage, int *fromPage, int *toPage) { *minPage = 1; - *maxPage = 32000; + *maxPage = DEFAULT_MAX_PAGES; *fromPage = 1; *toPage = 1; }