- sm_abortIt = FALSE;
- sm_abortWindow = NULL;
-
- if (!printout)
- return FALSE;
-
- printout->SetIsPreview(FALSE);
- 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)
- return FALSE;
-
- m_printData.SetMinPage(minPage);
- m_printData.SetMaxPage(maxPage);
- if (fromPage != 0)
- m_printData.SetFromPage(fromPage);
- if (toPage != 0)
- m_printData.SetToPage(toPage);
-
- if (minPage != 0)
- {
- m_printData.EnablePageNumbers(TRUE);
- if (m_printData.GetFromPage() < m_printData.GetMinPage())
- m_printData.SetFromPage(m_printData.GetMinPage());
- else if (m_printData.GetFromPage() > m_printData.GetMaxPage())
- m_printData.SetFromPage(m_printData.GetMaxPage());
- if (m_printData.GetToPage() > m_printData.GetMaxPage())
- m_printData.SetToPage(m_printData.GetMaxPage());
- else if (m_printData.GetToPage() < m_printData.GetMinPage())
- m_printData.SetToPage(m_printData.GetMinPage());
- }
- else
- m_printData.EnablePageNumbers(FALSE);
-
- // Create a suitable device context
- wxDC *dc = NULL;
- if (prompt)
- {
- wxPrintDialog dialog(parent, & m_printData);
- if (dialog.ShowModal() == wxID_OK)
- {
- dc = dialog.GetPrintDC();
- m_printData = dialog.GetPrintData();
- }
- }
- else
- {
- dc = new wxPrinterDC("", "", "", FALSE, m_printData.GetOrientation());
- }
-
- // May have pressed cancel.
- if (!dc || !dc->Ok())
- {
- if (dc) delete dc;
- return FALSE;
- }
-
- int logPPIScreenX = 0;
- int logPPIScreenY = 0;
- int logPPIPrinterX = 0;
- int logPPIPrinterY = 0;
-
- HDC hdc = ::GetDC(NULL);
- logPPIScreenX = ::GetDeviceCaps(hdc, LOGPIXELSX);
- logPPIScreenY = ::GetDeviceCaps(hdc, LOGPIXELSY);
- ::ReleaseDC(NULL, hdc);
-
- logPPIPrinterX = ::GetDeviceCaps((HDC) dc->GetHDC(), LOGPIXELSX);
- logPPIPrinterY = ::GetDeviceCaps((HDC) dc->GetHDC(), LOGPIXELSY);
- if (logPPIPrinterX == 0 || logPPIPrinterY == 0)
- {
- delete dc;
- return FALSE;
- }
+ sm_abortIt = FALSE;
+ sm_abortWindow = NULL;
+
+ if (!printout)
+ return FALSE;
+
+ printout->SetIsPreview(FALSE);
+
+ // 4/9/99, JACS: this is a silly place to allow preparation, considering
+ // the DC and no parameters have been set in the printout object.
+ // Moved further down.
+ // 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)
+ return FALSE;
+
+ m_printDialogData.SetMinPage(minPage);
+ m_printDialogData.SetMaxPage(maxPage);
+ if (fromPage != 0)
+ m_printDialogData.SetFromPage(fromPage);
+ if (toPage != 0)
+ m_printDialogData.SetToPage(toPage);
+
+ if (minPage != 0)
+ {
+ m_printDialogData.EnablePageNumbers(TRUE);
+ if (m_printDialogData.GetFromPage() < m_printDialogData.GetMinPage())
+ m_printDialogData.SetFromPage(m_printDialogData.GetMinPage());
+ else if (m_printDialogData.GetFromPage() > m_printDialogData.GetMaxPage())
+ m_printDialogData.SetFromPage(m_printDialogData.GetMaxPage());
+ if (m_printDialogData.GetToPage() > m_printDialogData.GetMaxPage())
+ m_printDialogData.SetToPage(m_printDialogData.GetMaxPage());
+ else if (m_printDialogData.GetToPage() < m_printDialogData.GetMinPage())
+ m_printDialogData.SetToPage(m_printDialogData.GetMinPage());
+ }
+ else
+ m_printDialogData.EnablePageNumbers(FALSE);
+
+ // Create a suitable device context
+ wxDC *dc = NULL;
+ if (prompt)
+ {
+ dc = PrintDialog(parent);
+ if (!dc)
+ return FALSE;
+ }
+ else
+ {
+ // dc = new wxPrinterDC("", "", "", FALSE, m_printData.GetOrientation());
+ dc = new wxPrinterDC(m_printDialogData.GetPrintData());
+ }
+
+ // May have pressed cancel.
+ if (!dc || !dc->Ok())
+ {
+ if (dc) delete dc;
+ return FALSE;
+ }
+
+ int logPPIScreenX = 0;
+ int logPPIScreenY = 0;
+ int logPPIPrinterX = 0;
+ int logPPIPrinterY = 0;
+
+ HDC hdc = ::GetDC(NULL);
+ logPPIScreenX = ::GetDeviceCaps(hdc, LOGPIXELSX);
+ logPPIScreenY = ::GetDeviceCaps(hdc, LOGPIXELSY);
+ ::ReleaseDC(NULL, hdc);
+
+ logPPIPrinterX = ::GetDeviceCaps((HDC) dc->GetHDC(), LOGPIXELSX);
+ logPPIPrinterY = ::GetDeviceCaps((HDC) dc->GetHDC(), LOGPIXELSY);
+ if (logPPIPrinterX == 0 || logPPIPrinterY == 0)
+ {
+ delete dc;
+ return FALSE;
+ }