]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.C
move some selection related stuff over to textcursor.C
[lyx.git] / src / BufferView.C
index 7bd571ed9a4268b983470a39309af8e0208c8bff..697d85cc2b9d074d586ce75f5d599c88ff228592 100644 (file)
@@ -36,7 +36,6 @@
 #include "frontends/screen.h"
 
 #include "insets/insetcommand.h" // ChangeRefs
-#include "insets/inseterror.h"
 #include "insets/updatableinset.h"
 
 #include "support/FileInfo.h"
@@ -104,11 +103,17 @@ void BufferView::buffer(Buffer * b)
 }
 
 
+bool BufferView::loadLyXFile(string const & fn, bool tl)
+{
+       return pimpl_->loadLyXFile(fn, tl);
+}
+
+
 void BufferView::reload()
 {
        string const fn = buffer()->fileName();
        if (bufferlist.close(buffer(), false))
-               buffer(bufferlist.loadLyXFile(fn));
+               loadLyXFile(fn);
 }
 
 
@@ -331,30 +336,12 @@ bool BufferView::insertLyXFile(string const & filen)
 }
 
 
-void BufferView::resetErrorList()
-{
-       pimpl_->errorlist_.clear();
-}
-
-
-void BufferView::setErrorList(ErrorList const & el)
-{
-       pimpl_->errorlist_ = el;
-}
-
-
-void BufferView::addError(ErrorItem const & ei)
-{
-       pimpl_->errorlist_.push_back(ei);
-
-}
-
-
 void BufferView::showErrorList(string const & action) const
 {
        if (getErrorList().size()) {
                string const title = bformat(_("LyX: %1$s errors (%2$s)"), action, buffer()->fileName());
                owner()->getDialogs().show("errorlist", title);
+               pimpl_->errorlist_.clear();
        }
 }
 
@@ -379,7 +366,7 @@ void BufferView::setCursorFromRow(int row)
                texrowpar = text->ownerParagraphs().begin();
                tmppos = 0;
        } else {
-               texrowpar = *buffer()->getParFromID(tmpid);
+               texrowpar = buffer()->getParFromID(tmpid).pit();
        }
        text->setCursor(texrowpar, tmppos);
 }
@@ -395,7 +382,8 @@ void BufferView::gotoLabel(string const & label)
 {
        for (Buffer::inset_iterator it = buffer()->inset_iterator_begin();
             it != buffer()->inset_iterator_end(); ++it) {
-               vector<string> labels = it->getLabelList();
+               vector<string> labels;
+               it->getLabelList(labels);
                if (find(labels.begin(),labels.end(),label)
                     != labels.end()) {
                        beforeChange(text);
@@ -535,15 +523,15 @@ bool BufferView::lockInset(UpdatableInset * inset)
                        InsetList::iterator it = pit->insetlist.begin();
                        InsetList::iterator end = pit->insetlist.end();
                        for (; it != end; ++it) {
-                               if (it.getInset() == inset) {
-                                       text->setCursorIntern(pit, it.getPos());
+                               if (it->inset == inset) {
+                                       text->setCursorIntern(pit, it->pos);
                                        theLockingInset(inset);
                                        return true;
                                }
-                               if (it.getInset()->getInsetFromID(id)) {
-                                       text->setCursorIntern(pit, it.getPos());
+                               if (it->inset->getInsetFromID(id)) {
+                                       text->setCursorIntern(pit, it->pos);
                                        FuncRequest cmd(this, LFUN_INSET_EDIT, "left");
-                                       it.getInset()->localDispatch(cmd);
+                                       it->inset->localDispatch(cmd);
                                        return theLockingInset()->lockInsetInInset(this, inset);
                                }
                        }
@@ -604,9 +592,7 @@ void BufferView::lockedInsetStoreUndo(Undo::undo_kind kind)
                return; // shouldn't happen
        if (kind == Undo::EDIT) // in this case insets would not be stored!
                kind = Undo::FINISH;
-       setUndo(this, kind,
-               text->cursor.par(),
-               boost::next(text->cursor.par()));
+       setUndo(this, kind, text->cursor.par());
 }
 
 
@@ -631,8 +617,8 @@ bool BufferView::ChangeInsets(Inset::Code code,
                bool changed_inset = false;
                for (InsetList::iterator it2 = it->insetlist.begin();
                     it2 != it->insetlist.end(); ++it2) {
-                       if (it2.getInset()->lyxCode() == code) {
-                               InsetCommand * inset = static_cast<InsetCommand *>(it2.getInset());
+                       if (it2->inset->lyxCode() == code) {
+                               InsetCommand * inset = static_cast<InsetCommand *>(it2->inset);
                                if (inset->getContents() == from) {
                                        inset->setContents(to);
                                        changed_inset = true;
@@ -647,10 +633,10 @@ bool BufferView::ChangeInsets(Inset::Code code,
                        // The test it.size()==1 was needed to prevent crashes.
                        // How to set the cursor corretly when it.size()>1 ??
                        if (it.size() == 1) {
-                               text->setCursorIntern(*it, 0);
+                               text->setCursorIntern(it.pit(), 0);
                                text->redoParagraphs(text->cursor,
                                                     boost::next(text->cursor.par()));
-                               text->fullRebreak();
+                               text->partialRebreak();
                        }
                }
        }
@@ -662,7 +648,8 @@ bool BufferView::ChangeInsets(Inset::Code code,
 bool BufferView::ChangeRefsIfUnique(string const & from, string const & to)
 {
        // Check if the label 'from' appears more than once
-       vector<string> labels = buffer()->getLabelList();
+       vector<string> labels;
+       buffer()->getLabelList(labels);
 
        if (lyx::count(labels.begin(), labels.end(), from) > 1)
                return false;