Angus Leeming wrote:

> Andreas Vox wrote:
>> 3.  Which iterator would I use to iterate all mathhull-insets
>> for snippet collection? Insetiterator?
> 
> See src/graphics/Previews.C
> This iterates over all top level insets.
> 
> void Previews::generateBufferPreviews(Buffer const & buffer) const
> {
>     PreviewLoader & ploader = loader(buffer);
> 
>     InsetBase & inset = buffer.inset();
>     InsetIterator it = inset_iterator_begin(inset);
>     InsetIterator const end = inset_iterator_end(inset);
> 
>     for (; it != end; ++it)
>         it->addPreview(ploader);
> 
>     ploader.startLoading();
> }


All insets, not only top-level (but you probably meant that).

> And this, in src/graphics/PreviewLoader.C iterates over all top level math
> macro insets.
> 
>     // Loop over the insets in the buffer and dump all the math-macros.
>     InsetBase & inset = buffer_.inset();
>     InsetIterator it = inset_iterator_begin(inset);
>     InsetIterator const end = inset_iterator_end(inset);
> 
>     for (; it != end; ++it)
>         if (it->lyxCode() == InsetBase::MATHMACRO_CODE)
>             it->latex(buffer_, os, runparams);

Same here.

Alfredo


Reply via email to