]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/printps.cpp
added mingw32 host platform to configure.in, added WINVER define for windows
[wxWidgets.git] / src / generic / printps.cpp
index cc301b7aae1c3e4e7260a780bfc4c52b1e91c843..3317b1df0abc71ae91550e5b5a66c15f430c0a33 100644 (file)
@@ -30,6 +30,8 @@
 
 #include "wx/defs.h"
 
+#if wxUSE_PRINTING_ARCHITECTURE
+
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
     #include "wx/dc.h"
@@ -167,14 +169,17 @@ 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..."),
-       maxPage-minPage+1,
+       totalPages,
        parent,
-       /* disable parent only */ true,
-       /* show abort button */ true);
+       wxPD_CAN_ABORT|wxPD_AUTO_HIDE|wxPD_APP_MODAL);
     
     printout->OnBeginPrinting();
 
@@ -204,8 +209,8 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
             else
             {
                wxString msg;
-               msg.Printf(_("Printing page %d..."), pn);
-               if(progressDialog->Update(pn-minPage, msg))
+               msg.Printf(_("Printing page %d..."), printedPages+1);
+               if(progressDialog->Update(printedPages++, msg))
                {
                   dc->StartPage();
                   printout->OnPrintPage(pn);
@@ -213,16 +218,17 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
                }
                else
                {
-                  sm_abortIt = true;
-                  keepGoing = false; //FIXME: do we need both?
+                  sm_abortIt = TRUE;
+                  keepGoing = FALSE;
                }
             }
+           wxYield();
         }
-        delete progressDialog;
         printout->OnEndDocument();
     }
 
     printout->OnEndPrinting();
+    delete progressDialog;
 
     wxEndBusyCursor();
 
@@ -343,3 +349,4 @@ void wxPostScriptPrintPreview::DetermineScaling()
     }
 }
 
+#endif