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.

> Index: insettabular.C
> ===================================================================
> --- insettabular.C    (revision 14084)
> +++ insettabular.C    (working copy)
> @@ -332,6 +332,35 @@
>       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 dd = 99; 
> +     for (lyx::size_type d = 0; d < cur.depth(); d++) {
> +             if (ptr_cmp(&cur[d].inset(), this)) {
> +                     dd = d;
> +                     break;
> +             }
> +     }

        bool found = false; 
        for (lyx::size_type d = 0; d < cur.depth(); d++) {
                if (ptr_cmp(&cur[d].inset(), this)) {
                        found = true;
                        break;
                }
        }

Or if it is not critical:


        bool found = false; 
        for (lyx::size_type d = 0; d != cur.depth() && !found; ++d)
                if (ptr_cmp(&cur[d].inset(), this))
                        found = true;


Or if this functionality is likely to be re-used, move it to LCursor.
When I think about it, there might even already be such a method.

Andre'

Reply via email to