]> git.lyx.org Git - lyx.git/commitdiff
remove lockPath
authorAlfredo Braunstein <abraunst@lyx.org>
Mon, 2 Feb 2004 11:07:51 +0000 (11:07 +0000)
committerAlfredo Braunstein <abraunst@lyx.org>
Mon, 2 Feb 2004 11:07:51 +0000 (11:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8380 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.C
src/BufferView.h
src/BufferView_pimpl.C
src/ChangeLog
src/iterators.C
src/iterators.h
src/lyxfunc.C
src/undo.C

index 3de1d1b6038560b7aac5fe63e16eadb2e72a14c6..a04f01993119aa838200b334b44a42d4f38bc69d 100644 (file)
@@ -444,6 +444,19 @@ LyXText * BufferView::text() const
 }
 
 
+void BufferView::setCursor(ParIterator const & par,
+                          lyx::pos_type pos)
+{
+       LCursor & cur = cursor();
+       cur.reset();
+       ParIterator::PosHolder const & positions = par.positions();
+       int const last = par.size() - 1;
+       for (int i = 0; i < last; ++i)
+               (*positions[i].it)->inset->edit(cur, true);
+       cur.resetAnchor();
+       LyXText * lt = par.text(*buffer());
+       lt->setCursor(par.pit(), pos);
+}
 
 
 /*
@@ -468,7 +481,8 @@ void BufferView::putSelectionAt(PosIterator const & cur,
        cursor().clearSelection();
 
        LyXText * text = par.text(*buffer());
-       par.lockPath(this);
+       setCursor(par, cur.pos());
+       
        // hack for the chicken and egg problem
        if (par.inset())
                top_y(par.outerPar()->y);
index d6beddec1a0e1b6e805c808811643a433d7597b4..fa89ca527c11461e7d96e22631fd0ac5cb083d17 100644 (file)
@@ -15,6 +15,8 @@
 #ifndef BUFFER_VIEW_H
 #define BUFFER_VIEW_H
 
+#include "support/types.h"
+
 #include <boost/utility.hpp>
 
 #include <string>
@@ -32,6 +34,7 @@ class LyXText;
 class LyXScreen;
 class LyXView;
 class Painter;
+class ParIterator;
 class PosIterator;
 class TeXErrors;
 class UpdatableInset;
@@ -190,6 +193,8 @@ public:
        ///
        LyXText * text() const;
        ///
+       void setCursor(ParIterator const & par, lyx::pos_type pos);
+       ///
        void putSelectionAt(PosIterator const & cur, int length, bool backwards);
 
 private:
index 27adc9dcfb9699d2e89532111ed2f659499eb5b7..a71644d47b129c51d47cf776f725259d05b54727 100644 (file)
@@ -933,8 +933,8 @@ bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd0)
 
                screen().hideCursor();
 
-               // either the inset under the cursor or the surrounding LyXText will
-               // handle this event.
+               // either the inset under the cursor or the
+               // surrounding LyXText will handle this event.
 
                // built temporary path to inset
                LyXText * text = bv_->text();
index 7b5e490f13f18ed0022da767b5f3da7f4e07d906..83653aae7b9727d4308d77c877fb6bc303908c76 100644 (file)
@@ -1,3 +1,12 @@
+
+2004-02-02  Alfredo Braunstein  <abraunst@lyx.org>
+
+       * iterators.[Ch] (lockPath): remove in favour of...
+       * BufferView.[Ch] (setCursor): this addition
+       * BufferView.C (putSelectionAt): adjust
+       * undo.C (performUndoOrRedo): adjust
+       * lyxfunc.C (dispatch): adjust
+
 2004-02-02  Alfredo Braunstein  <abraunst@lyx.org>
 
        * iterators.C (lockPath): add a missing slice
index 3fcd6cf39282c4ea1cfdb94233ff2fc966cf6fbb..befe0a971c9aec986842d3f604fef0b911f63a79 100644 (file)
@@ -221,17 +221,6 @@ ParIterator::ParIterator(PosIterator const & pos)
 }
 
 
-void ParIterator::lockPath(BufferView * bv) const
-{
-       LCursor & cur = bv->cursor();
-       cur.reset();
-       int const last = size() - 1;
-       for (int i = 0; i < last; ++i)
-               (*positions_[i].it)->inset->edit(cur, true);
-       cur.resetAnchor();
-}
-
-
 bool operator==(ParIterator const & iter1, ParIterator const & iter2)
 {
        return iter1.positions() == iter2.positions();
index 07c885b8c6704583c58a549e3e315cd2f8f6e289..a68f7ff12d565886c7c732b4332edd0d79a214b0 100644 (file)
@@ -25,7 +25,6 @@ class LyXText;
 class InsetBase;
 class Cursor;
 class Buffer;
-class BufferView;
 class PosIterator;
 
 
@@ -78,8 +77,6 @@ public:
        int index() const;
        ///
        size_t size() const;
-       ///
-       void lockPath(BufferView *) const;
 
        typedef std::vector<ParPosition> PosHolder;
        PosHolder const & positions() const
index d079a8970b8c0a54a1b052f9e4be572ab5c75486..a4fe32bcf84d61112874732cd95f128924ee98ba 100644 (file)
@@ -1164,11 +1164,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                                                                << " found." << endl;
                        }
 
-                       par.lockPath(view());
-                       LyXText * lt = par.text(*view()->buffer());
-
                        // Set the cursor
-                       lt->setCursor(par.pit(), 0);
+                       view()->setCursor(par, 0);
+
                        view()->switchKeyMap();
                        owner->view_state_changed();
 
index 272caf6fa34acad0e8858c945acd0c19600bd605..939aee4530eb36323791e07181c279d74fb5ddea 100644 (file)
@@ -183,8 +183,9 @@ bool performUndoOrRedo(BufferView * bv, Undo const & undo)
        // rebreak the entire lyxtext
        buf.text().fullRebreak();
 
-       pit.lockPath(bv);
-       text->setCursor(undo.cursor_par, undo.cursor_pos);
+       ParIterator pit2 = num2pit(buf, undo.text);
+       advance(pit2, undo.cursor_par);
+       bv->setCursor(pit2, undo.cursor_pos);
 
        finishUndo();
        return true;