Mercurial > wow > ouroloot
comparison gui.lua @ 6:df3e27edbd60
Much work on history tab.
| author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
|---|---|
| date | Wed, 15 Jun 2011 03:59:13 +0000 |
| parents | 7adbc59de8fe |
| children | 9a37bd40eb5e |
comparison
equal
deleted
inserted
replaced
| 5:7adbc59de8fe | 6:df3e27edbd60 |
|---|---|
| 1 local addon = select(2,...) | 1 local addon = select(2,...) |
| 2 | 2 |
| 3 --[[ | 3 --[[ |
| 4 Purely the AceGUI-related routines, and the subroutines needed for support. | 4 Purely the AceGUI-related routines, and the subroutines needed for support. |
| 5 ------ Constants | 5 ------ Constants |
| 6 ------ Locals | 6 ------ Globals |
| 7 ------ Behind the scenes routines | 7 ------ Behind the scenes routines |
| 8 ------ Main GUI Window | 8 ------ Main GUI Window |
| 9 ------ Popup dialogs | 9 ------ Popup dialogs |
| 10 ]] | 10 ]] |
| 11 | 11 |
| 36 [3] = {value=""}, | 36 [3] = {value=""}, |
| 37 } } | 37 } } |
| 38 local time_column1_used_mt = addon.time_column1_used_mt | 38 local time_column1_used_mt = addon.time_column1_used_mt |
| 39 | 39 |
| 40 | 40 |
| 41 ------ Locals | 41 ------ Globals |
| 42 local GUI = LibStub("AceGUI-3.0") | 42 local GUI = LibStub("AceGUI-3.0") |
| 43 local flib = LibStub("LibFarmbuyer") | 43 local flib = LibStub("LibFarmbuyer") |
| 44 | 44 |
| 45 local g_loot = nil | 45 local g_loot = nil |
| 46 local g_generated = nil | 46 local g_generated = nil |
| 238 end | 238 end |
| 239 end | 239 end |
| 240 | 240 |
| 241 do | 241 do |
| 242 function addon:_fill_out_hist_data (opt_starting_index) | 242 function addon:_fill_out_hist_data (opt_starting_index) |
| 243 local new, del = flib.new, flib.del | |
| 244 | |
| 243 -- Clearing history finishes this function with #hist==0 and hist_clean==0. | 245 -- Clearing history finishes this function with #hist==0 and hist_clean==0. |
| 244 -- The next call typically detects this (#<1) and handles it. If loot is | 246 -- The next call typically detects this (#<1) and handles it. If loot is |
| 245 -- recorded before then, it results in hist_clean==0 and #hist==1, which | 247 -- recorded before then, it results in hist_clean==0 and #hist==1, which |
| 246 -- breaks the first iteration of the loop. Thus, the "extra" test here: | 248 -- breaks the first iteration of the loop. Thus, the "extra" test here: |
| 247 if #self.history < 1 or self.hist_clean == 0 then | 249 if #self.history < 1 or self.hist_clean == 0 then |
| 248 self.hist_clean = nil | 250 self.hist_clean = nil |
| 249 opt_starting_index = nil | 251 opt_starting_index = nil |
| 250 end | 252 end |
| 251 if not self.history.st then | 253 if not self.history.st then |
| 254 --print"creating ST!" | |
| 252 self.history.st = { | 255 self.history.st = { |
| 253 --[[{ kind = "realm", | 256 --[[{ kind = "realm", |
| 254 cols = setmetatable({ | 257 cols = setmetatable({ |
| 255 { value = self.history.realm }, | 258 { value = self.history.realm }, |
| 256 }, time_column1_used_mt) | 259 }, time_column1_used_mt) |
| 257 }]] | 260 }]] |
| 258 } | 261 } |
| 259 end | 262 end |
| 263 | |
| 264 -- for now | |
| 265 if self.hist_clean == #self.history then return end | |
| 266 | |
| 260 local st = self.history.st | 267 local st = self.history.st |
| 261 for i = (opt_starting_index or self.hist_clean or 1), #self.history do | 268 --print("starting history loop, #st ==", #st, "#history ==", #self.history) |
| 262 local h = self.history[i] | 269 for i,t in ipairs(st) do |
| 263 local sti = i | 270 del(t.cols[1]) |
| 264 if not st[sti] then | 271 del(t.cols[2]) |
| 265 st[sti] = { kind = "history" } | 272 del(t.cols[3]) |
| 266 end | 273 del(t.cols) |
| 267 local sth = st[sti] -- corresponding ST entry for h | 274 del(t) |
| 268 | 275 st[i] = nil |
| 269 sth.cols = sth.cols or { | 276 end |
| 270 { value = h.name }, | 277 |
| 271 {},--{ value = h[1].id }, | 278 --for i = (opt_starting_index or self.hist_clean or 1), #self.history do |
| 272 {},--{ value = h[1].when }, | 279 local cache_okay = true |
| 273 } | 280 for pi,player in ipairs(self.history) do |
| 274 | 281 local col1 = new() |
| 275 if sth.shown ~= h[1].id then | 282 col1.OLi = pi |
| 276 -- things have changed, redo the row with new data | 283 col1.OLn = #player |
| 277 local itexture = GetItemIcon(h[1].id) | 284 col1.value = player.name -- may spiffy this up in future |
| 278 local iname, ilink, iquality = GetItemInfo(h[1].id) | 285 |
| 286 for li,loot in ipairs(player) do | |
| 287 local col2 = new() | |
| 288 col2.OLi = li | |
| 289 local col3 = new() | |
| 290 col3.value = loot.when | |
| 291 | |
| 292 local itexture = GetItemIcon(loot.id) | |
| 293 local iname, ilink, iquality = GetItemInfo(loot.id) | |
| 279 local textured | 294 local textured |
| 280 if itexture and iname then | 295 if itexture and iname then |
| 281 textured = eoi_st_textured_item_format:format (itexture, self.quality_hexes[iquality], iname, h[1].count or "") | 296 textured = eoi_st_textured_item_format:format (itexture, |
| 282 sth.shown = h[1].id | 297 self.quality_hexes[iquality], iname, loot.count or "") |
| 283 else | 298 else |
| 284 textured = eoi_st_textured_item_format:format ([[ICONS\INV_Misc_QuestionMark]], self.quality_hexes[1], 'UNKNOWN', "") | 299 textured = eoi_st_textured_item_format:format ([[ICONS\INV_Misc_QuestionMark]], |
| 300 self.quality_hexes[ITEM_QUALITY_COMMON], 'UNKNOWN - TRY AGAIN', "") | |
| 301 cache_okay = false | |
| 285 end | 302 end |
| 286 sth.cols[2].value = textured | 303 col2.value = textured |
| 287 sth.cols[3].value = h[1].when | 304 |
| 305 local dotcols = new (col1, col2, col3) | |
| 306 local st_entry = new() | |
| 307 st_entry.kind = 'history' | |
| 308 st_entry.OLwho = player.name | |
| 309 st_entry.cols = dotcols | |
| 310 tinsert (st, st_entry) | |
| 288 end | 311 end |
| 289 | 312 end |
| 290 end | 313 |
| 291 self.hist_clean = #self.history | 314 --print("finished history loop, #st ==", #st) |
| 292 end | 315 self.hist_clean = cache_okay and #self.history or nil |
| 316 end | |
| 317 | |
| 318 | |
| 293 end | 319 end |
| 294 | 320 |
| 295 | 321 |
| 296 ------ Main GUI Window | 322 ------ Main GUI Window |
| 297 -- Lots of shared data here, kept in a large local scope. For readability, | 323 -- Lots of shared data here, kept in a large local scope. For readability, |
| 310 ["hist"] = {title=[[History]], desc=[[A short semi-permanent record]]}, | 336 ["hist"] = {title=[[History]], desc=[[A short semi-permanent record]]}, |
| 311 ["help"] = {title=[[Help]], desc=[[Instructions, reminders, and tips for non-obvious features]]}, | 337 ["help"] = {title=[[Help]], desc=[[Instructions, reminders, and tips for non-obvious features]]}, |
| 312 ["opt"] = {title=[[Options]], desc=[[Options for fine-tuning behavior]]}, | 338 ["opt"] = {title=[[Options]], desc=[[Options for fine-tuning behavior]]}, |
| 313 --["adv"] = {title=[[Advanced]], desc=[[Debugging and testing]]}, | 339 --["adv"] = {title=[[Advanced]], desc=[[Debugging and testing]]}, |
| 314 } | 340 } |
| 315 if addon.author_debug then | 341 --if addon.author_debug then |
| 316 _taborder = { "eoi", "hist", "help", "opt" } | 342 _taborder = { "eoi", "hist", "help", "opt" } |
| 317 else _taborder = { "eoi", "help", "opt" } end | 343 --else _taborder = { "eoi", "help", "opt" } end |
| 318 | 344 |
| 319 --[[ | 345 --[[ |
| 320 This is a table of callback functions, each responsible for drawing a tab | 346 This is a table of callback functions, each responsible for drawing a tab |
| 321 into the container passed in the first argument. Special-purpose buttons | 347 into the container passed in the first argument. Special-purpose buttons |
| 322 can optionally be created (mkbutton) and added to the container in the second | 348 can optionally be created (mkbutton) and added to the container in the second |
| 354 local name, arg, tiptext | 380 local name, arg, tiptext |
| 355 name, tiptext = strsplit('|',tag) | 381 name, tiptext = strsplit('|',tag) |
| 356 name, arg = strsplit('%',name) | 382 name, arg = strsplit('%',name) |
| 357 if name == "--" then | 383 if name == "--" then |
| 358 tinsert (initial, { | 384 tinsert (initial, { |
| 359 disabled = true, text = "", | 385 disabled = true, notCheckable = true, text = "", |
| 360 }) | 386 }) |
| 361 else | 387 else |
| 362 if not funcs[name] then | 388 if not funcs[name] then |
| 363 error(("'%s' not defined as a dropdown function"):format(name)) | 389 error(("'%s' not defined as a dropdown function"):format(name)) |
| 364 end | 390 end |
| 704 end | 730 end |
| 705 | 731 |
| 706 return true -- do not do anything further | 732 return true -- do not do anything further |
| 707 end | 733 end |
| 708 | 734 |
| 709 local function hist_st_OnClick (rowFrame, cellFrame, data, cols, row, realrow, column, stable, button, ...) | |
| 710 if (row == nil) or (realrow == nil) then return false end -- click column header, do default resorting | |
| 711 local h = data[realrow] | |
| 712 local kind = h.kind | |
| 713 | |
| 714 | |
| 715 return true -- do not do anything further | |
| 716 end | |
| 717 | |
| 718 local function hist_st_OnDoubleClick (rowFrame, cellFrame, data, cols, row, realrow, column, stable, button, ...) | |
| 719 if (row == nil) or (realrow == nil) then return true end -- they clicked on column header, suppress reordering | |
| 720 local h = data[realrow] | |
| 721 local kind = h.kind | |
| 722 | |
| 723 return true -- do not do anything further | |
| 724 end | |
| 725 | |
| 726 -- Used for EOI column 2 and Hist column 1. Both are player name columns. | 735 -- Used for EOI column 2 and Hist column 1. Both are player name columns. |
| 727 local function eoi_st_col2_DoCellUpdate (rowFrame, cellFrame, data, cols, row, realrow, column, fShow, stable, ...) | 736 local function eoi_st_col2_DoCellUpdate (rowFrame, cellFrame, data, cols, row, realrow, column, fShow, stable, ...) |
| 728 if not fShow then | 737 if not fShow then |
| 729 cellFrame.text:SetText("") | 738 cellFrame.text:SetText("") |
| 730 if cellFrame.icontexture then | 739 if cellFrame.icontexture then |
| 731 cellFrame.icontexture:Hide() | 740 cellFrame.icontexture:Hide() |
| 732 end | 741 end |
| 782 name = "Notes", | 791 name = "Notes", |
| 783 width = 250, | 792 width = 250, |
| 784 }, | 793 }, |
| 785 } | 794 } |
| 786 | 795 |
| 787 local rowfilter_all | 796 local player_filter_all |
| 788 local rowfilter_by_name = function (st, e) | 797 local player_filter_by_name = function (st, e) |
| 789 if e.kind ~= 'loot' then return true end | 798 if e.kind ~= 'loot' then return true end |
| 790 return e.person == _d:GetUserData("player filter name") | 799 return e.person == _d:GetUserData("player filter name") |
| 791 end | 800 end |
| 792 | 801 |
| 793 -- Tab 1: Events Of Interest (implementation) | 802 -- Tab 1: Events Of Interest (implementation) |
| 859 end | 868 end |
| 860 | 869 |
| 861 -- No need to keep creating function closures that all just "return true", | 870 -- No need to keep creating function closures that all just "return true", |
| 862 -- instead we grab the one made inside lib-st. There's no "get filter" API | 871 -- instead we grab the one made inside lib-st. There's no "get filter" API |
| 863 -- so we just reach inside. | 872 -- so we just reach inside. |
| 864 rowfilter_all = ST.Filter | 873 player_filter_all = ST.Filter |
| 865 | 874 |
| 866 -- Now set up the future drawing function... | 875 -- Now set up the future drawing function... |
| 867 tabs_OnGroupSelected["eoi"] = function(container,specials) | 876 tabs_OnGroupSelected["eoi"] = function(container,specials) |
| 868 local st_widget = GUI:Create("lib-st") | 877 local st_widget = GUI:Create("lib-st") |
| 869 local st = _d:GetUserData("eoiST") | 878 local st = _d:GetUserData("eoiST") |
| 870 | 879 |
| 871 -- This is actually required each time | 880 -- This is actually required each time |
| 872 _d:SetUserData ("player filter clear", rowfilter_all) | 881 _d:SetUserData ("player filter clear", player_filter_all) |
| 873 _d:SetUserData ("player filter by name", rowfilter_by_name) | 882 _d:SetUserData ("player filter by name", player_filter_by_name) |
| 874 | 883 |
| 875 st:OuroLoot_Refresh() | 884 st:OuroLoot_Refresh() |
| 876 st_widget:WrapST(st) | 885 st_widget:WrapST(st) |
| 877 st_widget.head_offset = 15 | 886 st_widget.head_offset = 15 |
| 878 st_widget.tail_offset = 0 | 887 st_widget.tail_offset = 0 |
| 891 local b = mkbutton('eoi_filter_reset', "Reset Player Filter", | 900 local b = mkbutton('eoi_filter_reset', "Reset Player Filter", |
| 892 [[Return to showing complete loot information.]]) | 901 [[Return to showing complete loot information.]]) |
| 893 b:SetFullWidth(true) | 902 b:SetFullWidth(true) |
| 894 b:SetCallback("OnClick", function (_b) | 903 b:SetCallback("OnClick", function (_b) |
| 895 local st = _d:GetUserData("eoiST") | 904 local st = _d:GetUserData("eoiST") |
| 896 st:SetFilter(rowfilter_all) | 905 st:SetFilter(player_filter_all) |
| 897 _b:SetDisabled(true) | 906 _b:SetDisabled(true) |
| 898 end) | 907 end) |
| 899 b:SetDisabled(st.Filter == rowfilter_all) | 908 b:SetDisabled(st.Filter == player_filter_all) |
| 900 specials:AddChild(b) | 909 specials:AddChild(b) |
| 901 | 910 |
| 902 local people = { "<nobody>" } | 911 local people = { "<nobody>" } |
| 903 for i=1,GetNumRaidMembers() do | 912 for i=1,GetNumRaidMembers() do |
| 904 tinsert(people,(GetRaidRosterInfo(i))) | 913 tinsert(people,(GetRaidRosterInfo(i))) |
| 1010 sort = "asc", | 1019 sort = "asc", |
| 1011 sortnext = 1, | 1020 sortnext = 1, |
| 1012 }, | 1021 }, |
| 1013 } | 1022 } |
| 1014 | 1023 |
| 1024 local hist_normal_status = [[Click on a row to view all history for that player only. (Click column headers to re-sort.)]] | |
| 1025 local hist_name_status = [[Right-click on any row to return to normal history display.]] | |
| 1026 | |
| 1027 local history_filter_by_recent = function (st, e) | |
| 1028 if e.kind ~= 'history' then return true end | |
| 1029 return e.cols[2].OLi == 1 | |
| 1030 end | |
| 1031 | |
| 1032 local history_filter_who | |
| 1033 local history_filter_by_name = function (st, e) | |
| 1034 if e.kind ~= 'history' then return true end | |
| 1035 return e.OLwho == history_filter_who | |
| 1036 end | |
| 1037 | |
| 1015 -- Loot column | 1038 -- Loot column |
| 1016 local function hist_st_col2_DoCellUpdate (rowFrame, cellFrame, data, cols, row, realrow, column, fShow, stable, ...) | 1039 local function hist_st_col2_DoCellUpdate (rowFrame, cellFrame, data, cols, row, realrow, column, fShow, stable, ...) |
| 1040 print("col2 DCU", realrow) | |
| 1017 end | 1041 end |
| 1018 | 1042 |
| 1019 -- Formatted timestamp column | 1043 -- Formatted timestamp column |
| 1020 local function hist_st_col3_DoCellUpdate (rowFrame, cellFrame, data, cols, row, realrow, column, fShow, stable, ...) | 1044 local function hist_st_col3_DoCellUpdate (rowFrame, cellFrame, data, cols, row, realrow, column, fShow, stable, ...) |
| 1045 print("col3 DCU", realrow) | |
| 1021 if not fShow then | 1046 if not fShow then |
| 1022 cellFrame.text:SetText("") | 1047 cellFrame.text:SetText("") |
| 1023 return | 1048 return |
| 1024 end | 1049 end |
| 1025 | 1050 |
| 1033 stable:SetHighLightColor (rowFrame, eoi_st_otherrow_bgcolortable[d.kind]) | 1058 stable:SetHighLightColor (rowFrame, eoi_st_otherrow_bgcolortable[d.kind]) |
| 1034 --else | 1059 --else |
| 1035 -- table:SetHighLightColor (rowFrame, table:GetDefaultHighlightBlank()) | 1060 -- table:SetHighLightColor (rowFrame, table:GetDefaultHighlightBlank()) |
| 1036 --end | 1061 --end |
| 1037 end | 1062 end |
| 1063 | |
| 1064 local function hist_st_OnClick (rowFrame, cellFrame, data, cols, row, realrow, column, stable, button, ...) | |
| 1065 if (row == nil) or (realrow == nil) then return false end -- click column header, do default resorting | |
| 1066 local h = data[realrow] | |
| 1067 local kind = h.kind | |
| 1068 | |
| 1069 if history_filter_who and button == "RightButton" then -- now filtering and wanting not to | |
| 1070 history_filter_who = nil | |
| 1071 stable:SetFilter(history_filter_by_recent) | |
| 1072 setstatus(hist_normal_status) | |
| 1073 elseif (not history_filter_who) and button == "LeftButton" then -- not filtering and wanting to | |
| 1074 history_filter_who = h.OLwho | |
| 1075 stable:SetFilter(history_filter_by_name) | |
| 1076 setstatus(hist_name_status) | |
| 1077 end | |
| 1078 | |
| 1079 return true -- do not do anything further | |
| 1080 end | |
| 1081 | |
| 1082 --[[ | |
| 1083 local function hist_st_OnDoubleClick (rowFrame, cellFrame, data, cols, row, realrow, column, stable, button, ...) | |
| 1084 if (row == nil) or (realrow == nil) then return true end -- they clicked on column header, suppress reordering | |
| 1085 local h = data[realrow] | |
| 1086 local kind = h.kind | |
| 1087 | |
| 1088 return true -- do not do anything further | |
| 1089 end]] | |
| 1038 | 1090 |
| 1039 tabs_OnGroupSelected["hist"] = function(container,specials) | 1091 tabs_OnGroupSelected["hist"] = function(container,specials) |
| 1040 histST = LibStub("ScrollingTable"):CreateST(hist_st_cols,eoi_st_displayed_rows,eoi_st_rowheight) | 1092 histST = LibStub("ScrollingTable"):CreateST(hist_st_cols,eoi_st_displayed_rows,eoi_st_rowheight) |
| 1041 if addon.author_debug then | 1093 if addon.author_debug then |
| 1042 _G.OLHST = histST | 1094 _G.OLHST = histST |
| 1054 histST:SetData(addon.history.st) | 1106 histST:SetData(addon.history.st) |
| 1055 histST:RegisterEvents{ | 1107 histST:RegisterEvents{ |
| 1056 OnEnter = eoi_st_OnEnter, | 1108 OnEnter = eoi_st_OnEnter, |
| 1057 OnLeave = eoi_st_OnLeave, | 1109 OnLeave = eoi_st_OnLeave, |
| 1058 OnClick = hist_st_OnClick, | 1110 OnClick = hist_st_OnClick, |
| 1059 --OnDoubleClick = eoi_st_OnDoubleClick, | 1111 --OnDoubleClick = hist_st_OnDoubleClick, |
| 1060 } | 1112 } |
| 1061 local oldrefresh = histST.Refresh | 1113 local oldrefresh = histST.Refresh |
| 1062 histST.Refresh = function (self, opt_index) | 1114 histST.Refresh = function (self, opt_index) |
| 1063 addon:_fill_out_hist_data(opt_index) | 1115 addon:_fill_out_hist_data(opt_index) |
| 1064 return oldrefresh(self) | 1116 return oldrefresh(self) |
| 1066 histST.OuroLoot_Refresh = function (self, opt_index) | 1118 histST.OuroLoot_Refresh = function (self, opt_index) |
| 1067 addon:_fill_out_hist_data(opt_index) | 1119 addon:_fill_out_hist_data(opt_index) |
| 1068 self:SortData() -- calls hooked refresh | 1120 self:SortData() -- calls hooked refresh |
| 1069 end | 1121 end |
| 1070 | 1122 |
| 1071 local function reset_current_realm() | 1123 histST:SetFilter(history_filter_by_recent) |
| 1072 local r = assert(GetRealmName()) | 1124 |
| 1125 -- Zaps history for the given realm, or the current (current-playing | |
| 1126 -- realm, not currently-displayed realm) one if not specified. | |
| 1127 local function reset_current_realm (opt_realmname) | |
| 1128 local r = assert(opt_realmname or GetRealmName()) | |
| 1073 -- new .history table: | 1129 -- new .history table: |
| 1074 addon.history_all[r] = addon:_prep_new_history_category (nil, r) | 1130 addon.history_all[r] = addon:_prep_new_history_category (nil, r) |
| 1075 addon.history = addon.history_all[r] | 1131 addon.history = addon.history_all[r] |
| 1076 addon.hist_clean = nil | 1132 addon.hist_clean = nil |
| 1077 -- new .history.st table: | 1133 -- new .history.st table: |
| 1078 histST:OuroLoot_Refresh() | 1134 histST:OuroLoot_Refresh() |
| 1079 histST:SetData(addon.history.st) | 1135 histST:SetData(addon.history.st) |
| 1080 addon:Print("You've clicked the history erase button!") | |
| 1081 end | 1136 end |
| 1082 | 1137 |
| 1083 tabs_OnGroupSelected["hist"] = function(container,specials) | 1138 tabs_OnGroupSelected["hist"] = function(container,specials) |
| 1084 local st_widget = GUI:Create("lib-st") | 1139 local st_widget = GUI:Create("lib-st") |
| 1085 histST:OuroLoot_Refresh() | 1140 histST:OuroLoot_Refresh() |
| 1086 st_widget:WrapST(histST) | 1141 st_widget:WrapST(histST) |
| 1087 st_widget.head_offset = 15 | 1142 st_widget.head_offset = 15 |
| 1088 st_widget.tail_offset = 0 | 1143 st_widget.tail_offset = 0 |
| 1089 container:SetLayout("Fill") | 1144 container:SetLayout("Fill") |
| 1090 container:AddChild(st_widget) | 1145 container:AddChild(st_widget) |
| 1146 setstatus(hist_normal_status) | |
| 1091 | 1147 |
| 1092 local b | 1148 local b |
| 1093 do | 1149 do |
| 1094 local realms,current = {},1 | 1150 local realms,current = {},1 |
| 1095 for realmname,histtable in pairs(addon.history_all) do | 1151 for realmname,histtable in pairs(addon.history_all) do |
| 1100 b:SetFullWidth(true) | 1156 b:SetFullWidth(true) |
| 1101 b:SetLabel() -- required even when empty, see ace3 ticket #234 | 1157 b:SetLabel() -- required even when empty, see ace3 ticket #234 |
| 1102 b:SetList(realms) | 1158 b:SetList(realms) |
| 1103 b:SetValue(current) | 1159 b:SetValue(current) |
| 1104 b:SetCallback("OnValueChanged", function(_dd,event,choice) | 1160 b:SetCallback("OnValueChanged", function(_dd,event,choice) |
| 1105 print("chose realm", choice, realms[choice]) | 1161 local r = realms[choice] |
| 1162 addon.history = addon:_prep_new_history_category (addon.history_all[r], r) | |
| 1163 addon.hist_clean = nil | |
| 1164 histST:OuroLoot_Refresh() | |
| 1165 histST:SetData(addon.history.st) | |
| 1166 -- Reset filters to normal | |
| 1167 history_filter_who = nil | |
| 1168 histST:SetFilter(history_filter_by_recent) | |
| 1169 setstatus(hist_normal_status) | |
| 1170 return addon:redisplay() | |
| 1106 end) | 1171 end) |
| 1107 specials:AddChild(b) | 1172 specials:AddChild(b) |
| 1108 end | 1173 end |
| 1109 | 1174 |
| 1110 --[[ | 1175 --[[ b = GUI:Create("Spacer") b:SetFullWidth(true) b:SetHeight(10) specials:AddChild(b) ]] |
| 1111 b = GUI:Create("Spacer") | |
| 1112 b:SetFullWidth(true) | |
| 1113 b:SetHeight(10) | |
| 1114 specials:AddChild(b) | |
| 1115 ]] | |
| 1116 | 1176 |
| 1117 b = mkbutton("Regenerate", | 1177 b = mkbutton("Regenerate", |
| 1118 [[Erases all history entries from the displayed realm, and regenerates it from current loot information.]]) | 1178 [[Erases all history entries from the displayed realm, and regenerates it from current loot information.]]) |
| 1119 b:SetFullWidth(true) | 1179 b:SetFullWidth(true) |
| 1120 b:SetDisabled (#addon.history == 0) | 1180 b:SetDisabled (#addon.history == 0) |
| 1121 b:SetCallback("OnClick", function(_b) | 1181 b:SetCallback("OnClick", function(_b) |
| 1182 addon:rewrite_history (addon.history.realm) | |
| 1183 histST:OuroLoot_Refresh() | |
| 1184 histST:SetData(addon.history.st) | |
| 1122 addon:Print("%s history has been regenerated.", addon.history.realm) | 1185 addon:Print("%s history has been regenerated.", addon.history.realm) |
| 1123 return addon:redisplay() | 1186 return addon:redisplay() |
| 1124 --return tabs_OnGroupSelected_func(container,"OnGroupSelected","hist") | |
| 1125 end) | 1187 end) |
| 1126 specials:AddChild(b) | 1188 specials:AddChild(b) |
| 1127 | 1189 |
| 1128 b = mkbutton('hist_clear', "Clear Realm History", | 1190 b = mkbutton('hist_clear', "Clear Realm History", |
| 1129 [[No confirmation! |cffff1010Erases absolutely all> history entries from the displayed realm.]]) | 1191 [[No confirmation! |cffff1010Erases absolutely all> history entries from the displayed realm.]]) |
| 1130 b:SetFullWidth(true) | 1192 b:SetFullWidth(true) |
| 1131 b:SetCallback("OnClick", function (_b) | 1193 b:SetCallback("OnClick", function (_b) |
| 1132 reset_current_realm() | 1194 reset_current_realm(addon.history.realm) |
| 1195 addon:Print("Stimpy, you idiot! You've pushed the history erase button!") | |
| 1133 return addon:redisplay() | 1196 return addon:redisplay() |
| 1134 end) | 1197 end) |
| 1135 specials:AddChild(b) | 1198 specials:AddChild(b) |
| 1136 | 1199 |
| 1137 b = mkbutton('hist_clear_all', "Clear All History", | 1200 b = mkbutton('hist_clear_all', "Clear All History", |
| 1138 [[No confirmation! |cffff1010Erases absolutely all> history entries from ALL realms.]]) | 1201 [[No confirmation! |cffff1010Erases absolutely all> history entries from ALL realms.]]) |
| 1139 b:SetFullWidth(true) | 1202 b:SetFullWidth(true) |
| 1140 b:SetCallback("OnClick", function (_b) | 1203 b:SetCallback("OnClick", function (_b) |
| 1141 addon.history_all = {} | 1204 addon.history_all = {} |
| 1142 reset_current_realm() | 1205 reset_current_realm() |
| 1206 addon:Print("Stimpy, you idiot! You've pushed the history erase button!") | |
| 1143 return addon:redisplay() | 1207 return addon:redisplay() |
| 1144 end) | 1208 end) |
| 1145 specials:AddChild(b) | 1209 specials:AddChild(b) |
| 1146 | 1210 |
| 1147 b = mkbutton('hist_clear_old', "Clear Older", | 1211 b = mkbutton('hist_clear_old', "Clear Older", |
| 1148 [[Preserves only the latest loot entry for each player on the current realm, removing all earlier ones.]]) | 1212 [[Preserves only the latest loot entry for each player on the displayed realm, removing all earlier ones.]]) |
| 1149 b:SetFullWidth(true) | 1213 b:SetFullWidth(true) |
| 1150 b:SetCallback("OnClick", function (_b) | 1214 b:SetCallback("OnClick", function (_b) |
| 1215 addon:preen_history(addon.history.realm) | |
| 1151 addon:Print("All loot prior to the most recent entries has been erased.") | 1216 addon:Print("All loot prior to the most recent entries has been erased.") |
| 1217 addon.hist_clean = nil | |
| 1218 histST:OuroLoot_Refresh() | |
| 1152 return addon:redisplay() | 1219 return addon:redisplay() |
| 1153 --return tabs_OnGroupSelected_func(container,"OnGroupSelected","hist") | |
| 1154 end) | 1220 end) |
| 1155 specials:AddChild(b) | 1221 specials:AddChild(b) |
| 1156 end | 1222 end |
| 1157 return tabs_OnGroupSelected["hist"](container,specials) | 1223 return tabs_OnGroupSelected["hist"](container,specials) |
| 1158 end | 1224 end |
| 1159 end | 1225 end |
| 1160 | 1226 |
| 1161 -- Tab 5: Help (content in lootaux.lua) | 1227 -- Tab 5: Help (content in verbage.lua) |
| 1162 do | 1228 do |
| 1163 local tabs_help_OnGroupSelected_func = function (treeg,event,category) | 1229 local tabs_help_OnGroupSelected_func = function (treeg,event,category) |
| 1164 treeg:ReleaseChildren() | 1230 treeg:ReleaseChildren() |
| 1165 local txt = GUI:Create("Label") | 1231 local txt = GUI:Create("Label") |
| 1166 txt:SetFullWidth(true) | 1232 txt:SetFullWidth(true) |
| 1485 addon:Print("No longer filtering out", val_name) | 1551 addon:Print("No longer filtering out", val_name) |
| 1486 end) | 1552 end) |
| 1487 grp:AddChild(w) | 1553 grp:AddChild(w) |
| 1488 end | 1554 end |
| 1489 | 1555 |
| 1490 scroll:AddChild(grp) | |
| 1491 | |
| 1492 addon.sender_list.sort() | 1556 addon.sender_list.sort() |
| 1493 if #addon.sender_list.namesI > 0 then | 1557 if #addon.sender_list.namesI > 0 then |
| 1494 local senders = table.concat(addon.sender_list.namesI,'\n') -- sigh | 1558 local senders = table.concat(addon.sender_list.namesI,'\n') -- sigh |
| 1495 -- If 39 other people in the raid are running this, the label will | 1559 -- If 39 other people in the raid are running this, the label will |
| 1496 -- explode... is it likely enough to care about? No. | 1560 -- explode... is it likely enough to care about? No. |
| 1501 w = GUI:Create("Label") | 1565 w = GUI:Create("Label") |
| 1502 w:SetRelativeWidth(0.4) | 1566 w:SetRelativeWidth(0.4) |
| 1503 w:SetText(addon.quality_hexes[3].."Echo from latest ping:|r\n"..senders) | 1567 w:SetText(addon.quality_hexes[3].."Echo from latest ping:|r\n"..senders) |
| 1504 grp:AddChild(w) | 1568 grp:AddChild(w) |
| 1505 end | 1569 end |
| 1570 | |
| 1571 scroll:AddChild(grp) | |
| 1506 | 1572 |
| 1507 w = mkbutton("ReloadUI", [[Does what you think it does. Loot information is written out and restored.]]) | 1573 w = mkbutton("ReloadUI", [[Does what you think it does. Loot information is written out and restored.]]) |
| 1508 w:SetFullWidth(true) | 1574 w:SetFullWidth(true) |
| 1509 w:SetCallback("OnClick", ReloadUI) | 1575 w:SetCallback("OnClick", ReloadUI) |
| 1510 specials:AddChild(w) | 1576 specials:AddChild(w) |
| 1623 ]] | 1689 ]] |
| 1624 display:SetCallback("OnClose", function(_display) | 1690 display:SetCallback("OnClose", function(_display) |
| 1625 _d = _display:GetUserData("eoiST") | 1691 _d = _display:GetUserData("eoiST") |
| 1626 self.display = nil | 1692 self.display = nil |
| 1627 GUI:Release(_display) | 1693 GUI:Release(_display) |
| 1694 flib.clear() | |
| 1628 collectgarbage() | 1695 collectgarbage() |
| 1629 end) | 1696 end) |
| 1630 | 1697 |
| 1631 ----- Right-hand panel | 1698 ----- Right-hand panel |
| 1632 local rhs_width = 0.20 | 1699 local rhs_width = 0.20 |
