2 * \file ControlErrorList.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alfredo Braunstein
8 * Full author contact details are available in file CREDITS.
13 #include "ControlErrorList.h"
15 #include "BufferView.h"
16 #include "bufferview_funcs.h"
18 #include "iterators.h"
20 #include "paragraph.h"
21 #include "PosIterator.h"
28 ControlErrorList::ControlErrorList(Dialog & d)
29 : Dialog::Controller(d)
33 void ControlErrorList::clearParams()
37 ErrorList const & ControlErrorList::errorList() const
43 bool ControlErrorList::initialiseParams(string const & name)
45 errorlist_ = kernel().bufferview()->getErrorList();
51 string const & ControlErrorList::name()
57 void ControlErrorList::goTo(int item)
59 ErrorItem const & err = errorlist_[item];
64 Buffer & buf = kernel().buffer();
65 ParIterator pit = buf.getParFromID(err.par_id);
67 if (pit == buf.par_iterator_end()) {
68 lyxerr << "par id not found" << endl;
72 int const end = std::min(err.pos_end, pit->size());
73 int const start = std::min(err.pos_start, end);
74 int const range = end - start;
76 // Now make the selection.
77 PosIterator const pos = pit.asPosIterator(start);
78 bv_funcs::put_selection_at(kernel().bufferview(), pos, range, false);