From: Jürgen Vigna Date: Wed, 24 Apr 2002 15:17:33 +0000 (+0000) Subject: Fix mouse wheel handling. Added code to interpret wheel-value as % of X-Git-Tag: 1.6.10~19351 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=9b75c4a8480667ce6ef82c0cf2924c153c2bcae1;p=lyx.git Fix mouse wheel handling. Added code to interpret wheel-value as % of workarea-height, but #ifdef'd out because Lars doesn't like it in now. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4055 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/BufferView_pimpl.C b/src/BufferView_pimpl.C index 65ca816d4b..043a1410d2 100644 --- a/src/BufferView_pimpl.C +++ b/src/BufferView_pimpl.C @@ -476,19 +476,24 @@ void BufferView::Pimpl::scrollCB(double value) int BufferView::Pimpl::scrollUp(long time) { - if (!buffer_) return 0; - if (!screen_.get()) return 0; + if (!buffer_ || !screen_.get()) + return 0; double value = workarea_.getScrollbarValue(); - if (value == 0) return 0; + if (value == 0) + return 0; +#if 1 float add_value = (bv_->text->defaultHeight() + float(time) * float(time) * 0.125); if (add_value > workarea_.height()) add_value = float(workarea_.height() - bv_->text->defaultHeight()); +#else + float add_value = float(workarea_.height()) * float(time) / 100; +#endif value -= add_value; @@ -504,21 +509,26 @@ int BufferView::Pimpl::scrollUp(long time) int BufferView::Pimpl::scrollDown(long time) { - if (!buffer_) return 0; - if (!screen_.get()) return 0; + if (!buffer_ || !screen_.get()) + return 0; double value = workarea_.getScrollbarValue(); pair p = workarea_.getScrollbarBounds(); double const max = p.second; - if (value == max) return 0; + if (value == max) + return 0; +#if 1 float add_value = (bv_->text->defaultHeight() + float(time) * float(time) * 0.125); if (add_value > workarea_.height()) add_value = float(workarea_.height() - bv_->text->defaultHeight()); +#else + float add_value = float(workarea_.height()) * float(time) / 100; +#endif value += add_value; @@ -609,9 +619,8 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, if (!buffer_ || !screen_.get()) return; - Inset * inset_hit = checkInsetHit(bv_->text, xpos, ypos); - // ok ok, this is a hack. + // Why??? (Jug20020424) if (button == 4 || button == 5) { switch (button) { case 4: @@ -621,8 +630,14 @@ void BufferView::Pimpl::workAreaButtonPress(int xpos, int ypos, scrollDown(lyxrc.wheel_jump); break; } + // We shouldn't go further down as we really should only do the + // scrolling and be done with this. Otherwise we may open some + // dialogs (Jug 20020424). + return; } + Inset * inset_hit = checkInsetHit(bv_->text, xpos, ypos); + // Middle button press pastes if we have a selection // We do this here as if the selection was inside an inset // it could get cleared on the unlocking of the inset so @@ -826,7 +841,9 @@ void BufferView::Pimpl::leaveView() void BufferView::Pimpl::workAreaButtonRelease(int x, int y, unsigned int button) { - if (!buffer_ || !screen_.get()) return; + // do nothing if we used the mouse wheel + if (!buffer_ || !screen_.get() || button == 4 || button == 5) + return; // If we hit an inset, we have the inset coordinates in these // and inset_hit points to the inset. If we do not hit an diff --git a/src/ChangeLog b/src/ChangeLog index a232666746..7f1f7babea 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2002-04-24 Juergen Vigna + + * BufferView_pimpl.C (workAreaButtonPress): fix handling of mouse-wheel + (workAreaButtonRelease): don't do anything if it was a mouse-wheel + 2002-04-22 Angus Leeming * buffer.C (getBibkeyList): If using \bibliography, return the