]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/printps.cpp
remove always-true test of unsigned >= 0
[wxWidgets.git] / src / generic / printps.cpp
index d5396c480a940bbfc5c64180d20876e02c2ad879..a264bdabc5633a6aae5a4eab1b1a02557d043658 100644 (file)
@@ -40,7 +40,7 @@
 #include "wx/generic/printps.h"
 #include "wx/printdlg.h"
 #include "wx/generic/prntdlgg.h"
-#include "wx/generic/progdlgg.h"
+#include "wx/progdlg.h"
 #include "wx/paper.h"
 
 #include <stdlib.h>
@@ -80,8 +80,6 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
         return false;
     }
 
-    printout->SetIsPreview(false);
-
     if (m_printDialogData.GetMinPage() < 1)
         m_printDialogData.SetMinPage(1);
     if (m_printDialogData.GetMaxPage() < 1)
@@ -332,14 +330,16 @@ void wxPostScriptPrintPreview::DetermineScaling()
 
     if (paper)
     {
-        wxSize ScreenPixels = wxGetDisplaySize();
-        wxSize ScreenMM = wxGetDisplaySizeMM();
-
         int resolution = 600;  // TODO, this is correct, but get this from wxPSDC somehow
 
-        m_previewPrintout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()),
-                                         (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) );
-        m_previewPrintout->SetPPIPrinter( resolution, resolution );
+        const wxSize screenPPI = wxGetDisplayPPI();
+        int logPPIScreenX = screenPPI.GetWidth();
+        int logPPIScreenY = screenPPI.GetHeight();
+        int logPPIPrinterX = resolution;
+        int logPPIPrinterY = resolution;
+
+        m_previewPrintout->SetPPIScreen( logPPIScreenX, logPPIScreenY );
+        m_previewPrintout->SetPPIPrinter( logPPIPrinterX, logPPIPrinterY );
 
         wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
         sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * resolution / 72.0);
@@ -364,8 +364,8 @@ void wxPostScriptPrintPreview::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 = (float)0.8 * 72.0 / (float)resolution;
-        m_previewScaleY = m_previewScaleX;
+        m_previewScaleX = float(logPPIScreenX) / logPPIPrinterX;
+        m_previewScaleY = float(logPPIScreenY) / logPPIPrinterY;
     }
 }