#include "insets/updatableinset.h"
using std::vector;
+using std::endl;
-DispatchResult Cursor::dispatch(FuncRequest const &)
+DispatchResult Cursor::dispatch(FuncRequest const & cmd)
{
for (int i = data_.size() - 1; i >= 0; --i) {
- lyxerr << "trying to dispatch to " << data_[i].text_ << std::endl;
+ CursorItem & citem = data_[i];
+
+ lyxerr << "trying to dispatch to inset" << citem.inset_ << endl;
+ DispatchResult res = citem.inset_->dispatch(cmd);
+ lyxerr << " result: " << res.val() << endl;
+
+ if (res.dispatched())
+ return res;
+
+ lyxerr << "# unhandled result: " << res.val() << endl;
}
- return UNDISPATCHED;
+ return DispatchResult(false);
}
void buildCursor(Cursor & cursor, BufferView & bv)
{
UpdatableInset * inset = bv.theLockingInset();
- lyxerr << "\nbuildCursor: " << inset << std::endl;
+ lyxerr << "\nbuildCursor: " << inset << endl;
if (!inset)
return;
}
if (!ok) {
- lyxerr << " tli not found! inset: " << inset << std::endl;
+ lyxerr << " tli not found! inset: " << inset << endl;
return;
}
- vector<ParagraphList::iterator> pits;
- vector<ParagraphList const *> plists;
- vector<LyXText *> texts;
-/*
- pit.getPits(pits, plists, texts);
-
- cursor.data_.resize(pits.size());
- for (size_t i = 0, n = pits.size(); i != n; ++i) {
- cursor.data_[i].text_ = texts[i];
- cursor.data_[i].pit_ = pits[i];
- //cursor.data_[i].pos_ = texts[i]->cursor.pos();
- cursor.data_[i].pos_ = 0;
- lyxerr << " text: " << cursor.data_[i].text_
- << " pit: " << cursor.data_[i].pit_->id()
+ pit.asCursor(cursor);
+ for (size_t i = 0, n = cursor.data_.size(); i != n; ++i) {
+ lyxerr << " inset: " << cursor.data_[i].inset_
+ << " idx: " << cursor.data_[i].idx_
+ << " text: " << cursor.data_[i].text_
+ << " par: " << cursor.data_[i].par_
<< " pos: " << cursor.data_[i].pos_
- << std::endl;
+ << endl;
}
-*/
}