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();
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);

View 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:

View 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();

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>
* 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)
{
return iter1.positions() == iter2.positions();

View 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

View 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();

View 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;