summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2011-08-27 18:30:50 +0000
committerRobert Jonsson <spamatica@gmail.com>2011-08-27 18:30:50 +0000
commited5aec7376ab2f4c68750c07ca4187d8b17c349d (patch)
treeeb494cbfdbeb78071c127147842fbf454488a0bc
parent390582dfac9951fdf1be5708763ebad4d52e3526 (diff)
mouse wheel behaviour changed
-rw-r--r--muse2/ChangeLog2
-rw-r--r--muse2/muse/midieditor.cpp2
-rw-r--r--muse2/muse/waveedit/waveview.cpp40
-rw-r--r--muse2/muse/widgets/canvas.cpp57
4 files changed, 50 insertions, 51 deletions
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);
}