mirror of
https://github.com/brues-code/pfUI.git
synced 2026-09-28 02:16:02 +00:00
api: add new fonts and config migration
This commit is contained in:
Binary file not shown.
Executable → Regular
Binary file not shown.
Binary file not shown.
Binary file not shown.
+62
-22
@@ -1,15 +1,37 @@
|
||||
pfUI_playerDB = {}
|
||||
pfUI_config = {}
|
||||
|
||||
function pfUI:UpdateConfig(group, subgroup, entry, value)
|
||||
-- check for missing config groups
|
||||
if not pfUI_config[group] then
|
||||
pfUI_config[group] = {}
|
||||
end
|
||||
|
||||
-- update config
|
||||
if not subgroup and entry and value and not pfUI_config[group][entry] then
|
||||
pfUI_config[group][entry] = value
|
||||
end
|
||||
|
||||
-- check for missing config subgroups
|
||||
if subgroup and not pfUI_config[group][subgroup] then
|
||||
pfUI_config[group][subgroup] = {}
|
||||
end
|
||||
|
||||
-- update config in subgroup
|
||||
if subgroup and entry and value and not pfUI_config[group][subgroup][entry] then
|
||||
pfUI_config[group][subgroup][entry] = value
|
||||
end
|
||||
end
|
||||
|
||||
function pfUI:LoadConfig()
|
||||
-- MODULE SUBGROUP ENTRY VALUE
|
||||
-- MODULE SUBGROUP ENTRY VALUE
|
||||
pfUI:UpdateConfig("global", nil, "profile", "default")
|
||||
pfUI:UpdateConfig("global", nil, "pixelperfect", "0")
|
||||
pfUI:UpdateConfig("global", nil, "offscreen", "0")
|
||||
pfUI:UpdateConfig("global", nil, "font_size", "12")
|
||||
pfUI:UpdateConfig("global", nil, "font_default", "arial")
|
||||
pfUI:UpdateConfig("global", nil, "font_square", "homespun")
|
||||
pfUI:UpdateConfig("global", nil, "font_combat", "diediedie")
|
||||
pfUI:UpdateConfig("global", nil, "font_default", "Myriad-Pro")
|
||||
pfUI:UpdateConfig("global", nil, "font_square", "Homespun")
|
||||
pfUI:UpdateConfig("global", nil, "font_combat", "Continuum")
|
||||
pfUI:UpdateConfig("global", nil, "force_region", "1")
|
||||
pfUI:UpdateConfig("global", nil, "errors_limit", "1")
|
||||
pfUI:UpdateConfig("global", nil, "errors_hide", "0")
|
||||
@@ -182,24 +204,42 @@ function pfUI:LoadConfig()
|
||||
pfUI:UpdateConfig("disabled", nil, nil, nil)
|
||||
end
|
||||
|
||||
function pfUI:UpdateConfig(group, subgroup, entry, value)
|
||||
-- check for missing config groups
|
||||
if not pfUI_config[group] then
|
||||
pfUI_config[group] = {}
|
||||
function pfUI:MigrateConfig()
|
||||
-- config version
|
||||
local major, minor, fix = pfUI.api.strsplit(".", tostring(pfUI_config.version))
|
||||
local major = tonumber(major) or 0
|
||||
local minor = tonumber(minor) or 0
|
||||
local fix = tonumber(fix) or 0
|
||||
|
||||
-- migrating to new fonts (1.5 -> 1.6)
|
||||
if major <= 1 and minor <= 5 then
|
||||
-- replace "arial" with "myriad-pro"
|
||||
if pfUI_config.global.font_default == "arial" then
|
||||
pfUI_config.global.font_default = "Myriad-Pro"
|
||||
elseif pfUI_config.global.font_square == "arial" then
|
||||
pfUI_config.global.font_square = "Myriad-Pro"
|
||||
elseif pfUI_config.global.font_combat == "arial" then
|
||||
pfUI_config.global.font_combat = "Myriad-Pro"
|
||||
end
|
||||
|
||||
-- replace "homespun" with "Homespun"
|
||||
if pfUI_config.global.font_default == "homespun" then
|
||||
pfUI_config.global.font_default = "Homespun"
|
||||
elseif pfUI_config.global.font_square == "homespun" then
|
||||
pfUI_config.global.font_square = "Homespun"
|
||||
elseif pfUI_config.global.font_combat == "homespun" then
|
||||
pfUI_config.global.font_combat = "Homespun"
|
||||
end
|
||||
|
||||
-- replace "diediedie" with "DieDieDie"
|
||||
if pfUI_config.global.font_default == "diediedie" then
|
||||
pfUI_config.global.font_default = "DieDieDie"
|
||||
elseif pfUI_config.global.font_square == "diediedie" then
|
||||
pfUI_config.global.font_square = "DieDieDie"
|
||||
elseif pfUI_config.global.font_combat == "diediedie" then
|
||||
pfUI_config.global.font_combat = "DieDieDie"
|
||||
end
|
||||
end
|
||||
|
||||
-- update config
|
||||
if not subgroup and entry and value and not pfUI_config[group][entry] then
|
||||
pfUI_config[group][entry] = value
|
||||
end
|
||||
|
||||
-- check for missing config subgroups
|
||||
if subgroup and not pfUI_config[group][subgroup] then
|
||||
pfUI_config[group][subgroup] = {}
|
||||
end
|
||||
|
||||
-- update config in subgroup
|
||||
if subgroup and entry and value and not pfUI_config[group][subgroup][entry] then
|
||||
pfUI_config[group][subgroup][entry] = value
|
||||
end
|
||||
pfUI_config.version = pfUI.version.string
|
||||
end
|
||||
|
||||
+1
-1
@@ -728,7 +728,7 @@ pfUI:RegisterModule("gui", function ()
|
||||
|
||||
-- global
|
||||
pfUI.gui.global = pfUI.gui:CreateConfigTab("Global Settings")
|
||||
local values = { "arial", "homespun", "diediedie" }
|
||||
local values = { "Continuum", "DieDieDie", "Expressway", "Homespun", "Myriad-Pro", "PT-Sans-Narrow-Bold", "PT-Sans-Narrow-Regular" }
|
||||
pfUI.gui:CreateConfig(pfUI.gui.global, "Use Pixelperfect (native resolution) scaling", pfUI_config.global, "pixelperfect", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.global, "Allow frames being placed offscreen", pfUI_config.global, "offscreen", "checkbox")
|
||||
pfUI.gui:CreateConfig(pfUI.gui.global, "Fontsize", pfUI_config.global, "font_size")
|
||||
|
||||
@@ -26,6 +26,7 @@ pfUI.module = {}
|
||||
pfUI.modules = {}
|
||||
pfUI.environment = {}
|
||||
pfUI.movables = {}
|
||||
pfUI.version = {}
|
||||
|
||||
pfLocaleClass = {}
|
||||
pfLocaleBagtypes = {}
|
||||
@@ -51,7 +52,15 @@ pfUI:SetScript("OnEvent", function()
|
||||
pfUI_profiles = {}
|
||||
end
|
||||
|
||||
-- read pfUI version from .toc file
|
||||
local major, minor, fix = pfUI.api.strsplit(".", tostring(GetAddOnMetadata("pfUI", "Version")))
|
||||
pfUI.version.major = tonumber(major) or 1
|
||||
pfUI.version.minor = tonumber(minor) or 2
|
||||
pfUI.version.fix = tonumber(fix) or 0
|
||||
pfUI.version.string = pfUI.version.major .. "." .. pfUI.version.minor .. "." .. pfUI.version.fix
|
||||
|
||||
pfUI:LoadConfig()
|
||||
pfUI:MigrateConfig()
|
||||
|
||||
-- reload environment
|
||||
pfUI.environment:UpdateFonts()
|
||||
|
||||
Reference in New Issue
Block a user