On Sun, Mar 09, 2008 at 06:06:19PM +0100, Stefan Schimanski wrote: > > Am 09.03.2008 um 16:04 schrieb Abdelrazak Younes: > >> Stefan Schimanski wrote: >>> Am 09.03.2008 um 15:03 schrieb Abdelrazak Younes: >>>> Stefan Schimanski wrote: >>>>> Hi! >>>>> Can anybody summarize the situation and issues to switch to >>>>> InsetMathMbox? >>>> >>>> This would be the solution for all text in math purpose. There are a >>>> number of bugs related to the fact that text in math are not real Text >>>> object. >>>> >>>> Last time I tried, InsetMathMbox needed some work in order to be >>>> complete; essentially metrics and drawing code. >>>> >>>> Having this in 1.6 would be a great step forward. >>> I am playing around with it. The main problem right now is that Text >>> objects need a buffer object assigned, e.g. for Text::write. Some math >>> macros use mbox insets, but they are buffer independent (= global). I >>> just tried to create a dummy Buffer for those cases, but get some crashes >>> now. >> >> No, you should instead implement Inset::setBuffer() in the proper math >> inset (the one that contains the InsetMathMbox). > > This buffer variable in every inset is a mess. I still don't like the idea > at all. It changes the ownership of insets from MathAtom effectively to the > buffer. The consequence is that we cannot have insets anymore independently > from the Buffer, or at least we cannot use all of the functionality of an > inset if it is not assigned to a buffer.
Right. And in what situation may we want to have such a beast? > Spreading setBuffer calls around the LyX code is not elegant either. The > compiler cannot tell us where we forgot to do it, or where an inset has a > buffer variable, but to an old/different buffer. What does it buy us after > all other than some "Cursor & cur" arguments? The Buffer argument can be passed at inset construction time, and the only time it will ever change is cut-and-paste to another buffer. > I am trying to get the InsetMathMBox working and hit several problems with > this change. The text inset depends on the Buffer variable unfortunately > and the mathed insets do not have it set. The problem appears especially > when mbox appears in math macros. Which Buffer do the global math macros > belong to? Pretty easy: None at all. There should be no global macros. > What about cases like asArray/asString? We need to set the > buffer there as well, also in the parser in general. Right, and right. Andre'