WoWInterface SVN KuiNameplates

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 121 to Rev 122
    Reverse comparison

Rev 121 → Rev 122

Kui_Nameplates/layout.lua
30,6 → 30,7
}
 
local font, uiscale, prevuiscale
local bgOffset = 4 -- inset offset for the frame glow (frame.bg)
local loadedGUIDs, loadedNames, targetExists, profile = {}, {}
local origSizes, origFontSizes, sizes, fontSizes = {},{},{},{}
 
299,7 → 300,7
-- TODO or I could just make the positioning a function and call it here
self.carrier.DoShow = true
end
 
 
-- reset name
self.name.text = self.oldName:GetText()
self.name:SetText(self.name.text)
308,7 → 309,7
-- force un-highlight
self.highlighted = true
end
 
 
-- classifications
if self.boss:IsVisible() then
self.level:SetText('??b')
335,6 → 336,96
-- store this frame's name
loadedNames[self.name.text] = self
end
 
---------------------------------------------- Trivial sizing/positioning --
if self.firstChild:GetScale() < 1 then
if not self.trivial then
-- initialise trivial unit sizes
if uiscale then
self.parent:SetSize(self:GetWidth()/uiscale, self:GetHeight()/uiscale)
end
 
local w,h = self.parent:GetSize()
local x,y =
floor((w / 2) - ((sizes.width/2) / 2)),
floor((h / 2) - ((sizes.height/2) / 2))
 
self.health:ClearAllPoints()
self.bg:ClearAllPoints()
self.bg.fill:ClearAllPoints()
self.name:ClearAllPoints()
 
self.level:Hide()
self.health.p:Hide()
 
if self.health.mo then
self.health.mo:Hide()
end
 
self.name = kui.CreateFontString(self.name, {reset = true,
font = font, size = fontSizes.small, outline = 'OUTLINE' })
self.name:SetJustifyH('CENTER')
 
self.name:SetPoint('BOTTOMLEFT', self.health, 'TOPLEFT', -10, 0)
self.name:SetPoint('BOTTOMRIGHT', self.health, 'TOPRIGHT', 10, 0)
 
self.bg.fill:SetSize(sizes.width/2, sizes.height/2)
self.health:SetSize((sizes.width/2)-2, (sizes.height/2)-2)
 
self.health:SetPoint('BOTTOMLEFT', x+1, y+1)
 
self.bg.fill:SetPoint('BOTTOMLEFT', x, y)
 
self.bg:SetPoint('BOTTOMLEFT', x-(bgOffset-2), y-(bgOffset-2))
self.bg:SetPoint('TOPRIGHT', self.parent, 'BOTTOMLEFT', x+(sizes.width/2)+(bgOffset-2), y+(sizes.height/2)+(bgOffset-2))
 
self.trivial = true
else
-- (performed each time a trivial frame is shown)
self.level:Hide()
end
elseif self.trivial then
-- return to normal sizes
if uiscale then
self.parent:SetSize(self:GetWidth()/uiscale, self:GetHeight()/uiscale)
end
 
local w,h = self.parent:GetSize()
local x,y =
floor((w / 2) - (sizes.width / 2)),
floor((h / 2) - (sizes.height / 2))
 
self.health:ClearAllPoints()
self.bg:ClearAllPoints()
self.bg.fill:ClearAllPoints()
self.name:ClearAllPoints()
 
self.level:Show()
self.health.p:Show()
 
if self.health.mo then
self.health.mo:Show()
end
 
self.name = kui.CreateFontString(self.name, {reset = true,
font = font, size = fontSizes.name, outline = 'OUTLINE' })
self.name:SetJustifyH('LEFT')
 
self.name:SetPoint('LEFT', self.level, 'RIGHT', -2, 0)
self.name:SetPoint('RIGHT', self.health.p, 'LEFT')
 
self.bg.fill:SetSize(sizes.width, sizes.height)
self.health:SetSize(sizes.width - 2, sizes.height - 2)
 
self.health:SetPoint('BOTTOMLEFT', x+1, y+1)
 
self.bg.fill:SetPoint('BOTTOMLEFT', x, y)
 
self.bg:SetPoint('BOTTOMLEFT', x-bgOffset, y-bgOffset)
self.bg:SetPoint('TOPRIGHT', self.parent, 'BOTTOMLEFT', x+(sizes.width)+bgOffset, y+(sizes.height)+bgOffset)
 
self.trivial = nil
end
 
self:UpdateFrame()
self:UpdateFrameCritical()
422,12 → 513,13
self.elapsed = self.elapsed + e
self.critElap = self.critElap + e
 
if profile.general.fixaa and uiscale then
if self.carrier then
------------------------------------------------------------ Position --
local scale = self.firstChild:GetScale()
local x, y = select(4, self.firstChild:GetPoint())
x = x / uiscale
y = y / uiscale
 
x = (x / uiscale) * scale
y = (y / uiscale) * scale
 
self.carrier:ClearAllPoints()
self.carrier:SetPoint('BOTTOMLEFT', UIParent, 'BOTTOMLEFT', floor(x-(self.carrier:GetWidth()/2)), floor(y))
 
605,7 → 697,7
self.highlighted = false
OnFrameLeave(self)
end
 
 
-- [debug]
--[[
if self.guid and loadedGUIDs[self.guid] == self then
759,7 → 851,7
 
------------------------------------------------------------------ Layout --
local parent
if profile.general.fixaa then
if profile.general.fixaa and uiscale then
frame.carrier = CreateFrame('Frame', nil, WorldFrame)
frame.carrier:SetFrameStrata('BACKGROUND')
frame.carrier:SetSize(frame:GetWidth()/uiscale, frame:GetHeight()/uiscale)
770,13 → 862,13
frame.carrier:SetBackdrop({ bgFile = kui.m.t.solid })
frame.carrier:SetBackdropColor(0,0,0,.5)
]]
 
 
parent = frame.carrier
else
parent = frame
end
 
self.parent = parent
frame.parent = parent
 
-- using CENTER breaks pixel-perfectness with oddly sized frames
-- .. so we have to align frames manually.
803,8 → 895,8
frame.bg.fill:SetPoint('BOTTOMLEFT', x, y)
 
frame.bg:ClearAllPoints()
frame.bg:SetPoint('BOTTOMLEFT', x-5, y-5)
frame.bg:SetPoint('TOPRIGHT', parent, 'BOTTOMLEFT', x+sizes.width+5, y+sizes.height+5)
frame.bg:SetPoint('BOTTOMLEFT', x-bgOffset, y-bgOffset)
frame.bg:SetPoint('TOPRIGHT', parent, 'BOTTOMLEFT', x+sizes.width+bgOffset, y+sizes.height+bgOffset)
 
-- health bar --------------------------------------------------------------
frame.health = CreateFrame('StatusBar', nil, parent)
820,31 → 912,6
frame.health.SetValue = ns.SetValueSmooth
end
 
-- frame background --------------------------------------------------------
-- this also provides the shadow & threat glow
-- 120x20 over 256x32
--frame.bg:SetTexture('Interface\\AddOns\\Kui_Nameplates\\FrameGlow')
--[[
frame.bg:SetTexture(nil)
frame.bg:SetTexCoord(0, .469, 0, .625)
--frame.bg:SetVertexColor(0, 0, 0, .85)
frame.bg:SetVertexColor(0, 0, 0, .9)
 
frame.bg:SetPoint('TOPLEFT', frame.health, -5, 5)
frame.bg:SetPoint('BOTTOMRIGHT', frame.health, 5, -5)
]]
 
-- health background -------------------------------------------------------
--[[
frame.health.bg = frame:CreateTexture(nil, 'ARTWORK')
frame.health.bg:SetDrawLayer('ARTWORK', 1) -- (1 sub-layer above .bg)
frame.health.bg:SetTexture(kui.m.t.solid)
frame.health.bg:SetVertexColor(0, 0, 0, .85)
 
frame.health.bg:SetPoint('TOPLEFT', frame.health, -1, 1)
frame.health.bg:SetPoint('BOTTOMRIGHT', frame.health, 1, -1)
]]
 
-- raid icon ---------------------------------------------------------------
frame.icon:SetParent(parent)
--frame.icon:SetSize(24, 24)
1233,7 → 1300,7
-- fetch the unit's nameplate
f = self:GetNameplate(guid, name)
if f then
if not f.castbar then return end
if not f.castbar or f.trivial then return end
if e == 'UNIT_SPELLCAST_STOP' or
e == 'UNIT_SPELLCAST_FAILED' or
e == 'UNIT_SPELLCAST_INTERRUPTED'
1267,7 → 1334,7
 
local f = self:GetNameplate(guid, name)
if f then
if not f.SetIncomingWarning then return end
if not f.SetIncomingWarning or f.trivial then return end
local spName, spSch = select(13, ...)
 
if event == 'SPELL_HEAL' or
1457,6 → 1524,7
uiscale, origSizes, origFontSizes =
UIParent:GetEffectiveScale(), sizes, fontSizes
 
bgOffset = 5
origSizes.cbheight = 12
 
-- scale sizes up to "unscaled" values