/branches/cataclysm/Aloft/AloftLevelText
----------------------------------------------------------------------------- |
local AloftLevelText = Aloft:NewModule("LevelText", Aloft, "AceEvent-3.0", "AceHook-3.0", "AceTimer-3.0") |
-- local AloftHealthBar = Aloft:GetModule("HealthBar") |
----------------------------------------------------------------------------- |
----------------------------------------------------------------------------- |
--[[ |
function AloftLevelText:DumpCoords(arg) |
-- local point, relativeTo, relativePoint, xOfs, yOfs = arg.object:GetPoint(self.db.profile.point) |
local left = arg.object:GetLeft() |
local right = arg.object:GetRight() |
local top = arg.object:GetTop() |
local bottom = arg.object:GetBottom() |
ChatFrame7:AddMessage(arg.caller .. ": " .. tostring(arg.name) .. "/" .. tostring(top) .. "/" .. tostring(left) .. "/" .. tostring(bottom) .. "/" .. tostring(right)) |
end |
]] |
--[[ |
-- TODO: propagate this to name text, level text, boss icon, and/or other "default" nameplate components as needed |
function AloftLevelText:GetInset(aloftData) |
return ((AloftHealthBar.db.profile.border ~= "None") and 4) or 0 |
end |
]] |
function AloftLevelText:UpdateAll() |
for aloftData in Aloft:IterateNameplates() do |
local levelTextRegion = aloftData.levelTextRegion |
levelTextRegion:SetDrawLayer("OVERLAY") |
-- ChatFrame7:AddMessage("AloftLevelText:UpdateAll(): PrepareText " .. tostring(aloftData.name) .. "/" .. tostring(levelTextRegion) .. "/" .. tostring(self.db.profile.font) .. "/" .. tostring(self.db.profile.fontSize) .. "/" .. tostring(self.db.profile.outline) --[[.. "/" .. tostring(SML:Fetch("font", self.db.profile.font))]]) |
self:PrepareText(levelTextRegion, self.db.profile) |
-- local inset = self:GetInset(aloftData) |
-- local hinset, vinset = self:AdjustFrame(inset, self.db.profile.relativeToPoint) |
-- self:PlaceFrame(levelTextRegion, layoutFrame, self.db.profile, hinset, vinset) |
self:PlaceFrame(levelTextRegion, layoutFrame, self.db.profile, 0, 0) |
-- self:ScheduleTimer(function(arg) AloftLevelText:DoPlaceFrame(arg) end, 0.0, { levelTextRegion = levelTextRegion, layoutFrame = layoutFrame } ) |
-- self:ScheduleTimer(function(arg) AloftLevelText:DumpCoords(arg) end, 0.3, { name = aloftData.name, object = levelTextRegion, caller = "AloftLevelText:UpdateAll()" } ) |
if self.db.profile.overrideText then |
if self.db.profile.format and self.db.profile.format ~= "" and (not self.textMethodData or not self.textMethod) then |
function AloftLevelText:SetupFrame(message, aloftData) |
local levelTextRegion = aloftData.levelTextRegion |
-- local nameplateFrame = aloftData.nameplateFrame |
local layoutFrame = Aloft:AcquireLayoutFrame(aloftData) |
-- if aloftData.name == "[invalid]" or not self.db or not self.db.profile or not self.db.profile.font or not self.db.profile.fontSize or not self.db.profile.outline then |
levelTextRegion:SetDrawLayer("OVERLAY") |
-- ChatFrame7:AddMessage("AloftLevelText:SetupFrame(): PrepareText " .. tostring(aloftData.name) .. "/" .. tostring(levelTextRegion) .. "/" .. tostring(self.db) .. "/" .. tostring(self.db.profile) .. "/" .. tostring(self.db.profile.font) .. "/" .. tostring(self.db.profile.fontSize) .. "/" .. tostring(self.db.profile.outline) --[[.. "/" .. tostring(SML:Fetch("font", self.db.profile.font))]]) |
self:PrepareText(levelTextRegion, self.db.profile) |
-- local inset = self:GetInset(aloftData) |
-- local hinset, vinset = self:AdjustFrame(inset, self.db.profile.relativeToPoint) |
self:PlaceFrame(levelTextRegion, layoutFrame, self.db.profile, 0, 0) |
-- self:ScheduleTimer(function(arg) AloftLevelText:DoPlaceFrame(arg) end, 0.0, { levelTextRegion = levelTextRegion, layoutFrame = layoutFrame } ) |
-- self:ScheduleTimer(function(arg) AloftLevelText:DumpCoords(arg) end, 0.3, { name = aloftData.name, object = levelTextRegion, caller = "AloftLevelText:SetupFrame()" } ) |
self:Hook(levelTextRegion, "GetText", "GetLevelTextRegionText", true) |
self:Hook(levelTextRegion, "SetText", "SetLevelTextRegionText", true) |
levelTextRegion:SetDrawLayer("OVERLAY") |
-- ChatFrame7:AddMessage("AloftLevelText:PlaceAndUpdateLevelTextOnNameplateShow(): PrepareText " .. tostring(aloftData.name) .. "/" .. tostring(levelTextRegion) .. "/" .. tostring(self.db.profile.font) .. "/" .. tostring(self.db.profile.fontSize) .. "/" .. tostring(self.db.profile.outline) --[[.. "/" .. tostring(SML:Fetch("font", self.db.profile.font))]]) |
self:PrepareText(levelTextRegion, self.db.profile) |
-- local inset = self:GetInset(aloftData) |
-- local hinset, vinset = self:AdjustFrame(inset, self.db.profile.relativeToPoint) |
-- self:PlaceFrame(levelTextRegion, layoutFrame, self.db.profile, hinset, vinset) |
self:PlaceFrame(levelTextRegion, aloftData.layoutFrame, self.db.profile, 0, 0) |
-- self:ScheduleTimer(function(arg) AloftLevelText:DoPlaceFrame(arg) end, 0.0, { levelTextRegion = levelTextRegion, layoutFrame = aloftData.layoutFrame } ) |
-- self:ScheduleTimer(function(arg) AloftLevelText:DumpCoords(arg) end, 0.3, { name = aloftData.name, object = levelTextRegion, caller = "AloftLevelText:PlaceAndUpdateLevelTextOnNameplateShow()" } ) |
levelTextRegion:Show() |
self:UpdateText(message, aloftData) |
levelTextRegion:SetDrawLayer("OVERLAY") |
-- ChatFrame7:AddMessage("AloftLevelText:PlaceLevelTextOnNameplateShow(): PrepareText " .. tostring(aloftData.name) .. "/" .. tostring(levelTextRegion) .. "/" .. tostring(self.db.profile.font) .. "/" .. tostring(self.db.profile.fontSize) .. "/" .. tostring(self.db.profile.outline) --[[.. "/" .. tostring(SML:Fetch("font", self.db.profile.font))]]) |
self:PrepareText(levelTextRegion, self.db.profile) |
-- local inset = self:GetInset(aloftData) |
-- local hinset, vinset = self:AdjustFrame(inset, self.db.profile.relativeToPoint) |
-- self:PlaceFrame(levelTextRegion, layoutFrame, self.db.profile, hinset, vinset) |
self:PlaceFrame(levelTextRegion, aloftData.layoutFrame, self.db.profile, 0, 0) |
-- self:ScheduleTimer(function(arg) AloftLevelText:DoPlaceFrame(arg) end, 0.0, { levelTextRegion = levelTextRegion, layoutFrame = aloftData.layoutFrame } ) |
-- self:ScheduleTimer(function(arg) AloftLevelText:DumpCoords(arg) end, 0.3, { name = aloftData.name, object = levelTextRegion, caller = "AloftLevelText:PlaceLevelTextOnNameplateShow()" } ) |
end |
function AloftLevelText:HideLevelTextOnNameplateShow(message, aloftData) |
aloftData.levelTextRegion:Hide() |
end |
--[[ |
function AloftLevelText:DoPlaceFrame(arg) |
self:PlaceFrame(arg.levelTextRegion, arg.layoutFrame, self.db.profile, 0, 0) |
end |
]] |
----------------------------------------------------------------------------- |
function AloftLevelText:UpdateLevelFromTarget() |