X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/95724b1aa2f7248091cdec506d4678b4fbcea20d..da63acebda3288dc66d5e24a973ca0b09450ff99:/src/common/prntbase.cpp diff --git a/src/common/prntbase.cpp b/src/common/prntbase.cpp index 7966f5479b..8e7e80b769 100644 --- a/src/common/prntbase.cpp +++ b/src/common/prntbase.cpp @@ -55,7 +55,6 @@ #endif #endif // __WXMSW__ -#if !USE_SHARED_LIBRARY IMPLEMENT_CLASS(wxPrinterBase, wxObject) IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject) IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow) @@ -71,7 +70,6 @@ BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow) EVT_PAINT(wxPreviewCanvas::OnPaint) EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged) END_EVENT_TABLE() -#endif /* * Printer @@ -84,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() { @@ -115,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); } @@ -197,6 +197,13 @@ void wxPreviewCanvas::OnPaint(wxPaintEvent& WXUNUSED(event)) wxPaintDC dc(this); PrepareDC( dc ); +/* +#ifdef __WXGTK__ + if (!GetUpdateRegion().IsEmpty()) + dc.SetClippingRegion( GetUpdateRegion() ); +#endif +*/ + if (m_printPreview) { m_printPreview->PaintPage(this, dc); @@ -605,7 +612,8 @@ bool wxPrintPreviewBase::SetCurrentPage(int pageNum) if (m_previewCanvas) { - RenderPage(pageNum); + if (!RenderPage(pageNum)) + return FALSE; m_previewCanvas->Refresh(); } return TRUE; @@ -616,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; @@ -648,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); @@ -673,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; } @@ -704,6 +717,7 @@ bool wxPrintPreviewBase::RenderPage(int pageNum) memoryDC.SelectObject(wxNullBitmap); delete m_previewBitmap; + m_previewBitmap = NULL; return FALSE; }