Give a sane behaviour to page up/down scrolling when clicking in the page scroll area of the scrollbar.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20287 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-09-15 13:59:26 +00:00
parent e99d97c127
commit 78b78ec6e1
4 changed files with 16 additions and 18 deletions

View File

@ -339,6 +339,7 @@ void BufferView::scrollDocView(int value)
int const h = tm.parMetrics(anchor_ref_).height();
offset_ref_ = int((bar * t.paragraphs().size() - anchor_ref_) * h);
updateMetrics(false);
buffer_.changed();
}

View File

@ -255,20 +255,6 @@ void WorkArea::updateScrollbar()
}
void WorkArea::scrollBufferView(int position)
{
stopBlinkingCursor();
buffer_view_->scrollDocView(position);
redraw();
if (lyxrc.cursor_follows_scrollbar) {
buffer_view_->setCursorFromScrollbar();
lyx_view_->updateLayoutChoice();
}
// Show the cursor immediately after any operation.
startBlinkingCursor();
}
void WorkArea::showCursor()
{
if (cursor_visible_)

View File

@ -111,8 +111,6 @@ protected:
void close();
///
void resizeBufferView();
///
void scrollBufferView(int position);
/// hide the visible cursor, if it is visible
void hideCursor();
/// show the cursor if it is not visible

View File

@ -241,9 +241,22 @@ void GuiWorkArea::setScrollbarParams(int h, int scroll_pos, int scroll_line_step
}
void GuiWorkArea::adjustViewWithScrollBar(int)
void GuiWorkArea::adjustViewWithScrollBar(int action)
{
scrollBufferView(verticalScrollBar()->sliderPosition());
stopBlinkingCursor();
if (action == QAbstractSlider::SliderPageStepAdd)
buffer_view_->scrollDown(viewport()->height());
else if (action == QAbstractSlider::SliderPageStepSub)
buffer_view_->scrollUp(viewport()->height());
else
buffer_view_->scrollDocView(verticalScrollBar()->sliderPosition());
if (lyxrc.cursor_follows_scrollbar) {
buffer_view_->setCursorFromScrollbar();
lyx_view_->updateLayoutChoice();
}
// Show the cursor immediately after any operation.
startBlinkingCursor();
QApplication::syncX();
}