On Mon, Jun 12, 2006 at 11:42:25PM +0300, Martin Vermeer wrote:
> On Mon, Jun 12, 2006 at 10:18:04PM +0300, Martin Vermeer wrote:
> > On Mon, Jun 12, 2006 at 12:47:56PM +0200, Juergen Spitzmueller wrote:
> > > Juergen Spitzmueller wrote:
> > > > I'm seeing drawing errors in 1.4 every now and then with collapsable 
> > > > insets
> > > > in tabular cells (that is, if you write into the collapsable, the screen
> > > > does not get updated).
> > > 
> > > I obviously mean something different:
> > > 
> > > - New table
> > > - add some text in a cell
> > > - change column with
> > > - insert ERT and type inside
> > > 
> > > the result looks like the attached screenshot.
> > > 
> > > Jürgen
> > 
> > I don't know precisely what you mean, but I too manage to produce
> > artefacts... by deleting stuff inside the ERT inside the tabular.

....
 
> It appears to me that the problem is, that rowpainter expects the
> inset->drawSelection() method to "blank out" the inset background before
> doing anything else. insettext (and derivatives) does that, insettabular
> does not.

That was the problem. Attached the patch. Unfortunately rather big...
please give it some testing.

- Martin


Index: insettabular.C
===================================================================
--- insettabular.C      (revision 14084)
+++ insettabular.C      (working copy)
@@ -332,6 +332,29 @@
        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; 
+       for (; d < cur.depth(); d++) {
+               if (ptr_cmp(&cur[d].inset(), this))
+                       break;
+       }
+       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 +362,6 @@
 
        //resetPos(cur);
 
-       x += scx_ + ADD_TO_TABULAR_WIDTH;
 
        if (tablemode(cur)) {
                row_type rs, re;

Attachment: pgpEkhz8DB7Ry.pgp
Description: PGP signature

Reply via email to