new InsetIterator

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8543 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2004-03-27 12:42:10 +00:00
parent 32855cf6ed
commit 206a1c6a02
3 changed files with 12 additions and 10 deletions

View File

@ -24,6 +24,7 @@
#include "debug.h"
#include "funcrequest.h"
#include "gettext.h"
#include "insetiterator.h"
#include "iterators.h"
#include "language.h"
#include "lyxlayout.h"
@ -310,13 +311,12 @@ void BufferView::setCursorFromRow(int row)
void BufferView::gotoLabel(string const & label)
{
for (Buffer::inset_iterator it = buffer()->inset_iterator_begin();
it != buffer()->inset_iterator_end(); ++it) {
for (InsetIterator it(buffer()->inset()); it; ++it) {
vector<string> labels;
it->getLabelList(*buffer(), labels);
if (find(labels.begin(),labels.end(),label) != labels.end()) {
cursor().clearSelection();
text()->setCursor(cursor(), it.getPar(), it.getPos());
text()->setCursor(cursor(), it.par(), it.pos());
cursor().resetAnchor();
update();
return;

View File

@ -32,6 +32,7 @@
#include "gettext.h"
#include "intl.h"
#include "iterators.h"
#include "insetiterator.h"
#include "lyx_cb.h" // added for Dispatch functions
#include "lyx_main.h"
#include "lyxfind.h"
@ -722,8 +723,7 @@ InsetBase * BufferView::Pimpl::getInsetByCode(InsetBase::Code /*code*/)
#warning FIXME
#if 0
Buffer * buf = bv_->buffer();
Buffer::inset_iterator beg = buf->inset_iterator_begin();
Buffer::inset_iterator end = buf->inset_iterator_end();
InsetIterator beg(buf->inset());
bool cursor_par_seen = false;
@ -731,19 +731,19 @@ InsetBase * BufferView::Pimpl::getInsetByCode(InsetBase::Code /*code*/)
LyXText * = bv_->getLyXText();
ParagraphList::iterator pit = text->getPar(cur.par());
for (; beg != end; ++beg) {
if (beg.getPar() == pit)
for (; beg; ++beg) {
if (beg.par() == pit)
cursor_par_seen = true;
if (cursor_par_seen) {
if (beg.getPar() == pit && beg.getPos() >= cur.pos())
if (beg.par() == pit && beg.pos() >= cur.pos())
break;
if (beg.getPar() != pit)
break;
}
}
if (beg != end) {
if (beg) {
// Now find the first inset that matches code.
for (; beg != end; ++beg) {
for (; beg; ++beg) {
if (beg->lyxCode() == code)
return &(*beg);
}

View File

@ -167,6 +167,8 @@ lyx_SOURCES = \
intl.h \
iterators.C \
iterators.h \
insetiterator.C \
insetiterator.h \
kbmap.C \
kbmap.h \
kbsequence.C \