Abdelrazak Younes <[EMAIL PROTECTED]> writes: > OK to commit? Minor points only:
> Index: src/frontends/controllers/ControlToc.C > +toc::TocItem const ControlToc::getCurrentTocItem( > + string const & type) const > +{ > + BufferView const * const bv = kernel().bufferview(); > + if (!bv) > + return toc::TocItem(-1, -1, ""); If the third parameter to TocItem is a std::string, then pass it a std::string. No need to initiate a conversion from char const *. > Index: src/frontends/controllers/ControlToc.h > + /// Return the first TocItem before the cursor > + toc::TocItem const getCurrentTocItem( > + std::string const & type) const; Perhaps we are using language differently, but to my ears "the first TocItem after the cursor" sounds more plausible. Unless you really do mean to navigate from the cursor back towards the beginning of the document. > Index: src/frontends/qt4/QToc.C > =================================================================== This looks like heavyweight manipulation to get the data you desire. It suggests that TocItem needs a new member function that should be used instead of item.str. > +QModelIndex const QToc::getCurrentIndex() > +{ > + vector<string> const & types = getTypes(); > + toc::TocItem const item = getCurrentTocItem(types[type_]); > + if (item.id_ == -1) { > + lyxerr[Debug::GUI] > + << "QToc::getCurrentIndex(): TocItem is invalid!" << > endl; > + return QModelIndex(); > + } > + > + string toc_str = item.str; > + toc_str.erase(0, toc_str.find(' ') + 1); > + > + return toc_models_[type_]->index(toc_str); > +} > + > + One of these days I'm going to have to try out all these exciting new toys ;-) Angus