From: Jean-Marc Lasgouttes Date: Thu, 20 Apr 2017 16:05:04 +0000 (+0200) Subject: Make top/bottom margin value DPI-dependent X-Git-Tag: 2.3.0alpha1~27 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=b2e759d8b23f9db6b8703b91971f0ccc5ccf8c3d;p=features.git Make top/bottom margin value DPI-dependent One less hardcoded pixel value. Use thisoccasion to set the left/right margin in inches too, since it is easier to compute. --- diff --git a/src/BufferView.cpp b/src/BufferView.cpp index a6ae1d40a3..80bea84ea2 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -351,8 +351,8 @@ 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 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 additional test for the case the outliner is opened. if (!full_screen_ || !lyxrc.full_screen_limit || width_ < lyxrc.full_screen_width + 2 * default_margin) diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp index 475b8096f5..c577b47c40 100644 --- a/src/TextMetrics.cpp +++ b/src/TextMetrics.cpp @@ -479,19 +479,21 @@ bool TextMetrics::redoParagraph(pit_type const pit) // specially tailored for the main text. // 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); if (pit == 0) { - pm.rows().front().dimension().asc += 20; + pm.rows().front().dimension().asc += margin; /* coverity thinks that we should update pm.dim().asc * below, but all the rows heights are actually counted as * part of the paragraph metric descent see loop above). */ // coverity[copy_paste_error] - pm.dim().des += 20; + pm.dim().des += margin; } ParagraphList const & pars = text_->paragraphs(); if (pit + 1 == pit_type(pars.size())) { - pm.rows().back().dimension().des += 20; - pm.dim().des += 20; + pm.rows().back().dimension().des += margin; + pm.dim().des += margin; } }