Jean-Marc Lasgouttes wrote:
> Did you look at gotoInset in bufferview_funcs.[Ch]?

Yes, but I think this is not what I need here. gotoInset moves the cursor to 
the next inset, while LFUN_BIBDB_* needs the next bibtex inset, without 
moving the cursor.

It would probably make more sense to use gotoInset in LFUN_LABEL_GOTO, which 
also uses getInsetByCode, but I'm not sure. Actually, I'm not even sure I 
understand what LABEL_GOTO does (or is it broken?)

Do you have an idea how to make getInsetByCode loop (and stop if there is no 
inset in the document)? Here's the code:

/// Get next inset of this class from current cursor position
template <class T>
T * getInsetByCode(LCursor & cur, InsetBase::Code code)
{
        T * inset = 0;
        DocIterator it = cur;
        if (it.nextInset() &&
            it.nextInset()->lyxCode() == code) {
                inset = static_cast<T*>(it.nextInset());
        }
        return inset;
}

Jürgen

Reply via email to