From 9c43747cc9d50a4ccb8d3ada651596b71a2862c9 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Thu, 3 Dec 2015 10:07:52 +0100 Subject: [PATCH] Make text margin size dependent on zoom and dpi The default hardcoded value of 10 corresponds to 2.5mm at 100dpi, but does not make much sense on a HiDpi screen. --- src/BufferView.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index e237a635eb..15dcb92682 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -351,11 +351,12 @@ BufferView::~BufferView() int BufferView::rightMargin() const { + // The value used to be hardcoded to 10, which is 2.5mm at 100dpi + int const default_margin = Length(2.5, Length::MM).inPixels(0); // The additional test for the case the outliner is opened. - if (!full_screen_ || - !lyxrc.full_screen_limit || - width_ < lyxrc.full_screen_width + 20) - return 10; + if (!full_screen_ || !lyxrc.full_screen_limit + || width_ < lyxrc.full_screen_width + 2 * default_margin) + return default_margin; return (width_ - lyxrc.full_screen_width) / 2; }