X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8826f46f0d755eba7996920da2aee45946bc6144..e179bd6537b8e3d7543d23db3b6735ea7effe159:/src/generic/printps.cpp diff --git a/src/generic/printps.cpp b/src/generic/printps.cpp index 389fb5c7e1..3317b1df0a 100644 --- a/src/generic/printps.cpp +++ b/src/generic/printps.cpp @@ -30,12 +30,15 @@ #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 + #include "wx/intl.h" + #include "wx/progdlg.h" #endif #include "wx/generic/printps.h" @@ -113,6 +116,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 +169,18 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro // 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; @@ -192,15 +208,27 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro } 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(); @@ -321,3 +349,4 @@ void wxPostScriptPrintPreview::DetermineScaling() } } +#endif