From ed5aec7376ab2f4c68750c07ca4187d8b17c349d Mon Sep 17 00:00:00 2001 From: Robert Jonsson Date: Sat, 27 Aug 2011 18:30:50 +0000 Subject: mouse wheel behaviour changed --- muse2/ChangeLog | 2 ++ muse2/muse/midieditor.cpp | 2 -- muse2/muse/waveedit/waveview.cpp | 40 ++++++++++++++-------------- muse2/muse/widgets/canvas.cpp | 57 ++++++++++++++++++++-------------------- 4 files changed, 50 insertions(+), 51 deletions(-) (limited to 'muse2') diff --git a/muse2/ChangeLog b/muse2/ChangeLog index d5dd93ce..aa7b65d1 100644 --- a/muse2/ChangeLog +++ b/muse2/ChangeLog @@ -1,3 +1,5 @@ +28.08.2011: + - Changed mousewheel behaviour, vertical scrolling is default and horizontal scrolling (shift) is reversed (rj) 17.08.2011: - Convert some Qt3 style coding in ComboBox to Qt4 in terms of menu entry handling. (Orcan) - Add mouse wheel support to ComboBox. (Orcan) diff --git a/muse2/muse/midieditor.cpp b/muse2/muse/midieditor.cpp index f4d21320..ce6c52f8 100644 --- a/muse2/muse/midieditor.cpp +++ b/muse2/muse/midieditor.cpp @@ -228,7 +228,6 @@ void MidiEditor::setCurCanvasPart(Part* part) void MidiEditor::horizontalZoomIn() { - printf("zoom in \n"); int mag = hscroll->mag(); int zoomlvl = ScrollScale::getQuickZoomLevel(mag); if (zoomlvl < 23) @@ -242,7 +241,6 @@ void MidiEditor::horizontalZoomIn() void MidiEditor::horizontalZoomOut() { - printf("zoom out \n"); int mag = hscroll->mag(); int zoomlvl = ScrollScale::getQuickZoomLevel(mag); if (zoomlvl > 1) diff --git a/muse2/muse/waveedit/waveview.cpp b/muse2/muse/waveedit/waveview.cpp index cd798c40..236e2588 100644 --- a/muse2/muse/waveedit/waveview.cpp +++ b/muse2/muse/waveedit/waveview.cpp @@ -396,35 +396,35 @@ void WaveView::wheelEvent(QWheelEvent* ev) bool ctrl = keyState & Qt::ControlModifier; if (shift) { // scroll vertically - emit mouseWheelMoved(ev->delta() / 10); + int delta = -ev->delta() / WHEEL_DELTA; + int xpixelscale = 5*fast_log10(rmapxDev(1)); - } else if (ctrl) { // zoom horizontally - if (ev->delta()>0) - emit horizontalZoomIn(); - else - emit horizontalZoomOut(); - } else { // scroll horizontally - int delta = ev->delta() / WHEEL_DELTA; - int xpixelscale = 5*fast_log10(rmapxDev(1)); + if (xpixelscale <= 0) + xpixelscale = 1; + int scrollstep = WHEEL_STEPSIZE * (delta); + ///if (ev->state() == Qt::ShiftModifier) + // if (((QInputEvent*)ev)->modifiers() == Qt::ShiftModifier) + scrollstep = scrollstep / 10; - if (xpixelscale <= 0) - xpixelscale = 1; + int newXpos = xpos + xpixelscale * scrollstep; - int scrollstep = WHEEL_STEPSIZE * (delta); - ///if (ev->state() == Qt::ShiftModifier) -// if (((QInputEvent*)ev)->modifiers() == Qt::ShiftModifier) - scrollstep = scrollstep / 10; + if (newXpos < 0) + newXpos = 0; - int newXpos = xpos + xpixelscale * scrollstep; + //setYPos(newYpos); + emit horizontalScroll((unsigned)newXpos); - if (newXpos < 0) - newXpos = 0; - //setYPos(newYpos); - emit horizontalScroll((unsigned)newXpos); + } else if (ctrl) { // zoom horizontally + if (ev->delta()>0) + emit horizontalZoomIn(); + else + emit horizontalZoomOut(); + } else { // scroll horizontally + emit mouseWheelMoved(ev->delta() / 10); } } diff --git a/muse2/muse/widgets/canvas.cpp b/muse2/muse/widgets/canvas.cpp index c7186a2d..6491b585 100644 --- a/muse2/muse/widgets/canvas.cpp +++ b/muse2/muse/widgets/canvas.cpp @@ -465,25 +465,25 @@ void Canvas::wheelEvent(QWheelEvent* ev) bool shift = keyState & Qt::ShiftModifier; bool ctrl = keyState & Qt::ControlModifier; - if (shift) { // scroll vertically - int delta = ev->delta() / WHEEL_DELTA; - int ypixelscale = rmapyDev(1); + if (shift) { // scroll horizontally + int delta = -ev->delta() / WHEEL_DELTA; + int xpixelscale = 5*fast_log10(rmapxDev(1)); - if (ypixelscale <= 0) - ypixelscale = 1; + if (xpixelscale <= 0) + xpixelscale = 1; - int scrollstep = WHEEL_STEPSIZE * (-delta); - ///if (ev->state() == Qt::ShiftModifier) -// if (((QInputEvent*)ev)->modifiers() == Qt::ShiftModifier) - scrollstep = scrollstep / 2; + int scrollstep = WHEEL_STEPSIZE * (delta); + ///if (ev->state() == Qt::ShiftModifier) + // if (((QInputEvent*)ev)->modifiers() == Qt::ShiftModifier) + scrollstep = scrollstep / 10; - int newYpos = ypos + ypixelscale * scrollstep; + int newXpos = xpos + xpixelscale * scrollstep; - if (newYpos < 0) - newYpos = 0; + if (newXpos < 0) + newXpos = 0; - //setYPos(newYpos); - emit verticalScroll((unsigned)newYpos); + //setYPos(newYpos); + emit horizontalScroll((unsigned)newXpos); } else if (ctrl) { // zoom horizontally if (ev->delta()>0) @@ -491,26 +491,25 @@ void Canvas::wheelEvent(QWheelEvent* ev) else emit horizontalZoomOut(); - } else { // scroll horizontally - int delta = ev->delta() / WHEEL_DELTA; - int xpixelscale = 5*fast_log10(rmapxDev(1)); + } else { // scroll vertically + int delta = ev->delta() / WHEEL_DELTA; + int ypixelscale = rmapyDev(1); + if (ypixelscale <= 0) + ypixelscale = 1; - if (xpixelscale <= 0) - xpixelscale = 1; + int scrollstep = WHEEL_STEPSIZE * (-delta); + ///if (ev->state() == Qt::ShiftModifier) + // if (((QInputEvent*)ev)->modifiers() == Qt::ShiftModifier) + scrollstep = scrollstep / 2; - int scrollstep = WHEEL_STEPSIZE * (delta); - ///if (ev->state() == Qt::ShiftModifier) -// if (((QInputEvent*)ev)->modifiers() == Qt::ShiftModifier) - scrollstep = scrollstep / 10; + int newYpos = ypos + ypixelscale * scrollstep; - int newXpos = xpos + xpixelscale * scrollstep; + if (newYpos < 0) + newYpos = 0; - if (newXpos < 0) - newXpos = 0; - - //setYPos(newYpos); - emit horizontalScroll((unsigned)newXpos); + //setYPos(newYpos); + emit verticalScroll((unsigned)newYpos); } -- cgit v1.2.3