On Thu, Mar 25, 2004 at 05:34:32PM +0100, Alfredo Braunstein wrote:
> Making collapsables derive from InsetText raises some problems, mainly there
> is one cached dimension/position missing. This problem is semi-addressed in
> insettext by not using its cached dim_ but use instead the dimension of its
> LyXText. dim_ is then overwritten in InsetCollapsable.
> 
> The problem is that then for instance InsetText::ascent (who uses dim_)
> still refers to the ascent of the InsetCollapsable. In fact, once dim_ is
> overwritten there is no way of accessing the InsetText dimension from
> outside.
> 
> So: either we add an insetdim_ member in InsetCollapsable and store the
> InsetText's dimension there, and we continue to overwrite dim_ (I have a
> patch for this),

InsetCollapsable's dim should be the dimension of the InsetCollapsable.
It could be created by calling InsetText::metrics first and augmenting
it afterwards. If the dim of the InsetText is really needed (why?
There's a cache in LyXText, too...) it should be cached in some separate
variable.

The model is e.g. MathNestInset / MathSqrtInset.

> or we add an collapsabledim_ member and we overload all
> methods accessing dim_ to use that one instead.

I don't like this. It works the other way round everywhere else.

> The last option seems the cleanest to me, but a lot of burden and
> duplication.
> 
> All this raises some doubts about the 'cleaningness' of deriving
> collapsables from insettext IMHO.

The alternative is the owner_ stuff. The solution now is certainly the
smaller pile of ....

Andre'

Reply via email to