+
+ 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;
+ wxEndBusyCursor();
+ return false;
+ }
+
+ // Only set min and max, because from and to have been
+ // set by the user
+ m_printDialogData.SetMinPage(minPage);
+ m_printDialogData.SetMaxPage(maxPage);
+
+ if (m_printDialogData.GetFromPage() < minPage)
+ m_printDialogData.SetFromPage( minPage );
+ if (m_printDialogData.GetToPage() > maxPage)
+ m_printDialogData.SetToPage( maxPage );
+
+ 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);
+