On Wed, 2006-06-14 at 20:58 +0200, Andre Poenitz wrote:
> On Wed, Jun 14, 2006 at 09:35:23PM +0300, Martin Vermeer wrote:
> > (BTW what should I use instead of 99? No, don't say 42...)
> 
> size_t(-1)
> 
> [Or the equivalent from numeric_limits...]
> 
> Or a bool.

Done. I propose this for trunk and 1.4 (Jean-Marc?), as it fixes a
rendering bug.

- Martin

Index: insettabular.C
===================================================================
--- insettabular.C	(revision 14084)
+++ insettabular.C	(working copy)
@@ -332,6 +332,36 @@
 	setPosCache(pi, x, y);
 
 	LCursor & cur = pi.base.bv->cursor();
+
+	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;
+		}
+	}
+
+	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))
@@ -339,7 +369,6 @@
 
 	//resetPos(cur);
 
-	x += scx_ + ADD_TO_TABULAR_WIDTH;
 
 	if (tablemode(cur)) {
 		row_type rs, re;

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

Reply via email to