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 ErrorItem const & err = errorlist_[item];
62 Buffer * const 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->toggleSelection();
79 bv->text->clearSelection();
80 bv->text->setCursor(pit.pit(), err.pos_start);
81 bv->text->setSelectionRange(range);
82 bv->toggleSelection(false);
84 bv->update(bv->text, BufferView::SELECT);