On Wed, Oct 15, 2003 at 05:43:29PM +0200, Alfredo Braunstein wrote: > Andre Poenitz wrote: > > > On Wed, Oct 15, 2003 at 05:35:20PM +0200, Alfredo Braunstein wrote: > >> I would think that bv->lockInset(inset), where inset is the inner inset > >> you are locking (an InsetText if inside a tabular) but I don't know > >> really. > > > > That's what I am doing. And it works sometimes ;-| > > Incidentally, I need the InsetText owning some paragraph for locking, but > inside a tabular ParIterator::inset returns the insettabular, not the > insettext. How do I get it?
By doing something like I do in undo.C with text2pit. Brute force. Would be: LyXText * par2text(BufferView * bv, Paragraph * par) { Buffer * buf = bv->buffer(); ParagraphList::iterator pt = buf->paragraphs().begin(); ParagraphList::iterator et = buf->paragraphs().end(); for ( ; pt != end; ++pt) if (&*pt == par) return bv->text; ParIterator pit = buf->par_iterator_begin(); ParIterator end = buf->par_iterator_end(); for ( ; pit != end; ++pit, ++tcount) { ParagraphList::iterator pt = pit.plist().begin(); ParagraphList::iterator et = pit.plist().end(); if (&*pt == par) return pit.text(); } ASSERT } Untested. And yes, we should do something about it... Lars, what did your benchmark say? Andre'