> 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 [snip]
I have the impression that we talk of different things. While you're fixed at the preview level I think at a more general "graphics" level. I don't care about the implementation of "preview" I care if and when a graphics file is loaded and/or displayed. void SomeInset::draw(...) { [am I in the range I need to be drawed?][no] return! [need to draw a graphics file] [is graphics already converted]? [no] goto really_draw [yes] load graphics file; goto really_draw really_draw: [am I visible]? [no] return! [draw myself] } This is more or less what I think the inset should do now. What we can make better in the above design is the "delaid" loading of graphics files. To do this IMO we would have to split the loading from the drawing part. That means that loading the graphics into memory has to be requested by someone. I see this something like: [i am scrolling now] [i stopped scrolling] [call load graphics on all insets in 2 seconds] after 2 seconds [iterate over all insets and do] [bool loaded = false;] [loaded = loaded || inset->loadGraphicsIfAvailable()] for all insets [if loaded rebreak_the_text() and redraw_the_screen()] Am I clear what I think now? Jug -- -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._ Dr. Jürgen Vigna E-Mail: [EMAIL PROTECTED] Kravoglstrasse 4 Tel/Fax: +39 0471 564172 - +39 0471 564122 I-39100 Bozen Web: http://www.lyx.org/~jug -._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._-._