comparison 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
comparison
equal deleted inserted replaced
64:359d0159d6ca 65:69fd720f853e
251 self.loot_clean = nil 251 self.loot_clean = nil
252 pprint('_f_o_e_d', "index",i,"somehow still in loop past",#g_loot,"bailing") 252 pprint('_f_o_e_d', "index",i,"somehow still in loop past",#g_loot,"bailing")
253 return 253 return
254 end 254 end
255 255
256 local display_bcast_from = OuroLootSV_opts.display_bcast_from
256 -- XXX FIXME a major weakness here is that we're constantly replacing 257 -- XXX FIXME a major weakness here is that we're constantly replacing
257 -- what's already been created. Lots of garbage. Trying to detect what 258 -- what's already been created. Lots of garbage. Trying to detect what
258 -- actually needs to be replaced is even worse. We'll live with 259 -- actually needs to be replaced is even worse. We'll live with
259 -- garbage for now. 260 -- garbage for now.
260 if e.kind == 'loot' then 261 if e.kind == 'loot' then
270 e.disposition = k 271 e.disposition = k
271 --e.extratext = nil, not feasible 272 --e.extratext = nil, not feasible
272 break 273 break
273 end 274 end
274 end end 275 end end
275 local ex = eoi_st_lootrow_col3_colortable[e.disposition or ""].text 276 local ex = e.disposition or ""
276 if e.bcast_from and e.extratext then 277 ex = eoi_st_lootrow_col3_colortable[ex].text
278 if e.bcast_from and display_bcast_from and e.extratext then
277 ex = e.extratext .. " (from " .. e.bcast_from .. ")" 279 ex = e.extratext .. " (from " .. e.bcast_from .. ")"
278 elseif e.bcast_from then 280 elseif e.bcast_from and display_bcast_from then
279 ex = "(from " .. e.bcast_from .. ")" 281 ex = ex .. " (from " .. e.bcast_from .. ")"
280 elseif e.extratext then 282 elseif e.extratext then
281 ex = e.extratext 283 ex = e.extratext
282 end 284 end
283 e.cols[3].value = ex 285 e.cols[3].value = ex
284 286
1504 end 1506 end
1505 1507
1506 1508
1507 -- Tab 6: Options / Advanced 1509 -- Tab 6: Options / Advanced
1508 do 1510 do
1511 -- Local ref to OuroLootSV_opts, which may be reassigned after load.
1512 -- So instead this is updated when the tab is displayed.
1513 local opts
1509 local function mkoption (opt, label, width, desc, opt_func) 1514 local function mkoption (opt, label, width, desc, opt_func)
1510 local w = mkbutton("CheckBoxSmallLabel", nil, "", desc) 1515 local w = mkbutton("CheckBoxSmallLabel", nil, "", desc)
1511 w:SetRelativeWidth(width) 1516 w:SetRelativeWidth(width)
1512 w:SetType("checkbox") 1517 w:SetType("checkbox")
1513 w:SetLabel(label) 1518 w:SetLabel(label)
1514 if opt then 1519 if opt then
1515 w:SetValue(OuroLootSV_opts[opt]) 1520 w:SetValue(opts[opt])
1516 w:SetCallback("OnValueChanged", opt_func or (function(_w,event,value) 1521 w:SetCallback("OnValueChanged", opt_func or (function(_w,event,value)
1517 OuroLootSV_opts[opt] = value 1522 opts[opt] = value
1518 end)) 1523 end))
1519 end 1524 end
1520 return w 1525 return w
1521 end 1526 end
1522 1527
1686 end) 1691 end)
1687 container:AddChild(speedbump) 1692 container:AddChild(speedbump)
1688 end 1693 end
1689 1694
1690 tabs_OnGroupSelected["opt"] = function(container,specials) 1695 tabs_OnGroupSelected["opt"] = function(container,specials)
1696 opts = OuroLootSV_opts
1697
1691 --container:SetLayout("List") 1698 --container:SetLayout("List")
1692 container:SetLayout("Fill") 1699 container:SetLayout("Fill")
1693 local scroll, grp, w 1700 local scroll, grp, w
1694 1701
1695 scroll = GUI:Create("ScrollFrame") 1702 scroll = GUI:Create("ScrollFrame")
1734 grp:AddChild(w) 1741 grp:AddChild(w)
1735 1742
1736 -- LOD plugins in all cases 1743 -- LOD plugins in all cases
1737 w = mkoption('display_disabled_LODs', "Include disabled plugins", 0.49, 1744 w = mkoption('display_disabled_LODs', "Include disabled plugins", 0.49,
1738 [[Show loadable plugins even if they've been disabled (and offer to enable them). Relog to take effect.]]) 1745 [[Show loadable plugins even if they've been disabled (and offer to enable them). Relog to take effect.]])
1746 grp:AddChild(w)
1747
1748 -- showing the "(from Rebroadcasterdude)" in the notes column
1749 w = mkoption('display_bcast_from', "Show rebroadcasting player", 0.49,
1750 [[Include "(from Player_Name)" in the Notes column for loot that was broadcast to you.]],
1751 function(_w,_e,value)
1752 opts.display_bcast_from = value
1753 addon.loot_clean = nil
1754 end)
1739 grp:AddChild(w) 1755 grp:AddChild(w)
1740 1756
1741 -- possible keybindings 1757 -- possible keybindings
1742 do 1758 do
1743 local pair = GUI:Create("SimpleGroup") 1759 local pair = GUI:Create("SimpleGroup")
1744 pair:SetLayout("Flow") 1760 pair:SetLayout("Flow")
1745 pair:SetRelativeWidth(0.95) 1761 pair:SetRelativeWidth(0.95)
1746 local editbox, checkbox 1762 local editbox, checkbox
1747 editbox = mkbutton("EditBox", nil, OuroLootSV_opts.keybinding_text, 1763 editbox = mkbutton("EditBox", nil, opts.keybinding_text,
1748 [[Keybinding text format is fragile! Relog to take effect.]]) 1764 [[Keybinding text format is fragile! Relog to take effect.]])
1749 editbox:SetRelativeWidth(0.5) 1765 editbox:SetRelativeWidth(0.5)
1750 editbox:SetLabel("Keybinding text") 1766 editbox:SetLabel("Keybinding text")
1751 editbox:SetCallback("OnEnterPressed", function(_w,event,value) 1767 editbox:SetCallback("OnEnterPressed", function(_w,event,value)
1752 OuroLootSV_opts.keybinding_text = value 1768 opts.keybinding_text = value
1753 end) 1769 end)
1754 editbox:SetDisabled(not OuroLootSV_opts.keybinding) 1770 editbox:SetDisabled(not opts.keybinding)
1755 checkbox = mkoption('keybinding', "Register keybinding", 0.5, 1771 checkbox = mkoption('keybinding', "Register keybinding", 0.5,
1756 [[Register a keybinding to toggle the loot display. Relog to take effect.]], 1772 [[Register a keybinding to toggle the loot display. Relog to take effect.]],
1757 function (_w,_,value) 1773 function (_w,_,value)
1758 OuroLootSV_opts.keybinding = value 1774 opts.keybinding = value
1759 editbox:SetDisabled(not OuroLootSV_opts.keybinding) 1775 editbox:SetDisabled(not opts.keybinding)
1760 end) 1776 end)
1761 pair:AddChild(checkbox) 1777 pair:AddChild(checkbox)
1762 pair:AddChild(editbox) 1778 pair:AddChild(editbox)
1763 grp:AddChild(pair) 1779 grp:AddChild(pair)
1764 end 1780 end
1771 do 1787 do
1772 local list = {} 1788 local list = {}
1773 local current 1789 local current
1774 for k,v in ipairs(addon.bossmods) do 1790 for k,v in ipairs(addon.bossmods) do
1775 list[k] = v.n 1791 list[k] = v.n
1776 if v.n == OuroLootSV_opts.bossmod then 1792 if v.n == opts.bossmod then
1777 current = k 1793 current = k
1778 end 1794 end
1779 end 1795 end
1780 w = mkbutton("Dropdown", nil, "", [[Which 'boss mod' to use.]]) 1796 w = mkbutton("Dropdown", nil, "", [[Which 'boss mod' to use.]])
1781 w:SetRelativeWidth(0.2) 1797 w:SetRelativeWidth(0.2)
1782 w:SetLabel("Boss Mod:") 1798 w:SetLabel("Boss Mod:")
1783 w:SetList(list) 1799 w:SetList(list)
1784 w:SetValue(current) 1800 w:SetValue(current)
1785 w:SetCallback("OnValueChanged", function(_w,event,choice) 1801 w:SetCallback("OnValueChanged", function(_w,event,choice)
1786 OuroLootSV_opts.bossmod = list[choice] 1802 opts.bossmod = list[choice]
1787 end) 1803 end)
1788 grp:AddChild(w) 1804 grp:AddChild(w)
1789 end 1805 end
1790 1806
1791 -- item filter 1807 -- item filter
1794 w:SetHeight(20) 1810 w:SetHeight(20)
1795 grp:AddChild(w) 1811 grp:AddChild(w)
1796 do 1812 do
1797 local list = {} 1813 local list = {}
1798 local cache_warn, cache_warned = false, false 1814 local cache_warn, cache_warned = false, false
1799 for id in pairs(OuroLootSV_opts.itemfilter) do 1815 for id in pairs(opts.itemfilter) do
1800 local iname, _, iquality = GetItemInfo(id) 1816 local iname, _, iquality = GetItemInfo(id)
1801 if iname then 1817 if iname then
1802 list[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" 1818 list[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r"
1803 else 1819 else
1804 cache_warn = true 1820 cache_warn = true
1814 if not iname then 1830 if not iname then
1815 return addon:Print("Error: %s is not a valid item name/link!", text) 1831 return addon:Print("Error: %s is not a valid item name/link!", text)
1816 end 1832 end
1817 local id = tonumber(ilink:match("item:(%d+)")) 1833 local id = tonumber(ilink:match("item:(%d+)"))
1818 list[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r" 1834 list[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r"
1819 OuroLootSV_opts.itemfilter[id] = true 1835 opts.itemfilter[id] = true
1820 addon:Print("Now filtering out", ilink) 1836 addon:Print("Now filtering out", ilink)
1821 end) 1837 end)
1822 w:SetCallback("OnListItemClicked", function(_w, _, key_id, val_name) 1838 w:SetCallback("OnListItemClicked", function(_w, _, key_id, val_name)
1823 --local ilink = select(2,GetItemInfo(key_id)) 1839 --local ilink = select(2,GetItemInfo(key_id))
1824 OuroLootSV_opts.itemfilter[tonumber(key_id)] = nil 1840 opts.itemfilter[tonumber(key_id)] = nil
1825 --addon:Print("No longer filtering out", ilink) 1841 --addon:Print("No longer filtering out", ilink)
1826 addon:Print("No longer filtering out", val_name) 1842 addon:Print("No longer filtering out", val_name)
1827 end) 1843 end)
1828 w:SetCallback("OnDropdownShown", function() 1844 w:SetCallback("OnDropdownShown", function()
1829 if cache_warn and not cache_warned then 1845 if cache_warn and not cache_warned then