diff gui.lua @ 65:69fd720f853e

Add display_bcast_from option.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 27 Apr 2012 09:12:45 +0000
parents 1cbaa1ce8253
children c01875b275ca
line wrap: on
line diff
--- a/gui.lua	Fri Apr 20 04:41:10 2012 +0000
+++ b/gui.lua	Fri Apr 27 09:12:45 2012 +0000
@@ -253,6 +253,7 @@
 				return
 			end
 
+			local display_bcast_from = OuroLootSV_opts.display_bcast_from
 			-- XXX FIXME a major weakness here is that we're constantly replacing
 			-- what's already been created.  Lots of garbage.  Trying to detect what
 			-- actually needs to be replaced is even worse.  We'll live with
@@ -272,11 +273,12 @@
 						break
 					end
 				end end
-				local ex = eoi_st_lootrow_col3_colortable[e.disposition or ""].text
-				if e.bcast_from and e.extratext then
+				local ex = e.disposition or ""
+				ex = eoi_st_lootrow_col3_colortable[ex].text
+				if e.bcast_from and display_bcast_from and e.extratext then
 					ex = e.extratext .. " (from " .. e.bcast_from .. ")"
-				elseif e.bcast_from then
-					ex = "(from " .. e.bcast_from .. ")"
+				elseif e.bcast_from and display_bcast_from then
+					ex = ex .. " (from " .. e.bcast_from .. ")"
 				elseif e.extratext then
 					ex = e.extratext
 				end
@@ -1506,15 +1508,18 @@
 
 -- Tab 6:  Options / Advanced
 do
+	-- Local ref to OuroLootSV_opts, which may be reassigned after load.
+	-- So instead this is updated when the tab is displayed.
+	local opts
 	local function mkoption (opt, label, width, desc, opt_func)
 		local w = mkbutton("CheckBoxSmallLabel", nil, "", desc)
 		w:SetRelativeWidth(width)
 		w:SetType("checkbox")
 		w:SetLabel(label)
 		if opt then
-			w:SetValue(OuroLootSV_opts[opt])
+			w:SetValue(opts[opt])
 			w:SetCallback("OnValueChanged", opt_func or (function(_w,event,value)
-				OuroLootSV_opts[opt] = value
+				opts[opt] = value
 			end))
 		end
 		return w
@@ -1688,6 +1693,8 @@
 	end
 
 	tabs_OnGroupSelected["opt"] = function(container,specials)
+		opts = OuroLootSV_opts
+
 		--container:SetLayout("List")
 		container:SetLayout("Fill")
 		local scroll, grp, w
@@ -1738,25 +1745,34 @@
 			[[Show loadable plugins even if they've been disabled (and offer to enable them).  Relog to take effect.]])
 		grp:AddChild(w)
 
+		-- showing the "(from Rebroadcasterdude)" in the notes column
+		w = mkoption('display_bcast_from', "Show rebroadcasting player", 0.49,
+			[[Include "(from Player_Name)" in the Notes column for loot that was broadcast to you.]],
+			function(_w,_e,value)
+				opts.display_bcast_from = value
+				addon.loot_clean = nil
+			end)
+		grp:AddChild(w)
+
 		-- possible keybindings
 		do
 			local pair = GUI:Create("SimpleGroup")
 			pair:SetLayout("Flow")
 			pair:SetRelativeWidth(0.95)
 			local editbox, checkbox
-			editbox = mkbutton("EditBox", nil, OuroLootSV_opts.keybinding_text,
+			editbox = mkbutton("EditBox", nil, opts.keybinding_text,
 				[[Keybinding text format is fragile!  Relog to take effect.]])
 			editbox:SetRelativeWidth(0.5)
 			editbox:SetLabel("Keybinding text")
 			editbox:SetCallback("OnEnterPressed", function(_w,event,value)
-				OuroLootSV_opts.keybinding_text = value
+				opts.keybinding_text = value
 			end)
-			editbox:SetDisabled(not OuroLootSV_opts.keybinding)
+			editbox:SetDisabled(not opts.keybinding)
 			checkbox = mkoption('keybinding', "Register keybinding", 0.5,
 				[[Register a keybinding to toggle the loot display.  Relog to take effect.]],
 				function (_w,_,value)
-					OuroLootSV_opts.keybinding = value
-					editbox:SetDisabled(not OuroLootSV_opts.keybinding)
+					opts.keybinding = value
+					editbox:SetDisabled(not opts.keybinding)
 				end)
 			pair:AddChild(checkbox)
 			pair:AddChild(editbox)
@@ -1773,7 +1789,7 @@
 			local current
 			for k,v in ipairs(addon.bossmods) do
 				list[k] = v.n
-				if v.n == OuroLootSV_opts.bossmod then
+				if v.n == opts.bossmod then
 					current = k
 				end
 			end
@@ -1783,7 +1799,7 @@
 			w:SetList(list)
 			w:SetValue(current)
 			w:SetCallback("OnValueChanged", function(_w,event,choice)
-				OuroLootSV_opts.bossmod = list[choice]
+				opts.bossmod = list[choice]
 			end)
 			grp:AddChild(w)
 		end
@@ -1796,7 +1812,7 @@
 		do
 			local list = {}
 			local cache_warn, cache_warned = false, false
-			for id in pairs(OuroLootSV_opts.itemfilter) do
+			for id in pairs(opts.itemfilter) do
 				local iname, _, iquality = GetItemInfo(id)
 				if iname then
 					list[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r"
@@ -1816,12 +1832,12 @@
 				end
 				local id = tonumber(ilink:match("item:(%d+)"))
 				list[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r"
-				OuroLootSV_opts.itemfilter[id] = true
+				opts.itemfilter[id] = true
 				addon:Print("Now filtering out", ilink)
 			end)
 			w:SetCallback("OnListItemClicked", function(_w, _, key_id, val_name)
 				--local ilink = select(2,GetItemInfo(key_id))
-				OuroLootSV_opts.itemfilter[tonumber(key_id)] = nil
+				opts.itemfilter[tonumber(key_id)] = nil
 				--addon:Print("No longer filtering out", ilink)
 				addon:Print("No longer filtering out", val_name)
 			end)