On Mon, Jul 08, 2002 at 03:18:26PM +0100, Angus Leeming wrote: > I don't think you're wrong. I'd just like to implement it so that the Inset > does as little as possible. I think I see how we'd do this, but I need your > help to turn it into working code. > > The plan > ======= > 1. Don't load all image files once they are converted. > 2. insets ascertain whether they should use the previewed image with > > void InsetFormula::draw(BufferView * bv, LyXFont const & font, > int y, float & xx, bool) const > { > if (preview_->usePreview()) { > pi.pain.image(x + 1, y - a + 1, w - 2, h - 2, > *(preview_->pimage_->image())); > ... > }
Fine. > If we modify this usePreview call, we can use that to invode startLoading, > albeit without the inset knowing anything about this. Ok. > [...] > So, we already have the mechanism to trigger the loading of the image. Just > modify PreviewLoader::preview to something like: Fine. > void PreviewImage::checkVisibility(Inset * inset) > { > if (!inset || iloader_->status() != WaitingToLoad) > return; > > if (!inset->isVisible()) > return; > > image->startLoading(); > } > > > So,, Jürgen, what should I use for "inset->isVisible()". I have a Buffer & at > my disposal. Ah... good that you are not asking me. Andre' -- Those who desire to give up Freedom in order to gain Security, will not have, nor do they deserve, either one. (T. Jefferson)