X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferView_pimpl.C;h=2f4848f6a26f47929fb957b5495823bdbed27ce5;hb=e0660589c44ac5f3b2920be0db260fff58290b53;hp=86621ce1499ff6388b2c7098221ce747a0ad7c08;hpb=5a15177281516f21416c3c123ae994a6d9d4c67d;p=lyx.git diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 86621ce149..2f4848f6a2 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -384,19 +384,26 @@ void BufferView::Pimpl::scrollDocView(int value) } -int BufferView::Pimpl::scroll(long time) +void BufferView::Pimpl::scroll(int lines) { - if (!buffer_) - return 0; + if (!buffer_) { + return; + } LyXText const * t = bv_->text; + int const line_height = t->defaultHeight(); + + // The new absolute coordinate + int new_first_y = t->first_y + lines * line_height; - double const diff = t->defaultHeight() - + double(time) * double(time) * 0.125; + // Restrict to a valid value + new_first_y = std::min(t->height - 4 * line_height, new_first_y); + new_first_y = std::max(0, new_first_y); - scrollDocView(int(diff)); + scrollDocView(new_first_y); + + // Update the scrollbar. workarea().setScrollbarParams(t->height, t->first_y, t->defaultHeight()); - return 0; } @@ -1119,8 +1126,11 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev) InsetCitation * inset = new InsetCitation(p); if (!insertInset(inset)) delete inset; - else + else { + inset->setLoadingBuffer(bv_->buffer(), false); updateInset(inset, true); + } + } break;