[LyX/master] Revert "Center correctly centered top labels (e.g. abstract)"

Jean-Marc Lasgouttes lasgouttes at lyx.org
Tue Jan 5 14:23:55 UTC 2021


commit b8188e54dd6e24fa92c3844458ed41ad37b50fb8
Author: Jean-Marc Lasgouttes <lasgouttes at lyx.org>
Date:   Tue Jan 5 15:14:41 2021 +0100

    Revert "Center correctly centered top labels (e.g. abstract)"
    
    This reverts commit 6c1855313cef2fac19022ddc4c8eccaee66088e6.
---
 lib/layouts/stdstruct.inc |    3 ++-
 src/RowPainter.cpp        |    4 ++--
 src/TextMetrics.cpp       |    9 +++------
 3 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/lib/layouts/stdstruct.inc b/lib/layouts/stdstruct.inc
index a0a9750..b611b53 100644
--- a/lib/layouts/stdstruct.inc
+++ b/lib/layouts/stdstruct.inc
@@ -27,12 +27,13 @@ Style Abstract
 	Align                 Block
 	LabelType             Centered
 	LabelString           "Abstract"
-	LabelBottomSep        0.2
+	LabelBottomSep        0.5
 	Font
 	  Size                Small
 	EndFont
 	LabelFont
 	  Series              Bold
+	  Size                Large
 	EndFont
 	HTMLLabelFirst        1
 	HTMLForceCSS          1
diff --git a/src/RowPainter.cpp b/src/RowPainter.cpp
index 9f9f51e..e378f43 100644
--- a/src/RowPainter.cpp
+++ b/src/RowPainter.cpp
@@ -462,8 +462,8 @@ void RowPainter::paintTopLevelLabel() const
 		 * respect to the left and right margins.
 		 */
 		int const leftm = row_.isRTL() ? tm_.rightMargin(row_.pit())
-		                               : tm_.leftMargin(row_.pit(), 1);
-		int const rightm = row_.isRTL() ? tm_.leftMargin(row_.pit(), 1)
+		                               : tm_.leftMargin(row_.pit());
+		int const rightm = row_.isRTL() ? tm_.leftMargin(row_.pit())
 			                            : tm_.rightMargin(row_.pit());
 		x += leftm - row_.left_margin + (tm_.width() - leftm -rightm) / 2
 			- fm.width(str) / 2;
diff --git a/src/TextMetrics.cpp b/src/TextMetrics.cpp
index 56d312f..214fe89 100644
--- a/src/TextMetrics.cpp
+++ b/src/TextMetrics.cpp
@@ -1610,10 +1610,7 @@ int TextMetrics::leftMargin(pit_type const pit, pos_type const pos) const
 	LASSERT(pit < int(pars.size()), return 0);
 	Paragraph const & par = pars[pit];
 	LASSERT(pos >= 0, return 0);
-	// We do not really care whether pos > par.size(), since we do not
-	// access the data. It can be actially useful, when querying the
-	// margin without indentation (see RowPainter::paintTopLevelLabel).
-
+	LASSERT(pos <= par.size(), return 0);
 	Buffer const & buffer = bv_->buffer();
 	//lyxerr << "TextMetrics::leftMargin: pit: " << pit << " pos: " << pos << endl;
 	DocumentClass const & tclass = buffer.params().documentClass();
@@ -1767,8 +1764,8 @@ int TextMetrics::leftMargin(pit_type const pit, pos_type const pos) const
 	    && !text_->inset().neverIndent()
 	    // display style insets do not need indentation
 	    && !(!par.empty()
-	         && par.isInset(0)
-	         && par.getInset(0)->rowFlags() & Inset::Display)
+	         && par.isInset(pos)
+	         && par.getInset(pos)->rowFlags() & Inset::Display)
 	    && (!(tclass.isDefaultLayout(par.layout())
 	        || tclass.isPlainLayout(par.layout()))
 	        || buffer.params().paragraph_separation


More information about the lyx-cvs mailing list