X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b64de91622281ec29d4e5990d09aa6ca6c41e0a0..f1d93f0beeec9d88f8a225aa35a9ccc163dcdb15:/src/generic/printps.cpp?ds=sidebyside diff --git a/src/generic/printps.cpp b/src/generic/printps.cpp index 9a97d9cc6e..adf67bf80f 100644 --- a/src/generic/printps.cpp +++ b/src/generic/printps.cpp @@ -148,25 +148,13 @@ bool wxPostScriptPrinter::Print(wxWindow *parent, wxPrintout *printout, bool pro return FALSE; } - int logPPIScreenX = 0; - int logPPIScreenY = 0; - int logPPIPrinterX = 0; - int logPPIPrinterY = 0; + wxSize ScreenPixels = wxGetDisplaySize(); + wxSize ScreenMM = wxGetDisplaySizeMM(); - logPPIScreenX = 100; - logPPIScreenY = 100; - - /* - // Correct values for X/PostScript? - logPPIPrinterX = 100; - logPPIPrinterY = 100; - */ - - logPPIPrinterX = wxPostScriptDC::GetResolution(); - logPPIPrinterY = wxPostScriptDC::GetResolution(); - - printout->SetPPIScreen(logPPIScreenX, logPPIScreenY); - printout->SetPPIPrinter(logPPIPrinterX, logPPIPrinterY); + printout->SetPPIScreen( (ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth(), + (ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight() ); + printout->SetPPIPrinter( wxPostScriptDC::GetResolution(), + wxPostScriptDC::GetResolution() ); // Set printout parameters printout->SetDC(dc); @@ -348,8 +336,11 @@ void wxPostScriptPrintPreview::DetermineScaling() if (paper) { - m_previewPrintout->SetPPIScreen(100, 100); - // m_previewPrintout->SetPPIPrinter(100, 100); + wxSize ScreenPixels = wxGetDisplaySize(); + wxSize ScreenMM = wxGetDisplaySizeMM(); + + m_previewPrintout->SetPPIScreen( (ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth(), + (ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight() ); m_previewPrintout->SetPPIPrinter(wxPostScriptDC::GetResolution(), wxPostScriptDC::GetResolution()); wxSize sizeDevUnits(paper->GetSizeDeviceUnits());