]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt4/GuiErrorList.cpp
Complete the removal of the embedding stuff. Maybe. It's hard to be sure we got every...
[lyx.git] / src / frontends / qt4 / GuiErrorList.cpp
index e24357edca75e34fcbadaac6a83739d6f23a9061..3e1d104936de38be51b1d3400dc064699fa7bd1f 100644 (file)
 
 #include "GuiErrorList.h"
 
+#include "qt_helpers.h"
+
 #include "Buffer.h"
 #include "BufferView.h"
-#include "debug.h"
-#include "gettext.h"
-#include "Text.h"
 #include "ParIterator.h"
+#include "Text.h"
 
-#include "qt_helpers.h"
-
+#include "support/debug.h"
+#include "support/gettext.h"
 #include "support/lstrings.h"
 
 #include <QListWidget>
-#include <QTextBrowser>
 #include <QPushButton>
-#include <QCloseEvent>
-
-using std::string;
+#include <QShowEvent>
+#include <QTextBrowser>
 
+using namespace std;
+using namespace lyx::support;
 
 namespace lyx {
 namespace frontend {
 
-using support::bformat;
-
 GuiErrorList::GuiErrorList(GuiView & lv)
-       : GuiDialog(lv, "errorlist")
+       : GuiDialog(lv, "errorlist", qt_("Error List"))
 {
        setupUi(this);
 
@@ -51,13 +49,6 @@ GuiErrorList::GuiErrorList(GuiView & lv)
 }
 
 
-void GuiErrorList::closeEvent(QCloseEvent * e)
-{
-       slotClose();
-       e->accept();
-}
-
-
 void GuiErrorList::showEvent(QShowEvent * e)
 {
        errorsLW->setCurrentRow(0);
@@ -76,7 +67,7 @@ void GuiErrorList::select(QListWidgetItem * wi)
 
 void GuiErrorList::updateContents()
 {
-       setViewTitle(name_);
+       setTitle(toqstr(name_));
        errorsLW->clear();
        descriptionTB->setPlainText(QString());
 
@@ -111,21 +102,20 @@ void GuiErrorList::goTo(int item)
                return;
 
        Buffer & buf = buffer();
-       ParIterator pit = buf.getParFromID(err.par_id);
+       DocIterator dit = buf.getParFromID(err.par_id);
 
-       if (pit == buf.par_iterator_end()) {
+       if (dit == doc_iterator_end(buf.inset())) {
                LYXERR0("par id " << err.par_id << " not found");
                return;
        }
 
        // Now make the selection.
-       // This should be implemented using an LFUN. (Angus)
        // if pos_end is 0, this means it is end-of-paragraph
-       pos_type const end = err.pos_end ? std::min(err.pos_end, pit->size())
-                                        : pit->size();
-       pos_type const start = std::min(err.pos_start, end);
+       pos_type const s = dit.paragraph().size();
+       pos_type const end = err.pos_end ? min(err.pos_end, s) : s;
+       pos_type const start = min(err.pos_start, end);
        pos_type const range = end - start;
-       DocIterator const dit = makeDocIterator(pit, start);
+       dit.pos() = start;
        bufferview()->putSelectionAt(dit, range, false);
        // FIXME: If we used an LFUN, we would not need this line:
        bufferview()->processUpdateFlags(Update::Force | Update::FitCursor);