changeset 61:adba10dfa908

Implemented the "Defaults" button for the key bindings options subpage.
author madcatzinc@35b17cf1-18cd-47ff-9ca3-31d6b526ef09
date Fri, 03 May 2013 23:24:58 +0000
parents a710bedc1ec4
children c22f1accec43
files CyborgMMO7.lua Localisation.lua OptionPage.xml
diffstat 3 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/CyborgMMO7.lua	Fri May 03 23:24:53 2013 +0000
+++ b/CyborgMMO7.lua	Fri May 03 23:24:58 2013 +0000
@@ -430,6 +430,15 @@
 	CyborgMMO_SetCyborgHeadButton(true)
 end
 
+function CyborgMMO_SetDefaultKeyBindings()
+	for mode=1,RAT7.MODES do
+		for button=1,RAT7.BUTTONS do
+			local k = (mode - 1) * RAT7.BUTTONS + button
+			CyborgMMO_ProfileKeyBindings[k] = CyborgMMO_DefaultKeyBindings[k]
+			CyborgMMO_SetBindingButtonText(string.format("CyborgMMO_OptionPageRebindMouseRow%XMode%d", button, mode))
+		end
+	end
+end
 
 function CyborgMMO_SetupModeCallbacks(modeNum)
 	local fn = function()
--- a/Localisation.lua	Fri May 03 23:24:53 2013 +0000
+++ b/Localisation.lua	Fri May 03 23:24:58 2013 +0000
@@ -437,7 +437,11 @@
 CyborgMMO_StringTable = StringTables[locale] or StringTables[default_locale]
 
 -- key bindings are saved and will be replaced by SavedVariables
-CyborgMMO_ProfileKeyBindings = DefaultKeyBindings[locale] or DefaultKeyBindings[default_locale]
+CyborgMMO_DefaultKeyBindings = DefaultKeyBindings[locale] or DefaultKeyBindings[default_locale]
+CyborgMMO_ProfileKeyBindings = {}
+for k,v in pairs(CyborgMMO_DefaultKeyBindings) do
+	CyborgMMO_ProfileKeyBindings[k] = v
+end
 
 if locale ~= default_locale then
 	setmetatable(CyborgMMO_StringTable, {__index=StringTables[default_locale]})
--- a/OptionPage.xml	Fri May 03 23:24:53 2013 +0000
+++ b/OptionPage.xml	Fri May 03 23:24:58 2013 +0000
@@ -494,6 +494,7 @@
 			<OnLoad>
 				self.name = "Rebind keys"
 				self.parent = CyborgMMO_OptionPage
+				self.default = CyborgMMO_SetDefaultKeyBindings
 				InterfaceOptions_AddCategory(self)
 			</OnLoad>
 		</Scripts>