mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
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.
This commit is contained in:
parent
df6b2f4470
commit
b2e759d8b2
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user