Commit 04e046b6 authored by Azilroka's avatar Azilroka
Browse files

Merge branch 'issue-2048' into 'development'

#2048

See merge request !265
parents d7d28a85 6075f502
local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB
local UF = E:GetModule('UnitFrames');
local LSM = E.Libs.LSM
local unpack, tonumber, abs = unpack, tonumber, abs
......@@ -43,13 +44,11 @@ function UF:Construct_Castbar(frame, moverName)
castbar:CreateBackdrop(nil, nil, nil, nil, true)
castbar.Time = castbar:CreateFontString(nil, 'OVERLAY')
UF:Configure_FontString(castbar.Time)
castbar.Time:Point('RIGHT', castbar, 'RIGHT', -4, 0)
castbar.Time:SetTextColor(0.84, 0.75, 0.65)
castbar.Time:SetJustifyH('RIGHT')
castbar.Text = castbar:CreateFontString(nil, 'OVERLAY')
UF:Configure_FontString(castbar.Text)
castbar.Text:Point('LEFT', castbar, 'LEFT', 4, 0)
castbar.Text:Point('RIGHT', castbar.Time, 'LEFT', -4, 0)
castbar.Text:SetTextColor(0.84, 0.75, 0.65)
......@@ -130,6 +129,21 @@ function UF:Configure_Castbar(frame)
castbar.LatencyTexture:Hide()
end
--Font Options
local customFont = db.customTextFont
if customFont.enable then
castbar.Text:FontTemplate(LSM:Fetch('font', customFont.font), customFont.fontSize, customFont.fontStyle)
else
UF:Update_FontString(castbar.Text)
end
customFont = db.customTimeFont
if customFont.enable then
castbar.Time:FontTemplate(LSM:Fetch('font', customFont.font), customFont.fontSize, customFont.fontStyle)
else
UF:Update_FontString(castbar.Time)
end
local textColor = db.textColor
castbar.Text:SetTextColor(textColor.r, textColor.g, textColor.b)
castbar.Time:SetTextColor(textColor.r, textColor.g, textColor.b)
......
......@@ -1061,6 +1061,18 @@ local UF_AuraWatch = {
}
local UF_Castbar = {
customTextFont = {
enable = false,
font = 'PT Sans Narrow',
fontSize = 12,
fontStyle = 'OUTLINE'
},
customTimeFont = {
enable = false,
font = 'PT Sans Narrow',
fontSize = 12,
fontStyle = 'OUTLINE'
},
displayTarget = false,
enable = true,
format = 'REMAINING',
......
......@@ -1034,14 +1034,49 @@ local function GetOptionsTable_Castbar(hasTicks, updateFunc, groupName, numUnits
get = function(info) return E.db.unitframe.units[groupName].castbar[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].castbar[info[#info]] = value; updateFunc(UF, groupName, numUnits) end,
args = {
xOffsetText = {
enable = {
order = 1,
type = 'toggle',
name = L["Custom Font"],
get = function(info) return E.db.unitframe.units[groupName].castbar.customTextFont[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].castbar.customTextFont[info[#info]] = value; updateFunc(UF, groupName, numUnits) end,
},
font = {
order = 2,
type = 'select',
dialogControl = 'LSM30_Font',
name = L["Font"],
values = _G.AceGUIWidgetLSMlists.font,
get = function(info) return E.db.unitframe.units[groupName].castbar.customTextFont[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].castbar.customTextFont[info[#info]] = value; updateFunc(UF, groupName, numUnits) end,
disabled = function() return not E.db.unitframe.units[groupName].castbar.customTextFont.enable end
},
fontSize = {
order = 3,
type = 'range',
name = L["Font Size"],
min = 7, max = 212, step = 1,
get = function(info) return E.db.unitframe.units[groupName].castbar.customTextFont[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].castbar.customTextFont[info[#info]] = value; updateFunc(UF, groupName, numUnits) end,
disabled = function() return not E.db.unitframe.units[groupName].castbar.customTextFont.enable end
},
fontStyle = {
order = 4,
type = 'select',
name = L["Font Outline"],
values = C.Values.FontFlags,
get = function(info) return E.db.unitframe.units[groupName].castbar.customTextFont[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].castbar.customTextFont[info[#info]] = value; updateFunc(UF, groupName, numUnits) end,
disabled = function() return not E.db.unitframe.units[groupName].castbar.customTextFont.enable end
},
xOffsetText = {
order = 4,
type = 'range',
name = L["X-Offset"],
min = -100, max = 100, step = 1,
},
yOffsetText = {
order = 2,
order = 5,
type = 'range',
name = L["Y-Offset"],
min = -50, max = 50, step = 1,
......@@ -1056,14 +1091,49 @@ local function GetOptionsTable_Castbar(hasTicks, updateFunc, groupName, numUnits
get = function(info) return E.db.unitframe.units[groupName].castbar[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].castbar[info[#info]] = value; updateFunc(UF, groupName, numUnits) end,
args = {
xOffsetTime = {
enable = {
order = 1,
type = 'toggle',
name = L["Custom Font"],
get = function(info) return E.db.unitframe.units[groupName].castbar.customTimeFont[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].castbar.customTimeFont[info[#info]] = value; updateFunc(UF, groupName, numUnits) end,
},
font = {
order = 2,
type = 'select',
dialogControl = 'LSM30_Font',
name = L["Font"],
values = _G.AceGUIWidgetLSMlists.font,
get = function(info) return E.db.unitframe.units[groupName].castbar.customTimeFont[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].castbar.customTimeFont[info[#info]] = value; updateFunc(UF, groupName, numUnits) end,
disabled = function() return not E.db.unitframe.units[groupName].castbar.customTimeFont.enable end
},
fontSize = {
order = 3,
type = 'range',
name = L["Font Size"],
min = 7, max = 212, step = 1,
get = function(info) return E.db.unitframe.units[groupName].castbar.customTimeFont[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].castbar.customTimeFont[info[#info]] = value; updateFunc(UF, groupName, numUnits) end,
disabled = function() return not E.db.unitframe.units[groupName].castbar.customTimeFont.enable end
},
fontStyle = {
order = 4,
type = 'select',
name = L["Font Outline"],
values = C.Values.FontFlags,
get = function(info) return E.db.unitframe.units[groupName].castbar.customTimeFont[info[#info]] end,
set = function(info, value) E.db.unitframe.units[groupName].castbar.customTimeFont[info[#info]] = value; updateFunc(UF, groupName, numUnits) end,
disabled = function() return not E.db.unitframe.units[groupName].castbar.customTimeFont.enable end
},
xOffsetText = {
order = 4,
type = 'range',
name = L["X-Offset"],
min = -100, max = 100, step = 1,
},
yOffsetTime = {
order = 2,
yOffsetText = {
order = 5,
type = 'range',
name = L["Y-Offset"],
min = -50, max = 50, step = 1,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment