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.
This commit is contained in:
committed by
Vadim Zeitlin
parent
e211757af4
commit
1cd916fc0a
@@ -72,6 +72,11 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif // __WXMSW__
|
#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
|
// wxPrintFactory
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@@ -553,11 +558,22 @@ void wxPrintAbortDialog::SetProgress(int currentPage, int totalPages,
|
|||||||
int currentCopy, int totalCopies)
|
int currentCopy, int totalCopies)
|
||||||
{
|
{
|
||||||
wxString text;
|
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 )
|
if ( totalCopies > 1 )
|
||||||
text += wxString::Format(_(" (copy %d of %d)"), currentCopy, totalCopies);
|
text += wxString::Format(_(" (copy %d of %d)"), currentCopy, totalCopies);
|
||||||
m_progress->SetLabel(text);
|
m_progress->SetLabel(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
|
void wxPrintAbortDialog::OnCancel(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxCHECK_RET( wxPrinterBase::sm_abortWindow != NULL, "OnCancel called twice" );
|
wxCHECK_RET( wxPrinterBase::sm_abortWindow != NULL, "OnCancel called twice" );
|
||||||
@@ -617,7 +633,7 @@ bool wxPrintout::HasPage(int page)
|
|||||||
void wxPrintout::GetPageInfo(int *minPage, int *maxPage, int *fromPage, int *toPage)
|
void wxPrintout::GetPageInfo(int *minPage, int *maxPage, int *fromPage, int *toPage)
|
||||||
{
|
{
|
||||||
*minPage = 1;
|
*minPage = 1;
|
||||||
*maxPage = 32000;
|
*maxPage = DEFAULT_MAX_PAGES;
|
||||||
*fromPage = 1;
|
*fromPage = 1;
|
||||||
*toPage = 1;
|
*toPage = 1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user