mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-19 02:50:50 +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_playerDB = {}
|
||||||
pfUI_config = {}
|
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()
|
function pfUI:LoadConfig()
|
||||||
-- MODULE SUBGROUP ENTRY VALUE
|
-- MODULE SUBGROUP ENTRY VALUE
|
||||||
pfUI:UpdateConfig("global", nil, "profile", "default")
|
pfUI:UpdateConfig("global", nil, "profile", "default")
|
||||||
pfUI:UpdateConfig("global", nil, "pixelperfect", "0")
|
pfUI:UpdateConfig("global", nil, "pixelperfect", "0")
|
||||||
pfUI:UpdateConfig("global", nil, "offscreen", "0")
|
pfUI:UpdateConfig("global", nil, "offscreen", "0")
|
||||||
pfUI:UpdateConfig("global", nil, "font_size", "12")
|
pfUI:UpdateConfig("global", nil, "font_size", "12")
|
||||||
pfUI:UpdateConfig("global", nil, "font_default", "arial")
|
pfUI:UpdateConfig("global", nil, "font_default", "Myriad-Pro")
|
||||||
pfUI:UpdateConfig("global", nil, "font_square", "homespun")
|
pfUI:UpdateConfig("global", nil, "font_square", "Homespun")
|
||||||
pfUI:UpdateConfig("global", nil, "font_combat", "diediedie")
|
pfUI:UpdateConfig("global", nil, "font_combat", "Continuum")
|
||||||
pfUI:UpdateConfig("global", nil, "force_region", "1")
|
pfUI:UpdateConfig("global", nil, "force_region", "1")
|
||||||
pfUI:UpdateConfig("global", nil, "errors_limit", "1")
|
pfUI:UpdateConfig("global", nil, "errors_limit", "1")
|
||||||
pfUI:UpdateConfig("global", nil, "errors_hide", "0")
|
pfUI:UpdateConfig("global", nil, "errors_hide", "0")
|
||||||
@@ -182,24 +204,42 @@ function pfUI:LoadConfig()
|
|||||||
pfUI:UpdateConfig("disabled", nil, nil, nil)
|
pfUI:UpdateConfig("disabled", nil, nil, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
function pfUI:UpdateConfig(group, subgroup, entry, value)
|
function pfUI:MigrateConfig()
|
||||||
-- check for missing config groups
|
-- config version
|
||||||
if not pfUI_config[group] then
|
local major, minor, fix = pfUI.api.strsplit(".", tostring(pfUI_config.version))
|
||||||
pfUI_config[group] = {}
|
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
|
end
|
||||||
|
|
||||||
-- update config
|
pfUI_config.version = pfUI.version.string
|
||||||
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
|
end
|
||||||
|
|||||||
+1
-1
@@ -728,7 +728,7 @@ pfUI:RegisterModule("gui", function ()
|
|||||||
|
|
||||||
-- global
|
-- global
|
||||||
pfUI.gui.global = pfUI.gui:CreateConfigTab("Global Settings")
|
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, "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, "Allow frames being placed offscreen", pfUI_config.global, "offscreen", "checkbox")
|
||||||
pfUI.gui:CreateConfig(pfUI.gui.global, "Fontsize", pfUI_config.global, "font_size")
|
pfUI.gui:CreateConfig(pfUI.gui.global, "Fontsize", pfUI_config.global, "font_size")
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ pfUI.module = {}
|
|||||||
pfUI.modules = {}
|
pfUI.modules = {}
|
||||||
pfUI.environment = {}
|
pfUI.environment = {}
|
||||||
pfUI.movables = {}
|
pfUI.movables = {}
|
||||||
|
pfUI.version = {}
|
||||||
|
|
||||||
pfLocaleClass = {}
|
pfLocaleClass = {}
|
||||||
pfLocaleBagtypes = {}
|
pfLocaleBagtypes = {}
|
||||||
@@ -51,7 +52,15 @@ pfUI:SetScript("OnEvent", function()
|
|||||||
pfUI_profiles = {}
|
pfUI_profiles = {}
|
||||||
end
|
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:LoadConfig()
|
||||||
|
pfUI:MigrateConfig()
|
||||||
|
|
||||||
-- reload environment
|
-- reload environment
|
||||||
pfUI.environment:UpdateFonts()
|
pfUI.environment:UpdateFonts()
|
||||||
|
|||||||
Reference in New Issue
Block a user