View Single Post
Old 12-13-08, 03:21 AM   #20
Soeters
A Warpwood Thunder Caller
 
Soeters's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 97
I use tags with my layout but I've one question: I have a previous version of oUF because tags were easy to implement: only self.TaggedStrings{ourstrings} but now how do we tell oUF that a fontstring contain tags.
I looked at tags.lua but I'm not good enought to understand everything so I can't find where oUF registers tagged strings.

That code was pretty easy to understand and told oUF was easy to.
Code:
table.insert(oUF.subTypes, function(self, unit)
	if self.TaggedStrings then
		for i,fs in pairs(self.TaggedStrings) do
			local parent = fs:GetParent()
			local tagstring = fs:GetText()

			local f = CreateFrame("Frame", nil, parent)
			f:SetScript("OnEvent", OnEvent)
			f:SetScript("OnShow", OnShow)
			f.tagstring, f.fontstring, f.parent = tagstring, fs, self

			-- Register any update events we need
			for tag in string.gmatch(tagstring, "[[][%w]+[]]") do
				local tagevents = events[tag]
				if tagevents then
					for event in string.gmatch(tagevents, "%S+") do
						f:RegisterEvent(event)
					end
				end
			end
			if unit == "target" then f:RegisterEvent("PLAYER_TARGET_CHANGED") end
			if unit == "focus" then f:RegisterEvent("PLAYER_FOCUS_CHANGED") end

			OnShow(f)
		end
	end
end)
Actually if someone can told me how to tell oUF that a fontstring contains tags I'll test the new layout.
__________________
Soeters is offline