]> git.lyx.org Git - features.git/commitdiff
Make text margin size dependent on zoom and dpi
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 3 Dec 2015 09:07:52 +0000 (10:07 +0100)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Fri, 11 Dec 2015 11:26:07 +0000 (12:26 +0100)
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

index e237a635eb5ca386471debadc9729462de45bc87..15dcb926828b8bf30b0bcb4fb6052f7e8d5baa95 100644 (file)
@@ -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;
 }