From a6ac88a9472d16c35fe1dbdcc4b264570d5073bd Mon Sep 17 00:00:00 2001
From: Kalle Olavi Niemitalo <kon@iki.fi>
Date: Tue, 18 May 2010 02:27:38 +0300
Subject: [PATCHv2 3/3] Add hot key for "Show terrain attributes" in editor menu

Use this hot key also as the command key for when the menu is not open.
---
 languages/bos-fi.po             |   60 +++++++++++++++++++-------------------
 scripts/editor.lua              |    1 +
 scripts/menus/ingame/editor.lua |   10 +++++-
 3 files changed, 39 insertions(+), 32 deletions(-)

diff --git a/languages/bos-fi.po b/languages/bos-fi.po
index 02b7db8..b89d512 100644
--- a/languages/bos-fi.po
+++ b/languages/bos-fi.po
@@ -8,7 +8,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: boswars 2.6\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2010-05-22 10:42+0300\n"
+"POT-Creation-Date: 2010-05-18 02:23+0300\n"
 "PO-Revision-Date: 2010-05-18 01:41+0300\n"
 "Last-Translator: Kalle Olavi Niemitalo <kon@iki.fi>\n"
 "Language-Team: Kimmo Kalevi Merikivi <fi@li.org>\n"
@@ -18,11 +18,11 @@ msgstr ""
 "Language: fi\n"
 "X-Generator: KBabel 1.11.2\n"
 
-#: scripts/boswars.lua:127 scripts/menus/ingame/editor.lua:203
+#: scripts/boswars.lua:127 scripts/menus/ingame/editor.lua:209
 msgid "Energy"
 msgstr "Energia"
 
-#: scripts/boswars.lua:127 scripts/menus/ingame/editor.lua:215
+#: scripts/boswars.lua:127 scripts/menus/ingame/editor.lua:221
 msgid "Magma"
 msgstr "Magma"
 
@@ -90,7 +90,7 @@ msgid "File:"
 msgstr "Tiedosto:"
 
 #: scripts/guichan.lua:535 scripts/guichan.lua:742 scripts/guichan.lua:782
-#: scripts/menus/ingame/editor.lua:117 scripts/menus/network.lua:423
+#: scripts/menus/ingame/editor.lua:123 scripts/menus/network.lua:423
 #: scripts/menus/patch.lua:77
 msgid "Size:"
 msgstr "Koko:"
@@ -232,8 +232,8 @@ msgid "Create New Map"
 msgstr "Luo uusi kartta"
 
 #: scripts/guichan.lua:758 scripts/guichan.lua:813
-#: scripts/menus/campaigns.lua:62 scripts/menus/ingame/editor.lua:95
-#: scripts/menus/ingame/editor.lua:133 scripts/menus/ingame/editor.lua:238
+#: scripts/menus/campaigns.lua:62 scripts/menus/ingame/editor.lua:101
+#: scripts/menus/ingame/editor.lua:139 scripts/menus/ingame/editor.lua:244
 #: scripts/menus/ingame/game.lua:112 scripts/menus/ingame/game.lua:304
 #: scripts/menus/ingame/game.lua:352 scripts/menus/ingame/game.lua:365
 #: scripts/menus/network.lua:176 scripts/menus/network.lua:242
@@ -345,54 +345,54 @@ msgstr "paikkauksista, bugi-ilmoituksista, ideoista."
 msgid "Bos Wars Credits"
 msgstr "Bos Wars -tekijät"
 
+#: scripts/menus/ingame/editor.lua:33 scripts/menus/ingame/editor.lua:66
+msgid "Show ~!terrain attributes"
+msgstr "Näytä ~!maaston piirteet"
+
 # Tämä valikko aukeaa vasta editorin sisällä. Ei siis "editorivalikko"
 # joka kuulostaa että siitä voisi valita haluamansa editorin.
-#: scripts/menus/ingame/editor.lua:53
+#: scripts/menus/ingame/editor.lua:59
 msgid "Editor Menu"
 msgstr "Editorin valikko"
 
-#: scripts/menus/ingame/editor.lua:54 scripts/menus/ingame/game.lua:58
+#: scripts/menus/ingame/editor.lua:60 scripts/menus/ingame/game.lua:58
 msgid "Save (~<F11~>)"
 msgstr "Tallenna (~<F11~>)"
 
-#: scripts/menus/ingame/editor.lua:56
+#: scripts/menus/ingame/editor.lua:62
 msgid "Map Properties (~<F5~>)"
 msgstr "Kartan ominaisuudet (~<F5~>)"
 
-#: scripts/menus/ingame/editor.lua:58
+#: scripts/menus/ingame/editor.lua:64
 msgid "Player Properties (~<F6~>)"
 msgstr "Pelaajien ominaisuudet (~<F6~>)"
 
-#: scripts/menus/ingame/editor.lua:60
-msgid "Show terrain attributes"
-msgstr "Näytä maaston piirteet"
-
 # poistuu editorista päävalikkoon
-#: scripts/menus/ingame/editor.lua:65
+#: scripts/menus/ingame/editor.lua:71
 msgid "~!Exit to menu"
 msgstr "~!Poistu valikkoon"
 
-#: scripts/menus/ingame/editor.lua:67
+#: scripts/menus/ingame/editor.lua:73
 msgid "Return to the Editor (~<Esc~>)"
 msgstr "Palaa editoriin (~<Esc~>)"
 
-#: scripts/menus/ingame/editor.lua:76
+#: scripts/menus/ingame/editor.lua:82
 msgid "Save Map"
 msgstr "Tallenna kartta"
 
-#: scripts/menus/ingame/editor.lua:86 scripts/menus/ingame/game.lua:91
+#: scripts/menus/ingame/editor.lua:92 scripts/menus/ingame/game.lua:91
 msgid "~!Save"
 msgstr "~!Tallenna"
 
-#: scripts/menus/ingame/editor.lua:107
+#: scripts/menus/ingame/editor.lua:113
 msgid "Map Properties"
 msgstr "Kartan ominaisuudet"
 
-#: scripts/menus/ingame/editor.lua:109
+#: scripts/menus/ingame/editor.lua:115
 msgid "Map Description:"
 msgstr "Kartan kuvaus:"
 
-#: scripts/menus/ingame/editor.lua:126 scripts/menus/ingame/editor.lua:227
+#: scripts/menus/ingame/editor.lua:132 scripts/menus/ingame/editor.lua:233
 #: scripts/menus/ingame/game.lua:180 scripts/menus/ingame/game.lua:254
 #: scripts/menus/ingame/game.lua:533 scripts/menus/ingame/game.lua:559
 #: scripts/menus/network.lua:67 scripts/menus/options.lua:64
@@ -401,40 +401,40 @@ msgstr "Kartan kuvaus:"
 msgid "~!OK"
 msgstr "~!Valmis"
 
-#: scripts/menus/ingame/editor.lua:148
+#: scripts/menus/ingame/editor.lua:154
 msgid "Player Properties"
 msgstr "Pelaajien ominaisuudet"
 
-#: scripts/menus/ingame/editor.lua:157
+#: scripts/menus/ingame/editor.lua:163
 msgid "Type"
 msgstr "Tyyppi"
 
-#: scripts/menus/ingame/editor.lua:162
+#: scripts/menus/ingame/editor.lua:168
 #, fuzzy
 msgid "Person"
 msgstr "Pelaaja"
 
-#: scripts/menus/ingame/editor.lua:162
+#: scripts/menus/ingame/editor.lua:168
 msgid "Computer"
 msgstr "Tietokone"
 
-#: scripts/menus/ingame/editor.lua:162
+#: scripts/menus/ingame/editor.lua:168
 msgid "Rescue (Passive)"
 msgstr "Pelastettava (passiivinen)"
 
-#: scripts/menus/ingame/editor.lua:163
+#: scripts/menus/ingame/editor.lua:169
 msgid "Rescue (Active)"
 msgstr "Pelastettava (aktiivinen)"
 
-#: scripts/menus/ingame/editor.lua:163
+#: scripts/menus/ingame/editor.lua:169
 msgid "Neutral"
 msgstr "Puolueeton"
 
-#: scripts/menus/ingame/editor.lua:163
+#: scripts/menus/ingame/editor.lua:169
 msgid "Nobody"
 msgstr "Ei kukaan"
 
-#: scripts/menus/ingame/editor.lua:176
+#: scripts/menus/ingame/editor.lua:182
 msgid "AI"
 msgstr "Tekoäly"
 
diff --git a/scripts/editor.lua b/scripts/editor.lua
index 4ff4fe7..d622921 100644
--- a/scripts/editor.lua
+++ b/scripts/editor.lua
@@ -29,6 +29,7 @@
 
 Load("scripts/uilayout.lua")
 
+InitEditorIngameCommandKeys()
 HandleCommandKey = HandleEditorIngameCommandKey
 
 DefineIcon({
diff --git a/scripts/menus/ingame/editor.lua b/scripts/menus/ingame/editor.lua
index 5d30528..149243b 100644
--- a/scripts/menus/ingame/editor.lua
+++ b/scripts/menus/ingame/editor.lua
@@ -27,6 +27,12 @@
 --
 --      $Id: game.lua 453 2006-06-26 18:36:19Z feb $
 
+local terrainHotKey
+
+function InitEditorIngameCommandKeys()
+  terrainHotKey = UI:HotKeyOfCaption(_("Show ~!terrain attributes"))
+end
+
 function HandleEditorIngameCommandKey(key, ctrl, alt, shift)
   if ((key == "m" and alt) or key == "f10") then
     RunEditorIngameMenu()
@@ -36,7 +42,7 @@ function HandleEditorIngameCommandKey(key, ctrl, alt, shift)
     RunEditorMapPropertiesMenu()
   elseif (key == "f6") then
     RunEditorPlayerPropertiesMenu()
-  elseif (key == "t" and not (ctrl or alt)) then
+  elseif (key == terrainHotKey and not (ctrl or alt)) then
     Editor.ShowTerrainFlags = not Editor.ShowTerrainFlags
   else
     return false
@@ -57,7 +63,7 @@ function RunEditorIngameMenu(s)
     function() RunEditorMapPropertiesMenu() end)
   menu:addButton(_("Player Properties (~<F6~>)"), 16, 40 + (36 * 2),
     function() RunEditorPlayerPropertiesMenu() end)
-  showTerrain = menu:addCheckBox(_("Show terrain attributes"), 16, 40 + (36 * 3),
+  showTerrain = menu:addCheckBox(_("Show ~!terrain attributes"), 16, 40 + (36 * 3),
     function() Editor.ShowTerrainFlags = showTerrain:isMarked() end)
   showTerrain:setFont(Fonts["large"])
   showTerrain:setMarked(Editor.ShowTerrainFlags)
-- 
1.7.1

