On Fri, Mar 15, 2002 at 11:12:51AM +0100, Jean-Marc Lasgouttes wrote:
> Andre> Neither. Insets should be completely buffer agnostic. Buffer
> Andre> specific information should be handed down by arguments to any
> Andre> function that need to access it. In general, this should not be
> Andre> the buffer pointer, but only a pointer or reference to the part
> Andre> of the buffer information that is really needed.
> 
> But adding a new argument to 20 inset methods just because some random
> inset needs it is a major pain, IMO.

Most methods won't need it.

> I am all for the augmented cursor solution. The question is to know
> whether it will solve this particular problem.

Since we have the precendence in mathed it might be worth looking there.
The 'real' math LyX insets receive buffer pointers in quite a few methods.
They get dropped, however, as soon as possible, and _none_ of the mathed
insets does need to store a buffer pointer.

>From formula.C:


Inset * InsetFormula::clone(Buffer const &, bool) const
{
        return new InsetFormula(*this);
}


void InsetFormula::write(Buffer const * buf, ostream & os) const
{
        os << "Formula ";
        latex(buf, os, false, false);
}


int InsetFormula::latex(Buffer const *, ostream & os, bool fragil, bool) const
{
        WriteStream wi(os, fragil);
        par_->write(wi);
        return wi.line();
}


int InsetFormula::ascii(Buffer const *, ostream & os, int) const
{
        WriteStream wi(os, false);
        par_->write(wi);
        return wi.line();
}

etc.

Andre'

-- 
André Pönitz .............................................. [EMAIL PROTECTED]

Reply via email to