]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView2.C
remove unused code
[lyx.git] / src / BufferView2.C
index cb7a2ae554483e3b11a356df405cd42fd1b0f7b9..36bb14c6c375f81c5c9ec1f2e42be2ae101793de 100644 (file)
@@ -25,6 +25,7 @@
 #include "debug.h"
 #include "iterators.h"
 #include "lyxlex.h"
+#include "WordLangTuple.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
@@ -191,19 +192,20 @@ bool BufferView::removeAutoInsets()
                        }
                }
 
-               Paragraph::inset_iterator pit = par->inset_iterator_begin();
-               Paragraph::inset_iterator pend = par->inset_iterator_end();
+               InsetList::iterator pit = par->insetlist.begin();
+               InsetList::iterator pend = par->insetlist.end();
+
                while (pit != pend) {
-                       if (pit->autoDelete()) {
+                       if (pit.getInset()->autoDelete()) {
                                removed = true;
                                pos_type const pos = pit.getPos();
 
                                par->erase(pos);
                                // We just invalidated par's inset iterators so
                                // we get the next valid iterator position
-                               pit = par->InsetIterator(pos);
+                               pit = par->insetlist.insetIterator(pos);
                                // and ensure we have a valid end iterator.
-                               pend = par->inset_iterator_end();
+                               pend = par->insetlist.end();
 
                                if (cursor_par == par) {
                                        // update the saved cursor position
@@ -275,10 +277,12 @@ void BufferView::insertErrors(TeXErrors & terr)
                if (texrowpar == 0)
                        continue;
 
+               freezeUndo();
                InsetError * new_inset = new InsetError(msgtxt);
                text->setCursorIntern(this, texrowpar, tmppos);
                text->insertInset(this, new_inset);
                text->fullRebreak(this);
+               unFreezeUndo();
        }
        // Restore the cursor position
        text->setCursorIntern(this, cursor.par(), cursor.pos());
@@ -521,26 +525,24 @@ bool BufferView::lockInset(UpdatableInset * inset)
                        }
                }
                // Then do a deep look of the inset and lock the right one
-               Paragraph * par = buffer()->paragraph;
                int const id = inset->id();
-               while(par) {
-                       Paragraph::inset_iterator it =
-                               par->inset_iterator_begin();
-                       Paragraph::inset_iterator const end =
-                               par->inset_iterator_end();
+               ParagraphList::iterator pit = buffer()->paragraphs.begin();
+               ParagraphList::iterator pend = buffer()->paragraphs.end();
+               for (; pit != pend; ++pit) {
+                       InsetList::iterator it = pit->insetlist.begin();
+                       InsetList::iterator end = pit->insetlist.end();
                        for (; it != end; ++it) {
-                               if ((*it) == inset) {
-                                       text->setCursorIntern(this, par, it.getPos());
+                               if (it.getInset() == inset) {
+                                       text->setCursorIntern(this, &*pit, it.getPos());
                                        theLockingInset(inset);
                                        return true;
                                }
-                               if ((*it)->getInsetFromID(id)) {
-                                       text->setCursorIntern(this, par, it.getPos());
-                                       (*it)->edit(this);
+                               if (it.getInset()->getInsetFromID(id)) {
+                                       text->setCursorIntern(this, &*pit, it.getPos());
+                                       it.getInset()->edit(this);
                                        return theLockingInset()->lockInsetInInset(this, inset);
                                }
                        }
-                       par = par->next();
                }
                return false;
        }
@@ -609,13 +611,13 @@ int BufferView::unlockInset(UpdatableInset * inset)
                // make sure we update the combo !
                owner()->setLayout(getLyXText()->cursor.par()->layout()->name());
                // Tell the paragraph dialog that we changed paragraph
-               owner()->getDialogs()->updateParagraph();
+               owner()->getDialogs().updateParagraph();
                finishUndo();
                return 0;
        } else if (inset && theLockingInset() &&
                   theLockingInset()->unlockInsetInInset(this, inset)) {
                // Tell the paragraph dialog that we changed paragraph
-               owner()->getDialogs()->updateParagraph();
+               owner()->getDialogs().updateParagraph();
                // owner inset has updated the layout combo
                finishUndo();
                return 0;
@@ -656,10 +658,10 @@ bool BufferView::ChangeInsets(Inset::Code code,
             it != end; ++it) {
                Paragraph * par = *it;
                bool changed_inset = false;
-               for (Paragraph::inset_iterator it2 = par->inset_iterator_begin();
-                    it2 != par->inset_iterator_end(); ++it2) {
-                       if ((*it2)->lyxCode() == code) {
-                               InsetCommand * inset = static_cast<InsetCommand *>(*it2);
+               for (InsetList::iterator it2 = par->insetlist.begin();
+                    it2 != par->insetlist.end(); ++it2) {
+                       if (it2.getInset()->lyxCode() == code) {
+                               InsetCommand * inset = static_cast<InsetCommand *>(it2.getInset());
                                if (inset->getContents() == from) {
                                        inset->setContents(to);
                                        changed_inset = true;