]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/dcprint.cpp
fixed incorrect GetTextExtent for wxTELETYPE font
[wxWidgets.git] / src / os2 / dcprint.cpp
index 8367bb39403fc7c6f536c2764b39d77ceab0904e..81c60a30d499c161e5108e069b34723821e2072a 100644 (file)
@@ -1,20 +1,22 @@
 /////////////////////////////////////////////////////////////////////////////
 // Name:        dcprint.cpp
 // Purpose:     wxPrinterDC class
-// Author:      Julian Smart
+// Author:      David Webster
 // Modified by:
-// Created:     01/02/97
+// Created:     10/14/99
 // RCS-ID:      $Id$
-// Copyright:   (c) Julian Smart and Markus Holzem
-// Licence:    wxWindows licence
+// Copyright:   (c) David Webster
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#pragma implementation "dcprint.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
+
+#define INCL_DEV
+#define INCL_GPI
+#define INCL_PM
+#include<os2.h>
+
 #ifndef WX_PRECOMP
 #endif
 
 #include "wx/dcprint.h"
 #include "math.h"
 
-#if !USE_SHARED_LIBRARY
+#if wxUSE_PRINTING_ARCHITECTURE
+
 IMPLEMENT_CLASS(wxPrinterDC, wxDC)
-#endif
 
-#define INCL_DEV
-#define INCL_GPI
-#define INCL_PM
-#include<os2.h>
 
 // This form is deprecated
 wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_name, const wxString& file, bool interactive, int orientation)
 {
-    LONG            lType;
-    HAB             hab;
+    LONG            lType = 0;
+    HAB             hab = 0;
     DEVOPENSTRUC    devOpen = { (char*)device_name.c_str()
                                ,(char*)driver_name.c_str()
                                ,NULL
@@ -52,7 +50,7 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_nam
 
     m_isInteractive = interactive;
 
-    if (!file.IsNull() && file != T(""))
+    if (!file.IsNull() && file != wxT(""))
         m_printData.SetFilename(file);
 
 /*
@@ -90,9 +88,9 @@ wxPrinterDC::wxPrinterDC(const wxString& driver_name, const wxString& device_nam
     else
 #endif
 */
-        if ((!driver_name.IsNull() && driver_name != T("")) &&
-            (!device_name.IsNull() && device_name != T("")) &&
-            (!file.IsNull() && file != T("")))
+        if ((!driver_name.IsNull() && driver_name != wxT("")) &&
+            (!device_name.IsNull() && device_name != wxT("")) &&
+            (!file.IsNull() && file != wxT("")))
         {
             m_hDC = (WXHDC) ::DevOpenDC( hab
                                         ,OD_QUEUED
@@ -199,7 +197,7 @@ bool wxPrinterDC::StartDoc(const wxString& message)
     if (ret <= 0)
     {
         DWORD lastError = GetLastError();
-        wxLogDebug(T("wxDC::StartDoc failed with error: %d\n"), lastError);
+        wxLogDebug(wxT("wxDC::StartDoc failed with error: %d\n"), lastError);
     }
 #endif
     return (ret > 0);
@@ -278,7 +276,7 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName)
         GlobalFree(pd.hDevMode);
         pd.hDevMode=NULL;
     }
-    return ( deviceName != T("") );
+    return ( deviceName != wxT("") );
 */
     return(TRUE);
 }
@@ -286,7 +284,7 @@ static bool wxGetDefaultDeviceName(wxString& deviceName, wxString& portName)
 // Gets an HDC for the specified printer configuration
 WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
 {
-    HDC   hDC;
+    HDC   hDC = NULLHANDLE;
 /*
     wxPrintData printData = printDataConst;
     printData.ConvertToNative();
@@ -297,7 +295,7 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
     wxChar* deviceName;
     wxChar* portName = (wxChar*) NULL; // Obsolete in WIN32
 
-    if (devNameStr == T(""))
+    if (devNameStr == wxT(""))
         deviceName = (wxChar*) NULL;
     else
         deviceName = WXSTRINGCAST devNameStr;
@@ -309,13 +307,13 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
     if ( hDevMode )
         lpDevMode = (DEVMODE*) GlobalLock(hDevMode);
 
-    if (devNameStr == T(""))
+    if (devNameStr == wxT(""))
     {
         // Retrieve the default device name
         wxString portName;
         bool ret = wxGetDefaultDeviceName(devNameStr, portName);
 
-        wxASSERT_MSG( ret, T("Could not get default device name.") );
+        wxASSERT_MSG( ret, wxT("Could not get default device name.") );
 
         deviceName = WXSTRINGCAST devNameStr;
     }
@@ -332,3 +330,4 @@ WXHDC WXDLLEXPORT wxGetPrinterDC(const wxPrintData& printDataConst)
     return (WXHDC) hDC;
 }
 
+#endif //wxUSE_PRINTING_ARCHITECTURE