fix to target_x

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8103 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Alfredo Braunstein 2003-11-18 11:39:30 +00:00
parent a8ba56dce0
commit 25b208aa25
4 changed files with 18 additions and 11 deletions

View File

@ -1,3 +1,10 @@
2003-11-18 Alfredo Braunstein <abraunst@lyx.org>
* text2.C (setCursorIntern): move the x_target update here *
* text3.C: change some bv() to true/false in calls to
cursorUp/Down/Right/Left
* cursor.C: use helper function.
2003-11-17 Alfredo Braunstein <abraunst@lyx.org> 2003-11-17 Alfredo Braunstein <abraunst@lyx.org>
* BufferView_pimpl.C: send LFUN_MOUSE_MOTION to the cursor * BufferView_pimpl.C: send LFUN_MOUSE_MOTION to the cursor

View File

@ -120,7 +120,7 @@ void LCursor::push(UpdatableInset * inset)
{ {
lyxerr << "LCursor::push() inset: " << inset << endl; lyxerr << "LCursor::push() inset: " << inset << endl;
data_.push_back(CursorItem(inset)); data_.push_back(CursorItem(inset));
cached_y_ = bv_->top_y() + innerInset()->y(); updatePos();
} }

View File

@ -257,7 +257,7 @@ void LyXText::toggleInset()
&& inset_owner->owner()->isOpen()) { && inset_owner->owner()->isOpen()) {
finishUndo(); finishUndo();
inset_owner->owner()->close(bv()); inset_owner->owner()->close(bv());
bv()->getLyXText()->cursorRight(bv()); bv()->getLyXText()->cursorRight(true);
bv()->updateParagraphDialog(); bv()->updateParagraphDialog();
} }
return; return;
@ -1175,7 +1175,7 @@ void LyXText::setSelectionRange(lyx::pos_type length)
selection.cursor = cursor; selection.cursor = cursor;
while (length--) while (length--)
cursorRight(bv()); cursorRight(true);
setSelection(); setSelection();
} }
@ -1340,7 +1340,6 @@ void LyXText::setCursor(LyXCursor & cur, paroffset_type par,
} }
// now get the cursors x position // now get the cursors x position
cur.x(int(getCursorX(pit, row, pos, boundary))); cur.x(int(getCursorX(pit, row, pos, boundary)));
bv()->x_target(cur.x());
} }
@ -1405,6 +1404,7 @@ void LyXText::setCursorIntern(paroffset_type par,
pos_type pos, bool setfont, bool boundary) pos_type pos, bool setfont, bool boundary)
{ {
setCursor(cursor, par, pos, boundary); setCursor(cursor, par, pos, boundary);
bv()->x_target(cursor.x());
if (setfont) if (setfont)
setCurrentFont(); setCurrentFont();
} }
@ -1620,7 +1620,7 @@ DispatchResult LyXText::moveRightIntern(bool front, bool activate_inset, bool se
return DispatchResult(false, FINISHED_RIGHT); return DispatchResult(false, FINISHED_RIGHT);
if (activate_inset && checkAndActivateInset(front)) if (activate_inset && checkAndActivateInset(front))
return DispatchResult(true, true); return DispatchResult(true, true);
cursorRight(bv()); cursorRight(true);
if (!selecting) if (!selecting)
clearSelection(); clearSelection();
return DispatchResult(true); return DispatchResult(true);
@ -1632,7 +1632,7 @@ DispatchResult LyXText::moveLeftIntern(bool front,
{ {
if (cursor.par() == 0 && cursor.pos() <= 0) if (cursor.par() == 0 && cursor.pos() <= 0)
return DispatchResult(false, FINISHED); return DispatchResult(false, FINISHED);
cursorLeft(bv()); cursorLeft(true);
if (!selecting) if (!selecting)
clearSelection(); clearSelection();
if (activate_inset && checkAndActivateInset(front)) if (activate_inset && checkAndActivateInset(front))
@ -1645,7 +1645,7 @@ DispatchResult LyXText::moveUp()
{ {
if (cursorRow() == firstRow()) if (cursorRow() == firstRow())
return DispatchResult(false, FINISHED_UP); return DispatchResult(false, FINISHED_UP);
cursorUp(bv()); cursorUp(false);
clearSelection(); clearSelection();
return DispatchResult(true); return DispatchResult(true);
} }
@ -1655,7 +1655,7 @@ DispatchResult LyXText::moveDown()
{ {
if (cursorRow() == lastRow()) if (cursorRow() == lastRow())
return DispatchResult(false, FINISHED_DOWN); return DispatchResult(false, FINISHED_DOWN);
cursorDown(bv()); cursorDown(false);
clearSelection(); clearSelection();
return DispatchResult(true); return DispatchResult(true);
} }

View File

@ -1585,13 +1585,13 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
case LFUN_FINISHED_LEFT: case LFUN_FINISHED_LEFT:
lyxerr << "swallow LFUN_FINISHED_LEFT" << endl; lyxerr << "swallow LFUN_FINISHED_LEFT" << endl;
if (rtl()) if (rtl())
cursorRight(bv); cursorRight(true);
break; break;
case LFUN_FINISHED_RIGHT: case LFUN_FINISHED_RIGHT:
lyxerr << "swallow LFUN_FINISHED_RIGHT" << endl; lyxerr << "swallow LFUN_FINISHED_RIGHT" << endl;
if (!rtl()) if (!rtl())
cursorRight(bv); cursorRight(true);
break; break;
case LFUN_FINISHED_UP: case LFUN_FINISHED_UP:
@ -1600,7 +1600,7 @@ DispatchResult LyXText::dispatch(FuncRequest const & cmd)
case LFUN_FINISHED_DOWN: case LFUN_FINISHED_DOWN:
lyxerr << "swallow LFUN_FINISHED_DOWN" << endl; lyxerr << "swallow LFUN_FINISHED_DOWN" << endl;
cursorRight(bv); cursorRight(true);
break; break;
default: default: