Title: [90683] trunk/Source/WebKit/wx
Revision
90683
Author
[email protected]
Date
2011-07-09 12:29:47 -0700 (Sat, 09 Jul 2011)

Log Message

Reviewed by Kevin Ollivier.

Make sure wxPrintData grabs the default print settings to calculate page width, 
and readjusts settings after the print dialog is displayed.
        
https://bugs.webkit.org/show_bug.cgi?id=64232

Modified Paths

Diff

Modified: trunk/Source/WebKit/wx/ChangeLog (90682 => 90683)


--- trunk/Source/WebKit/wx/ChangeLog	2011-07-09 19:05:44 UTC (rev 90682)
+++ trunk/Source/WebKit/wx/ChangeLog	2011-07-09 19:29:47 UTC (rev 90683)
@@ -1,3 +1,17 @@
+2011-07-08  Robin Dunn  <[email protected]>
+
+        Reviewed by Kevin Ollivier.
+
+        Make sure wxPrintData grabs the default print settings to calculate page width, 
+        and readjusts settings after the print dialog is displayed.
+        
+        https://bugs.webkit.org/show_bug.cgi?id=64232
+
+        * WebFrame.cpp:
+        (wxWebFramePrintout::InitializeWithPageSize):
+        (wxWebFramePrintout::OnBeginPrinting):
+        (wxWebFrame::Print):
+
 2011-07-06  Kevin Ollivier  <[email protected]>
 
         [wx] Unreviewed build fix. Don't expose the kit function to the swig wrappers.

Modified: trunk/Source/WebKit/wx/WebFrame.cpp (90682 => 90683)


--- trunk/Source/WebKit/wx/WebFrame.cpp	2011-07-09 19:05:44 UTC (rev 90682)
+++ trunk/Source/WebKit/wx/WebFrame.cpp	2011-07-09 19:29:47 UTC (rev 90683)
@@ -117,7 +117,7 @@
         pageRect.y = pageRect.y * mmToPixelsY;
         pageRect.width = pageRect.width * mmToPixelsX;
         pageRect.height = pageRect.height * mmToPixelsY;
-
+        
         m_pageWidth = pageRect.width;
         m_printContext.begin(m_pageWidth);
         
@@ -129,6 +129,11 @@
     {
         wxPrinterDC* pdc = dynamic_cast<wxPrinterDC*>(GetDC());
         pdc->SetMapMode(wxMM_POINTS);
+        int pageWidth = 0;
+        int pageHeight = 0;
+        GetPageSizeMM(&pageWidth, &pageHeight);
+        
+        InitializeWithPageSize(wxRect(0, 0, pageWidth, pageHeight));
     }
     
     void GetPageInfo(int *minPage, int *maxPage, int *pageFrom, int *pageTo)
@@ -579,9 +584,9 @@
     
     wxPrintDialogData printdata;
     printdata.GetPrintData().SetPrintMode(wxPRINT_MODE_PRINTER);
-    printdata.GetPrintData().SetPaperId(wxPAPER_LETTER);
     printdata.GetPrintData().SetNoCopies(1);
-        
+    printdata.GetPrintData().ConvertFromNative();
+    
     wxPageSetupDialogData pageSetup(printdata.GetPrintData());
 
     wxRect paperSize = pageSetup.GetPaperSize();
@@ -598,19 +603,17 @@
     printdata.SetFromPage(1);
     printdata.SetToPage(printout->GetPageCount());
 
-    wxPrintDialogData data(printdata);
-
     if (showDialog) {
-        wxPrintDialog dialog(0, &data);
+        wxPrintDialog dialog(0, &printdata);
         if (dialog.ShowModal() == wxID_OK) {
-            data = ""
-            printout->SetFirstPage(data.GetFromPage());
-            printout->SetLastPage(data.GetToPage());
+            wxPrintDialogData updatedPrintdata = dialog.GetPrintDialogData();            
+            printout->SetFirstPage(updatedPrintdata.GetFromPage());
+            printout->SetLastPage(updatedPrintdata.GetToPage());
         } else
             return;
     }
     
-    wxPrinter printer(&data);
+    wxPrinter printer(&printdata);
         
     printer.Print(0, printout, false);
         
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to