]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/printps.cpp
A few more things are back to work.
[wxWidgets.git] / src / generic / printps.cpp
index 389fb5c7e152b395cdf08e4c0ff5298a650f2cce..053b00b275444c7b096a1bd6db2d3f95ffd2234f 100644 (file)
@@ -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();
     }