#include "wx/utils.h"
#include "wx/dc.h"
#include "wx/app.h"
+ #include "wx/math.h"
#include "wx/msgdlg.h"
#include "wx/layout.h"
#include "wx/choice.h"
GetPageSizeMM(&mw, &mh);
float mmToDeviceX = float(pw) / mw;
float mmToDeviceY = float(ph) / mh;
- wxRect pageMarginsRect(paperRect.x + wxCoord(mmToDeviceX * topLeft.x),
- paperRect.y + wxCoord(mmToDeviceY * topLeft.y),
- paperRect.width - wxCoord(mmToDeviceX * (topLeft.x + bottomRight.x)),
- paperRect.height - wxCoord(mmToDeviceY * (topLeft.y + bottomRight.y)));
+ wxRect pageMarginsRect(paperRect.x + wxRound(mmToDeviceX * topLeft.x),
+ paperRect.y + wxRound(mmToDeviceY * topLeft.y),
+ paperRect.width - wxRound(mmToDeviceX * (topLeft.x + bottomRight.x)),
+ paperRect.height - wxRound(mmToDeviceY * (topLeft.y + bottomRight.y)));
wxCoord w, h;
m_printoutDC->GetSize(&w, &h);
float scaleX = (float(pageMarginsRect.width) * w) / (float(pw) * imageSize.x);
// This DC doesn't match the printed page, so we have to scale.
float scaleX = float(w) / pw;
float scaleY = float(h) / ph;
- return wxRect(m_printoutDC->DeviceToLogicalX(wxCoord(paperRect.x * scaleX)),
- m_printoutDC->DeviceToLogicalY(wxCoord(paperRect.y * scaleY)),
- m_printoutDC->DeviceToLogicalXRel(wxCoord(paperRect.width * scaleX)),
- m_printoutDC->DeviceToLogicalYRel(wxCoord(paperRect.height * scaleY)));
+ return wxRect(m_printoutDC->DeviceToLogicalX(wxRound(paperRect.x * scaleX)),
+ m_printoutDC->DeviceToLogicalY(wxRound(paperRect.y * scaleY)),
+ m_printoutDC->DeviceToLogicalXRel(wxRound(paperRect.width * scaleX)),
+ m_printoutDC->DeviceToLogicalYRel(wxRound(paperRect.height * scaleY)));
}
wxRect wxPrintout::GetLogicalPageRect() const
GetPageSizeMM(&mw, &mh);
float mmToDeviceX = float(pw) / mw;
float mmToDeviceY = float(ph) / mh;
- wxRect pageMarginsRect(paperRect.x + wxCoord(mmToDeviceX * topLeft.x),
- paperRect.y + wxCoord(mmToDeviceY * topLeft.y),
- paperRect.width - wxCoord(mmToDeviceX * (topLeft.x + bottomRight.x)),
- paperRect.height - wxCoord(mmToDeviceY * (topLeft.y + bottomRight.y)));
+ wxRect pageMarginsRect(paperRect.x + wxRound(mmToDeviceX * topLeft.x),
+ paperRect.y + wxRound(mmToDeviceY * topLeft.y),
+ paperRect.width - wxRound(mmToDeviceX * (topLeft.x + bottomRight.x)),
+ paperRect.height - wxRound(mmToDeviceY * (topLeft.y + bottomRight.y)));
wxCoord w, h;
m_printoutDC->GetSize(&w, &h);
if (w == pw && h == ph) {
// This DC doesn't match the printed page, so we have to scale.
float scaleX = float(w) / pw;
float scaleY = float(h) / ph;
- return wxRect(m_printoutDC->DeviceToLogicalX(wxCoord(pageMarginsRect.x * scaleX)),
- m_printoutDC->DeviceToLogicalY(wxCoord(pageMarginsRect.y * scaleY)),
- m_printoutDC->DeviceToLogicalXRel(wxCoord(pageMarginsRect.width * scaleX)),
- m_printoutDC->DeviceToLogicalYRel(wxCoord(pageMarginsRect.height * scaleY)));
+ return wxRect(m_printoutDC->DeviceToLogicalX(wxRound(pageMarginsRect.x * scaleX)),
+ m_printoutDC->DeviceToLogicalY(wxRound(pageMarginsRect.y * scaleY)),
+ m_printoutDC->DeviceToLogicalXRel(wxRound(pageMarginsRect.width * scaleX)),
+ m_printoutDC->DeviceToLogicalYRel(wxRound(pageMarginsRect.height * scaleY)));
}
void wxPrintout::SetLogicalOrigin(wxCoord x, wxCoord y)
// The app workspace colour is always white, but we should have
// a contrast with the page.
wxSystemColour colourIndex = wxSYS_COLOUR_3DDKSHADOW;
+#elif defined(__WXGTK__)
+ wxSystemColour colourIndex = wxSYS_COLOUR_BTNFACE;
#else
wxSystemColour colourIndex = wxSYS_COLOUR_APPWORKSPACE;
#endif
// The app workspace colour is always white, but we should have
// a contrast with the page.
wxSystemColour colourIndex = wxSYS_COLOUR_3DDKSHADOW;
+#elif defined(__WXGTK__)
+ wxSystemColour colourIndex = wxSYS_COLOUR_BTNFACE;
#else
wxSystemColour colourIndex = wxSYS_COLOUR_APPWORKSPACE;
#endif