On Mon, 2006-06-19 at 15:05 +0300, Martin Vermeer wrote:
> On Mon, 2006-06-19 at 11:21 +0200, Jean-Marc Lasgouttes wrote:
> > >>>>> "Martin" == Martin Vermeer <[EMAIL PROTECTED]> writes:
> > 
> > >> Done. I propose this for trunk and 1.4 (Jean-Marc?), as it fixes a
> > >> rendering bug.
> > 
> > Martin> Committed for trunk. Jean-Marc?
> > 
> > OK.
> 
> No.
> 
> I found a better way to do this. See attached.
> 
> In my newfound tradition of making everything simpler :-) If you paint
> the whole tabular background, you don't have to figure out what cell
> you're in...
> 
> Please give it some exercise before the go-ahead for 1.4.
> 
> I would also like to replace my 1.5 patch with this.

Attached the replacement patch for trunk. I will commit this presently.

- Martin

Index: insettabular.C
===================================================================
--- insettabular.C	(revision 14141)
+++ insettabular.C	(working copy)
@@ -335,33 +335,12 @@
 
 	x += scx_ + ADD_TO_TABULAR_WIDTH;
 
-	// Here we take the cursor slice that is the tabular.
-	lyx::size_type d = 0; 
-	bool found = false;
-	for (; d < cur.depth(); d++) {
-		if (ptr_cmp(&cur[d].inset(), this)) {
-			found = true;
-			break;
-		}
-	}
+	// Paint background of current tabular
+	int const w = tabular.getWidthOfTabular();
+	int const h = tabular.getHeightOfTabular();
+	int yy = y - tabular.getAscentOfRow(0);
+	pi.pain.fillRectangle(x, yy, w, h, backgroundColor());
 
-	if (found) {
-		CursorSlice const & sl = cur[d];
-		// Paint background of current cell
-		int const w = tabular.getWidthOfColumn(sl.idx());
-		int yy = y - tabular.getAscentOfRow(0) + ADD_TO_HEIGHT;
-		row_type j = 0;
-		for (; tabular.getCellNumber(j, tabular.columns() - 1) < sl.idx(); ++j) {
-			int const a = tabular.getAscentOfRow(j);
-			int const h = a + tabular.getDescentOfRow(j);
-			yy += h;
-			yy += tabular.getAdditionalHeight(j + 1);
-		}
-		int const h = tabular.getAscentOfRow(j) + tabular.getDescentOfRow(j);
-		pi.pain.fillRectangle(x + getCellXPos(sl.idx()), yy, w, h,
-			backgroundColor());
-	}
-
 	if (!cur.selection())
 		return;
 	if (!ptr_cmp(&cur.inset(), this))

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to