Mercurial > wow > ouroloot
comparison gui.lua @ 110:f93c1a93923b
Change how dropdown menus are built, and register "mark as" in the loot dropdowns.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Wed, 08 Aug 2012 23:13:04 -0400 |
parents | ce45011fab4c |
children | cfbaf001fd52 |
comparison
equal
deleted
inserted
replaced
109:ce45011fab4c | 110:f93c1a93923b |
---|---|
45 ["eoi"] = {title=[[Loot]], desc=[[Observed loot, plus boss kills and other events of interest]]}, | 45 ["eoi"] = {title=[[Loot]], desc=[[Observed loot, plus boss kills and other events of interest]]}, |
46 ["hist"] = {title=[[History]], desc=[[A short semi-permanent record]]}, | 46 ["hist"] = {title=[[History]], desc=[[A short semi-permanent record]]}, |
47 }, | 47 }, |
48 taborder = { "eoi" }, | 48 taborder = { "eoi" }, |
49 taborder_APPEND = { "hist", "help", "opt" }, | 49 taborder_APPEND = { "hist", "help", "opt" }, |
50 | |
51 -- Tables for feeding to EasyMenu | |
52 dropdown = {}, | |
50 } | 53 } |
51 addon.gui_state_pointer = gui -- only during loading, then cleaned out | 54 addon.gui_state_pointer = gui -- only during loading, then cleaned out |
52 if addon.author_debug then | 55 if addon.author_debug then |
53 _G.OLgui = gui | 56 _G.OLgui = gui |
54 end | 57 end |
818 Dropdown menu handling; this has grown in ungainly directions. | 821 Dropdown menu handling; this has grown in ungainly directions. |
819 ]] | 822 ]] |
820 -- forward decls | 823 -- forward decls |
821 local eoi_editcell | 824 local eoi_editcell |
822 | 825 |
826 local dropdownmenuframe = CreateFrame("Frame", "OuroLootDropDownMenu", nil, "UIDropDownMenuTemplate") | |
823 local dropdownfuncs | 827 local dropdownfuncs |
824 do | 828 do |
825 local ddf_mt = { | 829 local ddf_mt = { |
826 __index = { | 830 __index = { |
827 -- more stuff should be moved into this table | 831 -- more stuff should be moved into this table |
839 subfunc(i,arg) | 843 subfunc(i,arg) |
840 gui.which_ST:OuroLoot_Refresh(i) | 844 gui.which_ST:OuroLoot_Refresh(i) |
841 end | 845 end |
842 end | 846 end |
843 | 847 |
844 local function gen_easymenu_table (initial, list, funcs) | 848 local function gen_dd_entry (name, functbl, funci, arg, ttt) |
845 for _,tag in ipairs(list) do | 849 local entry |
846 local name, arg, tiptext | 850 if name == '--' then |
847 name, tiptext = strsplit('|',tag) | 851 entry = { |
848 name, arg = strsplit('%',name) | 852 text = "", disabled = true, notCheckable = true, |
849 if name == "--" then | 853 } |
850 tinsert (initial, { | 854 else |
851 disabled = true, notCheckable = true, text = "", | 855 local a1 = functbl[name] |
852 }) | 856 if type(funci) == 'string' then |
853 else | 857 a1 = functbl[funci] |
854 if not funcs[name] then | 858 end |
855 error(("'%s' not defined as a dropdown function"):format(name)) | 859 entry = { |
856 end | 860 text = name, |
857 tinsert (initial, { | 861 func = dropdownmenu_handler, arg1 = a1, arg2 = arg, |
858 text = name, | 862 notCheckable = true, |
859 func = dropdownmenu_handler, | 863 tooltipOnButton = true, |
860 arg1 = funcs[name], | 864 tooltipWhileDisabled = true, |
861 arg2 = arg, | 865 tooltipTitle = ttt and name or nil, |
862 notCheckable = true, | 866 tooltipText = ttt, |
863 tooltipOnButton = true, | 867 } |
864 tooltipWhileDisabled = true, | 868 end |
865 tooltipTitle = tiptext and name or nil, | 869 return entry |
866 tooltipText = tiptext, | 870 end |
867 }) | |
868 end | |
869 end | |
870 return initial | |
871 end | |
872 | |
873 local dropdownmenuframe = CreateFrame("Frame", "OuroLootDropDownMenu", nil, "UIDropDownMenuTemplate") | |
874 | 871 |
875 | 872 |
876 -- Tab 1: Events Of Interest | 873 -- Tab 1: Events Of Interest |
877 -- This actually takes up quite a bit of the file. | 874 -- This actually takes up quite a bit of the file. |
878 eoi_dropdownfuncs = dropdownfuncs{ | 875 eoi_dropdownfuncs = dropdownfuncs{ |
898 else | 895 else |
899 addon:Print(err) | 896 addon:Print(err) |
900 end | 897 end |
901 end | 898 end |
902 end | 899 end |
900 end, | |
901 | |
902 df_DISPOSITION = function(rowi,disp) -- all "mark as <x>" entries start here | |
903 addon:loot_mark_disposition ("local", rowi, disp) | |
903 end, | 904 end, |
904 | 905 |
905 ["Delete remaining entries for this day"] = function(rowi,kind) | 906 ["Delete remaining entries for this day"] = function(rowi,kind) |
906 -- if kind is boss, also need to stop at new timestamp | 907 -- if kind is boss, also need to stop at new timestamp |
907 local fencepost = addon._find_timeboss_fencepost (kind, rowi) | 908 local fencepost = addon._find_timeboss_fencepost (kind, rowi) |
935 addon:Print("Rebroadcast entry", rowi, e.itemlink or e.bossname or UNKNOWN) | 936 addon:Print("Rebroadcast entry", rowi, e.itemlink or e.bossname or UNKNOWN) |
936 rowi = rowi + 1 | 937 rowi = rowi + 1 |
937 until rowi >= fencepost | 938 until rowi >= fencepost |
938 end, | 939 end, |
939 | 940 |
940 ["Mark as normal"] = function(rowi,disp) | |
941 addon:loot_mark_disposition ("local", rowi, disp) | |
942 end, | |
943 | |
944 ["Show only this player"] = function(rowi) | 941 ["Show only this player"] = function(rowi) |
945 local st = assert(gui.eoiST) | 942 local st = assert(gui.eoiST) |
946 _d:SetUserData("player filter name", g_loot[rowi].person) | 943 _d:SetUserData("player filter name", g_loot[rowi].person) |
947 st:SetFilter(_d:GetUserData("player filter by name")) | 944 st:SetFilter(_d:GetUserData("player filter by name")) |
948 _d:GetUserData("eoi_filter_reset"):SetDisabled(false) | 945 _d:GetUserData("eoi_filter_reset"):SetDisabled(false) |
969 CloseDropDownMenus() -- also need to close parent menu | 966 CloseDropDownMenus() -- also need to close parent menu |
970 local dialog = StaticPopup_Show "OUROL_REASSIGN_ENTER" | 967 local dialog = StaticPopup_Show "OUROL_REASSIGN_ENTER" |
971 dialog.data = {index=rowi, display=_d} | 968 dialog.data = {index=rowi, display=_d} |
972 end, | 969 end, |
973 } | 970 } |
974 -- Would be better to move the %arg to this list rather than below, but | 971 |
975 -- that's a lot of extra effort that doesn't buy much in return. | 972 do |
976 eoi_dropdownfuncs["Delete this loot event"] = eoi_dropdownfuncs.df_DELETE | 973 local function E (name, funci, arg, ttt) |
977 eoi_dropdownfuncs["Delete this boss event"] = eoi_dropdownfuncs.df_DELETE | 974 return gen_dd_entry (name, eoi_dropdownfuncs, funci, arg, ttt) |
978 eoi_dropdownfuncs["Insert new loot entry"] = eoi_dropdownfuncs.df_INSERT | 975 end |
979 eoi_dropdownfuncs["Insert new boss kill event"] = eoi_dropdownfuncs.df_INSERT | 976 |
980 eoi_dropdownfuncs["Mark as disenchanted"] = eoi_dropdownfuncs["Mark as normal"] | 977 gui.dropdown.eoi_time = { |
981 eoi_dropdownfuncs["Mark as ".._G.GUILD_BANK:lower()] = eoi_dropdownfuncs["Mark as normal"] | 978 { |
982 eoi_dropdownfuncs["Mark as offspec"] = eoi_dropdownfuncs["Mark as normal"] | 979 -- this is the dropdown title, text filled in on the fly |
983 eoi_dropdownfuncs["Delete remaining entries for this boss"] = | 980 isTitle = true, |
984 eoi_dropdownfuncs["Delete remaining entries for this day"] | 981 notClickable = true, |
985 eoi_dropdownfuncs["Rebroadcast this day"] = eoi_dropdownfuncs["Rebroadcast this boss"] | 982 notCheckable = true, |
986 local eoi_time_dropdown = gen_easymenu_table( | 983 }, |
987 {{ | 984 E("Rebroadcast this day", "Rebroadcast this boss", 'time', "Broadcasts everything from here down until a new day."), |
988 -- this is the dropdown title, text filled in on the fly | 985 E("Delete remaining entries for this day", nil, 'time', "Erases everything from here down until a new day.\n\nHold down the Shift key to also delete the corresponding entries from player History."), |
989 isTitle = true, | 986 E("Insert new loot entry", 'df_INSERT', 'loot', "Inserts new loot above this one, prompting you for information."), |
990 notClickable = true, | 987 E("Insert new boss kill event", 'df_INSERT', 'boss', "Inserts new event above this one, prompting you for information."), |
991 notCheckable = true, | 988 E(CLOSE), |
992 }}, | 989 } |
993 { | 990 gui.dropdown.eoi_loot = { |
994 "Rebroadcast this day%time|Broadcasts everything from here down until a new day.", | 991 { |
995 "Delete remaining entries for this day%time|Erases everything from here down until a new day.\n\nHold down the Shift key to also delete the corresponding entries from player History.", | 992 -- this is the dropdown title, text filled in on the fly |
996 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.", | 993 notClickable = true, |
997 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information.", | 994 notCheckable = true, |
998 CLOSE | 995 }, |
999 }, eoi_dropdownfuncs) | 996 E("--"), |
1000 local eoi_loot_dropdown = gen_easymenu_table( | 997 E("Rebroadcast this loot entry", nil, nil, "Sends this loot event, including special notes, as if it just happened."), |
1001 {{ | 998 E("Delete this loot event", 'df_DELETE', nil, "Permanent, no going back!\n\nHold down the Shift key to also delete the corresponding entry from player's History."), |
1002 -- this is the dropdown title, text filled in on the fly | 999 E("Delete remaining entries for this boss", "Delete remaining entries for this day", '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."), |
1003 notClickable = true, | 1000 E("Insert new loot entry", 'df_INSERT', 'loot', "Inserts new loot above this one, prompting you for information."), |
1004 notCheckable = true, | 1001 E("Insert new boss kill event", 'df_INSERT', 'boss', "Inserts new event above this one, prompting you for information."), |
1005 }}, | 1002 E("Edit note", nil, nil, "Same as double-clicking in the Notes column."), |
1006 { | 1003 E("--"), |
1007 "Mark as disenchanted%shard", | 1004 E(CLOSE), |
1008 "Mark as offspec%offspec", | 1005 } |
1009 "Mark as ".._G.GUILD_BANK:lower().."%gvault", | 1006 gui.dropdown.eoi_player = { |
1010 "Mark as normal|This is the default. Selecting any 'Mark as <x>' action blanks out extra notes about who broadcast this entry, etc.", | |
1011 "--", | |
1012 "Rebroadcast this loot entry|Sends this loot event, including special notes, as if it just happened.", | |
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.", | |
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.", | |
1015 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.", | |
1016 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information.", | |
1017 "Edit note|Same as double-clicking in the notes column.", | |
1018 "--", | |
1019 CLOSE | |
1020 }, eoi_dropdownfuncs) | |
1021 local eoi_player_dropdown = gen_easymenu_table( | |
1022 { | |
1023 { | 1007 { |
1024 -- this is the dropdown title, text filled in on the fly | 1008 -- this is the dropdown title, text filled in on the fly |
1025 isTitle = true, | 1009 isTitle = true, |
1026 notClickable = true, | 1010 notClickable = true, |
1027 notCheckable = true, | 1011 notCheckable = true, |
1031 hasArrow = true, | 1015 hasArrow = true, |
1032 --menuList = filled in in the fly, | 1016 --menuList = filled in in the fly, |
1033 tooltipOnButton = true, | 1017 tooltipOnButton = true, |
1034 tooltipWhileDisabled = true, | 1018 tooltipWhileDisabled = true, |
1035 }, | 1019 }, |
1036 }, | 1020 E("Show only this player"), |
1037 { | 1021 E(CLOSE), |
1038 "Show only this player", | 1022 } |
1039 CLOSE | 1023 gui.dropdown.eoi_boss = { |
1040 }, eoi_dropdownfuncs) | 1024 { |
1041 local eoi_boss_dropdown = gen_easymenu_table( | 1025 -- this is the dropdown title, text filled in on the fly |
1042 {{ | 1026 isTitle = true, |
1043 -- this is the dropdown title, text filled in on the fly | 1027 notClickable = true, |
1044 isTitle = true, | 1028 notCheckable = true, |
1045 notClickable = true, | 1029 }, |
1046 notCheckable = true, | 1030 E("Change from 'wipe' to 'kill'", nil, nil, "Also collapses previous wipe entries."), -- KILLWIPE |
1047 }}, | 1031 E("Rebroadcast this boss", nil, 'boss', "Broadcasts the kill event and all subsequent loot until next boss."), |
1048 { | 1032 E("Delete this boss event", 'df_DELETE', nil, "Permanent, no going back!"), |
1049 "Change from 'wipe' to 'kill'|Also collapses previous wipe entries.", -- KILLWIPE | 1033 E("Delete remaining entries for this boss", "Delete remaining entries for this day", '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."), |
1050 "Rebroadcast this boss%boss|Broadcasts the kill event and all subsequent loot until next boss.", | 1034 E("Insert new loot entry", 'df_INSERT', 'loot', "Inserts new loot above this one, prompting you for information."), |
1051 "Delete this boss event|Permanent, no going back!", | 1035 E("Insert new boss kill event", 'df_INSERT', 'boss', "Inserts new event above this one, prompting you for information."), |
1052 "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.", | 1036 E("--"), |
1053 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.", | 1037 E(CLOSE), |
1054 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information.", | 1038 } |
1055 "--", | 1039 end |
1056 CLOSE | 1040 |
1057 }, eoi_dropdownfuncs) | |
1058 | 1041 |
1059 --[[ quoted verbatim from lib-st docs (table->stable for obvious reasons): | 1042 --[[ quoted verbatim from lib-st docs (table->stable for obvious reasons): |
1060 rowFrame This is the UI Frame table for the row. | 1043 rowFrame This is the UI Frame table for the row. |
1061 cellFrame This is the UI Frame table for the cell in the row. | 1044 cellFrame This is the UI Frame table for the cell in the row. |
1062 data This is the data table supplied to the scrolling table (in case you lost it :) ) | 1045 data This is the data table supplied to the scrolling table (in case you lost it :) ) |
1154 if button ~= "RightButton" then return true end | 1137 if button ~= "RightButton" then return true end |
1155 _d:SetUserData("DD index", realrow) | 1138 _d:SetUserData("DD index", realrow) |
1156 | 1139 |
1157 if kind == 'loot' and (column == 1 or column == 3) then | 1140 if kind == 'loot' and (column == 1 or column == 3) then |
1158 _d:SetUserData("DD cell", cellFrame) | 1141 _d:SetUserData("DD cell", cellFrame) |
1159 eoi_loot_dropdown[1].text = e.itemlink | 1142 gui.dropdown.eoi_loot[1].text = e.itemlink |
1160 EasyMenu (eoi_loot_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | 1143 EasyMenu (gui.dropdown.eoi_loot, dropdownmenuframe, cellFrame, 0, 0, "MENU") |
1161 | 1144 |
1162 elseif kind == 'loot' and column == 2 then | 1145 elseif kind == 'loot' and column == 2 then |
1163 eoi_player_dropdown[1].text = e.person | 1146 gui.dropdown.eoi_player[1].text = e.person |
1164 local raiders = {} | 1147 local raiders = {} |
1165 for i = 1, GetNumRaidMembers() do | 1148 for i = 1, GetNumRaidMembers() do |
1166 tinsert (raiders, (GetRaidRosterInfo(i))) | 1149 tinsert (raiders, (GetRaidRosterInfo(i))) |
1167 end | 1150 end |
1168 table.sort(raiders) | 1151 table.sort(raiders) |
1169 for i = 1, #raiders do | 1152 for i = 1, #raiders do |
1170 local name = raiders[i] | 1153 local name = raiders[i] |
1171 raiders[i] = { | 1154 raiders[i] = gen_dd_entry (name, eoi_dropdownfuncs, 'df_REASSIGN', name) |
1172 text = name, | 1155 end |
1173 func = dropdownmenu_handler, | 1156 tinsert (raiders, gen_dd_entry ("Enter name...", eoi_dropdownfuncs)) |
1174 arg1 = eoi_dropdownfuncs.df_REASSIGN, | 1157 tinsert (raiders, gen_dd_entry (CLOSE, eoi_dropdownfuncs)) |
1175 arg2 = name, | 1158 gui.dropdown.eoi_player[2].menuList = raiders |
1176 notCheckable = true, | |
1177 } | |
1178 end | |
1179 eoi_player_dropdown[2].menuList = | |
1180 gen_easymenu_table (raiders, {"Enter name...",CLOSE}, eoi_dropdownfuncs) | |
1181 | 1159 |
1182 if not addon:_test_disposition (e.disposition, 'can_reassign') then | 1160 if not addon:_test_disposition (e.disposition, 'can_reassign') then |
1183 eoi_player_dropdown[2].disabled = true | 1161 gui.dropdown.eoi_player[2].disabled = true |
1184 eoi_player_dropdown[2].tooltipTitle = "Cannot Reassign" | 1162 gui.dropdown.eoi_player[2].tooltipTitle = "Cannot Reassign" |
1185 eoi_player_dropdown[2].tooltipText = "You must first mark this item as 'normal' or 'offspec' before reassignment." | 1163 gui.dropdown.eoi_player[2].tooltipText = "You must first mark this item as 'normal' or 'offspec' before reassignment." |
1186 else | 1164 else |
1187 eoi_player_dropdown[2].disabled = nil | 1165 gui.dropdown.eoi_player[2].disabled = nil |
1188 eoi_player_dropdown[2].tooltipTitle = nil | 1166 gui.dropdown.eoi_player[2].tooltipTitle = nil |
1189 eoi_player_dropdown[2].tooltipText = nil | 1167 gui.dropdown.eoi_player[2].tooltipText = nil |
1190 end | 1168 end |
1191 EasyMenu (eoi_player_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | 1169 EasyMenu (gui.dropdown.eoi_player, dropdownmenuframe, cellFrame, 0, 0, "MENU") |
1192 | 1170 |
1193 elseif kind == 'boss' then | 1171 elseif kind == 'boss' then |
1194 eoi_boss_dropdown[1].text = e.bossname | 1172 gui.dropdown.eoi_boss[1].text = e.bossname |
1195 -- KILLWIPE: update '2' if this is not the 2nd entry in eoi_boss_dropdown | 1173 -- KILLWIPE: update '2' if this is not the 2nd entry in gui.dropdown.eoi_boss |
1196 eoi_boss_dropdown[2].tooltipWhileDisabled = nil | 1174 gui.dropdown.eoi_boss[2].tooltipWhileDisabled = nil |
1197 eoi_boss_dropdown[2].disabled = e.reason ~= 'wipe' and true or nil | 1175 gui.dropdown.eoi_boss[2].disabled = e.reason ~= 'wipe' and true or nil |
1198 EasyMenu (eoi_boss_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | 1176 EasyMenu (gui.dropdown.eoi_boss, dropdownmenuframe, cellFrame, 0, 0, "MENU") |
1199 | 1177 |
1200 elseif kind == 'time' then | 1178 elseif kind == 'time' then |
1201 eoi_time_dropdown[1].text = e.startday.text | 1179 gui.dropdown.eoi_time[1].text = e.startday.text |
1202 EasyMenu (eoi_time_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | 1180 EasyMenu (gui.dropdown.eoi_time, dropdownmenuframe, cellFrame, 0, 0, "MENU") |
1203 | 1181 |
1204 end | 1182 end |
1205 | 1183 |
1206 return true -- do not do anything further | 1184 return true -- do not do anything further |
1207 end | 1185 end |
1535 scrollhere = scrollhere * eoi_st_rowheight | 1513 scrollhere = scrollhere * eoi_st_rowheight |
1536 -- But not past the bottom, it looks ugly | 1514 -- But not past the bottom, it looks ugly |
1537 scrollhere = math.min (scrollhere, | 1515 scrollhere = math.min (scrollhere, |
1538 (#gui.eoiST.filtered - eoi_st_displayed_rows) * eoi_st_rowheight) | 1516 (#gui.eoiST.filtered - eoi_st_displayed_rows) * eoi_st_rowheight) |
1539 gui.eoiST:SetSelection(name_or_lineno) | 1517 gui.eoiST:SetSelection(name_or_lineno) |
1540 local sf = gui.eoiST.scrollframe | 1518 if name_or_lineno > eoi_st_displayed_rows then |
1541 sf:GetScript("OnVerticalScroll")(sf,scrollhere) | 1519 -- don't try to scroll if there's not enough lines |
1520 local sf = gui.eoiST.scrollframe | |
1521 sf:GetScript("OnVerticalScroll")(sf,scrollhere) | |
1522 end | |
1542 end | 1523 end |
1543 end | 1524 end |
1544 | 1525 |
1545 | 1526 |
1546 -- Tab 2/3 (generated text) | 1527 -- Tab 2/3 (generated text) |
1641 addon:_build_history_names() | 1622 addon:_build_history_names() |
1642 addon:Print("Removed player %s from history (%d total entries).", | 1623 addon:Print("Removed player %s from history (%d total entries).", |
1643 addon:colorize(name,gone.person_class), #gone.unique) | 1624 addon:colorize(name,gone.person_class), #gone.unique) |
1644 end, | 1625 end, |
1645 } | 1626 } |
1646 local hist_general_dropdown = gen_easymenu_table( | 1627 |
1647 {{ | 1628 do |
1648 -- this is the dropdown title, text filled in on the fly | 1629 local function E (name, funci, arg, ttt) |
1649 isTitle = true, | 1630 return gen_dd_entry (name, hist_dropdownfuncs, funci, arg, ttt) |
1650 notClickable = true, | 1631 end |
1651 notCheckable = true, | 1632 |
1652 }}, | 1633 gui.dropdown.hist_general = { |
1653 { | 1634 { |
1654 "Delete this player's entire loot history|Permanent, no going back!", | 1635 -- this is the dropdown title, text filled in on the fly |
1655 "--", | 1636 isTitle = true, |
1656 CLOSE | 1637 notClickable = true, |
1657 }, hist_dropdownfuncs) | 1638 notCheckable = true, |
1658 local hist_specific_dropdown = gen_easymenu_table( | 1639 }, |
1659 {{ | 1640 E("Delete this player's entire loot history", nil, nil, "Permanent, no going back!"), |
1660 -- this is the dropdown title, text filled in on the fly | 1641 E("--"), |
1661 notClickable = true, | 1642 E(CLOSE), |
1662 notCheckable = true, | 1643 } |
1663 }}, | 1644 gui.dropdown.hist_specific = { |
1664 { | 1645 { |
1665 "Delete this loot event from history|Permanent, no going back!", | 1646 -- this is the dropdown title, text filled in on the fly |
1666 "--", | 1647 notClickable = true, |
1667 CLOSE | 1648 notCheckable = true, |
1668 }, hist_dropdownfuncs) | 1649 }, |
1650 E("Delete this loot event from history", nil, nil, "Permanent, no going back!"), | |
1651 E("--"), | |
1652 E(CLOSE), | |
1653 } | |
1654 end | |
1669 | 1655 |
1670 -- Loot column | 1656 -- Loot column |
1671 --[[ | 1657 --[[ |
1672 local function hist_st_col2_DoCellUpdate (rowFrame, cellFrame, data, cols, row, realrow, column, fShow, stable) | 1658 local function hist_st_col2_DoCellUpdate (rowFrame, cellFrame, data, cols, row, realrow, column, fShow, stable) |
1673 end]] | 1659 end]] |
1708 -- The rest depends on whether we're filtering (focused in on a specific | 1694 -- The rest depends on whether we're filtering (focused in on a specific |
1709 -- player) or not. | 1695 -- player) or not. |
1710 if history_filter_who then | 1696 if history_filter_who then |
1711 -- Shift-right opens a menu | 1697 -- Shift-right opens a menu |
1712 if IsShiftKeyDown() and button == "RightButton" then | 1698 if IsShiftKeyDown() and button == "RightButton" then |
1713 hist_specific_dropdown[1].text = h.itemlink | 1699 gui.dropdown.hist_specific[1].text = h.itemlink |
1714 EasyMenu (hist_specific_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | 1700 EasyMenu (gui.dropdown.hist_specific, dropdownmenuframe, cellFrame, 0, 0, "MENU") |
1715 | 1701 |
1716 -- Right goes back to normal mode | 1702 -- Right goes back to normal mode |
1717 elseif button == "RightButton" then | 1703 elseif button == "RightButton" then |
1718 history_filter_who = nil | 1704 history_filter_who = nil |
1719 stable:SetFilter(history_filter_by_recent) | 1705 stable:SetFilter(history_filter_by_recent) |
1721 end | 1707 end |
1722 | 1708 |
1723 else -- not focused | 1709 else -- not focused |
1724 -- Shift-right opens a menu | 1710 -- Shift-right opens a menu |
1725 if IsShiftKeyDown() and button == "RightButton" then | 1711 if IsShiftKeyDown() and button == "RightButton" then |
1726 hist_general_dropdown[1].text = h.OLwho | 1712 gui.dropdown.hist_general[1].text = h.OLwho |
1727 EasyMenu (hist_general_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | 1713 EasyMenu (gui.dropdown.hist_general, dropdownmenuframe, cellFrame, 0, 0, "MENU") |
1728 | 1714 |
1729 -- Left focuses on a specific player | 1715 -- Left focuses on a specific player |
1730 elseif button == "LeftButton" then | 1716 elseif button == "LeftButton" then |
1731 history_filter_who = h.OLwho | 1717 history_filter_who = h.OLwho |
1732 stable:SetFilter(history_filter_by_name) | 1718 stable:SetFilter(history_filter_by_name) |
2272 local lineno = tonumber(self.lootjumps[line]) | 2258 local lineno = tonumber(self.lootjumps[line]) |
2273 self:OpenMainDisplayToTab ("Loot", lineno) | 2259 self:OpenMainDisplayToTab ("Loot", lineno) |
2274 end | 2260 end |
2275 | 2261 |
2276 | 2262 |
2263 -- We need to be able to reference the dropdownmenu locals, and I didn't want to | |
2264 -- bubble them up any higher. | |
2265 function gui.add_dropdown_entry (menutag, name, func_tbl, func_or_othername, arg, tooltiptext) | |
2266 local emtbl = assert(gui.dropdown[menutag]) | |
2267 | |
2268 if type(func_tbl) == 'table' then | |
2269 -- use it directly | |
2270 elseif func_tbl == nil then | |
2271 -- determine it from the menu tag | |
2272 func_tbl = (menutag:sub(1,3) == 'eoi' and eoi_dropdownfuncs) | |
2273 or (menutag:sub(1,4) == 'hist' and hist_dropdownfuncs) | |
2274 or error("Cannot figure out function table from menu tag name") | |
2275 end | |
2276 | |
2277 if type(func_or_othername) == 'string' then | |
2278 -- gen_dd_entry handles this | |
2279 elseif type(func_or_othername) == 'function' then | |
2280 error"bah" | |
2281 end | |
2282 | |
2283 local index | |
2284 if menutag == 'eoi_loot' then | |
2285 index = 2 | |
2286 elseif menutag == 'eoi_player' then | |
2287 index = 3 | |
2288 else | |
2289 index = 2 | |
2290 end | |
2291 | |
2292 local ent = gen_dd_entry (name, func_tbl, func_or_othername, arg, tooltiptext) | |
2293 tinsert (emtbl, index, ent) | |
2294 return ent | |
2295 end | |
2296 | |
2297 | |
2277 ------ Popup dialogs | 2298 ------ Popup dialogs |
2278 local function build_my_slider_widget() | 2299 local function build_my_slider_widget() |
2279 local s = CreateFrame("Slider", "OuroLootSlider", nil, "OptionsSliderTemplate") | 2300 local s = CreateFrame("Slider", "OuroLootSlider", nil, "OptionsSliderTemplate") |
2280 s.text = OuroLootSliderText | 2301 s.text = OuroLootSliderText |
2281 s.low = OuroLootSliderLow | 2302 s.low = OuroLootSliderLow |