Hi,

Andre Poenitz wrote:
> > Do you mean the same as what I proposed on 2001-07-24 (copy below)? If
> > not, what's the difference?
> You use information about the "parent" inset. I don't like that.

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?


> > Gotcha:
> > in $\frac{|xxx}{ \frac{y}{z} }$ we want <down> to do
> >    $\frac{xxx}{ \frac{|y}{z} }$ so the above logic works nicely.
> > However, in $\frac{xxx|}{ y^{s} }$ we want <down> to do
> >             $\frac{xxx}{ y^{s|} }$ rather than
> >             $\frac{xxx}{ y^{|s| }$ even though the superscript is
> > than the 'y'. This is true in general for scripts. So, give the
> > script insets a floor value of +1000 (superscript) and -1000, and
> > tell topmost_subinset to ignore insets with these floor values.
> 
> And that's a hack.

The different treatment or the proposed implementation of the
difference? The latter is a hack, yes -- I was trying to preserve memory
in the xcell array. If you use virtuals to implement it then that's no
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);


  Regards,
    Eran

Reply via email to