#include "wx/defs.h"
+#if wxUSE_PRINTING_ARCHITECTURE
+
#ifndef WX_PRECOMP
#include "wx/utils.h"
#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"
else
m_printDialogData.EnablePageNumbers(FALSE);
+
// Create a suitable device context
wxDC *dc = (wxDC *) NULL;
if (prompt)
// Create an abort window
wxBeginBusyCursor();
+ int
+ pagesPerCopy = m_printDialogData.GetToPage()-m_printDialogData.GetFromPage()+1,
+ totalPages = pagesPerCopy * m_printDialogData.GetNoCopies(),
+ printedPages = 0;
+ // Open the progress bar dialog
+ wxProgressDialog *progressDialog = new wxProgressDialog (
+ printout->GetTitle(),
+ _("Printing..."),
+ totalPages,
+ parent,
+ wxPD_CAN_ABORT|wxPD_AUTO_HIDE|wxPD_APP_MODAL);
+
printout->OnBeginPrinting();
bool keepGoing = TRUE;
}
else
{
- dc->StartPage();
- printout->OnPrintPage(pn);
- dc->EndPage();
+ wxString msg;
+ msg.Printf(_("Printing page %d..."), printedPages+1);
+ if(progressDialog->Update(printedPages++, msg))
+ {
+ dc->StartPage();
+ printout->OnPrintPage(pn);
+ dc->EndPage();
+ }
+ else
+ {
+ sm_abortIt = TRUE;
+ keepGoing = FALSE;
+ }
}
+ wxYield();
}
printout->OnEndDocument();
}
printout->OnEndPrinting();
+ delete progressDialog;
wxEndBusyCursor();
}
}
+#endif