From: Abdelrazak Younes Date: Tue, 1 Jul 2008 07:28:37 +0000 (+0000) Subject: up-port fixes and cleanups from BRANCH. X-Git-Tag: 1.6.10~4259 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=66bd5be5fc095f74a7517b8272a59994f0842e77;p=features.git up-port fixes and cleanups from BRANCH. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25408 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiWorkArea.cpp b/src/frontends/qt4/GuiWorkArea.cpp index 4c38b9cefd..0b6659a77c 100644 --- a/src/frontends/qt4/GuiWorkArea.cpp +++ b/src/frontends/qt4/GuiWorkArea.cpp @@ -775,11 +775,8 @@ void GuiWorkArea::wheelEvent(QWheelEvent * ev) { // Wheel rotation by one notch results in a delta() of 120 (see // documentation of QWheelEvent) - int delta = ev->delta() / 120; + int const delta = ev->delta() / 120; if (ev->modifiers() & Qt::ControlModifier) { - // Sanity check in case the wheel mouse is set to one screen at a time. - if (delta > 1000) - delta = 20; lyxrc.zoom -= 5 * delta; if (lyxrc.zoom < 10) lyxrc.zoom = 10; @@ -787,23 +784,29 @@ void GuiWorkArea::wheelEvent(QWheelEvent * ev) // painting so we must reset it. QPixmapCache::clear(); guiApp->fontLoader().update(); + ev->accept(); lyx::dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE)); - } else { - double scroll_value = qApp->wheelScrollLines() - * delta * verticalScrollBar()->singleStep(); - int const page_step = verticalScrollBar()->pageStep(); - // Test if the wheel mouse is set to one screen at a time. - if (fabs(scroll_value) > page_step) - scroll_value = scroll_value > 0 ? page_step : - page_step; - // Take into account user preference. - scroll_value *= lyxrc.mouse_wheel_speed; - LYXERR(Debug::SCROLLING, "wheelScrollLines = " << qApp->wheelScrollLines() - << " delta = " << ev->delta() << " scroll_value = " << scroll_value - << " page_step = " << page_step); - // Now scroll. - verticalScrollBar()->setValue(verticalScrollBar()->value() - - int(scroll_value)); + return; } + + // Take into account the desktop wide settings. + int const lines = qApp->wheelScrollLines(); + int const page_step = verticalScrollBar()->pageStep(); + // Test if the wheel mouse is set to one screen at a time. + int scroll_value = lines > page_step + ? page_step : lines * verticalScrollBar()->singleStep(); + + // Take into account the rotation. + scroll_value *= delta; + + // Take into account user preference. + scroll_value *= lyxrc.mouse_wheel_speed; + LYXERR(Debug::SCROLLING, "wheelScrollLines = " << lines + << " delta = " << delta << " scroll_value = " << scroll_value + << " page_step = " << page_step); + // Now scroll. + verticalScrollBar()->setValue(verticalScrollBar()->value() - scroll_value); + ev->accept(); }