X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/809934d22ad2e97d67655ecb4b06b29b5d2a361d..7d1f4c3ff01b09105c07d5e176a14428c834975e:/src/common/prntbase.cpp diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index 6709e37217..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); } @@ -195,10 +197,12 @@ void wxPreviewCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) wxPaintDC dc(this); PrepareDC( dc ); +/* #ifdef __WXGTK__ if (!GetUpdateRegion().IsEmpty()) dc.SetClippingRegion( GetUpdateRegion() ); #endif +*/ if (m_printPreview) { @@ -209,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 @@ -608,7 +612,8 @@ bool wxPrintPreviewBase::SetCurrentPage(int pageNum) if (m_previewCanvas) { - RenderPage(pageNum); + if (!RenderPage(pageNum)) + return FALSE; m_previewCanvas->Refresh(); } return TRUE; @@ -619,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; @@ -651,12 +657,14 @@ bool wxPrintPreviewBase::PaintPage(wxWindow *canvas, wxDC& dc) bool wxPrintPreviewBase::RenderPage(int pageNum) { + wxBusyCursor busy; + int canvasWidth, canvasHeight; if (!m_previewCanvas) { - wxMessageBox(_("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!"), - _("Print Preview Failure"), wxOK); + wxFAIL_MSG(_T("wxPrintPreviewBase::RenderPage: must use wxPrintPreviewBase::SetCanvas to let me know about the canvas!")); + return FALSE; } m_previewCanvas->GetSize(&canvasWidth, &canvasHeight); @@ -676,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; } @@ -707,6 +717,7 @@ bool wxPrintPreviewBase::RenderPage(int pageNum) memoryDC.SelectObject(wxNullBitmap); delete m_previewBitmap; + m_previewBitmap = NULL; return FALSE; }