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"
17 #include "iterators.h"
19 #include "paragraph.h"
20 #include "PosIterator.h"
27 ControlErrorList::ControlErrorList(Dialog & d)
28 : Dialog::Controller(d)
32 void ControlErrorList::clearParams()
36 ErrorList const & ControlErrorList::errorList() const
42 bool ControlErrorList::initialiseParams(string const & name)
44 errorlist_ = kernel().bufferview()->getErrorList();
50 string const & ControlErrorList::name()
56 void ControlErrorList::goTo(int item)
58 ErrorItem const & err = errorlist_[item];
63 Buffer & buf = kernel().buffer();
64 ParIterator pit = buf.getParFromID(err.par_id);
66 if (pit == buf.par_iterator_end()) {
67 lyxerr << "par id not found" << endl;
71 int const end = std::min(err.pos_end, pit->size());
72 int const start = std::min(err.pos_start, end);
73 int const range = end - start;
75 // Now make the selection.
76 PosIterator const pos(pit, start);
77 kernel().bufferview()->putSelectionAt(pos, range, false);