Ticket #8764: lure_mouse_scroll.patch

File lure_mouse_scroll.patch, 1.8 KB (added by bluegr, 16 years ago)

Mouse scrolling for the save and load dialogs

  • surface.cpp

     
    894894                                        abortFlag = true;
    895895                                        break;
    896896                                }
    897                                 if (events.type() == Common::EVENT_MOUSEMOVE) {
     897                                if (events.type() == Common::EVENT_MOUSEMOVE ||
     898                                        events.type() == Common::EVENT_WHEELUP || events.type() == Common::EVENT_WHEELDOWN) {
    898899                                        // Mouse movement
    899900                                        int lineNum;
    900                                         if ((mouse.x() < (SAVE_DIALOG_X + DIALOG_EDGE_SIZE)) ||
    901                                                 (mouse.x() >= (SAVE_DIALOG_X + s->width() - DIALOG_EDGE_SIZE)) ||
    902                                                 (mouse.y() < SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y) ||
    903                                                 (mouse.y() >= SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + numSaves * FONT_HEIGHT))
    904                                                 // Outside displayed lines
    905                                                 lineNum = -1;
    906                                         else
    907                                                 lineNum = (mouse.y() - (SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y)) / FONT_HEIGHT;
    908901
     902                                        if (events.type() == Common::EVENT_MOUSEMOVE) {
     903                                                if ((mouse.x() < (SAVE_DIALOG_X + DIALOG_EDGE_SIZE)) ||
     904                                                        (mouse.x() >= (SAVE_DIALOG_X + s->width() - DIALOG_EDGE_SIZE)) ||
     905                                                        (mouse.y() < SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y) ||
     906                                                        (mouse.y() >= SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y + numSaves * FONT_HEIGHT))
     907                                                        // Outside displayed lines
     908                                                        lineNum = -1;
     909                                                else
     910                                                        lineNum = (mouse.y() - (SAVE_DIALOG_Y + SR_SAVEGAME_NAMES_Y)) / FONT_HEIGHT;
     911                                        } else if (events.type() == Common::EVENT_WHEELUP) {
     912                                                if (selectedLine > 0) {
     913                                                        lineNum = selectedLine - 1;
     914                                                }
     915                                        } else if (events.type() == Common::EVENT_WHEELDOWN) {
     916                                                if (selectedLine < DIALOG_EDGE_SIZE) {
     917                                                        lineNum = selectedLine + 1;
     918                                                }
     919                                        }
     920
    909921                                        if (lineNum != selectedLine) {
    910922                                                if (selectedLine != -1)
    911923                                                        // Deselect previously selected line