]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/printps.cpp
removed extremely user-unfriendly translations
[wxWidgets.git] / src / generic / printps.cpp
index f819ed81ee4dc1a18cfd1b5151d89410e661af65..dfa661141641430f8d3387a8736870ea5c9e0706 100644 (file)
@@ -30,7 +30,7 @@
 
 #include "wx/defs.h"
 
-#if wxUSE_PRINTING_ARCHITECTURE
+#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
 
 #ifndef WX_PRECOMP
     #include "wx/utils.h"
@@ -39,6 +39,7 @@
     #include "wx/msgdlg.h"
     #include "wx/intl.h"
     #include "wx/progdlg.h"
+    #include "wx/log.h"                                                                          
 #endif
 
 #include "wx/generic/printps.h"
@@ -56,7 +57,7 @@
 
     IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase)
     IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase)
-
+    
 // ============================================================================
 // implementation
 // ============================================================================
@@ -148,25 +149,13 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro
         return FALSE;
     }
 
-    int logPPIScreenX = 0;
-    int logPPIScreenY = 0;
-    int logPPIPrinterX = 0;
-    int logPPIPrinterY = 0;
-
-    logPPIScreenX = 100;
-    logPPIScreenY = 100;
-
-    /*
-    // Correct values for X/PostScript?
-    logPPIPrinterX = 100;
-    logPPIPrinterY = 100;
-    */
+    wxSize ScreenPixels = wxGetDisplaySize();
+    wxSize ScreenMM = wxGetDisplaySizeMM();
 
-    logPPIPrinterX = 72;
-    logPPIPrinterY = 72;
-
-    printout->SetPPIScreen(logPPIScreenX, logPPIScreenY);
-    printout->SetPPIPrinter(logPPIPrinterX, logPPIPrinterY);
+    printout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()),
+                            (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) );
+    printout->SetPPIPrinter( wxPostScriptDC::GetResolution(),
+                             wxPostScriptDC::GetResolution() );
 
     // Set printout parameters
     printout->SetDC(dc);
@@ -348,11 +337,16 @@ void wxPostScriptPrintPreview::DetermineScaling()
 
     if (paper)
     {
-        m_previewPrintout->SetPPIScreen(100, 100);
-        //      m_previewPrintout->SetPPIPrinter(100, 100);
-        m_previewPrintout->SetPPIPrinter(72, 72);
+        wxSize ScreenPixels = wxGetDisplaySize();
+        wxSize ScreenMM = wxGetDisplaySizeMM();
+
+        m_previewPrintout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()),
+                                         (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) );
+        m_previewPrintout->SetPPIPrinter(wxPostScriptDC::GetResolution(), wxPostScriptDC::GetResolution()); 
 
         wxSize sizeDevUnits(paper->GetSizeDeviceUnits());
+        sizeDevUnits.x = (wxCoord)((float)sizeDevUnits.x * wxPostScriptDC::GetResolution() / 72.0);
+        sizeDevUnits.y = (wxCoord)((float)sizeDevUnits.y * wxPostScriptDC::GetResolution() / 72.0);
         wxSize sizeTenthsMM(paper->GetSize());
         wxSize sizeMM(sizeTenthsMM.x / 10, sizeTenthsMM.y / 10);
 
@@ -373,7 +367,7 @@ void wxPostScriptPrintPreview::DetermineScaling()
         }
 
         // At 100%, the page should look about page-size on the screen.
-        m_previewScale = (float)0.8;
+        m_previewScale = (float)0.8 * 72.0 / (float)wxPostScriptDC::GetResolution();
     }
 }