remove lockPath

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8380 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2004-02-02 11:07:51 +00:00
parent 26b1ba3a9b
commit da1f3b8ac9
8 changed files with 36 additions and 23 deletions

View 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(); cursor().clearSelection();
LyXText * text = par.text(*buffer()); LyXText * text = par.text(*buffer());
par.lockPath(this); setCursor(par, cur.pos());
// hack for the chicken and egg problem // hack for the chicken and egg problem
if (par.inset()) if (par.inset())
top_y(par.outerPar()->y); top_y(par.outerPar()->y);

View File

@ -15,6 +15,8 @@
#ifndef BUFFER_VIEW_H #ifndef BUFFER_VIEW_H
#define BUFFER_VIEW_H #define BUFFER_VIEW_H
#include "support/types.h"
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <string> #include <string>
@ -32,6 +34,7 @@ class LyXText;
class LyXScreen; class LyXScreen;
class LyXView; class LyXView;
class Painter; class Painter;
class ParIterator;
class PosIterator; class PosIterator;
class TeXErrors; class TeXErrors;
class UpdatableInset; class UpdatableInset;
@ -190,6 +193,8 @@ public:
/// ///
LyXText * text() const; LyXText * text() const;
/// ///
void setCursor(ParIterator const & par, lyx::pos_type pos);
///
void putSelectionAt(PosIterator const & cur, int length, bool backwards); void putSelectionAt(PosIterator const & cur, int length, bool backwards);
private: private:

View File

@ -933,8 +933,8 @@ bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd0)
screen().hideCursor(); screen().hideCursor();
// either the inset under the cursor or the surrounding LyXText will // either the inset under the cursor or the
// handle this event. // surrounding LyXText will handle this event.
// built temporary path to inset // built temporary path to inset
LyXText * text = bv_->text(); LyXText * text = bv_->text();

View 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> 2004-02-02 Alfredo Braunstein <abraunst@lyx.org>
* iterators.C (lockPath): add a missing slice * iterators.C (lockPath): add a missing slice

View 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) bool operator==(ParIterator const & iter1, ParIterator const & iter2)
{ {
return iter1.positions() == iter2.positions(); return iter1.positions() == iter2.positions();

View File

@ -25,7 +25,6 @@ class LyXText;
class InsetBase; class InsetBase;
class Cursor; class Cursor;
class Buffer; class Buffer;
class BufferView;
class PosIterator; class PosIterator;
@ -78,8 +77,6 @@ public:
int index() const; int index() const;
/// ///
size_t size() const; size_t size() const;
///
void lockPath(BufferView *) const;
typedef std::vector<ParPosition> PosHolder; typedef std::vector<ParPosition> PosHolder;
PosHolder const & positions() const PosHolder const & positions() const

View File

@ -1164,11 +1164,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
<< " found." << endl; << " found." << endl;
} }
par.lockPath(view());
LyXText * lt = par.text(*view()->buffer());
// Set the cursor // Set the cursor
lt->setCursor(par.pit(), 0); view()->setCursor(par, 0);
view()->switchKeyMap(); view()->switchKeyMap();
owner->view_state_changed(); owner->view_state_changed();

View File

@ -183,8 +183,9 @@ bool performUndoOrRedo(BufferView * bv, Undo const & undo)
// rebreak the entire lyxtext // rebreak the entire lyxtext
buf.text().fullRebreak(); buf.text().fullRebreak();
pit.lockPath(bv); ParIterator pit2 = num2pit(buf, undo.text);
text->setCursor(undo.cursor_par, undo.cursor_pos); advance(pit2, undo.cursor_par);
bv->setCursor(pit2, undo.cursor_pos);
finishUndo(); finishUndo();
return true; return true;