WoWInterface SVN KuiNameplates

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 125 to Rev 126
    Reverse comparison

Rev 125 → Rev 126

Kui_Nameplates/custom-rename-me.lua
20,7 → 20,13
-- Place code to be performed after a frame is hidden here.
end
 
---------------------------------------------------------------------- Target --
local function PostTarget(frame)
-- Place code to be performed when a frame becomes the player's target here.
end
 
-------------------------------------------------------------------- Register --
kn.RegisterPostFunction('create', PostCreate)
kn.RegisterPostFunction('show', PostShow)
kn.RegisterPostFunction('hide', PostHide)
\ No newline at end of file +kn.RegisterPostFunction('hide', PostHide) +kn.RegisterPostFunction('target', PostTarget) \ No newline at end of file
Kui_Nameplates/castbar.lua
22,12 → 22,12
bar.progress = bar.progress + elapsed
end
 
if not bar.duration or
((not bar.channel and bar.progress >= bar.duration) or
(bar.channel and bar.progress <= 0))
if not bar.duration or
((not bar.channel and bar.progress >= bar.duration) or
(bar.channel and bar.progress <= 0))
then
-- hide the castbar bg
bar:GetParent():Hide()
-- hide the castbar
bar:Hide()
bar.progress = 0
return
end
52,39 → 52,35
end
end
 
bar:SetValue(bar.progress/bar.duration)
bar.bar:SetValue(bar.progress/bar.duration)
end
 
---------------------------------------------------------------------- create --
cb.CreateCastbar = function(frame)
-- cast bar background -------------------------------------------------
frame.castbarbg = CreateFrame("Frame", nil, frame.parent)
frame.castbarbg:SetFrameStrata('BACKGROUND');
frame.castbarbg:SetBackdrop({
bgFile = kui.m.t.solid, edgeFile = kui.m.t.shadow,
edgeSize = 5, insets = {
top = 5, left = 5, bottom = 5, right = 5
}
})
-- container ---------------------------------------------------------------
frame.castbar = CreateFrame('Frame', nil, frame.parent)
frame.castbar:Hide()
 
-- background --------------------------------------------------------------
frame.castbar.bg = frame.castbar:CreateTexture(nil, 'BACKGROUND')
frame.castbar.bg:SetTexture(kui.m.t.solid)
frame.castbar.bg:SetVertexColor(0, 0, 0, .85)
 
frame.castbarbg:SetBackdropColor(0, 0, 0, .85)
frame.castbarbg:SetBackdropBorderColor(1, .2, .1, 0)
frame.castbarbg:SetHeight(kn.sizes.cbheight)
 
frame.castbarbg:SetPoint('TOPLEFT', frame.bg.fill, 'BOTTOMLEFT', -5, 4)
frame.castbarbg:SetPoint('TOPRIGHT', frame.bg.fill, 'BOTTOMRIGHT', 5, 0)
 
frame.castbarbg:Hide()
 
frame.castbar.bg:SetHeight(kn.sizes.cbheight)
 
frame.castbar.bg:SetPoint('TOPLEFT', frame.bg.fill, 'BOTTOMLEFT', 0, -1)
frame.castbar.bg:SetPoint('TOPRIGHT', frame.bg.fill, 'BOTTOMRIGHT', 0, 0)
 
-- cast bar ------------------------------------------------------------
frame.castbar = CreateFrame("StatusBar", nil, frame.castbarbg)
frame.castbar:SetStatusBarTexture(kui.m.t.bar)
frame.castbar.bar = CreateFrame("StatusBar", nil, frame.castbar)
frame.castbar.bar:SetStatusBarTexture(kui.m.t.bar)
 
frame.castbar:SetPoint('TOPLEFT', frame.castbarbg, 'TOPLEFT', 6, -6)
frame.castbar:SetPoint('BOTTOMLEFT', frame.castbarbg, 'BOTTOMLEFT', 6, 6)
frame.castbar:SetPoint('RIGHT', frame.castbarbg, 'RIGHT', -6, 0)
frame.castbar.bar:SetPoint('TOPLEFT', frame.castbar.bg, 'TOPLEFT', 1, -1)
frame.castbar.bar:SetPoint('BOTTOMLEFT', frame.castbar.bg, 'BOTTOMLEFT', 1, 1)
frame.castbar.bar:SetPoint('RIGHT', frame.castbar.bg, 'RIGHT', -1, 0)
 
frame.castbar:SetMinMaxValues(0, 1)
frame.castbar.bar:SetFrameLevel(2)
frame.castbar.bar:SetMinMaxValues(0, 1)
 
-- uninterruptible cast shield -----------------------------------------
frame.castbar.shield = frame.castbar:CreateTexture(nil, 'ARTWORK')
92,7 → 88,7
frame.castbar.shield:SetTexCoord(0, .53125, 0, .6875)
 
frame.castbar.shield:SetSize(12, 17)
frame.castbar.shield:SetPoint('CENTER', frame.castbar, 0, 1)
frame.castbar.shield:SetPoint('CENTER', frame.castbar.bg, 0, 1)
 
frame.castbar.shield:SetBlendMode('BLEND')
frame.castbar.shield:SetDrawLayer('ARTWORK', 7)
104,13 → 100,13
if kn.profile.castbar.spellname then
frame.castbar.name = kui.CreateFontString(frame.castbar, {
font = kn.font, size = kn.fontSizes.name, outline = "OUTLINE" })
frame.castbar.name:SetPoint('TOPLEFT', frame.castbar, 'BOTTOMLEFT', 2, -2)
frame.castbar.name:SetPoint('TOPLEFT', frame.castbar.bg, 'BOTTOMLEFT', 2, -2)
end
 
if kn.profile.castbar.casttime then
frame.castbar.max = kui.CreateFontString(frame.castbar, {
font = kn.font, size = kn.fontSizes.name, outline = "OUTLINE" })
frame.castbar.max:SetPoint('TOPRIGHT', frame.castbar, 'BOTTOMRIGHT', -2, -1)
frame.castbar.max:SetPoint('TOPRIGHT', frame.castbar.bg, 'BOTTOMRIGHT', -2, -1)
 
frame.castbar.curr = kui.CreateFontString(frame.castbar, {
font = kn.font, size = kn.fontSizes.small, outline = "OUTLINE" })
120,7 → 116,7
 
if frame.spell then
-- cast bar icon background ----------------------------------------
frame.spellbg = frame.castbarbg:CreateTexture(nil, 'BACKGROUND')
frame.spellbg = frame.castbar:CreateTexture(nil, 'BACKGROUND')
frame.spellbg:SetTexture(kui.m.t.solid)
frame.spellbg:SetSize(kn.sizes.icon, kn.sizes.icon)
 
130,7 → 126,7
 
-- cast bar icon ---------------------------------------------------
frame.spell:ClearAllPoints()
frame.spell:SetParent(frame.castbarbg)
frame.spell:SetParent(frame.castbar)
frame.spell:SetSize(kn.sizes.icon - 2, kn.sizes.icon - 2)
 
frame.spell:SetPoint('TOPRIGHT', frame.spellbg, -1, -1)
141,12 → 137,10
-- scripts -------------------------------------------------------------
frame.castbar:HookScript('OnShow', function(bar)
if bar.interruptible then
bar:SetStatusBarColor(unpack(kn.profile.castbar.barcolour))
bar:GetParent():SetBackdropBorderColor(0, 0, 0, .3)
bar.bar:SetStatusBarColor(unpack(kn.profile.castbar.barcolour))
bar.shield:Hide()
else
bar:SetStatusBarColor(.8, .1, .1)
bar:GetParent():SetBackdropBorderColor(1, .1, .2, .5)
bar.bar:SetStatusBarColor(.8, .1, .1)
bar.shield:Show()
end
end)
158,7 → 152,7
if frame.castbar then
frame.castbar.duration = nil
frame.castbar.id = nil
frame.castbarbg:Hide()
frame.castbar:Hide()
end
end
-------------------------------------------------------------- Event handlers --
203,7 → 197,7
end
 
if not name then
frame.castbarbg:Hide()
frame.castbar:Hide()
return
end
 
227,7 → 221,7
castbar.progress = GetTime() - (startTime/1000)
end
 
frame.castbarbg:Show()
frame.castbar:Show()
end
 
function cb:UNIT_SPELLCAST_DELAYED(frame, unit, channel)
263,16 → 257,16
end
 
function cb:UNIT_SPELLCAST_STOP(frame, unit)
frame.castbarbg:Hide()
frame.castbar:Hide()
end
function cb:UNIT_SPELLCAST_FAILED(frame, unit)
frame.castbarbg:Hide()
frame.castbar:Hide()
end
function cb:UNIT_SPELLCAST_INTERRUPTED(frame, unit)
frame.castbarbg:Hide()
frame.castbar:Hide()
end
function cb:UNIT_SPELLCAST_CHANNEL_STOP(frame, unit)
frame.castbarbg:Hide()
frame.castbar:Hide()
end
 
function cb.IsCasting(frame)
Kui_Nameplates/castwarnings.lua
62,11 → 62,11
-- fetch the spell's target's nameplate
guid, name = targetGUID, targetName
end
 
 
-- [[debug]]
--guid, name = UnitGUID('target'), GetUnitName('target')
 
local f = kn.f:GetNameplate(guid, name)
local f = kn.f:GetNameplate(guid, name:gsub('%-.+$', ''))
if f then
if not f.SetIncomingWarning or f.trivial then return end
local spName, spSch = select(13, ...)
Kui_Nameplates/Kui_Nameplates.toc
12,5 → 12,6
 
castbar.lua
castwarnings.lua
combopoints.lua
 
custom.lua
\ No newline at end of file
Kui_Nameplates/config.lua
1,5 → 1,6
local addon, ns = ...
local kui = LibStub('Kui-1.0')
local kn = KuiNameplates
 
------------------------------------------------------------------ Ace config --
local AceConfig = LibStub('AceConfig-3.0')
46,7 → 47,7
},
fixaa = {
name = 'Fix aliasing',
desc = 'Attempt to make plates appear sharper. Has a positive effect on FPS, but will make plates appear a bit "loose", especially at low frame rates. Works best when uiscale is disabled and at good resolutions.',
desc = 'Attempt to make plates appear sharper. Has a positive effect on FPS, but will make plates appear a bit "loose", especially at low frame rates. Works best when uiscale is disabled and at good resolutions.\n|cffff0000UI reload required to take effect.|r',
type = 'toggle',
order = 4
},
300,6 → 301,9
else
ns.db.profile[info[1]][info[#info]] = val
end
 
--print(info[#info])
kn.updateFunctions.Call(info[#info], val)
end
 
AceConfig:RegisterOptionsTable('kuinameplates', options)
Kui_Nameplates/core.lua
6,6 → 6,8
local kui = LibStub('Kui-1.0')
local LSM = LibStub('LibSharedMedia-3.0')
 
KuiNameplates = {}
 
LibStub('AceAddon-3.0'):NewAddon(ns, 'KuiNameplates')
 
-- add yanone kaffesatz and accidental presidency to LSM (only supports latin)
Kui_Nameplates/combopoints.lua New file
0,0 → 1,91
local kui = LibStub('Kui-1.0')
local kn = KuiNameplates
local cp = CreateFrame('Frame')
 
local ComboPointsUpdate = function(self)
if self.points and self.points > 0 then
local size = (13 + ((18 - 13) / 5) * self.points)
local blue = (1 - (1 / 5) * self.points)
 
self:SetText(self.points)
self:SetFont(kn.font, size, 'OUTLINE')
self:SetTextColor(1, 1, blue)
self:Show()
elseif self:GetText() then
self:SetText('')
self:Hide()
end
end
-------------------------------------------------------------- Event handlers --
function cp:UNIT_COMBO_POINTS(event, unit)
local guid, name = UnitGUID('target'), UnitName('target')
local f = kn.f:GetNameplate(guid, name)
 
if f then
if f.cp then
f.cp.points = GetComboPoints(unit, 'target')
f.cp:Update()
end
end
 
-- clear points on other frames
local _, frame
for _, frame in pairs(kn.frameList) do
if frame.cp and frame ~= f then
frame.cp.points = nil
frame.cp:Update()
end
end
end
---------------------------------------------------------------------- Create --
cp.CreateComboPoints = function(frame)
frame.cp = kui.CreateFontString(frame.health,
{ font = kn.font, size = kn.fontSizes.combopoints, outline = 'OUTLINE', shadow = true })
frame.cp:SetPoint('LEFT', frame.health, 'RIGHT', 5, 1)
frame.cp.Update = ComboPointsUpdate
frame.cp:Hide()
end
------------------------------------------------------------------------ Hide --
cp.HideComboPoints = function(frame)
frame.cp.points = nil
frame.cp:Update()
end
-------------------------------------------------------------------- Register --
kn.updateFunctions.combopoints = function(frame, val, runonce)
if not val then
-- disable
if runonce == 0 then
cp:Disable()
end
 
if frame.cp then
-- hide combo points which are already displayed
frame.cp.points = nil
frame.cp:Update()
end
else
-- enable
if runonce == 0 then
cp:Enable()
end
 
if not frame.cp then
-- create combo points frame on existing frames
cp.CreateComboPoints(frame)
end
end
end
 
cp.Enable = function(self)
kn.RegisterPostFunction('create', self.CreateComboPoints)
kn.RegisterPostFunction('hide', self.HideComboPoints)
self:SetScript('OnEvent', cp.UNIT_COMBO_POINTS)
 
self:RegisterEvent('UNIT_COMBO_POINTS')
end
 
cp.Disable = function(self)
self:UnregisterEvent('UNIT_COMBO_POINTS')
end
 
kn.RegisterModule('combopoints', cp)
Kui_Nameplates/layout.lua
1,22 → 1,22
--[[
Kui Nameplates
Kesava-Auchindoun
 
TODO make option for friendly/enemy name text colour (defaults to white)
]]
 
local addon, ns = ...
local kui = LibStub('Kui-1.0')
local LSM = LibStub('LibSharedMedia-3.0')
local kn = KuiNameplates
 
KuiNameplates = {
f = CreateFrame('Frame'),
font = '', fontSizes = {}, sizes = {}
}
 
-- our frame, whee
ns.f = KuiNameplates.f
kn.f = CreateFrame('Frame')
ns.f = kn.f
 
kn.font = ''
kn.fontSizes = {}
kn.sizes = {}
kn.frameList = {}
 
-- Custom reaction colours
ns.r = {
{ .7, .2, .1 }, -- hated
25,15 → 25,35
{ .5, .5, .5 }, -- tapped
}
 
local bgOffset = 4 -- inset offset for the frame glow (frame.bg)
local uiscale, prevuiscale
local loadedGUIDs, loadedNames, targetExists, profile = {}, {}
local origSizes, origFontSizes = {},{}
local font, sizes, fontSizes = '', {}, {}
-- sizes of frame elements
local defaultSizes = {
frame = {
width = 110,
height = 11,
twidth = 55,
theight = 7,
cbheight = 4,
bgOffset = 4, -- inset offset for the frame glow (frame.bg)
icon = 16
},
font = {
combopoints = 13,
large = 10,
spellname = 9,
name = 9,
small = 8
},
}
 
local loadedGUIDs, loadedNames = {}, {}
local targetExists, targetPlate
local profile, uiscale, prevuiscale
local sizes, fontSizes, origSizes, origFontSizes = {}, {}, {}, {}
local font = ''
 
--------------------------------------------------------------------- globals --
local select, strfind, strsplit, pairs, ipairs, unpack
= select, strfind, strsplit, pairs, ipairs, unpack
local select, strfind, strsplit, pairs, ipairs, unpack, tinsert
= select, strfind, strsplit, pairs, ipairs, unpack, tinsert
 
-- helper for setting a given fontstring's font size
local function SetFontSize(fontstring, size)
163,20 → 183,6
end
end
 
--------------------------------------------------------- Update combo points --
local function ComboPointsUpdate(self)
if self.points and self.points > 0 then
local size = (13 + ((18 - 13) / 5) * self.points)
local blue = (1 - (1 / 5) * self.points)
 
self:SetText(self.points)
self:SetFont(font, size, 'OUTLINE')
self:SetTextColor(1, 1, blue)
elseif self:GetText() then
self:SetText('')
end
end
 
---------------------------------------------------- Update health bar & text --
local function OnHealthValueChanged(oldBar, curr)
local frame = oldBar:GetParent():GetParent()
204,8 → 210,10
condition = curr < max
elseif condition == '=' then
condition = curr == max
elseif condition == '<=' then
elseif condition == '<=' or condition == '=<' then
condition = curr <= max
else
condition = nil
end
 
if condition then
318,8 → 326,8
 
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.twidth+(bgOffset-2), y+sizes.theight+(bgOffset-2))
self.bg:SetPoint('BOTTOMLEFT', x-(sizes.bgOffset-2), y-(sizes.bgOffset-2))
self.bg:SetPoint('TOPRIGHT', self.parent, 'BOTTOMLEFT', x+sizes.twidth+(sizes.bgOffset-2), y+sizes.theight+(sizes.bgOffset-2))
 
self.trivial = true
else
366,8 → 374,8
 
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.bg:SetPoint('BOTTOMLEFT', x-sizes.bgOffset, y-sizes.bgOffset)
self.bg:SetPoint('TOPRIGHT', self.parent, 'BOTTOMLEFT', x+(sizes.width)+sizes.bgOffset, y+(sizes.height)+sizes.bgOffset)
 
self.trivial = nil
end
392,11 → 400,6
-- remove guid from the store and unset it
loadedGUIDs[self.guid] = nil
self.guid = nil
 
if self.cp then
self.cp.points = nil
self.cp:Update()
end
end
 
if loadedNames[self.name.text] == self then
506,7 → 509,7
else
(self.carrier and self.carrier or self):SetAlpha(self.currentAlpha)
end
 
 
-- call delayed updates
if self.elapsed > 1 then
self.elapsed = 0
537,11 → 540,6
 
-- Name text colour
self:SetNameColour()
 
if self.cp then
-- combo points
self.cp:Update()
end
end
 
-- stuff that needs to be updated often
671,7 → 669,8
 
function ns.f:InitFrame(frame)
frame.init = true
 
frame.fontObjects = {}
 
local overlayChild, nameTextChild = frame:GetChildren()
local healthBar, castBar = overlayChild:GetChildren()
 
713,7 → 712,7
 
frame.oldName = nameTextRegion
frame.oldName:Hide()
 
 
frame.oldHighlight = highlightRegion
 
--------------------------------------------------------- Frame functions --
770,8 → 769,8
frame.bg.fill:SetPoint('BOTTOMLEFT', x, y)
 
frame.bg:ClearAllPoints()
frame.bg:SetPoint('BOTTOMLEFT', x-bgOffset, y-bgOffset)
frame.bg:SetPoint('TOPRIGHT', parent, 'BOTTOMLEFT', x+sizes.width+bgOffset, y+sizes.height+bgOffset)
frame.bg:SetPoint('BOTTOMLEFT', x-sizes.bgOffset, y-sizes.bgOffset)
frame.bg:SetPoint('TOPRIGHT', parent, 'BOTTOMLEFT', x+sizes.width+sizes.bgOffset, y+sizes.height+sizes.bgOffset)
 
-- health bar --------------------------------------------------------------
frame.health = CreateFrame('StatusBar', nil, parent)
820,6 → 819,9
 
frame.health.p:SetPoint('BOTTOMRIGHT', frame.health, 'TOPRIGHT', -2, uiscale and -(3/uiscale) or -3)
 
frame.health.p.size = 'large'
tinsert(frame.fontObjects, frame.health.p)
 
if profile.hp.showalt then
frame.health.mo = kui.CreateFontString(frame.overlay, {
font = font, size = fontSizes.small, outline = "OUTLINE" })
827,6 → 829,9
 
frame.health.mo:SetPoint('BOTTOMRIGHT', frame.health, -2, uiscale and -(3/uiscale) or -3)
frame.health.mo:SetAlpha(.6)
 
frame.health.mo.size = 'small'
tinsert(frame.fontObjects, frame.health.mo)
end
 
if profile.text.level then
838,6 → 843,9
frame.level:ClearAllPoints()
frame.level:SetPoint('BOTTOMLEFT', frame.health, 'TOPLEFT', 2, uiscale and -(2/uiscale) or -2)
frame.level.enabled = true
 
frame.level.size = 'name'
tinsert(frame.fontObjects, frame.level)
else
frame.level:Hide()
end
848,7 → 856,7
frame.name:SetJustifyH('LEFT')
 
frame.name:SetHeight(13)
 
 
if frame.level.enabled then
frame.name:SetPoint('LEFT', frame.level, 'RIGHT', -2, 0)
else
857,15 → 865,9
 
frame.name:SetPoint('RIGHT', frame.health.p, 'LEFT')
 
-- combo point text --------------------------------------------------------
if profile.general.combopoints then
frame.cp = kui.CreateFontString(frame.health,
{ font = font, size = fontSizes.combopoints, outline = 'OUTLINE', shadow = true })
frame.cp:SetPoint('LEFT', frame.health, 'RIGHT', 5, 1)
 
frame.cp.Update = ComboPointsUpdate
end
 
frame.name.size = 'name'
tinsert(frame.fontObjects, frame.name)
 
----------------------------------------------------------------- Scripts --
frame:SetScript('OnShow', OnFrameShow)
frame:SetScript('OnHide', OnFrameHide)
904,25 → 906,6
end
 
---------------------------------------------------------------------- Events --
function ns.f:UNIT_COMBO_POINTS()
local target = UnitGUID('target')
if not target or not loadedGUIDs[target] then return end
target = loadedGUIDs[target]
 
if target.cp then
target.cp.points = GetComboPoints('player', 'target')
target.cp:Update()
end
 
-- clear points on other frames
for guid, frame in pairs(loadedGUIDs) do
if frame.cp and guid ~= target.guid then
frame.cp.points = nil
frame.cp:Update()
end
end
end
 
function ns.f:PLAYER_TARGET_CHANGED()
targetExists = UnitExists('target')
end
957,6 → 940,7
f = select(i, WorldFrame:GetChildren())
if self:IsNameplate(f) and not f.init then
self:InitFrame(f)
tinsert(kn.frameList, f)
end
end
 
980,67 → 964,100
end
end
 
function ns.ToggleComboPoints(io)
if io then
ns.f:RegisterEvent('UNIT_COMBO_POINTS')
else
ns.f:UnregisterEvent('UNIT_COMBO_POINTS')
-------------------------------------------------- Listen for profile changes --
function ns:ProfileChanged()
kn.profile = self.db.profile
profile = kn.profile
 
-- call all updateFunctions
local groupname, group
for groupname, group in pairs(profile) do
local settingname, value
for settingname, value in pairs(group) do
kn.updateFunctions.Call(settingname, value)
end
end
end
 
-------------------------------------------------- Listen for profile changes --
function ns:ProfileChanged()
profile = self.db.profile
-- TODO move all this crap into config.lua
---------------------------------------------------- Post db change functions --
-- for changes which require traversal of all frames
kn.updateFunctions = {}
kn.updateFunctions.Call = function(func, val)
if not kn.updateFunctions[func] then return end
 
local runonce, _, frame = 0
for _, frame in pairs(kn.frameList) do
kn.updateFunctions[func](frame, val, runonce)
runonce = runonce + 1
end
end
 
-------------------------------------------------------------------- Finalise --
function ns:OnEnable()
profile = self.db.profile
KuiNameplates.profile = profile
kn.updateFunctions.Health = function(frame)
if frame:IsShown() then
-- update health display
OnHealthValueChanged(frame.oldHealth, frame.oldHealth:GetValue())
end
end
kn.updateFunctions.friendly = kn.updateFunctions.Health
kn.updateFunctions.hostile = kn.updateFunctions.Health
 
KuiNameplates.sizes, KuiNameplates.fontSizes = {
-- frame
width = 110,
height = 11,
twidth = 55,
theight= 7,
-- cast bar stuff
cbheight = 14,
icon = 16,
}, {
combopoints = 13,
large = 10,
spellname = 9,
name = 9,
small = 8,
}
 
sizes, fontSizes = KuiNameplates.sizes, KuiNameplates.fontSizes
 
for k,size in pairs(fontSizes) do
fontSizes[k] = size * profile.general.fontscale
kn.updateFunctions.fontscale = function(frame, val, runonce)
if runonce == 0 then
ns:ScaleFonts()
end
 
local _, fontObject
for _, fontObject in pairs(frame.fontObjects) do
SetFontSize(fontObject, fontSizes[fontObject.size])
end
end
 
if profile.general.fixaa then
uiscale, origSizes, origFontSizes =
UIParent:GetEffectiveScale(), sizes, fontSizes
kn.updateFunctions.font = function(frame, val, runonce)
val = LSM:Fetch(LSM.MediaType.FONT, val)
 
bgOffset = 5
origSizes.cbheight = 12
local _, fontObject
for _, fontObject in pairs(frame.fontObjects) do
local _, size, flags = fontObject:GetFont()
fontObject:SetFont(val, size, flags)
end
end
 
-- scale sizes up to "unscaled" values
for k,size in pairs(origSizes) do
sizes[k] = floor(size/uiscale)
end
-------------------------------------------------------------------- Finalise --
-- [initialise and] scale frame sizes
function ns:ScaleFrames()
for k, size in pairs(defaultSizes.frame) do
kn.sizes[k] = (uiscale and floor(size/uiscale) or size)
end
end
 
for k,size in pairs(origFontSizes) do
fontSizes[k] = size/uiscale
-- [initialise and] scale font sizes
function ns:ScaleFonts()
for k, size in pairs(defaultSizes.font) do
kn.fontSizes[k] = size * profile.general.fontscale
 
if uiscale then
kn.fontSizes[k] = kn.fontSizes[k] / uiscale
end
end
end
 
function ns:OnEnable()
kn.profile = self.db.profile
profile = kn.profile
 
if profile.general.fixaa then
uiscale = UIParent:GetEffectiveScale()
end
 
self:ScaleFonts()
self:ScaleFrames()
 
fontSizes, sizes = kn.fontSizes, kn.sizes
 
-- fetch font path from lsm
KuiNameplates.font = LSM:Fetch(LSM.MediaType.FONT, profile.general.font)
font = KuiNameplates.font
kn.font = LSM:Fetch(LSM.MediaType.FONT, profile.general.font)
font = kn.font
 
-------------------------------------- Health bar smooth update functions --
-- (spoon-fed by oUF_Smooth)
1090,12 → 1107,14
if profile.castbar.warnings and modules.warnings then
modules.warnings:Enable()
end
 
if profile.general.combopoints and modules.combopoints then
modules.combopoints:Enable()
end
 
ns.f:SetScript('OnUpdate', self.OnUpdate)
ns.f:SetScript('OnEvent', self.OnEvent)
 
ns.f:RegisterEvent('PLAYER_TARGET_CHANGED')
 
self.ToggleCombatEvents(profile.general.combat)
self.ToggleComboPoints(profile.general.combopoints)
end