X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8907154c1a8a6882c6797d1f16393ddfb23e7f3a..9ce05df4bcf937129ca426e5e2937c07a109bde0:/src/generic/printps.cpp diff --git a/src/generic/printps.cpp b/src/generic/printps.cpp index 3b566ffefa..18653aa45d 100644 --- a/src/generic/printps.cpp +++ b/src/generic/printps.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: printps.cpp +// Name: src/generic/printps.cpp // Purpose: Postscript print/preview framework // Author: Julian Smart // Modified by: @@ -9,14 +9,6 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -// ============================================================================ -// declarations -// ============================================================================ - -// ---------------------------------------------------------------------------- -// headers -// ---------------------------------------------------------------------------- - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -24,7 +16,13 @@ #pragma hdrstop #endif -#include "wx/defs.h" +// ============================================================================ +// declarations +// ============================================================================ + +// ---------------------------------------------------------------------------- +// headers +// ---------------------------------------------------------------------------- #if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT && (!defined(__WXMSW__) || wxUSE_POSTSCRIPT_ARCHITECTURE_IN_MSW) @@ -36,10 +34,10 @@ #include "wx/intl.h" #include "wx/progdlg.h" #include "wx/log.h" + #include "wx/dcprint.h" #endif #include "wx/generic/printps.h" -#include "wx/dcprint.h" #include "wx/printdlg.h" #include "wx/generic/prntdlgg.h" #include "wx/generic/progdlgg.h" @@ -148,12 +146,12 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro // set by the user m_printDialogData.SetMinPage(minPage); m_printDialogData.SetMaxPage(maxPage); - + if (m_printDialogData.GetFromPage() < minPage) m_printDialogData.SetFromPage( minPage ); if (m_printDialogData.GetToPage() > maxPage) m_printDialogData.SetToPage( maxPage ); - + int pagesPerCopy = m_printDialogData.GetToPage()-m_printDialogData.GetFromPage()+1, totalPages = pagesPerCopy * m_printDialogData.GetNoCopies(), @@ -233,13 +231,13 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro wxDC* wxPostScriptPrinter::PrintDialog(wxWindow *parent) { wxDC* dc = (wxDC*) NULL; - + wxGenericPrintDialog dialog( parent, &m_printDialogData ); if (dialog.ShowModal() == wxID_OK) { dc = dialog.GetPrintDC(); m_printDialogData = dialog.GetPrintDialogData(); - + if (dc == NULL) sm_lastError = wxPRINTER_ERROR; else @@ -265,7 +263,7 @@ bool wxPostScriptPrinter::Setup(wxWindow *WXUNUSED(parent)) } dialog->Destroy(); - + return (ret == wxID_OK); #endif @@ -307,7 +305,16 @@ bool wxPostScriptPrintPreview::Print(bool interactive) { if (!m_printPrintout) return false; + + // Assume that on Unix, the preview may use the PostScript + // (generic) version, but printing using the native system is required. + // TODO: make a generic print preview class from which wxPostScriptPrintPreview + // is derived. +#ifdef __UNIX__ + wxPrinter printer(& m_printDialogData); +#else wxPostScriptPrinter printer(& m_printDialogData); +#endif return printer.Print(m_previewFrame, m_printPrintout, interactive); }