> Sure, you can keep "who's below me" and "who's above me" pointers in
> each inset using the same rules I proposed. But then you need to keep
> them up to date. Compared to traversing the tree on per-need basis, this
> has the following disadvantages:
> * Takes memory memory: you need to save explicit pointers for any inset, 
>   including leaves, and you can't use virtual methods to save memory
> * Slower: any change requires updating the pointers throughout the 
>   tree.
> * More complex: additional code to make sure the pointers are kept up
>   to date. If you try to prune unnnecessary checks, you get even more
>   complexity.
> 
> Or am I missing the point?

Urm... perhaps. Everything taking more than a total of 50 LOC is not the
final solution ;-)

> longer a concern and you can use a clearer implementation. Coming to
> think of it, you can completely do away with the integer 'floor' by
> moving some of the logic into the virtual methods -- something like the
> following (please excluse fictive class names):
>   virtual array<MathInset> getSubinsetsBelow(MathInset* subinset);
> or possibly even:
>   virtual MathInset* getSubinsetBelow(MathInset* subinset,
> CursorPosition pos);

Now it looks pretty similar to

  bool MathInset::idxDown(int & idx, int & pos)

which tries to move the cursor cell idx "down" (and adjust the position
"pos" in that cell), and returns success or failure...

So, indeed, we are not too far away from each other now. 

Andre'

-- 
Andr� P�nitz ............................................. [EMAIL PROTECTED]

Reply via email to