]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/print.cpp
Always invoke default action even if dclick is caught from wxListBox (as per wxMSW...
[wxWidgets.git] / src / gtk / print.cpp
index 27632df7973d5cbb2447fe0e7c6c8c72e7c2dd3a..7f7722f73ae390f326ff9ef9cfacd97e44b87fa3 100644 (file)
@@ -261,15 +261,24 @@ bool wxGtkPrintNativeData::TransferTo( wxPrintData &data )
     if(!m_config)
         return false;
 
-    GtkPrintQuality quality = gtk_print_settings_get_quality(m_config);
-    if (quality == GTK_PRINT_QUALITY_HIGH)
-        data.SetQuality(wxPRINT_QUALITY_HIGH);
-    else if (quality == GTK_PRINT_QUALITY_LOW)
-        data.SetQuality(wxPRINT_QUALITY_LOW);
-    else if (quality == GTK_PRINT_QUALITY_DRAFT)
-        data.SetQuality(wxPRINT_QUALITY_DRAFT);
-    else
-        data.SetQuality(wxPRINT_QUALITY_MEDIUM);
+    int resolution = gtk_print_settings_get_resolution(m_config);
+    if ( resolution > 0 )
+    {
+        // if resolution is explicitly set, use it
+        data.SetQuality(resolution);
+    }
+    else // use more vague "quality"
+    {
+        GtkPrintQuality quality = gtk_print_settings_get_quality(m_config);
+        if (quality == GTK_PRINT_QUALITY_HIGH)
+            data.SetQuality(wxPRINT_QUALITY_HIGH);
+        else if (quality == GTK_PRINT_QUALITY_LOW)
+            data.SetQuality(wxPRINT_QUALITY_LOW);
+        else if (quality == GTK_PRINT_QUALITY_DRAFT)
+            data.SetQuality(wxPRINT_QUALITY_DRAFT);
+        else
+            data.SetQuality(wxPRINT_QUALITY_MEDIUM);
+    }
 
     data.SetNoCopies(gtk_print_settings_get_n_copies(m_config));
 
@@ -892,6 +901,12 @@ void wxGtkPrinter::BeginPrint(wxPrintout *printout, GtkPrintOperation *operation
     wxPrintData printdata = GetPrintDialogData().GetPrintData();
     wxGtkPrintNativeData *native = (wxGtkPrintNativeData*) printdata.GetNativeData();
 
+    // We need to update printdata with the new data from the dialog and we
+    // have to do this here because this method needs this new data and we
+    // cannot update it earlier
+    native->SetPrintConfig(gtk_print_operation_get_print_settings(operation));
+    printdata.ConvertFromNative();
+
     SetPrintContext(context);
     native->SetPrintContext( context );
 
@@ -2254,8 +2269,6 @@ void wxGtkPrintPreview::Init(wxPrintout * WXUNUSED(printout),
                              wxPrintout * WXUNUSED(printoutForPrinting),
                              wxPrintData *data)
 {
-    DetermineScaling();
-
     // convert wxPrintQuality to resolution (input pointer can be NULL)
     wxPrintQuality quality = data ? data->GetQuality() : wxPRINT_QUALITY_MEDIUM;
     switch ( quality )
@@ -2264,7 +2277,22 @@ void wxGtkPrintPreview::Init(wxPrintout * WXUNUSED(printout),
             m_resolution = 1200;
             break;
 
+        case wxPRINT_QUALITY_LOW:
+            m_resolution = 300;
+            break;
+
+        case wxPRINT_QUALITY_DRAFT:
+            m_resolution = 150;
+            break;
+
         default:
+            if ( quality > 0 )
+            {
+                // positive values directly indicate print resolution
+                m_resolution = quality;
+                break;
+            }
+
             wxFAIL_MSG( "unknown print quality" );
             // fall through
 
@@ -2272,14 +2300,9 @@ void wxGtkPrintPreview::Init(wxPrintout * WXUNUSED(printout),
             m_resolution = 600;
             break;
 
-        case wxPRINT_QUALITY_LOW:
-            m_resolution = 300;
-            break;
-
-        case wxPRINT_QUALITY_DRAFT:
-            m_resolution = 150;
-            break;
     }
+
+    DetermineScaling();
 }
 
 wxGtkPrintPreview::wxGtkPrintPreview(wxPrintout *printout,