]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/dcprint.cpp
Fix for crash when opening empty node
[wxWidgets.git] / src / os2 / dcprint.cpp
index 655622d16f35f25be094df564710a29aa3158b4f..1c4a11c248532c2686c41a3b6f1a14321291d8e7 100644 (file)
 
 #if wxUSE_PRINTING_ARCHITECTURE
 
 
 #if wxUSE_PRINTING_ARCHITECTURE
 
+#include "wx/dcprint.h"
+
 #define INCL_DEV
 #define INCL_GPI
 #define INCL_PM
 #include<os2.h>
 
 #define INCL_DEV
 #define INCL_GPI
 #define INCL_PM
 #include<os2.h>
 
-#include "wx/dcprint.h"
-
 #ifndef WX_PRECOMP
     #include "wx/app.h"
     #include "wx/math.h"
     #include "wx/string.h"
 #ifndef WX_PRECOMP
     #include "wx/app.h"
     #include "wx/math.h"
     #include "wx/string.h"
+    #include "wx/log.h"
+    #include "wx/window.h"
 #endif
 
 #endif
 
-#include "wx/log.h"
-#include "wx/window.h"
 #include "wx/os2/private.h"
 
 IMPLEMENT_CLASS(wxPrinterDC, wxDC)
 #include "wx/os2/private.h"
 
 IMPLEMENT_CLASS(wxPrinterDC, wxDC)
@@ -41,8 +41,8 @@ wxPrinterDC::wxPrinterDC( const wxString& rsDriverName,
                           bool bInteractive,
                           int nOrientation )
 {
                           bool bInteractive,
                           int nOrientation )
 {
-    DEVOPENSTRUC    vDevOpen = { (char*)rsDeviceName.c_str()
-                                ,(char*)rsDriverName.c_str()
+    DEVOPENSTRUC    vDevOpen = { (char*)rsDeviceName.wx_str()
+                                ,(char*)rsDriverName.wx_str()
                                 ,NULL
                                 ,NULL
                                 ,NULL
                                 ,NULL
                                 ,NULL
                                 ,NULL
@@ -223,6 +223,15 @@ void wxPrinterDC::EndPage()
 //    if (m_hDC)
 //        ::EndPage((HDC) m_hDC);
 } // end of wxPrinterDC::EndPage
 //    if (m_hDC)
 //        ::EndPage((HDC) m_hDC);
 } // end of wxPrinterDC::EndPage
+
+wxRect wxPrinterDC::GetPaperRect()
+{
+    // Use page rect if we can't get paper rect.
+    wxCoord w, h;
+    GetSize(&w, &h);
+    return wxRect(0, 0, w, h);
+}
+
 #if 0
 // Returns default device and port names
 static bool wxGetDefaultDeviceName( wxString& rsDeviceName, wxString& rsPortName )
 #if 0
 // Returns default device and port names
 static bool wxGetDefaultDeviceName( wxString& rsDeviceName, wxString& rsPortName )
@@ -278,7 +287,7 @@ static bool wxGetDefaultDeviceName( wxString& rsDeviceName, wxString& rsPortName
         GlobalFree(pd.hDevMode);
         pd.hDevMode=NULL;
     }
         GlobalFree(pd.hDevMode);
         pd.hDevMode=NULL;
     }
-    return ( deviceName != wxT("") );
+    return !deviceName.empty();
 */
     return true;
 } // end of wxGetDefaultDeviceName
 */
     return true;
 } // end of wxGetDefaultDeviceName