diff 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
line wrap: on
line diff
--- a/gui.lua	Wed Sep 21 06:21:48 2011 +0000
+++ b/gui.lua	Wed Oct 05 02:14:07 2011 +0000
@@ -401,6 +401,8 @@
 				arg1 = funcs[name],
 				arg2 = arg,
 				notCheckable = true,
+				tooltipOnButton = true,
+				tooltipWhileDisabled = true,
 				tooltipTitle = tiptext and name or nil,
 				tooltipText = tiptext,
 			})
@@ -468,9 +470,11 @@
 	end,
 
 	["Mark as normal"] = function(rowi,disp) -- broadcast the change?  ugh
+		local olddisp = g_loot[rowi].disposition
 		g_loot[rowi].disposition = disp
 		g_loot[rowi].bcast_from = nil
 		g_loot[rowi].extratext = nil
+		addon:history_handle_disposition (rowi, olddisp)
 	end,
 
 	["Show only this player"] = function(rowi)
@@ -495,6 +499,7 @@
 		CloseDropDownMenus()  -- also need to close parent menu
 	end,
 	["Enter name..."] = function(rowi)
+		CloseDropDownMenus()  -- also need to close parent menu
 		local dialog = StaticPopup_Show "OUROL_REASSIGN_ENTER"
 		dialog.data = {index=rowi, display=_d}
 	end,
@@ -518,10 +523,10 @@
 		notCheckable = true,
 	}},
 	{
-		"Rebroadcast this day%time|Broadcasts everything from here down until a new day",
-		"Delete remaining entries for this day%time|Erases everything from here down until a new day",
-		"Insert new loot entry%loot|Inserts new loot above this one, prompting you for information",
-		"Insert new boss kill event%boss|Inserts new event above this one, prompting you for information",
+		"Rebroadcast this day%time|Broadcasts everything from here down until a new day.",
+		"Delete remaining entries for this day%time|Erases everything from here down until a new day.",
+		"Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.",
+		"Insert new boss kill event%boss|Inserts new event above this one, prompting you for information.",
 		CLOSE
 	}, dropdownfuncs)
 local eoi_loot_dropdown = gen_easymenu_table(
@@ -534,14 +539,14 @@
 		"Mark as disenchanted%shard",
 		"Mark as offspec%offspec",
 		"Mark as guild vault%gvault",
-		"Mark as normal|This is the default. Selecting any 'Mark as <x>' action blanks out extra notes about who broadcast this entry, etc.",
+		"Mark as normal|This is the default.  Selecting any 'Mark as <x>' action blanks out extra notes about who broadcast this entry, etc.",
 		"--",
 		"Rebroadcast this loot entry|Sends this loot event, including special notes, as if it just happened.",
 		"Delete this loot event|Permanent, no going back!",
-		"Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day",
-		"Insert new loot entry%loot|Inserts new loot above this one, prompting you for information",
-		"Insert new boss kill event%boss|Inserts new event above this one, prompting you for information",
-		"Edit note|Same as double-clicking in the notes column",
+		"Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day.",
+		"Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.",
+		"Insert new boss kill event%boss|Inserts new event above this one, prompting you for information.",
+		"Edit note|Same as double-clicking in the notes column.",
 		"--",
 		CLOSE
 	}, dropdownfuncs)
@@ -557,6 +562,8 @@
 			text = "Reassign to...",
 			hasArrow = true,
 			--menuList = filled in in the fly,
+			tooltipOnButton = true,
+			tooltipWhileDisabled = true,
 		},
 	},
 	{
@@ -571,12 +578,12 @@
 		notCheckable = true,
 	}},
 	{
-		"Change from 'wipe' to 'kill'|Also collapses other wipe entries",
-		"Rebroadcast this boss|Broadcasts the kill event and all subsequent loot until next boss",
+		"Change from 'wipe' to 'kill'|Also collapses other wipe entries.",
+		"Rebroadcast this boss|Broadcasts the kill event and all subsequent loot until next boss.",
 		"Delete this boss event|Permanent, no going back!",
-		"Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day",
-		"Insert new loot entry%loot|Inserts new loot above this one, prompting you for information",
-		"Insert new boss kill event%boss|Inserts new event above this one, prompting you for information",
+		"Delete remaining entries for this boss%boss|Erases everything from here down until a new boss/day.",
+		"Insert new loot entry%loot|Inserts new loot above this one, prompting you for information.",
+		"Insert new boss kill event%boss|Inserts new event above this one, prompting you for information.",
 		"--",
 		CLOSE
 	}, dropdownfuncs)
@@ -702,7 +709,15 @@
 		end
 		eoi_player_dropdown[2].menuList =
 			gen_easymenu_table (raiders, {"Enter name...",CLOSE}, dropdownfuncs)
-		--tabledump(eoi_player_dropdown)
+		if e.disposition == 'shard' or e.disposition == 'gvault' then
+			eoi_player_dropdown[2].disabled = true
+			eoi_player_dropdown[2].tooltipTitle = "Cannot Reassign"
+			eoi_player_dropdown[2].tooltipText = "You must first mark this item as 'normal' or 'offspec' before reassignment."
+		else
+			eoi_player_dropdown[2].disabled = nil
+			eoi_player_dropdown[2].tooltipTitle = nil
+			eoi_player_dropdown[2].tooltipText = nil
+		end
 		EasyMenu (eoi_player_dropdown, dropdownmenuframe, cellFrame, 0, 0, "MENU")
 
 	elseif kind == 'boss' then
@@ -1129,6 +1144,7 @@
 
 	tabs_OnGroupSelected["hist"] = function(container,specials)
 		histST = LibStub("ScrollingTable"):CreateST(hist_st_cols,eoi_st_displayed_rows,eoi_st_rowheight)
+		_d:SetUserData("histST",histST)
 		if addon.author_debug then
 			_G.OLHST = histST
 		end
@@ -1176,6 +1192,7 @@
 
 		tabs_OnGroupSelected["hist"] = function(container,specials)
 			local st_widget = GUI:Create("lib-st")
+			-- don't need _d:GetUserData("histST") here, as it's already a local
 			histST:OuroLoot_Refresh()
 			st_widget:WrapST(histST)
 			st_widget.head_offset = 15
@@ -1745,6 +1762,10 @@
 		self.display:Hide()
 	end
 
+	-- This probably causes taint... hm.
+	local prev_fade_time = UIDROPDOWNMENU_SHOW_TIME
+	UIDROPDOWNMENU_SHOW_TIME = 4
+
 	local display = GUI:Create("Frame")
 	if _d then
 		display:SetUserData("eoiST",_d)   -- warning! warning! kludge detected!
@@ -1766,6 +1787,7 @@
 	display.sizer_e:SetScript("OnMouseUp",nil)
 	]]
 	display:SetCallback("OnClose", function(_display)
+		UIDROPDOWNMENU_SHOW_TIME = prev_fade_time 
 		_d = _display:GetUserData("eoiST")
 		self.display = nil
 		GUI:Release(_display)
@@ -2218,4 +2240,48 @@
 	end,]]
 }
 
+
+-- Workaround this bug:  http://us.battle.net/wow/en/forum/topic/3278901991
+if true then
+	-- Verbatim copy of UIDropDownMenuTemplates.xml:155 or so, except as
+	-- tagged with CHANGE.
+	local function onenter (self, motion)
+		if ( self.hasArrow ) then
+			local level =  self:GetParent():GetID() + 1;
+			local listFrame = _G["DropDownList"..level];
+			if ( not listFrame or not listFrame:IsShown() or select(2, listFrame:GetPoint()) ~= self ) then
+				ToggleDropDownMenu(self:GetParent():GetID() + 1, self.value, nil, nil, nil, nil, self.menuList, self);
+			end
+		else
+			CloseDropDownMenus(self:GetParent():GetID() + 1);
+		end
+		_G[self:GetName().."Highlight"]:Show();
+		UIDropDownMenu_StopCounting(self:GetParent());
+		if ( self.tooltipTitle ) then
+			if ( self.tooltipOnButton ) then
+				GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
+				GameTooltip:AddLine(self.tooltipTitle, 1.0, 1.0, 1.0);
+				GameTooltip:AddLine(self.tooltipText, nil,nil,nil,1);  -- CHANGE added nil->1 arguments
+				GameTooltip:Show();
+			else
+				GameTooltip_AddNewbieTip(self, self.tooltipTitle, 1.0, 1.0, 1.0, self.tooltipText, 1);
+			end
+		end
+	end
+	-- end verbatime copy
+
+	for i = 1, UIDROPDOWNMENU_MAXLEVELS do
+		local list = _G["DropDownList"..i]
+		if list then
+			for j = 1, UIDROPDOWNMENU_MAXBUTTONS do
+				local button = _G["DropDownList"..i.."Button"..j]
+				if button then
+					--print("button fixup",i,j)
+					button:SetScript("OnEnter",onenter)
+				end
+			end
+		end
+	end
+end
+
 -- vim:noet