#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#include "wx/msw/printdlg.h"
+#include "wx/msw/dcprint.h"
#elif defined(__WXMAC__)
-#include "wx/mac/printdlg.h"
-#include "wx/mac/private/print.h"
+#include "wx/osx/printdlg.h"
+#include "wx/osx/private/print.h"
+#include "wx/osx/dcprint.h"
+#elif defined(__WXPM__)
+#include "wx/os2/dcprint.h"
+#include "wx/generic/prntdlgg.h"
#else
#include "wx/generic/prntdlgg.h"
#include "wx/dcps.h"
#endif
}
-#if wxUSE_NEW_DC
-
-wxImplDC* wxNativePrintFactory::CreatePrinterImplDC( wxPrinterDC *owner, const wxPrintData& data )
+wxDCImpl* wxNativePrintFactory::CreatePrinterDCImpl( wxPrinterDC *owner, const wxPrintData& data )
{
-#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
- return new wxWindowsPrinterDCImpl( owner, data );
-#elif defined(__WXMAC__)
- return new wxMacPrinterDCImpl( owner, data );
+#if defined(__WXGTK__) || defined(__WXMOTIF__) || defined(__WXUNIVERSAL__)
+ return new wxPostScriptDCImpl( owner, data );
#else
- return new wxPostScriptImplDC( owner, data );
+ return new wxPrinterDCImpl( owner, data );
#endif
}
-#else
-
-wxDC* wxNativePrintFactory::CreatePrinterDC( const wxPrintData& data )
-{
-#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
- return new wxPrinterDC(data);
-#elif defined(__WXMAC__)
- return new wxPrinterDC(data);
-#else
- return new wxPostScriptDC(data);
-#endif
-}
-
-#endif
-
bool wxNativePrintFactory::HasOwnPrintToFile()
{
// Only relevant for PostScript and here the
BEGIN_EVENT_TABLE(wxPreviewCanvas, wxScrolledWindow)
EVT_PAINT(wxPreviewCanvas::OnPaint)
EVT_CHAR(wxPreviewCanvas::OnChar)
+ EVT_IDLE(wxPreviewCanvas::OnIdle)
EVT_SYS_COLOUR_CHANGED(wxPreviewCanvas::OnSysColourChanged)
#if wxUSE_MOUSEWHEEL
EVT_MOUSEWHEEL(wxPreviewCanvas::OnMouseWheel)
}
}
+void wxPreviewCanvas::OnIdle(wxIdleEvent& event)
+{
+ if ( m_printPreview )
+ {
+ if ( m_printPreview->UpdatePageRendering() )
+ Refresh();
+ }
+ event.Skip();
+}
+
// Responds to colour changes, and passes event on to children.
void wxPreviewCanvas::OnSysColourChanged(wxSysColourChangedEvent& event)
{
m_printPreview->SetCanvas(NULL);
m_printPreview->SetFrame(NULL);
}
- delete m_printPreview;
+
+ m_previewCanvas->SetPreview(NULL);
+ wxDELETE(m_printPreview);
Destroy();
}
{
AdjustScrollbars(m_previewCanvas);
- if (!RenderPage(pageNum))
- return false;
m_previewCanvas->Refresh();
m_previewCanvas->SetFocus();
}
}
+bool wxPrintPreviewBase::UpdatePageRendering()
+{
+ if ( m_previewBitmap )
+ return false;
+
+ if ( !RenderPage(m_currentPage) )
+ return false;
+
+ return true;
+}
+
bool wxPrintPreviewBase::PaintPage(wxPreviewCanvas *canvas, wxDC& dc)
{
DrawBlankPage(canvas, dc);
- if (!m_previewBitmap)
- if (!RenderPage(m_currentPage))
- return false;
if (!m_previewBitmap)
return false;
if (!canvas)
if (m_previewCanvas)
{
AdjustScrollbars(m_previewCanvas);
- RenderPage(m_currentPage);
((wxScrolledWindow *) m_previewCanvas)->Scroll(0, 0);
m_previewCanvas->ClearBackground();
m_previewCanvas->Refresh();
return m_pimpl->PaintPage( canvas, dc );
}
+bool wxPrintPreview::UpdatePageRendering()
+{
+ return m_pimpl->UpdatePageRendering();
+}
+
bool wxPrintPreview::DrawBlankPage(wxPreviewCanvas *canvas, wxDC& dc)
{
return m_pimpl->DrawBlankPage( canvas, dc );