]> git.lyx.org Git - lyx.git/blob - src/frontends/controllers/ControlErrorList.C
some support for pch
[lyx.git] / src / frontends / controllers / ControlErrorList.C
1 /**
2  * \file ControlErrorList.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alfredo Braunstein
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "ControlErrorList.h"
14 #include "buffer.h"
15 #include "BufferView.h"
16 #include "debug.h"
17 #include "lyxtext.h"
18 #include "paragraph.h"
19 #include "pariterator.h"
20
21 using std::endl;
22 using std::string;
23
24 namespace lyx {
25 namespace frontend {
26
27 ControlErrorList::ControlErrorList(Dialog & d)
28         : Dialog::Controller(d)
29 {}
30
31
32 void ControlErrorList::clearParams()
33 {}
34
35
36 ErrorList const & ControlErrorList::errorList() const
37 {
38         return errorlist_;
39 }
40
41
42 bool ControlErrorList::initialiseParams(string const & name)
43 {
44         errorlist_ = kernel().bufferview()->getErrorList();
45         name_ = name;
46         return true;
47 }
48
49
50 string const & ControlErrorList::name()
51 {
52         return name_;
53 }
54
55
56 void ControlErrorList::goTo(int item)
57 {
58         ErrorItem const & err = errorlist_[item];
59
60         if (err.par_id == -1)
61                 return;
62
63         Buffer & buf = kernel().buffer();
64         ParIterator pit = buf.getParFromID(err.par_id);
65
66         if (pit == buf.par_iterator_end()) {
67                 lyxerr << "par id not found" << endl;
68                 return;
69         }
70
71         // Now make the selection.
72 #ifdef WITH_WARNINGS
73 #warning FIXME (goto error)
74 #warning This should be implemented using an LFUN. (Angus)
75 #endif
76 #if 0
77         pos_type const end = std::min(err.pos_end, pit->size());
78         pos_type const start = std::min(err.pos_start, end);
79         pos_type const range = end - start;
80         PosIterator const pos(pit, start);
81         kernel().bufferview()->putSelectionAt(pos, range, false);
82 #endif
83 }
84
85 } // namespace frontend
86 } // namespace lyx