]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/print.cpp
No changes, just get rid of wxDataViewColumn::GetConstGtkHandle().
[wxWidgets.git] / src / gtk / print.cpp
index 2c3376d044d413b2936eaf82aa55be0eea51c281..d72c2a9a5ef672e12e3aacc5c5afba94fe6e1c95 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        wx/gtk/print.cpp
+// Name:        src/gtk/print.cpp
 // Author:      Anthony Bretaudeau
 // Purpose:     GTK printing support
 // Created:     2007-08-25
 #include "wx/paper.h"
 
 #include <gtk/gtk.h>
+
+#if GTK_CHECK_VERSION(2,14,0)
+#include <gtk/gtkunixprint.h>
+#else
 #include <gtk/gtkpagesetupunixdialog.h>
+#endif
+
 
 #if wxUSE_GRAPHICS_CONTEXT
 #include "wx/graphics.h"
@@ -51,7 +57,7 @@ wxFORCE_LINK_THIS_MODULE(gtk_print)
 
 #include "wx/gtk/private/object.h"
 
-// Usefull to convert angles from/to Rad to/from Deg.
+// Useful to convert angles from/to Rad to/from Deg.
 static const double RAD2DEG  = 180.0 / M_PI;
 static const double DEG2RAD  = M_PI / 180.0;
 
@@ -543,7 +549,7 @@ bool wxGtkPrintNativeData::TransferFrom( const wxPrintData &data )
         default:                break;
     }
 
-    gtk_print_settings_set_printer(m_config, data.GetPrinterName());
+    gtk_print_settings_set_printer(m_config, data.GetPrinterName().utf8_str());
 
     return true;
 }
@@ -661,8 +667,8 @@ int wxGtkPrintDialog::ShowModal()
     }
     else if (response == GTK_PRINT_OPERATION_RESULT_ERROR)
     {
+        wxLogError(_("Error while printing: ") + wxString(gError ? gError->message : "???"));
         g_error_free (gError);
-        wxLogError(_("Error while printing: ") + wxString::Format(_("%s"), gError->message));
         return wxID_NO; // We use wxID_NO because there is no wxID_ERROR available
     }
 
@@ -763,7 +769,9 @@ int wxGtkPageSetupDialog::ShowModal()
     wxString title(GetTitle());
     if ( title.empty() )
         title = _("Page Setup");
-    GtkWidget *dlg = gtk_page_setup_unix_dialog_new(title, GTK_WINDOW(m_parent->m_widget));
+    GtkWidget *
+        dlg = gtk_page_setup_unix_dialog_new(title.utf8_str(),
+                                             GTK_WINDOW(m_parent->m_widget));
 
     gtk_page_setup_unix_dialog_set_print_settings(
         GTK_PAGE_SETUP_UNIX_DIALOG(dlg), nativeData);
@@ -2205,7 +2213,7 @@ void wxGtkPrinterDCImpl::SetPrintData(const wxPrintData& data)
     m_printData = data;
 }
 
-// overriden for wxPrinterDC Impl
+// overridden for wxPrinterDC Impl
 
 wxRect wxGtkPrinterDCImpl::GetPaperRect() const
 {
@@ -2306,8 +2314,14 @@ void wxGtkPrintPreview::DetermineScaling()
 
     if (paper)
     {
-        m_previewPrintout->SetPPIScreen(wxGetDisplayPPI());
-        m_previewPrintout->SetPPIPrinter( m_resolution, m_resolution );
+        const wxSize screenPPI = wxGetDisplayPPI();
+        int logPPIScreenX = screenPPI.GetWidth();
+        int logPPIScreenY = screenPPI.GetHeight();
+        int logPPIPrinterX = m_resolution;
+        int logPPIPrinterY = m_resolution;
+
+        m_previewPrintout->SetPPIScreen( logPPIScreenX, logPPIScreenY );
+        m_previewPrintout->SetPPIPrinter( logPPIPrinterX, logPPIPrinterY );
 
         // Get width and height in points (1/72th of an inch)
         wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
@@ -2334,8 +2348,8 @@ void wxGtkPrintPreview::DetermineScaling()
         m_previewPrintout->SetPaperRectPixels(wxRect(0, 0, m_pageWidth, m_pageHeight));
 
         // At 100%, the page should look about page-size on the screen.
-        m_previewScaleX = 0.8 * 72.0 / (double)m_resolution;
-        m_previewScaleY = m_previewScaleX;
+        m_previewScaleX = float(logPPIScreenX) / logPPIPrinterX;
+        m_previewScaleY = float(logPPIScreenY) / logPPIPrinterY;
     }
 }