ProgressDialog now handles multiple copies and shows total number of pages.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2451 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Karsten Ballüder
1999-05-13 15:52:20 +00:00
parent a9a96f0a9a
commit 67df978396

View File

@@ -167,11 +167,15 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
// Create an abort window // Create an abort window
wxBeginBusyCursor(); wxBeginBusyCursor();
int
pagesPerCopy = maxPage-minPage+1,
totalPages = pagesPerCopy * m_printDialogData.GetNoCopies(),
printedPages = 0;
// Open the progress bar dialog // Open the progress bar dialog
wxProgressDialog *progressDialog = new wxProgressDialog ( wxProgressDialog *progressDialog = new wxProgressDialog (
printout->GetTitle(), printout->GetTitle(),
_("Printing..."), _("Printing..."),
maxPage-minPage+1, totalPages,
parent, parent,
/* disable parent only */ true, /* disable parent only */ true,
/* show abort button */ true); /* show abort button */ true);
@@ -204,8 +208,8 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
else else
{ {
wxString msg; wxString msg;
msg.Printf(_("Printing page %d..."), pn); msg.Printf(_("Printing page %d..."), printedPages+1);
if(progressDialog->Update(pn-minPage, msg)) if(progressDialog->Update(printedPages++, msg))
{ {
dc->StartPage(); dc->StartPage();
printout->OnPrintPage(pn); printout->OnPrintPage(pn);
@@ -214,15 +218,15 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
else else
{ {
sm_abortIt = true; sm_abortIt = true;
keepGoing = false; //FIXME: do we need both? keepGoing = false;
} }
} }
} }
delete progressDialog;
printout->OnEndDocument(); printout->OnEndDocument();
} }
printout->OnEndPrinting(); printout->OnEndPrinting();
delete progressDialog;
wxEndBusyCursor(); wxEndBusyCursor();