From c793da5368f062caff571279c4f6bb1233ac88fe Mon Sep 17 00:00:00 2001 From: JoshuaJB Date: Sat, 21 Jun 2014 00:25:12 +0000 Subject: [PATCH] Don't allow changeing disabled dropdowns using the scrollwheel. Also corrects some things in b9a4af4cc6. This was SVN commit r15406. --- binaries/data/mods/public/gui/gamesetup/gamesetup.js | 2 +- binaries/data/mods/public/gui/lobby/lobby.js | 2 +- source/gui/CDropDown.cpp | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/binaries/data/mods/public/gui/gamesetup/gamesetup.js b/binaries/data/mods/public/gui/gamesetup/gamesetup.js index d44cd5c522..8630699e40 100644 --- a/binaries/data/mods/public/gui/gamesetup/gamesetup.js +++ b/binaries/data/mods/public/gui/gamesetup/gamesetup.js @@ -1058,7 +1058,7 @@ function onGameAttributesChange() var startingResourcesText = Engine.GetGUIObjectByName("startingResourcesText"); var gameSpeedText = Engine.GetGUIObjectByName("gameSpeedText"); - // Josh 20.6.2014: Not quite sure why we check for undefined on these properties, that shouldn't ever happen (?) + // We have to check for undefined on these properties as not all maps define them. var sizeIdx = (mapSettings.Size !== undefined && g_MapSizes.tiles.indexOf(mapSettings.Size) != -1 ? g_MapSizes.tiles.indexOf(mapSettings.Size) : g_MapSizes["default"]); var speedIdx = (g_GameAttributes.gameSpeed !== undefined && g_GameSpeeds.speeds.indexOf(g_GameAttributes.gameSpeed) != -1) ? g_GameSpeeds.speeds.indexOf(g_GameAttributes.gameSpeed) : g_GameSpeeds["default"]; var victoryIdx = (mapSettings.GameType !== undefined && VICTORY_DATA.indexOf(mapSettings.GameType) != -1 ? VICTORY_DATA.indexOf(mapSettings.GameType) : VICTORY_DEFAULTIDX); diff --git a/binaries/data/mods/public/gui/lobby/lobby.js b/binaries/data/mods/public/gui/lobby/lobby.js index 20697a67f0..583d1df445 100644 --- a/binaries/data/mods/public/gui/lobby/lobby.js +++ b/binaries/data/mods/public/gui/lobby/lobby.js @@ -419,7 +419,7 @@ function joinSelectedGame() } // Open Multiplayer connection window with join option. - Engine.PushGuiPage("page_gamesetup_mp.xml", { multiplayerGameType: "join", name: sname, ip: "127.0.0.1", rating: g_userRating }); + Engine.PushGuiPage("page_gamesetup_mp.xml", { multiplayerGameType: "join", name: sname, ip: sip, rating: g_userRating }); } } diff --git a/source/gui/CDropDown.cpp b/source/gui/CDropDown.cpp index b998800711..2a0c881511 100644 --- a/source/gui/CDropDown.cpp +++ b/source/gui/CDropDown.cpp @@ -231,8 +231,11 @@ void CDropDown::HandleMessage(SGUIMessage &Message) case GUIM_MOUSE_WHEEL_DOWN: { + bool enabled; + GUI::GetSetting(this, "enabled", enabled); + // Don't switch elements by scrolling when open, causes a confusing interaction between this and the scrollbar. - if (m_Open) + if (m_Open || !enabled) break; GUI::GetSetting(this, "selected", m_ElementHighlight); @@ -246,8 +249,11 @@ void CDropDown::HandleMessage(SGUIMessage &Message) case GUIM_MOUSE_WHEEL_UP: { + bool enabled; + GUI::GetSetting(this, "enabled", enabled); + // Don't switch elements by scrolling when open, causes a confusing interaction between this and the scrollbar. - if (m_Open) + if (m_Open || !enabled) break; GUI::GetSetting(this, "selected", m_ElementHighlight);