]> git.lyx.org Git - lyx.git/blob - src/cursor.C
58313c2025bd3d19c6ebb14f52ddb6235f18b258
[lyx.git] / src / cursor.C
1 /**
2  * \file cursor.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Jürgen Vigna
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "buffer.h"
14 #include "BufferView.h"
15 #include "cursor.h"
16 #include "debug.h"
17 #include "dispatchresult.h"
18 #include "iterators.h"
19 #include "lyxtext.h"
20 #include "paragraph.h"
21
22 #include "insets/updatableinset.h"
23
24 using std::vector;
25
26
27 DispatchResult Cursor::dispatch(FuncRequest const &)
28 {
29         for (int i = data_.size() - 1; i >= 0; --i) {
30                 lyxerr << "trying to dispatch to " << data_[i].text_ << std::endl;
31         }
32         return UNDISPATCHED;
33 }
34
35
36 void buildCursor(Cursor & cursor, BufferView & bv)
37 {
38         UpdatableInset * inset = bv.theLockingInset();
39         lyxerr << "\nbuildCursor: " << inset << std::endl;
40         if (!inset)
41                 return;
42
43         inset = inset->getLockingInset();
44
45         bool ok = false;
46         ParIterator pit = bv.buffer()->par_iterator_begin();
47         ParIterator end = bv.buffer()->par_iterator_end();
48         for ( ; pit != end && !ok; ++pit) {
49                 InsetList::iterator     it = pit->insetlist.begin();
50                 InsetList::iterator     iend = pit->insetlist.end();
51                 for ( ; it != iend && !ok; ++it)
52                         if (it->inset == inset || it->inset == inset->owner())
53                                 ok = true;
54         }
55
56         if (!ok) {
57                 lyxerr << " tli not found! inset: " << inset << std::endl;
58                 return;
59         }
60
61         vector<ParagraphList::iterator> pits;
62         vector<ParagraphList const *>   plists;
63         vector<LyXText *>               texts;
64 /*
65         pit.getPits(pits, plists, texts);
66
67         cursor.data_.resize(pits.size());
68         for (size_t i = 0, n = pits.size(); i != n; ++i) {
69                 cursor.data_[i].text_ = texts[i];
70                 cursor.data_[i].pit_  = pits[i];
71                 //cursor.data_[i].pos_ = texts[i]->cursor.pos();
72                 cursor.data_[i].pos_ = 0;
73                 lyxerr << " text: " << cursor.data_[i].text_
74                        << " pit: " << cursor.data_[i].pit_->id()
75                        << " pos: " << cursor.data_[i].pos_
76                        << std::endl;
77         }
78 */
79 }