]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/gnome/gprint.cpp
Fixup Blit so it can be used with a source that is a wxBufferedDC,
[wxWidgets.git] / src / gtk / gnome / gprint.cpp
index 05c48f82970e2fdba3717e585ef031ec0ab75b4a..a3520e69f5980257d71ffdf168492e7fc6ebf39a 100644 (file)
 
 #if wxUSE_LIBGNOMEPRINT
 
-#include "wx/math.h"
+#ifndef WX_PRECOMP
+    #include "wx/log.h"
+    #include "wx/dcmemory.h"
+    #include "wx/icon.h"
+    #include "wx/math.h"
+    #include "wx/image.h"
+    #include "wx/module.h"
+#endif
+
 #include "wx/fontutil.h"
 #include "wx/gtk/private.h"
-#include "wx/module.h"
 #include "wx/dynlib.h"
-#include "wx/dcmemory.h"
-#include "wx/log.h"
-#include "wx/icon.h"
 
 #include <libgnomeprint/gnome-print.h>
 #include <libgnomeprint/gnome-print-pango.h>
@@ -277,7 +281,7 @@ wxGnomePrintNativeData::wxGnomePrintNativeData()
 
 wxGnomePrintNativeData::~wxGnomePrintNativeData()
 {
-    g_object_unref (G_OBJECT (m_config));
+    g_object_unref (m_config);
 }
 
 bool wxGnomePrintNativeData::TransferTo( wxPrintData &data )
@@ -704,7 +708,7 @@ bool wxGnomePrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt )
     if (!dc)
     {
         gs_lgp->gnome_print_job_close( job );
-        g_object_unref (G_OBJECT (job));
+        g_object_unref (job);
         sm_lastError = wxPRINTER_ERROR;
         return false;
     }
@@ -735,7 +739,7 @@ bool wxGnomePrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt )
     if (maxPage == 0)
     {
         gs_lgp->gnome_print_job_close( job );
-        g_object_unref (G_OBJECT (job));
+        g_object_unref (job);
         sm_lastError = wxPRINTER_ERROR;
         return false;
     }
@@ -780,15 +784,20 @@ bool wxGnomePrinter::Print(wxWindow *parent, wxPrintout *printout, bool prompt )
     gs_lgp->gnome_print_job_close( job );
     if (m_native_preview)
     {
-        wxString title( _("Print preview") );
-        gtk_widget_show( gs_lgp->gnome_print_job_preview_new( job, (const guchar*)(const char*)wxGTK_CONV(title) ));
+        const wxCharBuffer title(wxGTK_CONV_SYS(_("Print preview")));
+        GtkWidget *preview = gs_lgp->gnome_print_job_preview_new
+                                     (
+                                        job,
+                                        (const guchar *)title.data()
+                                     );
+        gtk_widget_show(preview);
     }
     else
     {
         gs_lgp->gnome_print_job_print( job );
     }
 
-    g_object_unref (G_OBJECT (job));
+    g_object_unref (job);
     delete dc;
 
     return (sm_lastError == wxPRINTER_NO_ERROR);
@@ -842,7 +851,7 @@ wxGnomePrintDC::~wxGnomePrintDC()
 {
 }
 
-bool wxGnomePrintDC::Ok() const
+bool wxGnomePrintDC::IsOk() const
 {
     return true;
 }
@@ -1155,7 +1164,7 @@ void wxGnomePrintDC::DoDrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width,
     }
 }
 
-void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y, 
+void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y,
                                         wxCoord width, wxCoord height)
 {
     double r = 4 * (sqrt (2) - 1) / 3;
@@ -1165,22 +1174,22 @@ void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y,
             halfHR = r * halfH;
     wxCoord halfWI = (wxCoord) halfW,
             halfHI = (wxCoord) halfH;
-            
+
     gs_lgp->gnome_print_newpath( m_gpc );
-    
+
     // Approximate an ellipse using four cubic splines, clockwise from 0 deg */
     gs_lgp->gnome_print_moveto( m_gpc,
-                XLOG2DEV(x + width), 
+                XLOG2DEV(x + width),
                 YLOG2DEV(y + halfHI) );
     gs_lgp->gnome_print_curveto( m_gpc,
                 XLOG2DEV(x + width),
                 YLOG2DEV(y + (wxCoord) rint (halfH + halfHR)),
-                XLOG2DEV(x + (wxCoord) rint(halfW + halfWR)), 
+                XLOG2DEV(x + (wxCoord) rint(halfW + halfWR)),
                 YLOG2DEV(y + height),
-                XLOG2DEV(x + halfWI), 
+                XLOG2DEV(x + halfWI),
                 YLOG2DEV(y + height) );
     gs_lgp->gnome_print_curveto( m_gpc,
-                XLOG2DEV(x + (wxCoord) rint(halfW - halfWR)), 
+                XLOG2DEV(x + (wxCoord) rint(halfW - halfWR)),
                 YLOG2DEV(y + height),
                 XLOG2DEV(x),
                 YLOG2DEV(y + (wxCoord) rint (halfH + halfHR)),
@@ -1197,7 +1206,7 @@ void wxGnomePrintDC::makeEllipticalPath(wxCoord x, wxCoord y,
                 XLOG2DEV(x + width),
                 YLOG2DEV(y + (wxCoord) rint(halfH - halfHR)),
                 XLOG2DEV(x + width), YLOG2DEV(y + halfHI) );
-                
+
     gs_lgp->gnome_print_closepath(m_gpc);
 }
 
@@ -1529,7 +1538,7 @@ void wxGnomePrintDC::SetPen( const wxPen& pen )
         case wxSHORT_DASH:    gs_lgp->gnome_print_setdash( m_gpc, 2, short_dashed, 0 ); break;
         case wxLONG_DASH:     gs_lgp->gnome_print_setdash( m_gpc, 2, wxCoord_dashed, 0 ); break;
         case wxDOT_DASH:      gs_lgp->gnome_print_setdash( m_gpc, 4, dotted_dashed, 0 );  break;
-        case wxUSER_DASH: 
+        case wxUSER_DASH:
         {
             // It may be noted that libgnomeprint between at least
             // versions 2.8.0 and 2.12.1 makes a copy of the dashes