Mercurial > wow > ouroloot
comparison gui.lua @ 25:cb9635999171
- Reassigning loot, and marking loot as disenchanted/vault, will update the
history entries also.
- Tooltip help on dropdown menus appears at mouse now, instead of depending
on Blizzard's "Beginner Tooltips" setting.
- Forum BBcode output includes an option for MMO-Champion/Wowstead formatting.
- Smarter cleanup functions for expiring caches.
- Properly prefer locally-generated loot events, even when other users can
see and rebroadcast the events back to you faster than you see them.
author | Farmbuyer of US-Kilrogg <farmbuyer@gmail.com> |
---|---|
date | Wed, 05 Oct 2011 02:14:07 +0000 |
parents | 61d932f0e8f2 |
children | f866daadcdf6 |
comparison
equal
deleted
inserted
replaced
24:61d932f0e8f2 | 25:cb9635999171 |
---|---|
399 text = name, | 399 text = name, |
400 func = dropdownmenu_handler, | 400 func = dropdownmenu_handler, |
401 arg1 = funcs[name], | 401 arg1 = funcs[name], |
402 arg2 = arg, | 402 arg2 = arg, |
403 notCheckable = true, | 403 notCheckable = true, |
404 tooltipOnButton = true, | |
405 tooltipWhileDisabled = true, | |
404 tooltipTitle = tiptext and name or nil, | 406 tooltipTitle = tiptext and name or nil, |
405 tooltipText = tiptext, | 407 tooltipText = tiptext, |
406 }) | 408 }) |
407 end | 409 end |
408 end | 410 end |
466 ["Rebroadcast this boss"] = function(rowi,kind) | 468 ["Rebroadcast this boss"] = function(rowi,kind) |
467 addon:Print("not implemented yet") -- TODO | 469 addon:Print("not implemented yet") -- TODO |
468 end, | 470 end, |
469 | 471 |
470 ["Mark as normal"] = function(rowi,disp) -- broadcast the change? ugh | 472 ["Mark as normal"] = function(rowi,disp) -- broadcast the change? ugh |
473 local olddisp = g_loot[rowi].disposition | |
471 g_loot[rowi].disposition = disp | 474 g_loot[rowi].disposition = disp |
472 g_loot[rowi].bcast_from = nil | 475 g_loot[rowi].bcast_from = nil |
473 g_loot[rowi].extratext = nil | 476 g_loot[rowi].extratext = nil |
477 addon:history_handle_disposition (rowi, olddisp) | |
474 end, | 478 end, |
475 | 479 |
476 ["Show only this player"] = function(rowi) | 480 ["Show only this player"] = function(rowi) |
477 local st = _d:GetUserData("eoiST") | 481 local st = _d:GetUserData("eoiST") |
478 _d:SetUserData("player filter name", g_loot[rowi].person) | 482 _d:SetUserData("player filter name", g_loot[rowi].person) |
493 df_REASSIGN = function(rowi,to_whom) | 497 df_REASSIGN = function(rowi,to_whom) |
494 addon:reassign_loot (rowi, to_whom) | 498 addon:reassign_loot (rowi, to_whom) |
495 CloseDropDownMenus() -- also need to close parent menu | 499 CloseDropDownMenus() -- also need to close parent menu |
496 end, | 500 end, |
497 ["Enter name..."] = function(rowi) | 501 ["Enter name..."] = function(rowi) |
502 CloseDropDownMenus() -- also need to close parent menu | |
498 local dialog = StaticPopup_Show "OUROL_REASSIGN_ENTER" | 503 local dialog = StaticPopup_Show "OUROL_REASSIGN_ENTER" |
499 dialog.data = {index=rowi, display=_d} | 504 dialog.data = {index=rowi, display=_d} |
500 end, | 505 end, |
501 } | 506 } |
502 -- Would be better to move the %arg to this list rather than below, but | 507 -- Would be better to move the %arg to this list rather than below, but |
516 isTitle = true, | 521 isTitle = true, |
517 notClickable = true, | 522 notClickable = true, |
518 notCheckable = true, | 523 notCheckable = true, |
519 }}, | 524 }}, |
520 { | 525 { |
521 "Rebroadcast this day%time|Broadcasts everything from here down until a new day", | 526 "Rebroadcast this day%time|Broadcasts everything from here down until a new day.", |
522 "Delete remaining entries for this day%time|Erases everything from here down until a new day", | 527 "Delete remaining entries for this day%time|Erases everything from here down until a new day.", |
523 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information", | 528 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.", |
524 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information", | 529 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information.", |
525 CLOSE | 530 CLOSE |
526 }, dropdownfuncs) | 531 }, dropdownfuncs) |
527 local eoi_loot_dropdown = gen_easymenu_table( | 532 local eoi_loot_dropdown = gen_easymenu_table( |
528 {{ | 533 {{ |
529 -- this is the dropdown title, text filled in on the fly | 534 -- this is the dropdown title, text filled in on the fly |
532 }}, | 537 }}, |
533 { | 538 { |
534 "Mark as disenchanted%shard", | 539 "Mark as disenchanted%shard", |
535 "Mark as offspec%offspec", | 540 "Mark as offspec%offspec", |
536 "Mark as guild vault%gvault", | 541 "Mark as guild vault%gvault", |
537 "Mark as normal|This is the default. Selecting any 'Mark as <x>' action blanks out extra notes about who broadcast this entry, etc.", | 542 "Mark as normal|This is the default. Selecting any 'Mark as <x>' action blanks out extra notes about who broadcast this entry, etc.", |
538 "--", | 543 "--", |
539 "Rebroadcast this loot entry|Sends this loot event, including special notes, as if it just happened.", | 544 "Rebroadcast this loot entry|Sends this loot event, including special notes, as if it just happened.", |
540 "Delete this loot event|Permanent, no going back!", | 545 "Delete this loot event|Permanent, no going back!", |
541 "Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day", | 546 "Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day.", |
542 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information", | 547 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.", |
543 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information", | 548 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information.", |
544 "Edit note|Same as double-clicking in the notes column", | 549 "Edit note|Same as double-clicking in the notes column.", |
545 "--", | 550 "--", |
546 CLOSE | 551 CLOSE |
547 }, dropdownfuncs) | 552 }, dropdownfuncs) |
548 local eoi_player_dropdown = gen_easymenu_table( | 553 local eoi_player_dropdown = gen_easymenu_table( |
549 { | 554 { |
555 }, | 560 }, |
556 { | 561 { |
557 text = "Reassign to...", | 562 text = "Reassign to...", |
558 hasArrow = true, | 563 hasArrow = true, |
559 --menuList = filled in in the fly, | 564 --menuList = filled in in the fly, |
565 tooltipOnButton = true, | |
566 tooltipWhileDisabled = true, | |
560 }, | 567 }, |
561 }, | 568 }, |
562 { | 569 { |
563 "Show only this player", | 570 "Show only this player", |
564 CLOSE | 571 CLOSE |
569 isTitle = true, | 576 isTitle = true, |
570 notClickable = true, | 577 notClickable = true, |
571 notCheckable = true, | 578 notCheckable = true, |
572 }}, | 579 }}, |
573 { | 580 { |
574 "Change from 'wipe' to 'kill'|Also collapses other wipe entries", | 581 "Change from 'wipe' to 'kill'|Also collapses other wipe entries.", |
575 "Rebroadcast this boss|Broadcasts the kill event and all subsequent loot until next boss", | 582 "Rebroadcast this boss|Broadcasts the kill event and all subsequent loot until next boss.", |
576 "Delete this boss event|Permanent, no going back!", | 583 "Delete this boss event|Permanent, no going back!", |
577 "Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day", | 584 "Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day.", |
578 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information", | 585 "Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.", |
579 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information", | 586 "Insert new boss kill event%boss|Inserts new event above this one, prompting you for information.", |
580 "--", | 587 "--", |
581 CLOSE | 588 CLOSE |
582 }, dropdownfuncs) | 589 }, dropdownfuncs) |
583 local hist_dropdown = gen_easymenu_table( | 590 local hist_dropdown = gen_easymenu_table( |
584 {{ | 591 {{ |
700 notCheckable = true, | 707 notCheckable = true, |
701 } | 708 } |
702 end | 709 end |
703 eoi_player_dropdown[2].menuList = | 710 eoi_player_dropdown[2].menuList = |
704 gen_easymenu_table (raiders, {"Enter name...",CLOSE}, dropdownfuncs) | 711 gen_easymenu_table (raiders, {"Enter name...",CLOSE}, dropdownfuncs) |
705 --tabledump(eoi_player_dropdown) | 712 if e.disposition == 'shard' or e.disposition == 'gvault' then |
713 eoi_player_dropdown[2].disabled = true | |
714 eoi_player_dropdown[2].tooltipTitle = "Cannot Reassign" | |
715 eoi_player_dropdown[2].tooltipText = "You must first mark this item as 'normal' or 'offspec' before reassignment." | |
716 else | |
717 eoi_player_dropdown[2].disabled = nil | |
718 eoi_player_dropdown[2].tooltipTitle = nil | |
719 eoi_player_dropdown[2].tooltipText = nil | |
720 end | |
706 EasyMenu (eoi_player_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | 721 EasyMenu (eoi_player_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") |
707 | 722 |
708 elseif kind == 'boss' then | 723 elseif kind == 'boss' then |
709 eoi_boss_dropdown[1].text = e.bosskill | 724 eoi_boss_dropdown[1].text = e.bosskill |
710 EasyMenu (eoi_boss_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") | 725 EasyMenu (eoi_boss_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU") |
1127 return true -- do not do anything further | 1142 return true -- do not do anything further |
1128 end]] | 1143 end]] |
1129 | 1144 |
1130 tabs_OnGroupSelected["hist"] = function(container,specials) | 1145 tabs_OnGroupSelected["hist"] = function(container,specials) |
1131 histST = LibStub("ScrollingTable"):CreateST(hist_st_cols,eoi_st_displayed_rows,eoi_st_rowheight) | 1146 histST = LibStub("ScrollingTable"):CreateST(hist_st_cols,eoi_st_displayed_rows,eoi_st_rowheight) |
1147 _d:SetUserData("histST",histST) | |
1132 if addon.author_debug then | 1148 if addon.author_debug then |
1133 _G.OLHST = histST | 1149 _G.OLHST = histST |
1134 end | 1150 end |
1135 | 1151 |
1136 if not eoi_st_otherrow_bgcolortable_default then | 1152 if not eoi_st_otherrow_bgcolortable_default then |
1174 histST:SetData(addon.history.st) | 1190 histST:SetData(addon.history.st) |
1175 end | 1191 end |
1176 | 1192 |
1177 tabs_OnGroupSelected["hist"] = function(container,specials) | 1193 tabs_OnGroupSelected["hist"] = function(container,specials) |
1178 local st_widget = GUI:Create("lib-st") | 1194 local st_widget = GUI:Create("lib-st") |
1195 -- don't need _d:GetUserData("histST") here, as it's already a local | |
1179 histST:OuroLoot_Refresh() | 1196 histST:OuroLoot_Refresh() |
1180 st_widget:WrapST(histST) | 1197 st_widget:WrapST(histST) |
1181 st_widget.head_offset = 15 | 1198 st_widget.head_offset = 15 |
1182 st_widget.tail_offset = 0 | 1199 st_widget.tail_offset = 0 |
1183 container:SetLayout("Fill") | 1200 container:SetLayout("Fill") |
1743 if self.display then | 1760 if self.display then |
1744 -- try to get everything to update, rebuild, refresh... ugh, no | 1761 -- try to get everything to update, rebuild, refresh... ugh, no |
1745 self.display:Hide() | 1762 self.display:Hide() |
1746 end | 1763 end |
1747 | 1764 |
1765 -- This probably causes taint... hm. | |
1766 local prev_fade_time = UIDROPDOWNMENU_SHOW_TIME | |
1767 UIDROPDOWNMENU_SHOW_TIME = 4 | |
1768 | |
1748 local display = GUI:Create("Frame") | 1769 local display = GUI:Create("Frame") |
1749 if _d then | 1770 if _d then |
1750 display:SetUserData("eoiST",_d) -- warning! warning! kludge detected! | 1771 display:SetUserData("eoiST",_d) -- warning! warning! kludge detected! |
1751 end | 1772 end |
1752 _d = display | 1773 _d = display |
1764 display.sizer_s:SetScript("OnMouseUp",nil) | 1785 display.sizer_s:SetScript("OnMouseUp",nil) |
1765 display.sizer_e:SetScript("OnMouseDown",nil) | 1786 display.sizer_e:SetScript("OnMouseDown",nil) |
1766 display.sizer_e:SetScript("OnMouseUp",nil) | 1787 display.sizer_e:SetScript("OnMouseUp",nil) |
1767 ]] | 1788 ]] |
1768 display:SetCallback("OnClose", function(_display) | 1789 display:SetCallback("OnClose", function(_display) |
1790 UIDROPDOWNMENU_SHOW_TIME = prev_fade_time | |
1769 _d = _display:GetUserData("eoiST") | 1791 _d = _display:GetUserData("eoiST") |
1770 self.display = nil | 1792 self.display = nil |
1771 GUI:Release(_display) | 1793 GUI:Release(_display) |
1772 flib.clear() | 1794 flib.clear() |
1773 collectgarbage() | 1795 collectgarbage() |
2216 StaticPopupDialogs["OUROL_SAVE_SAVEAS"].OnAccept (dialog, dialog.data) | 2238 StaticPopupDialogs["OUROL_SAVE_SAVEAS"].OnAccept (dialog, dialog.data) |
2217 dialog:Hide() | 2239 dialog:Hide() |
2218 end,]] | 2240 end,]] |
2219 } | 2241 } |
2220 | 2242 |
2243 | |
2244 -- Workaround this bug: http://us.battle.net/wow/en/forum/topic/3278901991 | |
2245 if true then | |
2246 -- Verbatim copy of UIDropDownMenuTemplates.xml:155 or so, except as | |
2247 -- tagged with CHANGE. | |
2248 local function onenter (self, motion) | |
2249 if ( self.hasArrow ) then | |
2250 local level = self:GetParent():GetID() + 1; | |
2251 local listFrame = _G["DropDownList"..level]; | |
2252 if ( not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= self ) then | |
2253 ToggleDropDownMenu(self:GetParent():GetID() + 1, self.value, nil, nil, nil, nil, self.menuList, self); | |
2254 end | |
2255 else | |
2256 CloseDropDownMenus(self:GetParent():GetID() + 1); | |
2257 end | |
2258 _G[self:GetName().."Highlight"]:Show(); | |
2259 UIDropDownMenu_StopCounting(self:GetParent()); | |
2260 if ( self.tooltipTitle ) then | |
2261 if ( self.tooltipOnButton ) then | |
2262 GameTooltip:SetOwner(self, "ANCHOR_RIGHT"); | |
2263 GameTooltip:AddLine(self.tooltipTitle, 1.0, 1.0, 1.0); | |
2264 GameTooltip:AddLine(self.tooltipText, nil,nil,nil,1); -- CHANGE added nil->1 arguments | |
2265 GameTooltip:Show(); | |
2266 else | |
2267 GameTooltip_AddNewbieTip(self, self.tooltipTitle, 1.0, 1.0, 1.0, self.tooltipText, 1); | |
2268 end | |
2269 end | |
2270 end | |
2271 -- end verbatime copy | |
2272 | |
2273 for i = 1, UIDROPDOWNMENU_MAXLEVELS do | |
2274 local list = _G["DropDownList"..i] | |
2275 if list then | |
2276 for j = 1, UIDROPDOWNMENU_MAXBUTTONS do | |
2277 local button = _G["DropDownList"..i.."Button"..j] | |
2278 if button then | |
2279 --print("button fixup",i,j) | |
2280 button:SetScript("OnEnter",onenter) | |
2281 end | |
2282 end | |
2283 end | |
2284 end | |
2285 end | |
2286 | |
2221 -- vim:noet | 2287 -- vim:noet |