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"
14 #include "support/lstrings.h" // tostr
15 #include "errorlist.h"
17 #include "BufferView.h"
25 ControlErrorList::ControlErrorList(Dialog & d)
26 : Dialog::Controller(d)
30 void ControlErrorList::clearParams()
35 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 BufferView * const bv = kernel().bufferview();
58 Buffer * const buf = kernel().buffer();
60 ErrorItem const & err = errorlist_[item];
66 ParIterator pit = buf->getParFromID(err.par_id);
68 if (pit == buf->par_iterator_end()) {
69 lyxerr << "par id not found" << endl;
73 int range = err.pos_end - err.pos_start;
75 if (err.pos_end > (*pit)->size() || range <= 0)
76 range = (*pit)->size() - err.pos_start;
78 // Now make the selection.
80 bv->toggleSelection();
81 bv->text->clearSelection();
82 bv->text->setCursor(*pit, err.pos_start);
83 bv->text->setSelectionRange(range);
84 bv->toggleSelection(false);
86 bv->update(bv->text, BufferView::SELECT);