On Friday 05 October 2001 16:26, Jean-Marc Lasgouttes wrote: > >>>>> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes: > > Angus> Systemcalls::Callbackfct convert_callback = &convert_continue; > > Angus> Systemcalls convert(Systemcalls::DontWait, "convert file.eps > Angus> XPM::file.xpm", convert_callback); > > Angus> // continue main LyX loop ... > > Angus> void convert_continue(string cmd, int retval) { // Ok, we have > Angus> the file, now deal with it... } > > But you assume that the main loop can continue to do something useful > while the conversion is not yet done. I am not sure this will always > work... Would it work for graphics inset, for example?
Why not (psuado code, but not much different from today): void InsetGraphics::updateInset() const { GraphicsCache & gc = GraphicsCache::getInstance(); if (!params.filename.empty()) { // The GraphicsCache forks a process to // convert the file. temp = gc.addFile(params.filename); } // Mark the image as unloaded so that it gets updated. // Once the GraphicsCache has succeeded in loading the file // this must be set to true. // This is the job of the Systemcalls::callbackfunction imageLoaded = false; cacheHandle = temp; } void InsetGraphics::draw(BufferView * bv, LyXFont const & font, { if (imageLoaded) // draw it } The rest is all part of the event loop, no? A