On Monday 09 September 2002 10:11, Marco Morandini wrote: > Angus Leeming wrote: > > There are two problems to address. > > 1. Updating the image on screen. > > > > I think you should just use the FileMonitor.[Ch] files that > > we use in 1.3.0cvs because I know that they work and they're > > a clean and minimal solution. I attach them for your > > perusal. You'll have to replace the boost::signal stuff with > > its SigC::signal equivalent but that's trivial and I can > > definitely help you there if you get stuck. > > You'll then just need to add a FileMonitor instance to > > GraphicsCacheItem, connect to the signal and start it off. > > Same as is done in the 1.3.0cvs code. > > > > 2. Re-running latex. > > > > The latex compiler is activated only if the checksum of the > > .tex file has changed. Changes to included files are not > > taken into account. I have no real ideas about how to fix > > this properly. > > I think I've solved the latex problem: > even when the latex compiler is activated, the preview of the > image still refers to the old one. > This is because InsetGraphics::prepareFile check for the > existance of the graphic file (to be converted to eps) in > lyx_tempbuf, and the file is not copied if an old version is > already there. I think it shold check for the existence of the > file AND compare the timestamp (copy_tempfile.patch). The > problem is independent from the cache behaviour. With S-C-t > the document's .ps file is regenerated correctly even if the > .lyx file is unchanged.
Excellent. Well tracked down. > For the cache behaviour, I'm slowly working on it, but don't > expect anaything soon. I've replaced the boost::signal in > FileMonitor. Could you please check the two files? > In particular, is it ok to derive FileMonitor::Impl from > SigC::Object? Yes, this is exctly what you should do. SigC::Object is equivalent to boost::trackable and means that all stray pointers are cleaned up should an instance of the class be deleted. > And what about FileMonitor::Impl::Impl: > > timer_.timeout.connect( > slot(this, &FileMonitor::Impl::monitorFile)); >? Looks Ok to me. Preface slot with SigC:: so that compilers that are picky about namespaces don't complain. Angus