>>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:

>> Another one: insert a footnote, and put an `Abstract' environment
>> in there. Look how the Abstract label is misplaced.

Martin> It is in the middle above the text... whats wrong with that?
Martin> :-)

The following patch fixes the position of the centered label. The old
code divided also the left margin by 2, whereas only the width should
be concerned.

Since it is obvious, I'll commit it. However the display of abstract
label is still wrong for two reasons:

1/ the size of the top_label is not taken in account to measure the
width of a row (it should be done in setRowWidth) and therefore the
label can go outside of the inset frame. Not trivial fix.

2/ the right margin of a layout is explicitely suppressed in
non-toplevel insets. 

int LyXText::rightMargin(Paragraph const & par) const
{
        // We do not want rightmargins on inner texts.
        if (bv()->text() != this)
                return 0;

This is an explicit change Lars did to LyXText::rightMargin. Why?


JMarc

Index: src/ChangeLog
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v
retrieving revision 1.2334
diff -u -p -r1.2334 ChangeLog
--- src/ChangeLog	1 Dec 2005 10:28:47 -0000	1.2334
+++ src/ChangeLog	1 Dec 2005 13:44:12 -0000
@@ -1,3 +1,8 @@
+2005-12-01  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
+
+	* rowpainter.C (paintFirst): fix centering of
+	LABEL_CENTERED_TOP_ENVIRONMENT. 
+
 2005-11-30  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* BufferView.C (mouseSetCursor): new method. Calls
Index: src/rowpainter.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/rowpainter.C,v
retrieving revision 1.158
diff -u -p -r1.158 rowpainter.C
--- src/rowpainter.C	7 Oct 2005 12:00:40 -0000	1.158
+++ src/rowpainter.C	1 Dec 2005 13:44:12 -0000
@@ -537,8 +537,9 @@ void RowPainter::paintFirst()
 
 			double x = x_;
 			if (layout->labeltype == LABEL_CENTERED_TOP_ENVIRONMENT) {
-				x = ((is_rtl ? leftMargin() : x_)
-					 + width_ - text_.rightMargin(par_)) / 2;
+				if (is_rtl)
+					x = leftMargin();
+				x += (width_ - text_.rightMargin(par_) - leftMargin()) / 2;
 				x -= font_metrics::width(str, font) / 2;
 			} else if (is_rtl) {
 				x = width_ - leftMargin() -

Reply via email to