#include "support/gettext.h"
#include "support/lassert.h"
#include "support/lstrings.h"
+#include "support/lyxlib.h"
#include "support/Package.h"
#include "support/types.h"
int BufferView::rightMargin() const
{
- // The value used to be hardcoded to 10, which is 0.1in at 100dpi
- int const default_margin = Length(0.1, Length::IN).inPixels(0);
+ // The value used to be hardcoded to 10
+ int const default_margin = zoomedPixels(10);
// The additional test for the case the outliner is opened.
if (!full_screen_ || !lyxrc.full_screen_limit
|| width_ < lyxrc.full_screen_width + 2 * default_margin)
}
+int BufferView::zoomedPixels(int pix) const
+{
+ // FIXME: the dpi setting should really depend on the BufferView
+ // (think different monitors).
+
+ // Zoom factor specified by user in percent
+ double const zoom = lyxrc.currentZoom / 100.0; // [percent]
+
+ // DPI setting for monitor: pixels/inch
+ double const dpi = lyxrc.dpi; // screen resolution [pixels/inch]
+
+ return support::iround(pix * zoom * dpi);
+}
+
+
bool BufferView::isTopScreen() const
{
return 0 == d->scrollbarParameters_.min;
*/
int inPixels(Length const & len) const;
+ /** Return the number of pixels equivalent to \c pix pixels at
+ * 100dpi and 100% zoom.
+ */
+ int zoomedPixels(int pix) const;
+
/// \return true if the BufferView is at the top of the document.
bool isTopScreen() const;
// Top and bottom margin of the document (only at top-level)
if (text_->isMainText()) {
// original value was 20px, which is 0.2in at 100dpi
- int const margin = Length(0.2, Length::IN).inPixels(0);
+ int const margin = bv_->zoomedPixels(20);
if (pit == 0) {
pm.rows().front().dimension().asc += margin;
/* coverity thinks that we should update pm.dim().asc
if (l)
// Value was hardcoded to 30 pixels
- dim.wid += mi.base.inPixels(Length(0.3, Length::IN)) + l;
+ dim.wid += mi.base.bv->zoomedPixels(30) + l;
}
// reserve some space for marker.
if (l)
// Value was hardcoded to 30 pixels
- xmath += pi.base.inPixels(Length(0.3, Length::IN)) + l;
+ xmath += pi.base.bv->zoomedPixels(30) + l;
}
InsetMathGrid::draw(pi, xmath + 1, y);