3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * Full author contact details are available in file CREDITS.
14 #include "BufferView.h"
17 #include "iterators.h"
19 #include "paragraph.h"
21 #include "insets/updatableinset.h"
26 DispatchResult Cursor::dispatch(FuncRequest const &)
28 for (int i = data_.size() - 1; i >= 0; --i) {
29 lyxerr << "trying to dispatch to " << data_[i].text_ << std::endl;
35 void buildCursor(Cursor & cursor, BufferView & bv)
37 UpdatableInset * inset = bv.theLockingInset();
38 lyxerr << "\nbuildCursor: " << inset << std::endl;
42 inset = inset->getLockingInset();
45 ParIterator pit = bv.buffer()->par_iterator_begin();
46 ParIterator end = bv.buffer()->par_iterator_end();
47 for ( ; pit != end && !ok; ++pit) {
48 InsetList::iterator it = pit->insetlist.begin();
49 InsetList::iterator iend = pit->insetlist.end();
50 for ( ; it != iend && !ok; ++it)
51 if (it->inset == inset || it->inset == inset->owner())
56 lyxerr << " tli not found! inset: " << inset << std::endl;
60 vector<ParagraphList::iterator> pits;
61 vector<ParagraphList const *> plists;
62 vector<LyXText *> texts;
64 pit.getPits(pits, plists, texts);
66 cursor.data_.resize(pits.size());
67 for (size_t i = 0, n = pits.size(); i != n; ++i) {
68 cursor.data_[i].text_ = texts[i];
69 cursor.data_[i].pit_ = pits[i];
70 //cursor.data_[i].pos_ = texts[i]->cursor.pos();
71 cursor.data_[i].pos_ = 0;
72 lyxerr << " text: " << cursor.data_[i].text_
73 << " pit: " << cursor.data_[i].pit_->id()
74 << " pos: " << cursor.data_[i].pos_