The attached file expands to a directory preview_test
$ ls preview_test
boxcount.tex  preview_test.lyx  snapshot_t=40.tex

This lyx file demonstrates a couple of bugs in current cvs.

1. Try and open the dialog for the first include inset (boxcount.tex). 
Either with or without previews turned on, I can get nothing at all. 
Strangely, the dialog to the second include inset (snapshot_t=40.tex) 
opens without any problems at all.

2. With previews turned on, only the first figure (boxcount.tex) is 
displayed on the LyX screen. The second (snapshot_t=40.tex) 
stubbornly refuses to do so. There's nothing wrong with the file 
per-se. Open its dialog, turn off previewing and press Ok. Open the 
dialog again, turn on previewing and press Ok. Voilą!

The problem appears to be caused by the fact that the inset is inside 
a minipage inside a float. Previews are generated when the buffer is 
loaded by this code in graphics/Previews.C:

void Previews::generateBufferPreviews(Buffer const & buffer) const
{
        PreviewLoader & ploader = loader(buffer);

        Buffer::inset_iterator it  = buffer.inset_const_iterator_begin();
        Buffer::inset_iterator end = buffer.inset_const_iterator_end();

        for (; it != end; ++it)
                it->addPreview(ploader);

        ploader.startLoading();
}

Ie, loop over all 'outermost' insets and call their addPreview member 
function. For collabsable insets such as float and minipage, this is 
simply

void InsetCollapsable::addPreview(PreviewLoader & loader) const
{
        inset.addPreview(loader);
}

Ie, pass the call on to the InsetText member function:

void InsetText::addPreview(PreviewLoader & loader) const
{
        ParagraphList::const_iterator pit = paragraphs.begin();
        ParagraphList::const_iterator pend = paragraphs.end();

        for (; pit != pend; ++pit) {
                InsetList::const_iterator it  = pit->insetlist.begin();
                InsetList::const_iterator end = pit->insetlist.end();
                for (; it != end; ++it)
                        it->inset->addPreview(loader);
        }
}

My understanding is that ParagraphList::iterator loops over outermost 
insets only. Correct? Anyway, I fail to see why this code will not 
lead to a scheme where insets within insets will be called naturally. 
Could someone clued-in help me out here?

-- 
Angus

Attachment: preview_test.tar.gz
Description: GNU Zip compressed data

Reply via email to