Added a generic wxProgressDialog and made wxPostscriptPrinter use it.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2375 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -35,7 +35,8 @@
|
||||
#include "wx/dc.h"
|
||||
#include "wx/app.h"
|
||||
#include "wx/msgdlg.h"
|
||||
#include <wx/intl.h>
|
||||
#include "wx/intl.h"
|
||||
#include "wx/progdlg.h"
|
||||
#endif
|
||||
|
||||
#include "wx/generic/printps.h"
|
||||
@@ -113,6 +114,7 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
||||
else
|
||||
m_printDialogData.EnablePageNumbers(FALSE);
|
||||
|
||||
|
||||
// Create a suitable device context
|
||||
wxDC *dc = (wxDC *) NULL;
|
||||
if (prompt)
|
||||
@@ -165,6 +167,15 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
||||
// Create an abort window
|
||||
wxBeginBusyCursor();
|
||||
|
||||
// Open the progress bar dialog
|
||||
wxProgressDialog *progressDialog = new wxProgressDialog (
|
||||
printout->GetTitle(),
|
||||
_("Printing..."),
|
||||
maxPage-minPage,
|
||||
parent,
|
||||
/* disable parent only */ true,
|
||||
/* show abort button */ true);
|
||||
|
||||
printout->OnBeginPrinting();
|
||||
|
||||
bool keepGoing = TRUE;
|
||||
@@ -192,11 +203,22 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
|
||||
}
|
||||
else
|
||||
{
|
||||
dc->StartPage();
|
||||
printout->OnPrintPage(pn);
|
||||
dc->EndPage();
|
||||
wxString msg;
|
||||
msg.Printf(_("Printing page %d..."), pn);
|
||||
if(progressDialog->Update(pn-minPage, msg))
|
||||
{
|
||||
dc->StartPage();
|
||||
printout->OnPrintPage(pn);
|
||||
dc->EndPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
sm_abortIt = true;
|
||||
keepGoing = false; //FIXME: do we need both?
|
||||
}
|
||||
}
|
||||
}
|
||||
delete progressDialog;
|
||||
printout->OnEndDocument();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user