From 2e8fdbb54bf53f736c036fe04f3b002e9bedc1eb Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Fri, 21 Dec 2007 08:35:43 +0000 Subject: [PATCH] rename BufferView::center() to showCursor(). git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22222 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/BufferView.cpp | 14 +++++++------- src/BufferView.h | 9 ++++----- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 49aaa24183..8b720f2d33 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -374,7 +374,7 @@ void BufferView::processUpdateFlags(Update::flags flags) || flags == (Update::Decoration | Update::FitCursor)) { // tell the frontend to update the screen if needed. if (fitCursor()) { - center(); + showCursor(); return; } if (flags & Update::Decoration) { @@ -391,7 +391,7 @@ void BufferView::processUpdateFlags(Update::flags flags) if (full_metrics || !singleParUpdate()) { if (flags & Update::FitCursor && fitCursor()) { - center(); + showCursor(); return; } // 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 // refresh it: - center(); + showCursor(); } @@ -638,7 +638,7 @@ bool BufferView::moveToPosition(pit_type bottom_pit, pos_type bottom_pos, // So we need a redraw! buffer_.changed(); if (fitCursor()) - center(); + showCursor(); } 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 // done. @@ -1074,7 +1074,7 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd) break; case LFUN_SCREEN_RECENTER: - center(); + showCursor(); break; case LFUN_BIBTEX_DATABASE_ADD: { @@ -1174,7 +1174,7 @@ Update::flags BufferView::dispatch(FuncRequest const & cmd) Point p = getPos(cur, cur.boundary()); if (p.y_ < 0 || p.y_ > height_) { // The cursor is off-screen so recenter before proceeding. - center(); + showCursor(); p = getPos(cur, cur.boundary()); } scroll(cmd.action == LFUN_SCREEN_UP? - height_ : height_); diff --git a/src/BufferView.h b/src/BufferView.h index 31514e4808..c6c045a008 100644 --- a/src/BufferView.h +++ b/src/BufferView.h @@ -125,8 +125,10 @@ public: /// set the cursor based on the given TeX source row. void setCursorFromRow(int row); - /// center the document view around the cursor. - void center(); + /// Ensure the cursor is visible. + /// This method will automatically scroll and update the BufferView and updated + /// if needed. + void showCursor(); /// scroll down document by the given number of pixels. void scrollDown(int pixels); /// scroll up document by the given number of pixels. @@ -273,9 +275,6 @@ private: /// Buffer & buffer_; - /// - void updateOffsetRef(); - struct Private; Private * const d; }; -- 2.39.2