X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/771779ed912811d13ad82ff77eba3ea57d15e0c9..6a44bffd1ac68163e4c1cfe8aa8fe4f7f98a02e7:/src/common/prntbase.cpp diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index 03182d5c25..4521ba7b8f 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -82,10 +82,12 @@ wxPrinterBase::wxPrinterBase(wxPrintDialogData *data) sm_abortIt = FALSE; if (data) m_printDialogData = (*data); + sm_lastError = wxPRINTER_NO_ERROR; } wxWindow *wxPrinterBase::sm_abortWindow = (wxWindow *) NULL; bool wxPrinterBase::sm_abortIt = FALSE; +wxPrinterError wxPrinterBase::sm_lastError = wxPRINTER_NO_ERROR; wxPrinterBase::~wxPrinterBase() { @@ -113,7 +115,7 @@ wxWindow *wxPrinterBase::CreateAbortWindow(wxWindow *parent, wxPrintout *WXUNUSE return dialog; } -void wxPrinterBase::ReportError(wxWindow *parent, wxPrintout *WXUNUSED(printout), char *message) +void wxPrinterBase::ReportError(wxWindow *parent, wxPrintout *WXUNUSED(printout), const wxString& message) { wxMessageBox(message, _("Printing Error"), wxOK, parent); } @@ -181,7 +183,7 @@ wxPreviewCanvas::wxPreviewCanvas(wxPrintPreviewBase *preview, wxWindow *parent, wxScrolledWindow(parent, -1, pos, size, style, name) { m_printPreview = preview; - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE)); + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); SetScrollbars(15, 18, 100, 100); } @@ -211,7 +213,7 @@ void wxPreviewCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) // Responds to colour changes, and passes event on to children. void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent& event) { - SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_APPWORKSPACE)); + SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE)); Refresh(); // Propagate the event to the non-top-level children @@ -610,7 +612,8 @@ bool wxPrintPreviewBase::SetCurrentPage(int pageNum) if (m_previewCanvas) { - RenderPage(pageNum); + if (!RenderPage(pageNum)) + return FALSE; m_previewCanvas->Refresh(); } return TRUE; @@ -621,7 +624,8 @@ bool wxPrintPreviewBase::PaintPage(wxWindow *canvas, wxDC& dc) DrawBlankPage(canvas, dc); if (!m_previewBitmap) - RenderPage(m_currentPage); + if (!RenderPage(m_currentPage)) + return FALSE; if (!m_previewBitmap) return FALSE; @@ -653,13 +657,13 @@ bool wxPrintPreviewBase::PaintPage(wxWindow *canvas, wxDC& dc) bool wxPrintPreviewBase::RenderPage(int pageNum) { + wxBusyCursor busy; + int canvasWidth, canvasHeight; if (!m_previewCanvas) { - wxFAIL_MSG(_T("wxPrintPreviewBase::RenderPage: must use " - "wxPrintPreviewBase::SetCanvas to let me " - "know about the canvas!")); + wxFAIL_MSG(_T("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!")); return FALSE; } @@ -680,8 +684,10 @@ bool wxPrintPreviewBase::RenderPage(int pageNum) m_previewBitmap = new wxBitmap((int)actualWidth, (int)actualHeight); if (!m_previewBitmap || !m_previewBitmap->Ok()) { - if (m_previewBitmap) + if (m_previewBitmap) { delete m_previewBitmap; + m_previewBitmap = NULL; + } wxMessageBox(_("Sorry, not enough memory to create a preview."), _("Print Preview Failure"), wxOK); return FALSE; } @@ -711,6 +717,7 @@ bool wxPrintPreviewBase::RenderPage(int pageNum) memoryDC.SelectObject(wxNullBitmap); delete m_previewBitmap; + m_previewBitmap = NULL; return FALSE; }