Add Instance button font options and increase padding; store CoA settings account-wide via E.global
This commit is contained in:
@@ -23,7 +23,7 @@ end
|
|||||||
local function UpdateSize(button)
|
local function UpdateSize(button)
|
||||||
button = button or _G[BUTTON_NAME]
|
button = button or _G[BUTTON_NAME]
|
||||||
if button then
|
if button then
|
||||||
local size = E.db.CoA.extraActionButtonSize or 52
|
local size = E.global.CoA.extraActionButtonSize or 52
|
||||||
button:SetSize(size, size)
|
button:SetSize(size, size)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+21
-6
@@ -1,7 +1,27 @@
|
|||||||
local E, L, V, P, G = unpack(ElvUI)
|
local E, L, V, P, G = unpack(ElvUI)
|
||||||
|
local LSM = E.Libs.LSM
|
||||||
local CoA = E:GetModule("CoA")
|
local CoA = E:GetModule("CoA")
|
||||||
|
|
||||||
local BUTTON_NAME = "LayerPickerFrame"
|
local BUTTON_NAME = "LayerPickerFrame"
|
||||||
|
local MIN_WIDTH, MIN_HEIGHT = 66, 14
|
||||||
|
local PAD_X, PAD_Y = 10, 10
|
||||||
|
|
||||||
|
local function UpdateFont(button)
|
||||||
|
button = button or _G[BUTTON_NAME]
|
||||||
|
local text = button and _G[button:GetName().."Text"]
|
||||||
|
if not text then return end
|
||||||
|
|
||||||
|
text:FontTemplate(LSM:Fetch("font", E.global.CoA.instanceButtonFont), E.global.CoA.instanceButtonFontSize, E.global.CoA.instanceButtonFontOutline)
|
||||||
|
|
||||||
|
button:SetSize(
|
||||||
|
math.max(MIN_WIDTH, text:GetStringWidth() + PAD_X),
|
||||||
|
math.max(MIN_HEIGHT, text:GetStringHeight() + PAD_Y)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
function CoA:UpdateInstanceButtonFont()
|
||||||
|
UpdateFont()
|
||||||
|
end
|
||||||
|
|
||||||
do
|
do
|
||||||
local orig_AddButton = UIDropDownMenu_AddButton
|
local orig_AddButton = UIDropDownMenu_AddButton
|
||||||
@@ -60,16 +80,11 @@ local function SkinButton(button)
|
|||||||
if button.CoASkinned then return end
|
if button.CoASkinned then return end
|
||||||
button.CoASkinned = true
|
button.CoASkinned = true
|
||||||
|
|
||||||
local name = button:GetName()
|
|
||||||
local text = _G[name.."Text"]
|
|
||||||
|
|
||||||
button:StripTextures(true)
|
button:StripTextures(true)
|
||||||
button:CreateBackdrop("Default")
|
button:CreateBackdrop("Default")
|
||||||
button:StyleButton()
|
button:StyleButton()
|
||||||
|
|
||||||
if text then
|
UpdateFont(button)
|
||||||
text:FontTemplate()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function TryHook()
|
local function TryHook()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
local E, L, V, P, G = unpack(ElvUI)
|
local E, L, V, P, G = unpack(ElvUI)
|
||||||
local EP = E.Libs.EP
|
local EP = E.Libs.EP
|
||||||
|
local ACH = LibStub("LibAceConfigHelper")
|
||||||
|
|
||||||
local AddOnName = ...
|
local AddOnName = ...
|
||||||
|
|
||||||
@@ -10,8 +11,11 @@ E.CoA = CoA
|
|||||||
|
|
||||||
V.CoA = {}
|
V.CoA = {}
|
||||||
|
|
||||||
P.CoA = {
|
G.CoA = {
|
||||||
extraActionButtonSize = 52,
|
extraActionButtonSize = 52,
|
||||||
|
instanceButtonFont = "PT Sans Narrow",
|
||||||
|
instanceButtonFontSize = 12,
|
||||||
|
instanceButtonFontOutline = "OUTLINE",
|
||||||
}
|
}
|
||||||
|
|
||||||
local function getOptions()
|
local function getOptions()
|
||||||
@@ -39,9 +43,9 @@ local function getOptions()
|
|||||||
min = 30,
|
min = 30,
|
||||||
max = 100,
|
max = 100,
|
||||||
step = 1,
|
step = 1,
|
||||||
get = function() return E.db.CoA.extraActionButtonSize end,
|
get = function() return E.global.CoA.extraActionButtonSize end,
|
||||||
set = function(_, value)
|
set = function(_, value)
|
||||||
E.db.CoA.extraActionButtonSize = value
|
E.global.CoA.extraActionButtonSize = value
|
||||||
|
|
||||||
if CoA.UpdateExtraActionButtonSize then
|
if CoA.UpdateExtraActionButtonSize then
|
||||||
CoA:UpdateExtraActionButtonSize()
|
CoA:UpdateExtraActionButtonSize()
|
||||||
@@ -60,6 +64,40 @@ local function getOptions()
|
|||||||
type = "header",
|
type = "header",
|
||||||
name = "Instance Swap",
|
name = "Instance Swap",
|
||||||
},
|
},
|
||||||
|
font = ACH:SharedMediaFont("Font", nil, 2, nil,
|
||||||
|
function() return E.global.CoA.instanceButtonFont end,
|
||||||
|
function(_, value)
|
||||||
|
E.global.CoA.instanceButtonFont = value
|
||||||
|
|
||||||
|
if CoA.UpdateInstanceButtonFont then
|
||||||
|
CoA:UpdateInstanceButtonFont()
|
||||||
|
end
|
||||||
|
end),
|
||||||
|
fontSize = {
|
||||||
|
order = 3,
|
||||||
|
type = "range",
|
||||||
|
name = "Font Size",
|
||||||
|
min = 8,
|
||||||
|
max = 32,
|
||||||
|
step = 1,
|
||||||
|
get = function() return E.global.CoA.instanceButtonFontSize end,
|
||||||
|
set = function(_, value)
|
||||||
|
E.global.CoA.instanceButtonFontSize = value
|
||||||
|
|
||||||
|
if CoA.UpdateInstanceButtonFont then
|
||||||
|
CoA:UpdateInstanceButtonFont()
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
fontOutline = ACH:FontFlags("Font Outline", nil, 4, nil,
|
||||||
|
function() return E.global.CoA.instanceButtonFontOutline end,
|
||||||
|
function(_, value)
|
||||||
|
E.global.CoA.instanceButtonFontOutline = value
|
||||||
|
|
||||||
|
if CoA.UpdateInstanceButtonFont then
|
||||||
|
CoA:UpdateInstanceButtonFont()
|
||||||
|
end
|
||||||
|
end),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user