On Friday 05 July 2002 10:47 pm, David Kastrup wrote:
> > Incidentally, if you load a document with LOTS of equations, don't expect
> > to see anything soon. We only load the images into LyX once gs has
> > finished generating ALL the bitmap files.
> >
> > I've just tried with a Thesis containing 617 equations. It took gs
> > about 5 mins to do the work. Thereafter LyX freezes until all these
> > images are loaded up into memory.
>
> That's not good.
>
> > I think we'll have to do something about that. Presumably the
> > elegant solution of loading an image file as it is created might
> > aleviate this problem somewhat.
>
> That's not a good solution.  The good solution would be to load only
> those images that actually appear on-screen.  Often in a single
> editing session, you will not even be looking at most of the
> document.  No need to be loading the stuff into memory in the first
> place, then.

Agreed. Currently I just do:

void Previews::generateBufferPreviews(Buffer * buffer)
{
        if (!buffer || !lyxrc.preview)
                return;

        PreviewLoader & ploader = loader(buffer);

        Buffer::inset_iterator it  = buffer->inset_const_iterator_begin();
        Buffer::inset_iterator end = buffer->inset_const_iterator_end();

        for (; it != end; ++it) {
                if ((*it)->lyxCode() == Inset::MATH_CODE) {
                        (*it)->generatePreview(ploader);
                }
        }

        ploader.startLoading();
}

I'm sure that the wizards will be able to help here. Wizards, are you reading 
this? I'd like to generate small batches of these previews, say for the first 
three or four screen heights. Thereafter, if I arrive at an inset for which a 
preview hasn't been generated, I'd like to generate previews for three or 
four screen heights around it. Any thoughts on an interface?

Anyway, the current implementation is certainly Ok for 30 or 40 equations.

Angus

Reply via email to