Abdelrazak Younes wrote:
Probably something like the bibfiles cache?

Probably a good idea.

All right, I had a quick look at this. The analogy is reasonable enough, but it's not quite right. In that case, we basically keep a list of timestamps and check whether the files have been modified. In this case, what we need is a kind of "labelsChanged" boolean that we can set to false whenever we generate the list of labels (in Buffer::getLabelList()), and then have set to true whenever a label gets created or deleted. This can be checked then in GuiRef::updateRefs() before the actual updating is done. Roughly. Something like that will work.

But there are two issues. The first is simply that I don't know where labels can be created and deleted. Part of this can be done in the InsetLabel ctor and dtor, but it looks as if InsetMathHull creates and destroys its own sort of labels, so I'll need some help there, but that's not a huge problem. The second issue arises just with InsetLabel::InsetLabel(). We want to tell the buffer that labelsChanged needs to be set to true. But we don't have access to the buffer. I suppose there could be just a global labelsChanged---probably there should be, since the labels that need recalculating may be in a child document---but, if so, where should that global variable be put?

Well, the attached is one approach: I've put the variable in BufferList, because it does kind of seem to go with the BufferList: at least, we should markLabelsChanged() when buffers are created and destroyed. I've done my best with InsetMathHull.

Comments Welcome.

Richard

Reply via email to