diff --git a/AlegreyaSans-Medium.ttf b/AlegreyaSans-Medium.ttf new file mode 100644 index 0000000..574608a Binary files /dev/null and b/AlegreyaSans-Medium.ttf differ diff --git a/ClearFont.ttf b/ClearFont.ttf deleted file mode 100644 index e955207..0000000 Binary files a/ClearFont.ttf and /dev/null differ diff --git a/Options/WidgetForms.lua b/Options/WidgetForms.lua index 9927e1a..ebb936c 100644 --- a/Options/WidgetForms.lua +++ b/Options/WidgetForms.lua @@ -211,7 +211,7 @@ function ns.WidgetForms.Icon.Create(form) CreateSizeSettings(form) CreateAnchorSettings(form) - local font = ns.AddFontDropdown(form, 0.46, L"Stacks Font", "font", "ClearFont", callbackUpdateForm) + local font = ns.AddFontDropdown(form, 0.46, L"Stacks Font", "font", AptechkaDefaultConfig.defaultFont, callbackUpdateForm) local textsize = ns.AddSlider(form, 0.46, L"Font Size", "textsize", 12, 6, 30, 1, callbackUpdateForm) local alpha = ns.AddSlider(form, 0.95, L"Alpha", "alpha", 1, 0, 1, 0.05, callbackUpdateForm) local outline = ns.AddCheckbox(form, 0.46, L"Outline", "outline", false, callbackUpdateForm) @@ -373,7 +373,7 @@ function ns.WidgetForms.Text.Create(form) form = form or ns.InitForm() CreateAnchorSettings(form) - local font = ns.AddFontDropdown(form, 0.46, L"Font", "font", "ClearFont", callbackUpdateForm) + local font = ns.AddFontDropdown(form, 0.46, L"Font", "font", AptechkaDefaultConfig, callbackUpdateForm) local textsize = ns.AddSlider(form, 0.46, L"Font Size", "textsize", 12, 6, 30, 1, callbackUpdateForm) local effect = ns.AddDropdown(form, 0.46, L"Effect", "effect", "NONE", textEffects, callbackUpdateForm) diff --git a/config.lua b/config.lua index be32add..b35960a 100644 --- a/config.lua +++ b/config.lua @@ -15,7 +15,7 @@ config.maxgroups = 8 config.petcolor = {1,.5,.5} --A maximum of 5 pets can be displayed. -config.defaultFont = "ClearFont" +config.defaultFont = "AlegreyaSans-Medium" do local locale = GetLocale() if locale == "zhTW" or locale == "zhCN" or locale == "koKR" then @@ -81,19 +81,19 @@ config.MindControlStatus = { name = "MIND_CONTROL", assignto = set("border", "mi config.DefaultWidgets = { raidbuff = { type = "IndicatorArray", width = 5, height = 5, point = "TOPLEFT", x = 0, y = 0, growth = "DOWN", max = 5 }, mitigation = { type = "Bar", width=22, height=4, point="BOTTOMLEFT", x=4, y=-5, vertical = false}, - icon = { type = "Icon", width = 24, height = 24, point = "CENTER", x = 0, y = 0, alpha = 1, font = "ClearFont", textsize = 12, outline = true, edge = true }, + icon = { type = "Icon", width = 24, height = 24, point = "CENTER", x = 0, y = 0, alpha = 1, font = config.defaultFont, textsize = 12, outline = true, edge = true }, spell1 = { type = "Indicator", width = 9, height = 8, point = "BOTTOMRIGHT", x = 0, y = 0, }, -- spell2 = { type = "Indicator", width = 9, height = 8, point = "TOP", x = 0, y = 0, }, spell3 = { type = "Indicator", width = 9, height = 8, point = "TOPRIGHT", x = 0, y = 0, }, bar4 = { type = "Bar", width=21, height=5, point="TOPRIGHT", x=0, y=2, vertical = false}, - buffIcons = { type = "IconArray", width = 12, height = 18, point = "TOPRIGHT", x = 5, y = -6, alpha = 1, growth = "LEFT", max = 3, edge = true, outline = true, font = "ClearFont", textsize = 12 }, + buffIcons = { type = "IconArray", width = 12, height = 18, point = "TOPRIGHT", x = 5, y = -6, alpha = 1, growth = "LEFT", max = 3, edge = true, outline = true, font = config.defaultFont, textsize = 12 }, bars = { type = "BarArray", width = 21, height = 5, point = "BOTTOMRIGHT", x = 0, y = 0, vertical = false, growth = "UP", max = 7 }, vbar1 = { type = "Bar", width=4, height=20, point="TOPRIGHT", x=-9, y=2, vertical = true}, text1 = { type = "StaticText", point="CENTER", x=0, y=0, font = config.defaultFont, textsize = 12, effect = "SHADOW" }, - text2 = { type = "StaticText", point="CENTER", x=0, y=-10, font = "ClearFont", textsize = 10, effect = "NONE" }, - text3 = { type = "Text", point="TOPLEFT", x=2, y=0, font = "ClearFont", textsize = 9, effect = "NONE" }, - incomingCastIcon = { type = "ProgressIcon", width = 18, height = 18, point = "TOPLEFT", x = -3, y = 3, alpha = 1, font = "ClearFont", textsize = 12, outline = false, edge = false }, - debuffIcons = { type = "DebuffIconArray", width = 13, height = 13, point = "BOTTOMLEFT", x = 0, y = 0, style = "STRIP_RIGHT", animdir = "LEFT", alpha = 1, growth = "UP", max = 4, edge = true, outline = true, font = "ClearFont", textsize = 12, bigscale = 1.3 }, + text2 = { type = "StaticText", point="CENTER", x=0, y=-10, font = config.defaultFont, textsize = 10, effect = "NONE" }, + text3 = { type = "Text", point="TOPLEFT", x=2, y=0, font = config.defaultFont, textsize = 9, effect = "NONE" }, + incomingCastIcon = { type = "ProgressIcon", width = 18, height = 18, point = "TOPLEFT", x = -3, y = 3, alpha = 1, font = config.defaultFont, textsize = 12, outline = false, edge = false }, + debuffIcons = { type = "DebuffIconArray", width = 13, height = 13, point = "BOTTOMLEFT", x = 0, y = 0, style = "STRIP_RIGHT", animdir = "LEFT", alpha = 1, growth = "UP", max = 4, edge = true, outline = true, font = config.defaultFont, textsize = 12, bigscale = 1.3 }, -- bossdebuff = { type = "Indicator", width = 13, height = 13, point = "BOTTOMLEFT", x = 0, y = -0, }, statusIcon = { type = "Texture", width = 20, height = 20, point = "CENTER", x = 0, y = 14, texture = nil, rotation = 0, zorder = 1, alpha = 1, blendmode = "BLEND", disableOverrides = false }, roleIcon = { type = "Texture", width = 13, height = 13, point = "BOTTOMLEFT", x = -8, y = -8, texture = nil, rotation = 0, zorder = 1, alpha = 1, blendmode = "BLEND", disableOverrides = false }, diff --git a/frame.lua b/frame.lua index 6847f7d..822fcc5 100644 --- a/frame.lua +++ b/frame.lua @@ -1,12 +1,14 @@ local _, helpers = ... local Aptechka = Aptechka +local config = AptechkaDefaultConfig + local pixelperfect = helpers.pixelperfect local LSM = LibStub("LibSharedMedia-3.0") LSM:Register("statusbar", "Gradient", [[Interface\AddOns\Aptechka\gradient.tga]]) -LSM:Register("font", "ClearFont", [[Interface\AddOns\Aptechka\ClearFont.ttf]], GetLocale() ~= "enUS" and 15) +LSM:Register("font", "AlegreyaSans-Medium", [[Interface\AddOns\Aptechka\AlegreyaSans-Medium.ttf]], GetLocale() ~= "enUS" and 15) local isClassic = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC @@ -1109,7 +1111,7 @@ Aptechka.Widget.IndicatorArray.Reconf = Aptechka.Widget.BarArray.Reconf ---------------------------------------------------------- Aptechka.Widget.IconArray = {} -Aptechka.Widget.IconArray.default = { type = "IconArray", width = 15, height = 15, point = "TOPRIGHT", x = 0, y = 0, alpha = 1, font = "ClearFont", textsize = 10, outline = true, edge = true, growth = "LEFT", max = 3 } +Aptechka.Widget.IconArray.default = { type = "IconArray", width = 15, height = 15, point = "TOPRIGHT", x = 0, y = 0, alpha = 1, font = config.defaultFont, textsize = 10, outline = true, edge = true, growth = "LEFT", max = 3 } function Aptechka.Widget.IconArray.Create(parent, popts, gopts) local opts = InheritGlobalOptions(popts, gopts) return CreateArrayHeader("Icon", parent, opts.point, opts.x, opts.y, opts, opts.growth, opts.max) @@ -1328,7 +1330,7 @@ end AptechkaDefaultConfig.GridSkin_CreateIcon = CreateIcon Aptechka.Widget.Icon = {} -Aptechka.Widget.Icon.default = { type = "Icon", width = 24, height = 24, point = "CENTER", x = 0, y = 0, alpha = 1, font = "ClearFont", textsize = 12, outline = true, edge = true } +Aptechka.Widget.Icon.default = { type = "Icon", width = 24, height = 24, point = "CENTER", x = 0, y = 0, alpha = 1, font = config.defaultFont, textsize = 12, outline = true, edge = true } function Aptechka.Widget.Icon.Create(parent, popts, gopts) local opts = InheritGlobalOptions(popts, gopts) return CreateIcon(parent, opts.width, opts.height, opts.alpha, opts.point, parent, opts.point, opts.x, opts.y, opts.font, opts.textsize, opts.outline, opts.edge) @@ -1344,7 +1346,7 @@ function Aptechka.Widget.Icon.Reconf(parent, f, popts, gopts) f:SetPoint(opts.point, parent, opts.point, opts.x, opts.y) f:SetAlpha(opts.alpha) - local fontName = opts.font or "ClearFont" + local fontName = opts.font or config.defaultFont local font = LSM:Fetch("font", fontName) local flags = opts.effect == "OUTLINE" and "OUTLINE" if opts.effect == "SHADOW" then @@ -1547,7 +1549,7 @@ local function CreateDebuffIcon(parent, width, height, alpha, point, frame, to, return icon end Aptechka.Widget.DebuffIcon = {} -Aptechka.Widget.DebuffIcon.default = { type = "DebuffIcon", width = 13, height = 13, point = "CENTER", x = 0, y = 0, alpha = 1, style = "STRIP_RIGHT", animdir = "LEFT", font = "ClearFont", textsize = 12, edge = false } +Aptechka.Widget.DebuffIcon.default = { type = "DebuffIcon", width = 13, height = 13, point = "CENTER", x = 0, y = 0, alpha = 1, style = "STRIP_RIGHT", animdir = "LEFT", font = config.defaultFont, textsize = 12, edge = false } function Aptechka.Widget.DebuffIcon.Create(parent, popts, gopts) local opts = InheritGlobalOptions(popts, gopts) local icon = CreateDebuffIcon(parent, opts.width, opts.height, opts.alpha, opts.point, parent, opts.point, opts.x, opts.y, opts.font, opts.textsize, opts.outline, opts.edge) @@ -1676,7 +1678,7 @@ local function CreateProgressIcon(parent, width, height, alpha, point, frame, to end Aptechka.Widget.ProgressIcon = {} -Aptechka.Widget.ProgressIcon.default = { type = "ProgressIcon", width = 24, height = 24, point = "CENTER", x = 0, y = 0, alpha = 1, font = "ClearFont", textsize = 12, outline = false, edge = false } +Aptechka.Widget.ProgressIcon.default = { type = "ProgressIcon", width = 24, height = 24, point = "CENTER", x = 0, y = 0, alpha = 1, font = config.defaultFont, textsize = 12, outline = false, edge = false } function Aptechka.Widget.ProgressIcon.Create(parent, popts, gopts) local opts = InheritGlobalOptions(popts, gopts) return CreateProgressIcon(parent, opts.width, opts.height, opts.alpha, opts.point, parent, opts.point, opts.x, opts.y, opts.font, opts.textsize, opts.outline, opts.edge) @@ -1940,10 +1942,10 @@ end AptechkaDefaultConfig.GridSkin_CreateTextTimer = CreateTextTimer Aptechka.Widget.Text = {} -Aptechka.Widget.Text.default = { type = "Text", point = "TOPLEFT", x = 0, y = 0, --[[justify = "LEFT",]] font = "ClearFont", textsize = 13, effect = "NONE" } +Aptechka.Widget.Text.default = { type = "Text", point = "TOPLEFT", x = 0, y = 0, --[[justify = "LEFT",]] font = config.defaultFont, textsize = 13, effect = "NONE" } function Aptechka.Widget.Text.Create(parent, popts, gopts) local opts = InheritGlobalOptions(popts, gopts) - local font = LSM:Fetch("font", opts.font) or LSM:Fetch("font", "ClearFont") + local font = LSM:Fetch("font", opts.font) or LSM:Fetch("font", config.defaultFont) local flags = opts.effect == "OUTLINE" and "OUTLINE" local text = CreateTextTimer(parent, opts.point, parent, opts.point, opts.x, opts.y, opts.justify, opts.textsize, font, flags) if opts.effect == "SHADOW" then @@ -1962,7 +1964,7 @@ function Aptechka.Widget.Text.Reconf(parent, f, popts, gopts) f.text:ClearAllPoints() f.text:SetPoint(opts.point, parent, opts.point, opts.x, opts.y) -- f.text:SetJustifyH(opts.justify:upper()) - local font = LSM:Fetch("font", opts.font) or LSM:Fetch("font", "ClearFont") + local font = LSM:Fetch("font", opts.font) or LSM:Fetch("font", config.defaultFont) local flags = opts.effect == "OUTLINE" and "OUTLINE" if opts.effect == "SHADOW" then f.text:SetShadowOffset(1,-1) diff --git a/migrations.lua b/migrations.lua index 752b231..5b9e7b0 100644 --- a/migrations.lua +++ b/migrations.lua @@ -1,7 +1,7 @@ local addonName, helpers = ... do - local CURRENT_DB_VERSION = 9 + local CURRENT_DB_VERSION = 10 function Aptechka:DoMigrations(db) if not next(db) or db.DB_VERSION == CURRENT_DB_VERSION then -- skip if db is empty or current db.DB_VERSION = CURRENT_DB_VERSION @@ -332,6 +332,31 @@ do db.DB_VERSION = 9 end + if db.DB_VERSION == 9 then + local function SwapFont(opts, widgetName, profileName) + if opts.font and opts.font == "ClearFont" then + opts.font = "AlegreyaSans-Medium" + end + end + local func = SwapFont + if db and db.global and db.global.widgetConfig then + for wname, opts in pairs(db.global.widgetConfig) do + func(opts, wname, "global") + end + end + if db.profiles then + for profileName, profile in pairs(db.profiles) do + if profile.widgetConfig then + for wname, opts in pairs(profile.widgetConfig) do + func(opts, wname, profileName) + end + end + end + end + + db.DB_VERSION = 10 + end + db.DB_VERSION = CURRENT_DB_VERSION end end @@ -362,6 +387,19 @@ function Aptechka:ForAllCustomWidgets(func) end end +function Aptechka:ForAllWidgets(func) + for wname, opts in pairs(self.db.global.widgetConfig) do + func(opts, wname, "global") + end + for profileName, profile in pairs(self.db.profiles) do + if profile.widgetConfig then + for wname, opts in pairs(profile.widgetConfig) do + func(opts, wname, profileName) + end + end + end +end + function Aptechka:ForAllCustomStatuses(func, searchAllClasses) local list = Aptechka.GetWidgetList()