#include "wx/defs.h"
-#if wxUSE_PRINTING_ARCHITECTURE
+#if wxUSE_PRINTING_ARCHITECTURE && wxUSE_POSTSCRIPT
#ifndef WX_PRECOMP
#include "wx/utils.h"
#include "wx/msgdlg.h"
#include "wx/intl.h"
#include "wx/progdlg.h"
+ #include "wx/log.h"
#endif
#include "wx/generic/printps.h"
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase)
IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase)
-
+
// ============================================================================
// implementation
// ============================================================================
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);
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);
}
// 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();
}
}