X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/41514cc474a69b7ff554f1d5c529f079a30acfe7..5ae1a6697062752f2098a7a6edf0b91e1a42b10a:/src/msw/printwin.cpp diff --git a/src/msw/printwin.cpp b/src/msw/printwin.cpp index dd8c25b420..0c8a2ed652 100644 --- a/src/msw/printwin.cpp +++ b/src/msw/printwin.cpp @@ -91,16 +91,10 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt return false; } - // Get some parameters from the printout, if defined - int fromPage, toPage; - int minPage, maxPage; - printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage); - - m_printDialogData.SetFromPage(fromPage); - m_printDialogData.SetToPage(toPage); - m_printDialogData.SetMinPage(minPage); - m_printDialogData.SetMaxPage(maxPage); - m_printDialogData.SetAllPages((fromPage == minPage) && (toPage == maxPage)); + if (m_printDialogData.GetMinPage() < 1) + m_printDialogData.SetMinPage(1); + if (m_printDialogData.GetMaxPage() < 1) + m_printDialogData.SetMaxPage(9999); // Create a suitable device context wxPrinterDC *dc wxDUMMY_INITIALIZE(NULL); @@ -157,6 +151,11 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt printout->OnPreparePrinting(); + // Get some parameters from the printout, if defined + int fromPage, toPage; + int minPage, maxPage; + printout->GetPageInfo(&minPage, &maxPage, &fromPage, &toPage); + if (maxPage == 0) { sm_lastError = wxPRINTER_ERROR; @@ -168,7 +167,7 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt m_printDialogData.SetMinPage(minPage); m_printDialogData.SetMaxPage(maxPage); - wxWindow *win = CreateAbortWindow(parent, printout); + wxPrintAbortDialog *win = CreateAbortWindow(parent, printout); wxYield(); ::SetAbortProc(GetHdcOf(*impl), wxAbortProc); @@ -197,10 +196,8 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt maxPageNum = m_printDialogData.GetToPage(); } - int copyCount; - for ( copyCount = 1; - copyCount <= m_printDialogData.GetNoCopies(); - copyCount++ ) + const int maxCopyCount = m_printDialogData.GetNoCopies(); + for ( int copyCount = 1; copyCount <= maxCopyCount; copyCount++ ) { if ( !printout->OnBeginDocument(minPageNum, maxPageNum) ) { @@ -220,6 +217,10 @@ bool wxWindowsPrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt pn <= maxPageNum && printout->HasPage(pn); pn++ ) { + win->SetProgress(pn - minPageNum + 1, + maxPageNum - minPageNum + 1, + copyCount, maxCopyCount); + if ( sm_abortIt ) { sm_lastError = wxPRINTER_CANCELLED;