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"
26 ControlErrorList::ControlErrorList(Dialog & d)
27 : Dialog::Controller(d)
31 void ControlErrorList::clearParams()
35 ErrorList const & ControlErrorList::errorList() const
41 bool ControlErrorList::initialiseParams(string const & name)
43 errorlist_ = kernel().bufferview()->getErrorList();
49 string const & ControlErrorList::name()
55 void ControlErrorList::goTo(int item)
57 ErrorItem const & err = errorlist_[item];
62 Buffer & buf = kernel().buffer();
63 ParIterator pit = buf.getParFromID(err.par_id);
65 if (pit == buf.par_iterator_end()) {
66 lyxerr << "par id not found" << endl;
70 int range = err.pos_end - err.pos_start;
72 if (err.pos_end > pit->size() || range <= 0)
73 range = pit->size() - err.pos_start;
75 // Now make the selection.
76 BufferView * const bv = kernel().bufferview();
78 bv->text->clearSelection();
79 bv->text->setCursor(pit.pit(), err.pos_start);
80 bv->text->setSelectionRange(range);