Ticket #4145: autocomplete_hotkey_tooltips_v2.patch
File autocomplete_hotkey_tooltips_v2.patch, 8.4 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/gui/common/color.js
function colorizeHotkey(text, hotkey) 142 142 "[color=\"" + g_HotkeyColor + "\"]" + 143 143 "\\[" + key + "]" + 144 144 "[/color]" 145 145 }); 146 146 } 147 148 /** 149 * The autocomplete hotkey is hardcoded in SDLK_TAB of CInput.cpp, 150 * as we don't want hotkeys interfering with typing text. 151 */ 152 function colorizeAutocompleteHotkey() 153 { 154 return sprintf(translate("Press %(hotkey)s to autocomplete playernames."), { 155 "hotkey": 156 "[color=\"" + g_HotkeyColor + "\"]" + 157 "\\[" + translateWithContext("hotkey", "Tab") + "]" + 158 "[/color]" 159 }); 160 } -
binaries/data/mods/public/gui/common/functions_utility_loadsave.js
function reallyDeleteGame(gameID) 73 73 error("Could not delete saved game: " + gameID); 74 74 75 75 // Run init again to refresh saved game list 76 76 init(); 77 77 } 78 79 function deleteTooltip() 80 { 81 let deleteTooltip = colorizeHotkey( 82 translate("Delete the selected entry using %(hotkey)s."), 83 "session.savedgames.delete"); 84 85 if (deleteTooltip) 86 deleteTooltip += colorizeHotkey( 87 " " + translate("Hold %(hotkey)s to delete without confirmation."), 88 "session.savedgames.noconfirmation"); 89 90 return deleteTooltip; 91 } -
binaries/data/mods/public/gui/gamesetup/gamesetup.js
function initGUIObjects() 292 292 initMultiplayerSettings(); 293 293 initPlayerAssignments(); 294 294 295 295 resizeMoreOptionsWindow(); 296 296 297 Engine.GetGUIObjectByName("chatInput").tooltip = colorizeAutocompleteHotkey(); 298 297 299 if (g_IsNetworked) 298 300 Engine.GetGUIObjectByName("chatInput").focus(); 299 301 300 302 if (g_IsController) 301 303 { -
binaries/data/mods/public/gui/lobby/lobby.js
function init(attribs) 222 222 223 223 // When rejoining the lobby after a game, we don't need to process presence changes 224 224 Engine.LobbyClearPresenceUpdates(); 225 225 updatePlayerList(); 226 226 updateSubject(Engine.LobbyGetRoomSubject()); 227 228 Engine.GetGUIObjectByName("chatInput").tooltip = colorizeAutocompleteHotkey(); 227 229 } 228 230 229 231 function returnToMainMenu() 230 232 { 231 233 Engine.StopXmppClient(); -
binaries/data/mods/public/gui/replaymenu/replay_menu.js
function init(data) 65 65 { 66 66 Engine.SwitchGuiPage("page_pregame.xml"); 67 67 return; 68 68 } 69 69 70 initHotkeyTooltips(); 70 71 displayReplayList(); 71 72 } 72 73 73 74 /** 74 75 * Store the list of replays loaded in C++ in g_Replays. … … function sanitizeGameAttributes(attribs) 183 184 if (!pData.Name) 184 185 pData.Name = ""; 185 186 }); 186 187 } 187 188 189 function initHotkeyTooltips() 190 { 191 Engine.GetGUIObjectByName("playersFilter").tooltip = 192 translate("Filter replays by typing one or more, partial or complete playernames.") + 193 " " + colorizeAutocompleteHotkey(); 194 195 Engine.GetGUIObjectByName("deleteReplayButton").tooltip = deleteTooltip(); 196 } 197 188 198 /** 189 199 * Filter g_Replays, fill the GUI list with that data and show the description of the current replay. 190 200 */ 191 201 function displayReplayList() 192 202 { -
binaries/data/mods/public/gui/replaymenu/replay_menu.xml
10 10 <script file="gui/common/settings.js" /> 11 11 12 12 <!-- Used to display message boxes. --> 13 13 <script file="gui/common/functions_global_object.js" /> 14 14 15 <!-- Used for engine + mod version checks .-->15 <!-- Used for engine + mod version checks and deleteTooltip --> 16 16 <script file="gui/common/functions_utility_loadsave.js" /> 17 17 18 18 <!-- Actual replay scripts after settings.js, as it initializes g_Settings. --> 19 19 <script file="gui/replaymenu/replay_menu.js" /> 20 20 <script file="gui/replaymenu/replay_actions.js" /> -
binaries/data/mods/public/gui/savedgames/load.js
function init() 32 32 gameSelection.selected = 0; 33 33 else if (gameSelection.selected >= savedGames.length) // happens when deleting the last saved game 34 34 gameSelection.selected = savedGames.length - 1; 35 35 else 36 36 selectionChanged(); 37 38 Engine.GetGUIObjectByName("deleteGameButton").tooltip = deleteTooltip(); 37 39 } 38 40 39 41 function selectionChanged() 40 42 { 41 43 let gameSelection = Engine.GetGUIObjectByName("gameSelection"); -
binaries/data/mods/public/gui/savedgames/save.js
function init(data) 35 35 g_Descriptions[game.id] = game.metadata.description || ""; 36 36 37 37 gameSelection.list = savedGames.map(game => generateLabel(game.metadata)); 38 38 gameSelection.list_data = savedGames.map(game => game.id); 39 39 gameSelection.selected = -1; 40 41 Engine.GetGUIObjectByName("deleteGameButton").tooltip = deleteTooltip(); 40 42 } 41 43 42 44 function saveGame() 43 45 { 44 46 let gameSelection = Engine.GetGUIObjectByName("gameSelection"); -
binaries/data/mods/public/gui/savedgames/save.xml
1 1 <?xml version="1.0" encoding="utf-8"?> 2 2 3 3 <objects> 4 4 5 <script file="gui/common/color.js"/> 5 6 <script file="gui/common/functions_global_object.js" /> 6 7 <script file="gui/common/functions_utility_loadsave.js" /> 7 8 <script file="gui/savedgames/save.js" /> 8 9 9 10 <!-- Add a translucent black background to fade out the page --> -
binaries/data/mods/public/gui/session/session.js
function init(initData, hotloadData) 291 291 292 292 // If in Atlas editor, disable the exit button 293 293 if (Engine.IsAtlasRunning()) 294 294 Engine.GetGUIObjectByName("menuExitButton").enabled = false; 295 295 296 initHotkeyTooltips();297 298 296 if (hotloadData) 299 297 g_Selection.selected = hotloadData.selection; 300 298 301 299 sendLobbyPlayerlistUpdate(); 302 300 onSimulationUpdate(); … … function init(initData, hotloadData) 311 309 // and it generates a massive amount of data to transmit and store 312 310 //setTimeout(function() { reportPerformance(5); }, 5000); 313 311 //setTimeout(function() { reportPerformance(60); }, 60000); 314 312 } 315 313 316 function initHotkeyTooltips() 314 /** 315 * Depends on the current player (g_IsObserver). 316 */ 317 function updateHotkeyTooltips() 317 318 { 319 Engine.GetGUIObjectByName("chatInput").tooltip = colorizeAutocompleteHotkey() + 320 colorizeHotkey("\n" + translate("Press %(hotkey)s to open the public chat."), "chat") + 321 colorizeHotkey( 322 "\n" + (g_IsObserver ? 323 translate("Press %(hotkey)s to open the observer chat.") : 324 translate("Press %(hotkey)s to open the ally chat.")), 325 "teamchat"); 326 318 327 Engine.GetGUIObjectByName("idleWorkerButton").tooltip = 319 328 colorizeHotkey("%(hotkey)s" + " ", "selection.idleworker") + 320 329 translate("Find idle worker"); 321 330 322 331 Engine.GetGUIObjectByName("tradeHelp").tooltip = … … function selectViewPlayer(playerID) 387 396 } 388 397 389 398 Engine.SetViewedPlayer(g_ViewedPlayer); 390 399 391 400 updateTopPanel(); 392 393 401 updateChatAddressees(); 402 updateHotkeyTooltips(); 394 403 395 404 // Update GUI and clear player-dependent cache 396 405 onSimulationUpdate(); 397 406 398 407 if (g_IsDiplomacyOpen)