]> git.saurik.com Git - wxWidgets.git/commitdiff
Moved deletion of wxPrintFacory to module.
authorRobert Roebling <robert@roebling.de>
Sun, 7 Nov 2004 10:11:48 +0000 (10:11 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 7 Nov 2004 10:11:48 +0000 (10:11 +0000)
 Added wxWidgets 2.4 backward comp methods
   to wxPrintData which make use of the
   PostScript native print data if used.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30334 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/cmndata.h
src/common/cmndata.cpp
src/common/prntbase.cpp

index 459a78eca97bbc49721a4248f6584cb5396a0dc5..95f2b7dc142183a1e1b3ad0d292593717cc4ef32 100644 (file)
@@ -217,6 +217,29 @@ public:
     
     void operator=(const wxPrintData& data);
 
+#if WXWIN_COMPATIBILITY_2_4
+    // PostScript-specific data
+    wxString GetPrinterCommand() const;
+    wxString GetPrinterOptions() const;
+    wxString GetPreviewCommand() const;
+    wxString GetFontMetricPath() const;
+    double GetPrinterScaleX() const;
+    double GetPrinterScaleY() const;
+    long GetPrinterTranslateX() const;
+    long GetPrinterTranslateY() const;
+
+    void SetPrinterCommand(const wxString& command);
+    void SetPrinterOptions(const wxString& options);
+    void SetPreviewCommand(const wxString& command);
+    void SetFontMetricPath(const wxString& path);
+    void SetPrinterScaleX(double x);
+    void SetPrinterScaleY(double y);
+    void SetPrinterScaling(double x, double y);
+    void SetPrinterTranslateX(long x);
+    void SetPrinterTranslateY(long y);
+    void SetPrinterTranslation(long x, long y);
+#endif
+
     // Convert between wxPrintData and native data
     void ConvertToNative();
     void ConvertFromNative();
index dc13526103b334cfbf6521402ff5cfb0843fe9d4..1f839fb728600d29671cb36a7b620d4b22af2121 100644 (file)
@@ -204,7 +204,6 @@ wxPrintData::~wxPrintData()
 #endif
 }
 
-
 void wxPrintData::ConvertToNative()
 {
 #ifdef __WXMAC__
@@ -259,6 +258,163 @@ bool wxPrintData::Ok() const
     return m_nativeData->Ok();
 }
 
+#if WXWIN_COMPATIBILITY_2_4
+
+#include "wx/generic/prntdlgg.h"
+
+wxString wxPrintData::GetPrinterCommand() const
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterCommand();
+#endif
+    return wxT("");
+}
+
+wxString wxPrintData::GetPrinterOptions() const
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterOptions();
+#endif
+    return wxT("");
+}
+
+wxString wxPrintData::GetPreviewCommand() const
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPreviewCommand();
+#endif
+    return wxT("");
+}
+
+wxString wxPrintData::GetFontMetricPath() const
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        return ((wxPostScriptPrintNativeData*)m_nativeData)->GetFontMetricPath();
+#endif
+    return wxT("");
+}
+
+double wxPrintData::GetPrinterScaleX() const
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterScaleX();
+#endif
+    return 1.0;
+}
+
+double wxPrintData::GetPrinterScaleY() const
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterScaleY();
+#endif
+    return 1.0;
+}
+
+long wxPrintData::GetPrinterTranslateX() const
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterTranslateX();
+#endif
+    return 0;
+}
+
+long wxPrintData::GetPrinterTranslateY() const
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        return ((wxPostScriptPrintNativeData*)m_nativeData)->GetPrinterTranslateY();
+#endif
+    return 0;
+}
+
+void wxPrintData::SetPrinterCommand(const wxString& command)
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterCommand( command );
+#endif
+}
+
+void wxPrintData::SetPrinterOptions(const wxString& options)
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterOptions( options );
+#endif
+}
+
+void wxPrintData::SetPreviewCommand(const wxString& command)
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        ((wxPostScriptPrintNativeData*)m_nativeData)->SetPreviewCommand( command );
+#endif
+}
+
+void wxPrintData::SetFontMetricPath(const wxString& path)
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        ((wxPostScriptPrintNativeData*)m_nativeData)->SetFontMetricPath( path );
+#endif
+}
+
+void wxPrintData::SetPrinterScaleX(double x)
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterScaleX( x );
+#endif
+}
+
+void wxPrintData::SetPrinterScaleY(double y)
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterScaleY( y );
+#endif
+}
+
+void wxPrintData::SetPrinterScaling(double x, double y)
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterScaling( x, y );
+#endif
+}
+
+void wxPrintData::SetPrinterTranslateX(long x)
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterTranslateX( x );
+#endif
+}
+
+void wxPrintData::SetPrinterTranslateY(long y)
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterTranslateY( y );
+#endif
+}
+
+void wxPrintData::SetPrinterTranslation(long x, long y)
+{
+#if wxUSE_POSTSCRIPT
+    if (m_nativeData && wxIsKindOf(m_nativeData,wxPostScriptPrintNativeData))
+        ((wxPostScriptPrintNativeData*)m_nativeData)->SetPrinterTranslation( x, y );
+#endif
+}
+#endif
+
 // ----------------------------------------------------------------------------
 // Print dialog data
 // ----------------------------------------------------------------------------
index e0a3bbf3a599d9e45f32b8e2938172dc0118522f..6bf627c9675faf33882eb5fc93dd661f73f773da 100644 (file)
@@ -246,6 +246,23 @@ wxPrintNativeDataBase::wxPrintNativeDataBase()
     m_ref = 1; 
 }
 
+//----------------------------------------------------------------------------
+// wxPrintFactoryModule
+//----------------------------------------------------------------------------
+
+class wxPrintFactoryModule: public wxModule
+{
+public:
+    wxPrintFactoryModule() {}
+    bool OnInit() { return true; }
+    void OnExit() { wxPrintFactory::SetPrintFactory( NULL ); }
+    
+private:
+    DECLARE_DYNAMIC_CLASS(wxPrintFactoryModule)
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxPrintFactoryModule, wxModule)
+
 //----------------------------------------------------------------------------
 // wxPrinterBase
 //----------------------------------------------------------------------------