]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/dcpsg.cpp
Unicode compilation fix
[wxWidgets.git] / src / generic / dcpsg.cpp
index 1e6d11c6198e20d3d84af661fea132aaef4ef3a5..25c72a2a11e21e0c56f6f3fab4e8293b63f4eec4 100644 (file)
@@ -204,7 +204,8 @@ static const char *wxPostScriptHeaderColourImage = "\
   } ifelse          %% end of 'false' case\n\
 ";
 
   } ifelse          %% end of 'false' case\n\
 ";
 
-#ifndef __WXGTK20__
+#if wxUSE_PANGO
+#else
 static char wxPostScriptHeaderReencodeISO1[] =
     "\n/reencodeISO {\n"
 "dup dup findfont dup length dict begin\n"
 static char wxPostScriptHeaderReencodeISO1[] =
     "\n/reencodeISO {\n"
 "dup dup findfont dup length dict begin\n"
@@ -318,6 +319,31 @@ wxPostScriptDC::~wxPostScriptDC ()
     }
 }
 
     }
 }
 
+#if WXWIN_COMPATIBILITY_2_2
+bool wxPostScriptDC::Create( const wxString &output, bool interactive, wxWindow *parent )
+{
+    wxPrintData data;
+    data.SetFilename( output );
+    data.SetPrintMode( wxPRINT_MODE_FILE );
+    
+    if (interactive)
+    {
+        wxPrintDialogData ddata( data );
+        wxPrintDialog dialog( parent, &data );
+        dialog.GetPrintDialogData().SetSetupDialog(TRUE);
+        if (dialog.ShowModal() != wxID_OK)
+        {
+            m_ok = FALSE;
+            return FALSE;
+        }
+        data = dialog.GetPrintDialogData().GetPrintData();
+    }
+    
+    return TRUE;
+}
+#endif
+
+
 bool wxPostScriptDC::Ok() const
 {
   return m_ok;
 bool wxPostScriptDC::Ok() const
 {
   return m_ok;
@@ -861,7 +887,8 @@ void wxPostScriptDC::SetFont( const wxFont& font )
 
     m_font = font;
 
 
     m_font = font;
 
-#ifndef __WXGTK20__
+#if wxUSE_PANGO
+#else
     int Style = m_font.GetStyle();
     int Weight = m_font.GetWeight();
 
     int Style = m_font.GetStyle();
     int Weight = m_font.GetWeight();
 
@@ -1092,13 +1119,18 @@ void wxPostScriptDC::SetBrush( const wxBrush& brush )
     }
 }
 
     }
 }
 
-#ifdef __WXGTK20__
+#if wxUSE_PANGO
 
 #define PANGO_ENABLE_ENGINE
 
 
 #define PANGO_ENABLE_ENGINE
 
+#ifdef __WXGTK20__
 #include "wx/gtk/private.h"
 #include "wx/gtk/private.h"
-#include "wx/fontutil.h"
 #include "gtk/gtk.h"
 #include "gtk/gtk.h"
+#else
+#include "wx/x11/private.h"
+#endif
+
+#include "wx/fontutil.h"
 #include <pango/pangoft2.h>
 #include <freetype/ftglyph.h>
 
 #include <pango/pangoft2.h>
 #include <freetype/ftglyph.h>
 
@@ -1208,7 +1240,7 @@ void wxPostScriptDC::DoDrawText( const wxString& text, wxCoord x, wxCoord y )
 {
     wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
 
 {
     wxCHECK_RET( m_ok && m_pstream, wxT("invalid postscript dc") );
 
-#ifdef __WXGTK20__
+#if wxUSE_PANGO
     int dpi = GetResolution();
     dpi = 300;
     PangoContext *context = pango_ft2_get_context ( dpi, dpi );
     int dpi = GetResolution();
     dpi = 300;
     PangoContext *context = pango_ft2_get_context ( dpi, dpi );
@@ -1674,9 +1706,9 @@ bool wxPostScriptDC::StartDoc( const wxString& message )
 {
     wxCHECK_MSG( m_ok, FALSE, wxT("invalid postscript dc") );
 
 {
     wxCHECK_MSG( m_ok, FALSE, wxT("invalid postscript dc") );
 
-    if (m_printData.GetFilename() == "")
+    if (m_printData.GetFilename() == wxT(""))
     {
     {
-        wxString filename = wxGetTempFileName("ps");
+        wxString filename = wxGetTempFileName( wxT("ps") );
         m_printData.SetFilename(filename);
     }
 
         m_printData.SetFilename(filename);
     }
 
@@ -1729,7 +1761,8 @@ bool wxPostScriptDC::StartDoc( const wxString& message )
     fprintf( m_pstream, wxPostScriptHeaderEllipse );
     fprintf( m_pstream, wxPostScriptHeaderEllipticArc );
     fprintf( m_pstream, wxPostScriptHeaderColourImage );
     fprintf( m_pstream, wxPostScriptHeaderEllipse );
     fprintf( m_pstream, wxPostScriptHeaderEllipticArc );
     fprintf( m_pstream, wxPostScriptHeaderColourImage );
-#ifndef __WXGTK20__
+#if wxUSE_PANGO
+#else
     fprintf( m_pstream, wxPostScriptHeaderReencodeISO1 );
     fprintf( m_pstream, wxPostScriptHeaderReencodeISO2 );
 #endif
     fprintf( m_pstream, wxPostScriptHeaderReencodeISO1 );
     fprintf( m_pstream, wxPostScriptHeaderReencodeISO2 );
 #endif
@@ -1947,7 +1980,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
         return;
     }
     
         return;
     }
     
-#ifdef __WXGTK20__
+#if wxUSE_PANGO
     int dpi = GetResolution();
     PangoContext *context = pango_ft2_get_context ( dpi, dpi );
     
     int dpi = GetResolution();
     PangoContext *context = pango_ft2_get_context ( dpi, dpi );
     
@@ -2068,40 +2101,40 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
         lastStyle =  Style;
         lastWeight = Weight;
 
         lastStyle =  Style;
         lastWeight = Weight;
 
-        const char *name = NULL;
+        const wxChar *name = NULL;
 
         switch (Family)
         {
             case wxMODERN:
             case wxTELETYPE:
             {
 
         switch (Family)
         {
             case wxMODERN:
             case wxTELETYPE:
             {
-                if ((Style == wxITALIC) && (Weight == wxBOLD)) name = "CourBoO.afm";
-                else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = "CourBo.afm";
-                else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = "CourO.afm";
-                else name = "Cour.afm";
+                if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("CourBoO.afm");
+                else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("CourBo.afm");
+                else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("CourO.afm");
+                else name = wxT("Cour.afm");
                 break;
             }
             case wxROMAN:
             {
                 break;
             }
             case wxROMAN:
             {
-                if ((Style == wxITALIC) && (Weight == wxBOLD)) name = "TimesBoO.afm";
-                else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = "TimesBo.afm";
-                else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = "TimesO.afm";
-                else name = "TimesRo.afm";
+                if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("TimesBoO.afm");
+                else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("TimesBo.afm");
+                else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("TimesO.afm");
+                else name = wxT("TimesRo.afm");
                 break;
             }
             case wxSCRIPT:
             {
                 break;
             }
             case wxSCRIPT:
             {
-                name = "Zapf.afm";
+                name = wxT("Zapf.afm");
                 Style = wxNORMAL;
                 Weight = wxNORMAL;
             }
             case wxSWISS:
             default:
             {
                 Style = wxNORMAL;
                 Weight = wxNORMAL;
             }
             case wxSWISS:
             default:
             {
-                if ((Style == wxITALIC) && (Weight == wxBOLD)) name = "HelvBoO.afm";
-                else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = "HelvBo.afm";
-                else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = "HelvO.afm";
-                else name = "Helv.afm";
+                if ((Style == wxITALIC) && (Weight == wxBOLD)) name = wxT("HelvBoO.afm");
+                else if ((Style != wxITALIC) && (Weight == wxBOLD)) name = wxT("HelvBo.afm");
+                else if ((Style == wxITALIC) && (Weight != wxBOLD)) name = wxT("HelvO.afm");
+                else name = wxT("Helv.afm");
                 break;
             }
         }
                 break;
             }
         }
@@ -2315,8 +2348,57 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string,
     // GTK 2.0
 }
 
     // GTK 2.0
 }
 
+#if WXWIN_COMPATIBILITY_2_2
+WXDLLEXPORT wxPrintSetupData *wxThePrintSetupData = 0;
+
+void wxInitializePrintSetupData(bool init)
+{
+    if (init)
+    {
+        // gets initialized in the constructor
+        wxThePrintSetupData = new wxPrintSetupData;
+    }
+    else
+    {
+        delete wxThePrintSetupData;
+
+        wxThePrintSetupData = (wxPrintSetupData *) NULL;
+    }
+}
+
+// A module to allow initialization/cleanup of PostScript-related
+// things without calling these functions from app.cpp.
+
+class WXDLLEXPORT wxPostScriptModule: public wxModule
+{
+DECLARE_DYNAMIC_CLASS(wxPostScriptModule)
+public:
+    wxPostScriptModule() {}
+    bool OnInit();
+    void OnExit();
+};
+
+IMPLEMENT_DYNAMIC_CLASS(wxPostScriptModule, wxModule)
+
+bool wxPostScriptModule::OnInit()
+{
+    wxInitializePrintSetupData();
+
+    return TRUE;
+}
+
+void wxPostScriptModule::OnExit()
+{
+    wxInitializePrintSetupData(FALSE);
+}
+#endif
+  // WXWIN_COMPATIBILITY_2_2
+
 #endif
   // wxUSE_POSTSCRIPT
 
 #endif
   // wxUSE_PRINTING_ARCHITECTURE
 #endif
   // wxUSE_POSTSCRIPT
 
 #endif
   // wxUSE_PRINTING_ARCHITECTURE
+
+
+// vi:sts=4:sw=4:et