WoWInterface SVN KuiNameplates

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /branches
    from Rev 138 to Rev 139
    Reverse comparison

Rev 138 → Rev 139

v4/config.lua
307,7 → 307,7
},
small = {
name = 'Small',
desc = 'Used for contextual health on normal nameplates and name on trivial nameplates',
desc = 'Used for contextual health',
type = 'range',
min = 1,
softMax = 20
v4/combopoints.lua
36,12 → 36,12
local _, frame
for _, frame in pairs(addon.frameList) do
if frame.cp and frame ~= f then
self:HideComboPoints(frame)
self:HideComboPoints(nil, frame)
end
end
end
---------------------------------------------------------------------- Create --
function mod:CreateComboPoints(frame)
function mod:CreateComboPoints(msg, frame)
frame.cp = frame:CreateFontString(frame.health, {
font = addon.font, size = 'combopoints', outline = 'OUTLINE', shadow = true })
frame.cp:SetPoint('LEFT', frame.health, 'RIGHT', 5, 1)
49,7 → 49,7
frame.cp:Hide()
end
------------------------------------------------------------------------ Hide --
function mod:HideComboPoints(frame)
function mod:HideComboPoints(msg, frame)
if frame.cp then
frame.cp.points = nil
frame.cp:Update()
64,6 → 64,7
mod:Disable()
end
end
 
-------------------------------------------------------------------- Register --
function mod:GetOptions()
return {
87,15 → 88,15
end
 
function mod:OnEnable()
addon:RegisterPostFunction('create', self, 'CreateComboPoints')
addon:RegisterPostFunction('hide', self, 'HideComboPoints')
self:RegisterMessage('KuiNameplates_PostCreate', 'CreateComboPoints')
self:RegisterMessage('KuiNameplates_PostHide', 'HideComboPoints')
 
self:RegisterEvent('UNIT_COMBO_POINTS')
 
local _, frame
for _, frame in pairs(addon.frameList) do
if not frame.cp then
self:CreateComboPoints(frame)
self:CreateComboPoints(nil, frame)
end
end
end
105,6 → 106,6
 
local _, frame
for _, frame in pairs(addon.frameList) do
self:HideComboPoints(frame)
self:HideComboPoints(nil, frame)
end
end
\ No newline at end of file
v4/layout.lua
64,6 → 64,21
fs:SetFont(font, size, flags)
end
 
local function ModifyFontFlags(fs, io, flag)
local font, size, flags = fs:GetFont()
local flagStart,flagEnd = strfind(flags, flag)
 
if io and not flagStart then
-- add flag
flags = flags..' '..flag
elseif not val and flagStart then
-- remove flag
flags = strsub(flags, 0, flagStart-1) .. strsub(flags, flagEnd+1)
end
 
fs:SetFont(font, size, flags)
end
 
local function CreateFontString(self, parent, obj)
-- size can be stored as a key of kn.fontSizes so that it can be set
-- correctly if fonts are scaled
82,29 → 97,6
tinsert(self.fontObjects, fs)
return fs
end
 
-------------------------------------------------- External calling functions --
local postFunctions = {
target = {}, -- upon becoming the target
create = {}, -- post creation
show = {}, -- post OnFrameShow
hide = {} -- post OnFrameHide
}
 
local function CallPostFunction(typ, frame)
if postFunctions[typ] then
local _, mod
for _, mod in ipairs(postFunctions[typ]) do
mod[1][mod[2]](mod[1], frame)
end
end
end
 
function kn:RegisterPostFunction(typ, mod, func)
if not postFunctions[typ] then return end
tinsert(postFunctions[typ], { mod, func })
end
 
------------------------------------------------------------- Frame functions --
-- set colour of health bar according to reaction/threat
local function SetHealthColour(self)
325,7 → 317,7
self.health.mo:Hide()
end
 
SetFontSize(self.name, 'small')
--SetFontSize(self.name, 'small')
self.name:SetJustifyH('CENTER')
 
self.name:SetPoint('BOTTOM', self.health, 'TOP', 0, -3)
367,7 → 359,7
self.health.mo:Show()
end
 
SetFontSize(self.name, 'name')
--SetFontSize(self.name, 'name')
self.name:SetJustifyH('LEFT')
self.name:SetPoint('RIGHT', self.health.p, 'LEFT')
 
399,7 → 391,7
 
self:SetGlowColour()
 
CallPostFunction('show', self)
kn:SendMessage('KuiNameplates_PostShow', self)
end
 
local function OnFrameHide(self)
427,8 → 419,8
-- unset stored health bar colours
self.health.r, self.health.g, self.health.b, self.health.reset
= nil, nil, nil, nil
 
CallPostFunction('hide', self)
 
kn:SendMessage('KuiNameplates_PostHide', self)
end
 
local function OnFrameEnter(self)
606,7 → 598,7
if self.health.mo then self.health.mo:Show() end
end
 
CallPostFunction('target', self)
kn:SendMessage('KuiNameplates_PostTarget', self)
end
elseif self.target then
self.target = nil
896,7 → 888,7
frame.elapsed = 0
frame.critElap = 0
 
CallPostFunction('create', frame)
kn:SendMessage('KuiNameplates_PostCreate', frame)
 
-- force OnShow
OnFrameShow(frame)
975,6 → 967,29
end
end
 
kn.configChangedFuncs.outline = function(frame, val)
local _, fontObject
for _, fontObject in pairs(frame.fontObjects) do
ModifyFontFlags(fontObject, val, 'OUTLINE')
end
end
 
kn.configChangedFuncs.monochrome = function(frame, val)
local _, fontObject
for _, fontObject in pairs(frame.fontObjects) do
ModifyFontFlags(fontObject, val, 'MONOCHROME')
end
end
 
kn.configChangedFuncs.fontscale = function(frame, val)
local _, fontObject
for _, fontObject in pairs(frame.fontObjects) do
if type(fontObject.size) == 'string' then
SetFontSize(fontObject, kn.fontSizes[fontObject.size])
end
end
end
 
kn.configChangedFuncs.Health = function(frame)
if frame:IsShown() then
-- update health display
v4/castbar.lua
60,7 → 60,7
end
 
---------------------------------------------------------------------- create --
function mod:CreateCastbar(frame)
function mod:CreateCastbar(msg, frame)
-- container ---------------------------------------------------------------
frame.castbar = CreateFrame('Frame', nil, frame.parent)
frame.castbar:Hide()
156,7 → 156,7
frame.castbar:SetScript('OnUpdate', OnCastbarUpdate)
end
------------------------------------------------------------------------ Hide --
function mod:HideCastbar(frame)
function mod:HideCastbar(msg, frame)
if frame.castbar then
frame.castbar.duration = nil
frame.castbar.id = nil
277,7 → 277,7
frame.castbar:Hide()
end
 
function mod:IsCasting(frame)
function mod:IsCasting(msg, frame)
-- TODO update this for other units (party1target etc)
if not frame.castbar or not frame.target then return end
 
357,10 → 357,10
end
 
function mod:OnEnable()
addon:RegisterPostFunction('create', self, 'CreateCastbar')
addon:RegisterPostFunction('hide', self, 'HideCastbar')
addon:RegisterPostFunction('show', self, 'IsCasting')
addon:RegisterPostFunction('target', self, 'IsCasting')
self:RegisterMessage('create', 'CreateCastbar')
self:RegisterMessage('hide', 'HideCastbar')
self:RegisterMessage('show', 'IsCasting')
self:RegisterMessage('target', 'IsCasting')
 
for event,_ in pairs(castEvents) do
self:RegisterEvent(event, self.UnitCastEvent)
v4/castwarnings.lua
98,7 → 98,7
end
 
---------------------------------------------------------------------- Create --
function mod:CreateCastWarnings(frame)
function mod:CreateCastWarnings(msg, frame)
-- casting spell name
frame.castWarning = frame:CreateFontString(frame.overlay, {
font = addon.font, size = 'spellname', outline = 'OUTLINE' })
151,7 → 151,7
frame.SetIncomingWarning = SetIncomingWarning
end
 
function mod:Hide(frame)
function mod:Hide(msg, frame)
if frame.castWarning then
frame.castWarning.ag:Stop()
frame.castWarning:SetText()
206,15 → 206,15
 
function mod:OnEnable()
-- TODO replace this with RegisterMessage etc from AceEvent
addon:RegisterPostFunction('create', self, 'CreateCastWarnings')
addon:RegisterPostFunction('hide', self, 'Hide')
self:RegisterMessage('KuiNameplates_PostCreate', 'CreateCastWarnings')
self:RegisterMessage('KuiNameplates_PostHide', 'Hide')
 
self:RegisterEvent('COMBAT_LOG_EVENT_UNFILTERED')
 
local _,frame
for _, frame in pairs(addon.frameList) do
if not frame.castWarning then
self:CreateCastWarnings(frame)
self:CreateCastWarnings(nil, frame)
end
end
end
224,6 → 224,6
 
local _,frame
for _, frame in pairs(addon.frameList) do
self:Hide(frame)
self:Hide(nil, frame)
end
end
\ No newline at end of file