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"
24 ControlErrorList::ControlErrorList(Dialog & d)
25 : Dialog::Controller(d)
29 void ControlErrorList::clearParams()
34 ControlErrorList::errorList() const
40 bool ControlErrorList::initialiseParams(string const & name)
42 errorlist_ = kernel().bufferview()->getErrorList();
48 string const & ControlErrorList::name()
54 void ControlErrorList::goTo(int item)
56 ErrorItem const & err = errorlist_[item];
61 Buffer & buf = kernel().buffer();
62 ParIterator pit = buf.getParFromID(err.par_id);
64 if (pit == buf.par_iterator_end()) {
65 lyxerr << "par id not found" << endl;
69 int range = err.pos_end - err.pos_start;
71 if (err.pos_end > pit->size() || range <= 0)
72 range = pit->size() - err.pos_start;
74 // Now make the selection.
75 BufferView * const bv = kernel().bufferview();
77 bv->text->clearSelection();
78 bv->text->setCursor(pit.pit(), err.pos_start);
79 bv->text->setSelectionRange(range);