+// print postscript datas via required method (file, stream)
+void wxPostScriptDC::PsPrintf( const wxChar* fmt, ... )
+{
+ va_list argptr;
+ va_start(argptr, fmt);
+
+ PsPrint( wxString::FormatV( fmt, argptr ).c_str() );
+}
+
+void wxPostScriptDC::PsPrint( const char* psdata )
+{
+ switch( m_printData.GetPrintMode() )
+ {
+#if wxUSE_STREAMS
+ // append to output stream
+ case wxPRINT_MODE_STREAM:
+ {
+ wxOutputStream* outputstream = m_printData.GetOutputStream();
+ wxCHECK_RET( outputstream, wxT("invalid outputstream") );
+ outputstream->Write( psdata, strlen( psdata ) );
+ }
+ break;
+#endif // wxUSE_STREAMS
+
+ // save data into file
+ default:
+ wxCHECK_RET( m_pstream, wxT("invalid postscript dc") );
+ fwrite( psdata, 1, strlen( psdata ), m_pstream );
+ }
+}
+
+void wxPostScriptDC::PsPrint( int ch )
+{
+ switch( m_printData.GetPrintMode() )
+ {
+#if wxUSE_STREAMS
+ // append to output stream
+ case wxPRINT_MODE_STREAM:
+ {
+ wxOutputStream* outputstream = m_printData.GetOutputStream();
+ wxCHECK_RET( outputstream, wxT("invalid outputstream") );
+ outputstream->PutC( ch );
+ }
+ break;
+#endif // wxUSE_STREAMS
+
+ // save data into file
+ default:
+ wxCHECK_RET( m_pstream, wxT("invalid postscript dc") );
+ fputc( ch, m_pstream );
+ }
+}
+
+#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
+