extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySize();
extern void WXDLLIMPEXP_CORE wxDisplaySizeMM(int *width, int *height);
extern wxSize WXDLLIMPEXP_CORE wxGetDisplaySizeMM();
+extern wxSize WXDLLIMPEXP_CORE wxGetDisplayPPI();
// Get position and size of the display workarea
extern void WXDLLIMPEXP_CORE wxClientDisplayRect(int *x, int *y, int *width, int *height);
void GetPageSizeMM(int *w, int *h) const { *w = m_pageWidthMM; *h = m_pageHeightMM; }
void SetPPIScreen(int x, int y) { m_PPIScreenX = x; m_PPIScreenY = y; }
+ void SetPPIScreen(const wxSize& ppi) { SetPPIScreen(ppi.x, ppi.y); }
void GetPPIScreen(int *x, int *y) const { *x = m_PPIScreenX; *y = m_PPIScreenY; }
void SetPPIPrinter(int x, int y) { m_PPIPrinterX = x; m_PPIPrinterY = y; }
+ void SetPPIPrinter(const wxSize& ppi) { SetPPIPrinter(ppi.x, ppi.y); }
void GetPPIPrinter(int *x, int *y) const { *x = m_PPIPrinterX; *y = m_PPIPrinterY; }
void SetPaperRectPixels(const wxRect& paperRectPixels) { m_paperRectPixels = paperRectPixels; }
wxRect wxGetClientDisplayRect();
//@}
+/** @ingroup group_funcmacro_gdi */
+//@{
+/**
+ Returns the display resolution in pixels per inch.
+
+ @header{wx/gdicmn.h}
+
+ @since 2.9.0
+*/
+wxSize wxGetDisplayPPI();
+//@}
+
/** @ingroup group_funcmacro_gdi */
//@{
/**
return wxSize(x, y);
}
+wxSize wxGetDisplayPPI()
+{
+ const wxSize pixels = wxGetDisplaySize();
+ const wxSize mm = wxGetDisplaySizeMM();
+
+ return wxSize((pixels.x * 25.4) / mm.x,
+ (pixels.y * 25.4) / mm.y);
+}
+
wxResourceCache::~wxResourceCache ()
{
wxList::compatibility_iterator node = GetFirst ();
return false;
}
- wxSize ScreenPixels = wxGetDisplaySize();
- wxSize ScreenMM = wxGetDisplaySizeMM();
-
- printout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()),
- (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) );
+ printout->SetPPIScreen(wxGetDisplayPPI());
printout->SetPPIPrinter( dc->GetResolution(),
dc->GetResolution() );
if (paper)
{
- wxSize ScreenPixels = wxGetDisplaySize();
- wxSize ScreenMM = wxGetDisplaySizeMM();
+ m_previewPrintout->SetPPIScreen(wxGetDisplayPPI());
- m_previewPrintout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()),
- (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) );
-
int resolution = DPI;
m_previewPrintout->SetPPIPrinter( resolution, resolution );
}
return;
}
- wxSize ScreenPixels = wxGetDisplaySize();
- wxSize ScreenMM = wxGetDisplaySizeMM();
- printout->SetPPIScreen( (int) ((ScreenPixels.GetWidth() * 25.4) / ScreenMM.GetWidth()),
- (int) ((ScreenPixels.GetHeight() * 25.4) / ScreenMM.GetHeight()) );
+ printout->SetPPIScreen(wxGetDisplayPPI());
printout->SetPPIPrinter( printDC->GetResolution(),
printDC->GetResolution() );
if (paper)
{
- 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->SetPPIScreen(wxGetDisplayPPI());
m_previewPrintout->SetPPIPrinter( m_resolution, m_resolution );
// Get width and height in points (1/72th of an inch)