Index: binaries/data/config/default.cfg =================================================================== --- binaries/data/config/default.cfg +++ binaries/data/config/default.cfg @@ -324,6 +324,9 @@ delete = Delete ; Delete the selected saved game asking confirmation noconfirmation = Shift ; Do not ask confirmation when deleting a game +[hotkey.gamesetup] +openMapBrowser = "O" ; Opens the map browser + [hotkey.session.queueunit] ; > UNIT TRAINING 1 = "Z" ; add first unit type to queue 2 = "X" ; add second unit type to queue Index: binaries/data/mods/public/gui/gamesetup/gamesetup.js =================================================================== --- binaries/data/mods/public/gui/gamesetup/gamesetup.js +++ binaries/data/mods/public/gui/gamesetup/gamesetup.js @@ -1164,6 +1164,10 @@ } deepfreeze(g_DefaultPlayerData); + + Engine.GetGUIObjectByName("mapBrowser").tooltip = sprintf( + translate("%(hotkey_openMapBrowser)s : Open map borowser."), + { "hotkey_openMapBrowser": colorizeHotkey("%(hotkey)s", "gamesetup.openMapBrowser") }); } /** @@ -2410,6 +2414,37 @@ updateGUIObjects(); } +function openMapBrowser() +{ + Engine.PushGuiPage("page_mapbrowser.xml", + { + "callback": "mapBrowserCallback", + "mapSelected": true, + "map": { + "type": g_GameAttributes.mapType, + "filter": g_GameAttributes.mapFilter, + "name": g_GameAttributes.map // includes the map path + } + }); +} + +/** + * Called after closing the dialog. + */ +function mapBrowserCallback(data) +{ + if (!g_IsController || !data.mapSelected) + return; + + if (g_Dropdowns.mapType.get() != data.map.type) + g_Dropdowns.mapType.select(g_Dropdowns.mapType.ids().indexOf(data.map.type)); + + g_Dropdowns.mapFilter.select(g_Dropdowns.mapFilter.ids().indexOf(data.map.filter)); + g_Dropdowns.mapSelection.select(g_Dropdowns.mapSelection.ids().indexOf(data.map.path + data.map.name)); + + updateGameAttributes(); +} + function openAIConfig(playerSlot) { g_LastViewedAIPlayer = playerSlot; Index: binaries/data/mods/public/gui/gamesetup/gamesetup.xml =================================================================== --- binaries/data/mods/public/gui/gamesetup/gamesetup.xml +++ binaries/data/mods/public/gui/gamesetup/gamesetup.xml @@ -20,7 +20,12 @@ selectPanel(undefined); + + + openMapBrowser(); + + @@ -139,6 +144,10 @@ + + + openMapBrowser(); + Index: binaries/data/mods/public/gui/gamesetup/sprites.xml =================================================================== --- binaries/data/mods/public/gui/gamesetup/sprites.xml +++ binaries/data/mods/public/gui/gamesetup/sprites.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + Index: binaries/data/mods/public/gui/gamesetup/styles.xml =================================================================== --- binaries/data/mods/public/gui/gamesetup/styles.xml +++ binaries/data/mods/public/gui/gamesetup/styles.xml @@ -7,4 +7,11 @@ sound_pressed="audio/interface/ui/ui_button_click.ogg" /> +