diff gui.lua @ 94:db1d5d09e5f5

Do not register '/loot' as a synonym any longer, as it becomes a builtin command in MoP.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Tue, 24 Jul 2012 23:04:51 +0000
parents ea20a28327b5
children 3546c7b55986
line wrap: on
line diff
--- a/gui.lua	Wed Jul 18 07:42:16 2012 +0000
+++ b/gui.lua	Tue Jul 24 23:04:51 2012 +0000
@@ -2126,7 +2126,6 @@
 		w = mkoption('gui_noob', [[Show UI Tips]], 0.85,
 			[[Toggles display of the "helpful tips" box on the right side.  Useful if you've just installed/upgraded.]])
 		grp:AddChild(w)
-		w = GUI:Create("Spacer") w:SetFullWidth(true) w:SetHeight(10) grp:AddChild(w)
 
 		-- reminder popup
 		w = mkoption ('popup_on_join', "Show reminder popup on new raid", 0.49,
@@ -2138,11 +2137,6 @@
 			[[Scroll to the bottom of the loot window (most recent entries) when displaying the GUI.]])
 		grp:AddChild(w)
 
-		-- /loot option
-		w = mkoption('register_slashloot', "Register /loot slash command on login", 0.49,
-			[[Register "/loot" as a slash command in addition to the normal "/ouroloot".  Relog to take effect.]])
-		grp:AddChild(w)
-
 		-- chatty boss mode
 		w = mkoption('chatty_on_kill', "Be chatty on boss kill", 0.49,
 			[[Print something to chat output when the boss mod tells Ouro Loot about a successful boss kill.]])
@@ -2177,7 +2171,7 @@
 			[[See description under +Help -- Handy Tips -- Prescanning> for instructions.]])
 		grp:AddChild(w)
 
-		w = GUI:Create("Spacer") w:SetFullWidth(true) w:SetHeight(1) grp:AddChild(w)
+		w = GUI:Create("Spacer") w:SetFullWidth(true) w:SetHeight(5) grp:AddChild(w)
 
 		-- possible keybindings
 		do
@@ -2206,6 +2200,45 @@
 			grp:AddChild(pair)
 		end
 
+		-- replacement for slashloot
+		do
+			local pair = GUI:Create("InlineGroup")
+			pair:SetLayout("List")
+			pair:SetRelativeWidth(0.49)
+			pair:SetTitle('Synonyms for "/ouroloot"')
+			local editbox, checkbox
+			editbox = mkbutton("EditBox", nil, opts.slash_synonyms,
+				[[Separate multiple synonyms with a comma.  Relog to take effect.]])
+			editbox:SetFullWidth(true)
+			editbox:SetLabel("Slash commands")
+			editbox:SetCallback("OnEnterPressed", function(_e,event,value)
+				-- Do the sanity checking here rather than at each login.
+				-- This is not foolproof.  That's okay.
+				local t = { strsplit(',', tostring(value)) }
+				for k,v in ipairs(t) do
+					v = v:trim()
+					if v:sub(1,1) ~= "/" then
+						v = "/" .. v
+					end
+					t[k] = v
+				end
+				value = table.concat(t,',')
+				_e:SetText(value)
+				opts.slash_synonyms = value
+			end)
+			editbox:SetDisabled(not opts.register_slash_synonyms)
+			checkbox = mkoption('register_slash_synonyms', "Register slash commands", 1,
+				[[Register these slash commands as synonyms for "/ouroloot".  Relog to take effect.]],
+				function (_w,_,value)
+					opts.register_slash_synonyms = value
+					editbox:SetDisabled(not opts.register_slash_synonyms)
+				end)
+			checkbox:SetFullWidth(true)
+			pair:AddChild(checkbox)
+			pair:AddChild(editbox)
+			grp:AddChild(pair)
+		end
+
 		-- chatty disposition/assignment changes
 		do
 			local chatgroup = GUI:Create("InlineGroup")
@@ -2259,10 +2292,7 @@
 		end
 
 		-- boss mod selection
-		w = GUI:Create("Spacer")
-		w:SetFullWidth(true)
-		w:SetHeight(2)
-		grp:AddChild(w)
+		w = GUI:Create("Spacer") w:SetFullWidth(true) w:SetHeight(2) grp:AddChild(w)
 		do
 			local list = {}
 			local current
@@ -2284,10 +2314,7 @@
 		end
 
 		-- item filters
-		w = GUI:Create("Spacer")
-		w:SetFullWidth(true)
-		w:SetHeight(2)
-		grp:AddChild(w)
+		w = GUI:Create("Spacer") w:SetFullWidth(true) w:SetHeight(2) grp:AddChild(w)
 		do
 			local warntext = "At least one of the items in the filter list was not in your game client's cache.  This is okay.  Just wait a few seconds, display some other Ouro Loot tab, and then display Options again."
 			local cache_warn, cache_warned = false, false