Here's my idea of the inset design at the moment. I hope this will settle the
discussion between Alejandro and Allan, which mostly is a discussion about
words.
We have an inset that can contain a list of paragraphs. This inset corresponds
to the flow inset: We give it some geometry to tell it where to draw itself,
and it returns information about what screen estate it needs to do the job
(i.e. the height).
Let's call this inset a InsetFlow for the lack of a better name (I want to
preserve the name InsetText for something else. See below.)
This InsetFlow contains a list<Paragraph *>.
A paragraph is not necessarily an inset, but it contains a vector<Inset *> that
holds the text of a paragraph. It also contains a pointer to a ParagraphParams
structure that keeps all the structural information: Which layout it is, the
nesting depth, whether it's a heading or not, and all the other information
that we have in the Paragraph * structure now. (Notice that this information is
enough to solve the nesting problem that Allan posed.)
By moving these parameters to a ParagraphParams structure, we can save a lot of
memory, because the ParagraphParams structures can be reused.
Besides the InsetFlow and the Paragraph, we have the ordinary glyph Insets:
References, label, math insets, and others. Take the footnote inset. This is
an inset that contains a FlowInset.
Next to these "ordinary" insets, we also have the InsetText. This insets
contains the text of the document, in the form of an LString. It also contains
a pointer to a CharParams structure, that is similar to the ParagraphParams
structure, and contains the information about the text in the inset. This
includes Font, Logical Font, language and other character level information.
Notice that this implies that we will have no more Inset-codes, no more font
tables, and no more inset tables.
This design is the result I have come to from the discussions we have had so
far. There are more details about this in my head, and this is what I'll try
to write down in a proposal kernel document when I get the time.
However, if you feel that this overall approach is flawed, please tell me.
Greets,
Asger