changeset 47:1070a14cfee4

Updated lib-st widget from WRDW. Properly notice new generating tabs. Updated help text.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Sat, 28 Jan 2012 18:24:22 +0000
parents 0b1e703a6954
children 22db12e97313
files AceGUIWidget-lib-st.lua core.lua gui.lua text_tabs.lua verbage.lua
diffstat 5 files changed, 47 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
--- a/AceGUIWidget-lib-st.lua	Sat Jan 21 01:39:44 2012 +0000
+++ b/AceGUIWidget-lib-st.lua	Sat Jan 28 18:24:22 2012 +0000
@@ -22,9 +22,10 @@
 Version 1 initial functioning implementation
 Version 2 reshuffle to follow new AceGUI widget coding style
 Version 3 add .tail_offset, defaulting to same absolute value as .head_offset
+Version 4 restore original frame methods, as fortold by ancient prophecy
 -farmbuyer
 -------------------------------------------------------------------------------]]
-local Type, Version = "lib-st", 3
+local Type, Version = "lib-st", 4
 local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
 if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
 
@@ -86,13 +87,14 @@
 
 	-- Possibly have already wrapped this ST in a previous widget, careful.
 	if st.frame.obj ~= self then
+		self.frame.customSetPoint = rawget(self.frame,"SetPoint")
 		self.frame.realSetPoint = self.frame.SetPoint
 		self.frame.SetPoint = ShiftingSetPoint
 		self.frame.SetAllPoints = ShiftingSetAllPoints
 	end
 
-	-- This needs the .frame field.  This also creates .obj inside that
-	-- field and calls a SetScript as well.
+	-- This needs the .frame field.  This also unconditionally creates .obj
+	-- inside that field and calls a SetScript on it as well.
 	return AceGUI:RegisterAsWidget(self)
 end
 
@@ -150,10 +152,10 @@
 			self.st:Hide()
 		end
 		self.st = nil
-		-- XXX should also undo the frame hooks.  would most likely be wasted
-		-- cycles.  if somebody actually wants to make an ST, include it inside
-		-- an ace container, then hide the container and continue displaying
-		-- the ST by other means, they can file a ticket
+		self.frame.realSetPoint = nil
+		self.frame.SetAllPoints = nil
+		self.frame.SetPoint = self.frame.customSetPoint
+		self.frame.customSetPoint = nil
 	end,
 
 	--[[
--- a/core.lua	Sat Jan 21 01:39:44 2012 +0000
+++ b/core.lua	Sat Jan 28 18:24:22 2012 +0000
@@ -193,7 +193,8 @@
 local g_boss_signpost	= nil
 local opts				= nil
 
-local pairs, ipairs, tinsert, tremove, tonumber = pairs, ipairs, table.insert, table.remove, tonumber
+local pairs, ipairs, tinsert, tremove, tonumber, wipe =
+	pairs, ipairs, table.insert, table.remove, tonumber, table.wipe
 local pprint, tabledump = addon.pprint, flib.tabledump
 local GetNumRaidMembers = GetNumRaidMembers
 -- En masse forward decls of symbols defined inside local blocks
@@ -778,7 +779,7 @@
 		if addon.display then
 			addon:redisplay()
 		end
-		table.wipe(candidates)
+		wipe(candidates)
 	end
 	addon.recent_loot = create_new_cache ('loot', comm_cleanup_ttl+3, prefer_local_loots)
 
@@ -1110,7 +1111,7 @@
 			temp[#temp+1] = k
 		end
 		table.sort(temp)
-		table.wipe(dest)
+		wipe(dest)
 		for i = 1, #temp do
 			dest[i] = src[temp[i]]
 		end
@@ -1118,10 +1119,10 @@
 
 	function addon.sender_list.sort()
 		sort (addon.sender_list.active, byindex)
-		table.wipe(temp)
+		wipe(temp)
 		addon.sender_list.activeI = #byindex
 		sort (addon.sender_list.names, byindex)
-		table.wipe(temp)
+		wipe(temp)
 	end
 	addon.sender_list.namesI = byindex
 end
@@ -1328,7 +1329,7 @@
 				addon:Print("Registered kill for '%s' in %s!", boss.bosskill, boss.instance)
 			end
 		end
-		table.wipe(candidates)
+		wipe(candidates)
 	end
 	addon.recent_boss = create_new_cache ('boss', 10, fixup_durations)
 
--- a/gui.lua	Sat Jan 21 01:39:44 2012 +0000
+++ b/gui.lua	Sat Jan 28 18:24:22 2012 +0000
@@ -45,6 +45,7 @@
 local g_loot			= nil
 local g_generated		= nil
 local window_title		= "Ouro Loot"
+local dirty_tabs		= nil
 
 local pairs, ipairs, tinsert, tremove, tonumber = pairs, ipairs, table.insert, table.remove, tonumber
 
@@ -108,6 +109,7 @@
 		next_insertion_position = next_insertion_position + 1
 		text_gen_funcs[text_type] = generator
 		specials_gen_funcs[text_type] = opt_specgen
+		dirty_tabs = true
 	end
 
 	-- Called by tabs_generated_text_OGS
@@ -372,6 +374,7 @@
 			tabs_OnGroupSelected[v] = tabs_generated_text_OGS
 		end
 	end
+	dirty_tabs = nil
 end
 
 --[[
@@ -1790,7 +1793,7 @@
 		elseif not status then
 			opt_widget_type, opt_key, label, status = "Button", opt_widget_type, opt_key, label
 		end
-		local button = GUI:Create(opt_widget_type)
+		local button = assert(GUI:Create(opt_widget_type))
 		if button.SetText then button:SetText(tostring(label)) end
 		status = status:gsub("[%+<>]",replacement_colors)
 		button:SetCallback("OnEnter", function() setstatus(status) end) -- maybe factor that closure out
@@ -1814,6 +1817,11 @@
 	local prev_fade_time = UIDROPDOWNMENU_SHOW_TIME
 	UIDROPDOWNMENU_SHOW_TIME = 4
 
+	if dirty_tabs then
+		self:gui_init(g_loot)  -- pointer known to be good by now
+		self:zero_printed_fenceposts()
+	end
+
 	local display = GUI:Create("Frame")
 	if _d then
 		display:SetUserData("eoiST",_d)   -- warning! warning! kludge detected!
@@ -1824,9 +1832,7 @@
 	display:SetStatusText(self.status_text)
 	display:SetLayout("Flow")
 	display:SetStatusTable{width=900,height=550}   -- default height is 500
-	if display.EnableResize then -- FIXME after next Ace3 release, this can be assumed
-		display:EnableResize(false)
-	end
+	display:EnableResize(false)
 	display:SetCallback("OnClose", function(_display)
 		UIDROPDOWNMENU_SHOW_TIME = prev_fade_time 
 		_d = _display:GetUserData("eoiST")
--- a/text_tabs.lua	Sat Jan 21 01:39:44 2012 +0000
+++ b/text_tabs.lua	Sat Jan 28 18:24:22 2012 +0000
@@ -12,7 +12,7 @@
 in/out  GENERATED.TTYPE_pos:  if non-nil, this is the saved cursor position in
            the text window (so that it stays where the user last left it).
            Move it if you're doing something strange with the displayed text.
-tmp     GENERATED.loc_TTYPE_*:  Use as needed.
+tmp     GENERATED.loc_TTYPE_*:  Fields with this pattern free to use as needed.
 out     CACHE:  Empty output table.  Accumulate generated lines here, one entry
            per visible line.  Do not terminate with a newline unless you want
            an extra blank line there.
--- a/verbage.lua	Sat Jan 21 01:39:44 2012 +0000
+++ b/verbage.lua	Sat Jan 28 18:24:22 2012 +0000
@@ -117,8 +117,8 @@
 on the right side control operation and are mostly self-explanatory.  Hovering over
 things will usually display some additional text in the gray line at the bottom.
 
-Each tab on the left side can additionally create extra contols in the lower-right
-section of the display.
+Each tab on the left side can additionally create extra contols in the lower right
+section (with the same name as the tab).
 
 The first tab on the left side, <Loot>, is where everything goes to and comes
 from.  Looting events and Deadly Boss Mods notifications go to the <Loot> tab; the
@@ -157,7 +157,7 @@
 restore the display to normal.  The menu also allows you to +reassign> loot from
 one player to another; if the new recipient is not in the raid group at the time,
 use the +Enter name...> option at the bottom of the list of names to type the
-name into a text box.  If your raid takes advantage of the new ability to trade
+name into a text box.  If your raid takes advantage of the ability to trade
 soulbound items, you will need to reassign the item here for the generated text
 to be factually correct.
 
@@ -179,12 +179,12 @@
 fight.  If the loot display is opened, the wipes will be visible with a light gray
 background.
 
-After reminding the dps classes to watch the threat meters, we manage to kill
+After reminding the melee dps to move out of fire, we manage to kill
 Steamroller.  When DBM registers the win, a <kill> event is entered on the display
 with a dark gray background.
 All previous <wipe>s are removed and collapsed into the <kill> event.  The final
 <kill> event shows the duration of the successful fight and the number of attempts
-needed (or "one-shot" if we manage to be competent).
+needed (or "one-shot" if we're competent).
 
 Sometimes this goes wrong, when DBM misses its own triggers.  If DBM does not catch
 the start of the boss fight, it can't register the end, so nothing at all is
@@ -205,7 +205,7 @@
 across login sessions no matter the status.
 
 You can turn on tracking/broadcasting before joining a raid.  If you join a raid
-and the addon has not been turned on, then (by default) a popup dialog will ask for
+and the addon has not been turned on, then a popup dialog will ask for
 instructions.  (This can be turned off in the advanced <Options>.)
 
 The addon tries to be smart about logging on during a raid (due to a disconnect or
@@ -230,8 +230,8 @@
 1)  The loot quality is equal to or better than what you have selected in the
 +Threshold> drop-down.
 
-2)  The loot is not one of the few items hardcoded to not be tracked (badges,
-emblems, Stone Keeper Shards, etc).
+2)  The loot is not in the list of items to filter out (see the <Options> tab).
+These are things like shards from disenchanting and Darkmoon Faire quest items.
 
 3)  <You can see the loot event.>  More precisely, you need to be close enough
 to the recipient of the loot to be able to see "So-And-So receives loot: [Stuff]"
@@ -254,7 +254,7 @@
 them to turn on the "Rebroadcasting" feature.  Any loot events which they can
 see will be communicated to you.  Then it only becomes necessary for at least
 one person to be close enough to the loot recipient to see the item awarded,
-and you will record it no matter how far away you are -- even back in Dalaran.
+and you will record it no matter how far away you are -- even back in Orgrimmar.
 
 If you have Full Tracking enabled, then you are also automatically rebroadcasting.
 Having more than one player with Full Tracking turned on is probably a good
@@ -273,7 +273,8 @@
 ]]
 
 T.texts = [[
-The middle tabs are just large editboxes.  Their text is initially generated from
+The middle tabs are simply large editable text boxes.  Their text is initially
+generated from
 the information stored on the main <Loot> tab, at the time you click on the tab.
 Not every bit of information that
 we want in the generated text is always available, or depends on things that the
@@ -321,8 +322,9 @@
 close the display or click back on the <Loot> tab, your edited text will be
 preserved for later.
 
-Pro tip #2:  Barring things like pro tip #1, the author typically does not
-generate any text until the end of the raid.
+Pro tip #2:  Barring situations like pro tip #1, this addon author typically
+does not generate any text until the end of the raid, simplifying things
+considerably.
 ]]
 
 T.texts_other = [[
@@ -492,11 +494,12 @@
 
 Using the right-click menu to change an item's treatment (shard, offspec, etc)
 does not broadcast that change to anyone else who is also tracking.  Changing
-the item and then selecting "rebroadcast this item" *does* include that extra
-info.  Doing that on the initial "mark as xxx" action is... tricky.
+the item and then selecting "rebroadcast this item" <does> include that extra
+info.  Automatically doing that on the initial "mark as xxx" action would
+be... tricky.
 
-The generated text tries to only list the name of the instance if it has not
-already been listed, or if it is different than the instance of the previous
+The generated forum text tries to only list the name of the instance if it has
+not already been listed, or if it is different than the instance of the previous
 boss.  If you relog, the "last printed instance name" will be forgotten, and
 you'll see redundant raid instance names appearing in the text.
 
@@ -533,7 +536,7 @@
 	[40752]		= true, -- Emblem of Heroism
 	[40753]		= true, -- Emblem of Valor
 	[45624]		= true, -- Emblem of Conquest
-	-- could probably remove the above now
+	-- could probably remove most of this now
 	[43228]		= true, -- Stone Keeper's Shard
 	[47241]		= true, -- Emblem of Triumph
 	[49426]		= true, -- Emblem of Frost