]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/prntbase.cpp
added and partly implemented the time functions for wxFileName
[wxWidgets.git] / src / common / prntbase.cpp
index 059fa64f8cb1685e33c81d7a5d6ee108c58fbe20..8e7e80b76929dc40fe1778d31c59e0a66ed059e4 100644 (file)
@@ -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);
 }
@@ -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,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);
@@ -678,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;
         }
@@ -709,6 +717,7 @@ bool wxPrintPreviewBase::RenderPage(int pageNum)
         memoryDC.SelectObject(wxNullBitmap);
 
         delete m_previewBitmap;
+        m_previewBitmap = NULL;
         return FALSE;
     }