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 "dispatchresult.h"
18 #include "iterators.h"
20 #include "paragraph.h"
22 #include "insets/updatableinset.h"
28 DispatchResult Cursor::dispatch(FuncRequest const & cmd)
30 for (int i = data_.size() - 1; i >= 0; --i) {
31 lyxerr << "trying to dispatch to inset" << data_[i].inset_ << endl;
32 DispatchResult res = data_[i].inset_->dispatch(cmd);
33 lyxerr << " result: " << res.val() << endl;
35 if (res.dispatched()) {
36 if (res.val() != NOUPDATE) {
39 return DispatchResult(true);
42 lyxerr << "# unhandled result: " << res.val() << endl;
44 return DispatchResult(false);
48 void buildCursor(Cursor & cursor, BufferView & bv)
50 UpdatableInset * inset = bv.theLockingInset();
51 lyxerr << "\nbuildCursor: " << inset << endl;
55 inset = inset->getLockingInset();
58 ParIterator pit = bv.buffer()->par_iterator_begin();
59 ParIterator end = bv.buffer()->par_iterator_end();
60 for ( ; pit != end && !ok; ++pit) {
61 InsetList::iterator it = pit->insetlist.begin();
62 InsetList::iterator iend = pit->insetlist.end();
63 for ( ; it != iend && !ok; ++it)
64 if (it->inset == inset || it->inset == inset->owner())
69 lyxerr << " tli not found! inset: " << inset << endl;
74 for (size_t i = 0, n = cursor.data_.size(); i != n; ++i) {
75 lyxerr << " inset: " << cursor.data_[i].inset_
76 << " idx: " << cursor.data_[i].idx_
77 << " text: " << cursor.data_[i].text_
78 << " par: " << cursor.data_[i].par_
79 << " pos: " << cursor.data_[i].pos_