Mercurial > wow > ouroloot
comparison gui.lua @ 109:ce45011fab4c
- Test for errors during startup before trying to manipulate data.
- Thin encapsulation around dispositions. Abstract everything except the
insertion into GUI dropdowns (that comes next).
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Wed, 08 Aug 2012 14:43:26 -0400 |
parents | 04ccd12c2a41 |
children | f93c1a93923b |
comparison
equal
deleted
inserted
replaced
108:04ccd12c2a41 | 109:ce45011fab4c |
---|---|
21 kill = { ["r"] = 0.2, ["g"] = 0.2, ["b"] = 0.2}, | 21 kill = { ["r"] = 0.2, ["g"] = 0.2, ["b"] = 0.2}, |
22 time = { ["r"] = 0x0/255, ["g"] = 0x0/255, ["b"] = 1, ["a"] = 0.3}, | 22 time = { ["r"] = 0x0/255, ["g"] = 0x0/255, ["b"] = 1, ["a"] = 0.3}, |
23 } | 23 } |
24 eoi_st_otherrow_bgcolortable[""] = eoi_st_otherrow_bgcolortable["kill"] | 24 eoi_st_otherrow_bgcolortable[""] = eoi_st_otherrow_bgcolortable["kill"] |
25 local eoi_st_otherrow_bgcolortable_default | 25 local eoi_st_otherrow_bgcolortable_default |
26 local eoi_st_lootrow_col3_colortable = { | 26 local eoi_st_lootrow_col3_colortable = addon.disposition_colors |
27 normal = { text = "", r = "ff", g = "ff", b = "ff" }, | |
28 shard = { text = "shard", r = "a3", g = "35", b = "ee" }, | |
29 offspec = { text = "offspec", r = "c6", g = "9b", b = "6d" }, | |
30 gvault = { text = "guild vault", r = "33", g = "ff", b = "99" }, | |
31 } | |
32 for k,v in pairs(eoi_st_lootrow_col3_colortable) do | |
33 -- for chat output by core code | |
34 v.hex = "|cff" .. v.r .. v.g .. v.b | |
35 -- for lib-st | |
36 v.r = tonumber(v.r,16)/255 | |
37 v.g = tonumber(v.g,16)/255 | |
38 v.b = tonumber(v.b,16)/255 | |
39 v.a = 1 | |
40 end | |
41 addon.disposition_colors = eoi_st_lootrow_col3_colortable | |
42 local function eoi_st_lootrow_col3_colortable_func (data, _, realrow) | 27 local function eoi_st_lootrow_col3_colortable_func (data, _, realrow) |
43 local disp = data[realrow].disposition | 28 return eoi_st_lootrow_col3_colortable[data[realrow].disposition] |
44 return eoi_st_lootrow_col3_colortable[disp or 'normal'] | |
45 end | 29 end |
46 local time_column1_used_mt = { __index = { | 30 local time_column1_used_mt = { __index = { |
47 [2] = {value=""}, | 31 [2] = {value=""}, |
48 [3] = {value=""}, | 32 [3] = {value=""}, |
49 } } | 33 } } |
120 gui.markup = _markup -- too useful to keep local | 104 gui.markup = _markup -- too useful to keep local |
121 end | 105 end |
122 | 106 |
123 -- Working around this bug: | 107 -- Working around this bug: |
124 -- http://forums.wowace.com/showpost.php?p=295202&postcount=31 | 108 -- http://forums.wowace.com/showpost.php?p=295202&postcount=31 |
125 if false then -- XXX no longer needed? | 109 if false then -- XXX no longer needed? test on mop beta |
126 local function fix_frame_level (level, ...) | 110 local function fix_frame_level (level, ...) |
127 for i = 1, select("#", ...) do | 111 for i = 1, select("#", ...) do |
128 local button = select(i, ...) | 112 local button = select(i, ...) |
129 button:SetFrameLevel(level) | 113 button:SetFrameLevel(level) |
130 end | 114 end |
367 {value = textured}, | 351 {value = textured}, |
368 {value = e.person}, | 352 {value = e.person}, |
369 {} | 353 {} |
370 } | 354 } |
371 -- This is horrible. Must do better. | 355 -- This is horrible. Must do better. |
372 if e.extratext then for k,v in pairs(eoi_st_lootrow_col3_colortable) do | 356 if e.extratext then |
373 if v.text == e.extratext then | 357 for disp,text in self:_iter_dispositions('from_notes_text') do |
374 e.disposition = k ~= 'normal' and k or nil | 358 if text == e.extratext then |
375 --e.extratext = nil, not feasible | 359 e.disposition = disp |
376 break | 360 break |
361 end | |
377 end | 362 end |
378 end end | 363 end |
379 local ex = eoi_st_lootrow_col3_colortable[e.disposition or 'normal'].text | 364 local ex = eoi_st_lootrow_col3_colortable[e.disposition].text |
380 if e.bcast_from and display_bcast_from and e.extratext then | 365 if e.bcast_from and display_bcast_from and e.extratext then |
381 ex = e.extratext .. " (from " .. e.bcast_from .. ")" | 366 ex = e.extratext .. " (from " .. e.bcast_from .. ")" |
382 elseif e.bcast_from and display_bcast_from then | 367 elseif e.bcast_from and display_bcast_from then |
383 ex = ex .. (e.disposition and " " or "") | 368 ex = ex .. (e.disposition and " " or "") |
384 .. "(from " .. e.bcast_from .. ")" | 369 .. "(from " .. e.bcast_from .. ")" |
991 eoi_dropdownfuncs["Delete this loot event"] = eoi_dropdownfuncs.df_DELETE | 976 eoi_dropdownfuncs["Delete this loot event"] = eoi_dropdownfuncs.df_DELETE |
992 eoi_dropdownfuncs["Delete this boss event"] = eoi_dropdownfuncs.df_DELETE | 977 eoi_dropdownfuncs["Delete this boss event"] = eoi_dropdownfuncs.df_DELETE |
993 eoi_dropdownfuncs["Insert new loot entry"] = eoi_dropdownfuncs.df_INSERT | 978 eoi_dropdownfuncs["Insert new loot entry"] = eoi_dropdownfuncs.df_INSERT |
994 eoi_dropdownfuncs["Insert new boss kill event"] = eoi_dropdownfuncs.df_INSERT | 979 eoi_dropdownfuncs["Insert new boss kill event"] = eoi_dropdownfuncs.df_INSERT |
995 eoi_dropdownfuncs["Mark as disenchanted"] = eoi_dropdownfuncs["Mark as normal"] | 980 eoi_dropdownfuncs["Mark as disenchanted"] = eoi_dropdownfuncs["Mark as normal"] |
996 eoi_dropdownfuncs["Mark as guild vault"] = eoi_dropdownfuncs["Mark as normal"] | 981 eoi_dropdownfuncs["Mark as ".._G.GUILD_BANK:lower()] = eoi_dropdownfuncs["Mark as normal"] |
997 eoi_dropdownfuncs["Mark as offspec"] = eoi_dropdownfuncs["Mark as normal"] | 982 eoi_dropdownfuncs["Mark as offspec"] = eoi_dropdownfuncs["Mark as normal"] |
998 eoi_dropdownfuncs["Delete remaining entries for this boss"] = | 983 eoi_dropdownfuncs["Delete remaining entries for this boss"] = |
999 eoi_dropdownfuncs["Delete remaining entries for this day"] | 984 eoi_dropdownfuncs["Delete remaining entries for this day"] |
1000 eoi_dropdownfuncs["Rebroadcast this day"] = eoi_dropdownfuncs["Rebroadcast this boss"] | 985 eoi_dropdownfuncs["Rebroadcast this day"] = eoi_dropdownfuncs["Rebroadcast this boss"] |
1001 local eoi_time_dropdown = gen_easymenu_table( | 986 local eoi_time_dropdown = gen_easymenu_table( |
1019 notCheckable = true, | 1004 notCheckable = true, |
1020 }}, | 1005 }}, |
1021 { | 1006 { |
1022 "Mark as disenchanted%shard", | 1007 "Mark as disenchanted%shard", |
1023 "Mark as offspec%offspec", | 1008 "Mark as offspec%offspec", |
1024 "Mark as guild vault%gvault", | 1009 "Mark as ".._G.GUILD_BANK:lower().."%gvault", |
1025 "Mark as normal|This is the default. Selecting any 'Mark as <x>' action blanks out extra notes about who broadcast this entry, etc.", | 1010 "Mark as normal|This is the default. Selecting any 'Mark as <x>' action blanks out extra notes about who broadcast this entry, etc.", |
1026 "--", | 1011 "--", |
1027 "Rebroadcast this loot entry|Sends this loot event, including special notes, as if it just happened.", | 1012 "Rebroadcast this loot entry|Sends this loot event, including special notes, as if it just happened.", |
1028 "Delete this loot event|Permanent, no going back!\n\nHold down the Shift key to also delete the corresponding entry from player's History.", | 1013 "Delete this loot event|Permanent, no going back!\n\nHold down the Shift key to also delete the corresponding entry from player's History.", |
1029 "Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day.\n\nHold down the Shift key to also delete the corresponding entries from player History.", | 1014 "Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day.\n\nHold down the Shift key to also delete the corresponding entries from player History.", |
1191 notCheckable = true, | 1176 notCheckable = true, |
1192 } | 1177 } |
1193 end | 1178 end |
1194 eoi_player_dropdown[2].menuList = | 1179 eoi_player_dropdown[2].menuList = |
1195 gen_easymenu_table (raiders, {"Enter name...",CLOSE}, eoi_dropdownfuncs) | 1180 gen_easymenu_table (raiders, {"Enter name...",CLOSE}, eoi_dropdownfuncs) |
1196 if e.disposition == 'shard' or e.disposition == 'gvault' then | 1181 |
1182 if not addon:_test_disposition (e.disposition, 'can_reassign') then | |
1197 eoi_player_dropdown[2].disabled = true | 1183 eoi_player_dropdown[2].disabled = true |
1198 eoi_player_dropdown[2].tooltipTitle = "Cannot Reassign" | 1184 eoi_player_dropdown[2].tooltipTitle = "Cannot Reassign" |
1199 eoi_player_dropdown[2].tooltipText = "You must first mark this item as 'normal' or 'offspec' before reassignment." | 1185 eoi_player_dropdown[2].tooltipText = "You must first mark this item as 'normal' or 'offspec' before reassignment." |
1200 else | 1186 else |
1201 eoi_player_dropdown[2].disabled = nil | 1187 eoi_player_dropdown[2].disabled = nil |
2699 end | 2685 end |
2700 end | 2686 end |
2701 end | 2687 end |
2702 end | 2688 end |
2703 | 2689 |
2690 addon.FILES_LOADED = addon.FILES_LOADED + 1 | |
2704 -- vim:noet | 2691 -- vim:noet |