diff --git a/src/bme/bme_win.c b/src/bme/bme_win.c index caf0cbe..0f296d5 100644 --- a/src/bme/bme_win.c +++ b/src/bme/bme_win.c @@ -42,6 +42,7 @@ unsigned win_mousexrel = 0; unsigned win_mouseyrel = 0; unsigned win_mousebuttons = 0; int win_mousemode = MOUSE_FULLSCREEN_HIDDEN; +float win_mouseywheel = 0.f; unsigned char win_keystate[SDL_SCANCODE_COUNT] = {0}; // Static variables @@ -123,6 +124,7 @@ void win_checkmessages(void) unsigned keynum; win_activateclick = 0; + win_mouseywheel = 0.f; SDL_PumpEvents(); @@ -192,6 +194,10 @@ void win_checkmessages(void) } break; + case SDL_EVENT_MOUSE_WHEEL: + win_mouseywheel = event.wheel.y; + break; + case SDL_EVENT_QUIT: win_quitted = 1; break; diff --git a/src/bme/bme_win.h b/src/bme/bme_win.h index 5aa7202..19fd2e4 100644 --- a/src/bme/bme_win.h +++ b/src/bme/bme_win.h @@ -19,6 +19,7 @@ extern unsigned win_mousexrel; extern unsigned win_mouseyrel; extern unsigned win_mousebuttons; extern int win_mousemode; +extern float win_mouseywheel; extern SDL_Joystick *joy[MAX_JOYSTICKS]; extern Sint16 joyx[MAX_JOYSTICKS]; extern Sint16 joyy[MAX_JOYSTICKS]; diff --git a/src/loadtrk.c b/src/loadtrk.c index 1cf5b44..ed70327 100644 --- a/src/loadtrk.c +++ b/src/loadtrk.c @@ -573,7 +573,7 @@ void waitkeymouse(void) getkey(); if ((rawkey) || (key)) break; if (win_quitted) break; - if (mouseb) break; + if (mouseb || (win_mouseywheel != 0.f)) break; } converthex(); @@ -683,6 +683,20 @@ void mousecommands(void) currentSonglen = songlen_stereo[esnum][eschn]; } + if (win_mouseywheel != 0.f) + { + if ((mousey >= dpos.patternsY) && + (mousey <= dpos.statusBottomY - 1) && + (mousex >= dpos.patternsX) && + (mousex <= dpos.patternsX + 11 + (maxChns-1)*13)) + { + if (win_mouseywheel > 0.f) + patternup(); + else if (win_mouseywheel < 0.f) + patterndown(); + } + } + if (!mouseb) return; // Pattern editpos & pattern number selection @@ -845,7 +859,6 @@ void mousecommands(void) if (mouseb & MOUSEB_RIGHT) previnstr(); } - // Table editpos for (c = 0; c < MAX_TABLES; c++) {