changeset 51:11f18e279229

Updating to use the new APIs
author John@Yosemite-PC
date Wed, 21 Mar 2012 23:23:31 -0400
parents b155a875de42
children 7c7e80f63b51
files Gui.lua
diffstat 1 files changed, 26 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/Gui.lua	Wed Mar 21 23:23:06 2012 -0400
+++ b/Gui.lua	Wed Mar 21 23:23:31 2012 -0400
@@ -76,18 +76,8 @@
             if color == nil then return str end
             return "|cff"..tostring(color or "ffffff")..str.."|r"
         end
-        local pull = {}
-        local ltemp = 0
-        for i,v in pairs(lists) do
-            pull[i] = v.name
-            --local entry = {value=i,text=v.name}
-            if ltemp == 0  and getn(v) > 0 then
-                ltemp = i
-            end
-        end
 
-        PopulateRaidList() -- todo: this should be elsewhere
-
+        PersonList:RefreshRaidList() -- todo: this should be elsewhere
 
         scroller = AceGUI:Create("ScrollFrame")
         scroller:SetLayout("List")
@@ -109,24 +99,38 @@
         treecontrol:AddChild(scroller)
 
         local pulldown = AceGUI:Create("Dropdown")
+        local pull = {}
+        local ltemp = 0
+        local lids = LootLists:GetAllIds()
+        for _,v in pairs(lids) do
+            local l = LootLists:Select(v)
+            pull[l:GetId()] = l:GetName()
+            --local entry = {value=i,text=v.name}
+            if l:GetLength() > 0 then
+                pulldown:SetItemDisabled(i,true)
+                if ltemp == 0 then
+                    ltemp = l:GetId()
+                end
+            end
+        end
         pulldown:SetWidth(175)
         pulldown:SetList(pull)
-        for i,v in pairs(lists) do
-            if getn(v) == 0 then
-                pulldown:SetItemDisabled(i,true)
-            end
-        end
+        --for i,v in pairs(lists) do
+        --    if getn(v) == 0 then
+        --        pulldown:SetItemDisabled(i,true)
+        --    end
+        --end
         local ovc = function(_,_,value)
             --treecontrol:ReleaseChildren()
             local tree = {}
-            for x,y in ipairs(lists[value]) do
-                local p = persons[y.id]
-                local line = {value=y.id,text=p.main,icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]}
-                line.iconCoords=_G.CLASS_ICON_TCOORDS[p.class]
-                if not raidIdP[y.id] and not reserveIdP[y.id] then
+            local l = LootLists:Select(value)
+            for le in l:OrderedListEntryIter() do
+                local line = {value=le:GetId(),text=le:GetName(),icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]}
+                line.iconCoords=_G.CLASS_ICON_TCOORDS[le:GetClass()]
+                if not PersonList:IsActive(le:GetId()) then
                     line.disabled = true
                 else
-                    line.text=colorize(line.text,_G.RAID_CLASS_COLORS[p.class])
+                    line.text=colorize(line.text,_G.RAID_CLASS_COLORS[le:GetClass()])
                 end
                 table.insert(tree,line)
             end