Ticket #4145: autocomplete_hotkey_tooltips_v1.patch
File autocomplete_hotkey_tooltips_v1.patch, 5.8 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": "[color=\"" + g_HotkeyColor + "\"]" + "\\[Tab]" + "[/color]" 156 }); 157 } -
binaries/data/mods/public/gui/gamesetup/gamesetup.js
function initRadioButtons() 522 522 g_GameAttributes.settings.LastManStanding = false; 523 523 updateGameAttributes(); 524 524 }; 525 525 } 526 526 527 function updateTooltips() 528 { 529 Engine.GetGUIObjectByName("chatInput").tooltip = colorizeAutocompleteHotkey(); 530 } 531 527 532 /** 528 533 * If we're a network client, hide the controls and show the text instead. 529 534 */ 530 535 function hideControls() 531 536 { … … function updateGUIObjects() 1456 1461 pColorPicker.selected = g_PlayerColors.findIndex(col => sameColor(col, color)); 1457 1462 } 1458 1463 1459 1464 updateMapDescription(); 1460 1465 resizeMoreOptionsWindow(); 1466 updateTooltips(); 1461 1467 1462 1468 g_IsInGuiUpdate = false; 1463 1469 1464 1470 // Game attributes include AI settings, so update the player list 1465 1471 updatePlayerList(); -
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 updateTooltips(); 227 228 } 228 229 229 230 function returnToMainMenu() 230 231 { 231 232 Engine.StopXmppClient(); … … function filterGame(game) 296 297 return true; 297 298 298 299 return false; 299 300 } 300 301 302 function updateTooltips() 303 { 304 Engine.GetGUIObjectByName("chatInput").tooltip = colorizeAutocompleteHotkey(); 305 } 306 301 307 /** 302 308 * Update the subject GUI object. 303 309 * 304 310 * @param {string} newSubject 305 311 */ -
binaries/data/mods/public/gui/replaymenu/replay_menu.js
function displayReplayList() 220 220 replaySelection.list_data = list.directories || []; 221 221 222 222 replaySelection.selected = replaySelection.list.findIndex(directory => directory == g_SelectedReplayDirectory); 223 223 224 224 displayReplayDetails(); 225 updateTooltips(); 225 226 } 226 227 227 228 /** 228 229 * Shows preview image, description and player text in the right panel. 229 230 */ … … function displayReplayDetails() 265 266 Engine.GetGUIObjectByName("summaryButton").hidden = !Engine.HasReplayMetadata(replay.directory); 266 267 267 268 setMapPreviewImage("sgMapPreview", mapData.preview); 268 269 } 269 270 271 function updateTooltips() 272 { 273 Engine.GetGUIObjectByName("playersFilter").tooltip = 274 translate("Filter replays by typing one or more, partial or complete playernames.") + " " + 275 colorizeAutocompleteHotkey(); 276 277 let deleteTooltip = colorizeHotkey( 278 translate("Delete the selected replay using %(hotkey)s."), 279 "session.savedgames.delete"); 280 281 if (deleteTooltip) 282 deleteTooltip += " " + colorizeHotkey( 283 translate("Press %(hotkey)s to delete without confirmation."), 284 "session.savedgames.noconfirmation"); 285 286 Engine.GetGUIObjectByName("deleteReplayButton").tooltip = deleteTooltip; 287 } 288 270 289 /** 271 290 * Adds grey font if replay is not compatible. 272 291 */ 273 292 function greyout(text, isCompatible) 274 293 { -
binaries/data/mods/public/gui/session/session.js
function init(initData, hotloadData) 280 280 281 281 // If in Atlas editor, disable the exit button 282 282 if (Engine.IsAtlasRunning()) 283 283 Engine.GetGUIObjectByName("menuExitButton").enabled = false; 284 284 285 initHotkeyTooltips();285 updateTooltips(); 286 286 287 287 if (hotloadData) 288 288 g_Selection.selected = hotloadData.selection; 289 289 290 290 sendLobbyPlayerlistUpdate(); … … function init(initData, hotloadData) 300 300 // and it generates a massive amount of data to transmit and store 301 301 //setTimeout(function() { reportPerformance(5); }, 5000); 302 302 //setTimeout(function() { reportPerformance(60); }, 60000); 303 303 } 304 304 305 function initHotkeyTooltips()305 function updateTooltips() 306 306 { 307 Engine.GetGUIObjectByName("chatInput").tooltip = colorizeAutocompleteHotkey() + 308 colorizeHotkey("\n" + translate("Press %(hotkey)s to chat with everyone."), "chat") + 309 colorizeHotkey("\n" + 310 (g_IsObserver ? 311 translate("Press %(hotkey)s to chat with observers.") : 312 translate("Press %(hotkey)s to chat with allies.")), 313 "teamchat"); 314 307 315 Engine.GetGUIObjectByName("idleWorkerButton").tooltip = 308 316 colorizeHotkey("%(hotkey)s" + " ", "selection.idleworker") + 309 317 translate("Find idle worker"); 310 318 311 319 Engine.GetGUIObjectByName("tradeHelp").tooltip = … … function selectViewPlayer(playerID) 376 384 } 377 385 378 386 Engine.SetViewedPlayer(g_ViewedPlayer); 379 387 380 388 updateTopPanel(); 381 382 389 updateChatAddressees(); 390 updateTooltips(); 383 391 384 392 // Update GUI and clear player-dependent cache 385 393 onSimulationUpdate(); 386 394 387 395 if (g_IsDiplomacyOpen)