Reverse audio display scrolling on Mac to have natural scrolling directions for four-way scrolling devices. (Unfortunately those also exist for Windows and other systems, can't support those properly ATM.)

Originally committed to SVN as r1569.
This commit is contained in:
Niels Martin Hansen 2007-09-21 21:00:41 +00:00
parent f22a5b2838
commit a36a60375e
1 changed files with 7 additions and 1 deletions

View File

@ -1354,7 +1354,13 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
// Zoom
if (zoom) {
#ifdef __APPLE__
// Reverse scroll directions on Apple... ugly hack
// Otherwise left=right and right=left on systems that support four-way scrolling.
int step = -event.GetWheelRotation() / event.GetWheelDelta();
#else
int step = event.GetWheelRotation() / event.GetWheelDelta();
#endif
int value = box->HorizontalZoom->GetValue()+step;
box->HorizontalZoom->SetValue(value);
SetSamplesPercent(value,true,float(x)/float(w));
@ -1362,7 +1368,7 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event) {
// Scroll
else {
int step = event.GetWheelRotation() * w / 360;
int step = -event.GetWheelRotation() * w / 360;
UpdatePosition(Position+step,false);
UpdateImage();
}