From 52dc147f8c950007e8b49c0e130e256ef5520af8 Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 29 Dec 2007 00:31:15 +0000 Subject: Added mouse scrolling support to action menus and the save/restore dialog svn-id: r30065 --- engines/lure/menu.cpp | 15 +++++++++++++-- engines/lure/surface.cpp | 30 +++++++++++++++++++++--------- 2 files changed, 34 insertions(+), 11 deletions(-) diff --git a/engines/lure/menu.cpp b/engines/lure/menu.cpp index 41e505bf5d..2699d4847d 100644 --- a/engines/lure/menu.cpp +++ b/engines/lure/menu.cpp @@ -527,9 +527,20 @@ uint16 PopupMenu::Show(int numEntries, const char *actions[]) { if (e.quitFlag) { selectedIndex = 0xffff; goto bail_out; - } - else if (e.type() == Common::EVENT_KEYDOWN) { + } else if (e.type() == Common::EVENT_WHEELUP) { + // Scroll upwards + if (selectedIndex > 0) { + --selectedIndex; + refreshFlag = true; + } + } else if (e.type() == Common::EVENT_WHEELDOWN) { + // Scroll downwards + if (selectedIndex < numEntries - 1) { + ++selectedIndex; + refreshFlag = true; + } + } else if (e.type() == Common::EVENT_KEYDOWN) { uint16 keycode = e.event().kbd.keycode; if (((keycode == Common::KEYCODE_KP8) || (keycode == Common::KEYCODE_UP)) && (selectedIndex > 0)) { diff --git a/engines/lure/surface.cpp b/engines/lure/surface.cpp index ac5716f676..10526f8469 100644 --- a/engines/lure/surface.cpp +++ b/engines/lure/surface.cpp @@ -895,17 +895,29 @@ bool SaveRestoreDialog::show(bool saveDialog) { abortFlag = true; break; } - if (events.type() == Common::EVENT_MOUSEMOVE) { + if (events.type() == Common::EVENT_MOUSEMOVE || + events.type() == Common::EVENT_WHEELUP || events.type() == Common::EVENT_WHEELDOWN) { // Mouse movement int lineNum; - if ((mouse.x() < (SAVE_DIALOG_X + DIALOG_EDGE_SIZE)) || - (mouse.x() >= (SAVE_DIALOG_X + s->width() - DIALOG_EDGE_SIZE)) || - (mouse.y() < SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y) || - (mouse.y() >= SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + numSaves * FONT_HEIGHT)) - // Outside displayed lines - lineNum = -1; - else - lineNum = (mouse.y() - (SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y)) / FONT_HEIGHT; + + if (events.type() == Common::EVENT_MOUSEMOVE) { + if ((mouse.x() < (SAVE_DIALOG_X + DIALOG_EDGE_SIZE)) || + (mouse.x() >= (SAVE_DIALOG_X + s->width() - DIALOG_EDGE_SIZE)) || + (mouse.y() < SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y) || + (mouse.y() >= SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + numSaves * FONT_HEIGHT)) + // Outside displayed lines + lineNum = -1; + else + lineNum = (mouse.y() - (SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y)) / FONT_HEIGHT; + } else if (events.type() == Common::EVENT_WHEELUP) { + if (selectedLine > 0) { + lineNum = selectedLine - 1; + } + } else if (events.type() == Common::EVENT_WHEELDOWN) { + if (selectedLine < numSaves - 1) { + lineNum = selectedLine + 1; + } + } if (lineNum != selectedLine) { if (selectedLine != -1) -- cgit v1.2.3