rename BufferView::center() to showCursor().

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22222 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-12-21 08:35:43 +00:00
parent 7998dfd948
commit 2e8fdbb54b
2 changed files with 11 additions and 12 deletions

View File

@ -374,7 +374,7 @@ void BufferView::processUpdateFlags(Update::flags flags)
|| flags == (Update::Decoration | Update::FitCursor)) { || flags == (Update::Decoration | Update::FitCursor)) {
// tell the frontend to update the screen if needed. // tell the frontend to update the screen if needed.
if (fitCursor()) { if (fitCursor()) {
center(); showCursor();
return; return;
} }
if (flags & Update::Decoration) { if (flags & Update::Decoration) {
@ -391,7 +391,7 @@ void BufferView::processUpdateFlags(Update::flags flags)
if (full_metrics || !singleParUpdate()) { if (full_metrics || !singleParUpdate()) {
if (flags & Update::FitCursor && fitCursor()) { if (flags & Update::FitCursor && fitCursor()) {
center(); showCursor();
return; return;
} }
// We have to update the full screen metrics. // We have to update the full screen metrics.
@ -415,7 +415,7 @@ void BufferView::processUpdateFlags(Update::flags flags)
// The screen needs to be recentered around the cursor position so // The screen needs to be recentered around the cursor position so
// refresh it: // refresh it:
center(); showCursor();
} }
@ -638,7 +638,7 @@ bool BufferView::moveToPosition(pit_type bottom_pit, pos_type bottom_pos,
// So we need a redraw! // So we need a redraw!
buffer_.changed(); buffer_.changed();
if (fitCursor()) if (fitCursor())
center(); showCursor();
} }
return success; return success;
@ -667,7 +667,7 @@ int BufferView::workWidth() const
} }
void BufferView::center() void BufferView::showCursor()
{ {
// We are not properly started yet, delay until resizing is // We are not properly started yet, delay until resizing is
// done. // done.
@ -1074,7 +1074,7 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
break; break;
case LFUN_SCREEN_RECENTER: case LFUN_SCREEN_RECENTER:
center(); showCursor();
break; break;
case LFUN_BIBTEX_DATABASE_ADD: { case LFUN_BIBTEX_DATABASE_ADD: {
@ -1174,7 +1174,7 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd)
Point p = getPos(cur, cur.boundary()); Point p = getPos(cur, cur.boundary());
if (p.y_ < 0 || p.y_ > height_) { if (p.y_ < 0 || p.y_ > height_) {
// The cursor is off-screen so recenter before proceeding. // The cursor is off-screen so recenter before proceeding.
center(); showCursor();
p = getPos(cur, cur.boundary()); p = getPos(cur, cur.boundary());
} }
scroll(cmd.action == LFUN_SCREEN_UP? - height_ : height_); scroll(cmd.action == LFUN_SCREEN_UP? - height_ : height_);

View File

@ -125,8 +125,10 @@ public:
/// set the cursor based on the given TeX source row. /// set the cursor based on the given TeX source row.
void setCursorFromRow(int row); void setCursorFromRow(int row);
/// center the document view around the cursor. /// Ensure the cursor is visible.
void center(); /// This method will automatically scroll and update the BufferView and updated
/// if needed.
void showCursor();
/// scroll down document by the given number of pixels. /// scroll down document by the given number of pixels.
void scrollDown(int pixels); void scrollDown(int pixels);
/// scroll up document by the given number of pixels. /// scroll up document by the given number of pixels.
@ -273,9 +275,6 @@ private:
/// ///
Buffer & buffer_; Buffer & buffer_;
///
void updateOffsetRef();
struct Private; struct Private;
Private * const d; Private * const d;
}; };