From e32f3f4740636e8bd3b9d95b116c767769249778 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Fri, 13 Sep 2002 22:02:14 +0000 Subject: [PATCH] Backward comp. fix. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@17166 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/dcpsg.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 5e61da75f6..12d2545a27 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -2340,6 +2340,51 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, // GTK 2.0 } +#if WXWIN_COMPATIBILITY_2_2 +void wxInitializePrintSetupData(bool init) +{ + if (init) + { + // gets initialized in the constructor + wxThePrintSetupData = new wxPrintSetupData; + } + else + { + if (wxThePrintSetupData) + 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 -- 2.45.2