This commit is contained in:
Andrew6810
2023-03-30 12:32:45 -07:00
parent f3e579cb57
commit d6aaac97af
53 changed files with 2930 additions and 1307 deletions
+37 -4
View File
@@ -10,11 +10,15 @@
local TSM = select(2, ...)
local lib = TSMAPI
local LSM = LibStub("LibSharedMedia-3.0") -- load the SharedMedia library
TSMAPI.Design = {}
local Design = TSMAPI.Design
local coloredFrames = {}
local coloredTexts = {}
local LSM_Fonts = LSM:HashTable("font") -- Persistent hashtable of all registered LSM fonts.
--[[-----------------------------------------------------------------------------
Support functions
@@ -88,15 +92,44 @@ function Design:SetTitleTextColor(obj)
return SetTextColor(obj, "title")
end
--- Primary content font.
function Design:GetContentFont(size)
-- Retrieve the user's desired font size, if the "size" specifier is valid.
size = size or "normal"
TSM.db.profile.design.fontSizes[size] = TSM.db.profile.design.fontSizes[size] or TSM.designDefaults.fontSizes[size]
assert(TSM.db.profile.design.fontSizes[size], format("Invalid font size '%s", tostring(size)))
return TSM.db.profile.design.fonts.content, TSM.db.profile.design.fontSizes[size]
local size_number = TSM.db.profile.design.fontSizes[size]
if not size_number then
if TSM.designDefaults.fontSizes[size] then
-- Save the default size to user's settings, for faster lookups.
TSM.db.profile.design.fontSizes[size] = TSM.designDefaults.fontSizes[size]
size_number = TSM.db.profile.design.fontSizes[size]
end
assert(size_number, format("Invalid font size '%s", tostring(size)))
end
-- Verify existence of user's chosen font, and do a "soft revert" to our defaults
-- if missing, which can happen if previous SharedMedia fonts have been uninstalled.
-- NOTE: We don't overwrite the database value, in case the user re-enables that font.
local content_font = LSM_Fonts[TSM.db.profile.design.fonts.content]
if not content_font then
content_font = LSM_Fonts["Arial Narrow"]
end
-- Return the path to the font, and the desired (user-configurable) size.
return content_font, size_number
end
--- Header/section title font.
function Design:GetBoldFont()
return TSM.db.profile.design.fonts.bold
-- Verify existence of user's chosen font, and do a "soft revert" to our defaults
-- if missing, which can happen if previous SharedMedia fonts have been uninstalled.
-- NOTE: We don't overwrite the database value, in case the user re-enables that font.
local bold_font = LSM_Fonts[TSM.db.profile.design.fonts.bold]
if not bold_font then
bold_font = LSM_Fonts["TSM Droid Sans Bold"]
end
-- Return the path to the font.
return bold_font
end
function Design:GetInlineColor(key)
+3 -3
View File
@@ -29,10 +29,10 @@ function TSMAPI:OpenFrame()
if TSM.db.global.infoMessage < 1001 then
TSM.db.global.infoMessage = 1001
StaticPopupDialogs["TSM_INFO_MESSAGE"] = StaticPopupDialogs["TSM_INFO_MESSAGE"] or {
text = format(L["More advanced options are now designated by %sred text|r. Beginners are encourages to come back to these once they have a solid understanding of the basics."], TSMAPI.Design:GetInlineColor("advanced")),
text = format(L["More advanced options are now designated by %sred text|r. Beginners are encouraged to come back to these once they have a solid understanding of the basics."], TSMAPI.Design:GetInlineColor("advanced")),
button1 = OKAY,
OnAccept = function()
TSM:Printf(L["More advanced options are now designated by %sred text|r. Beginners are encourages to come back to these once they have a solid understanding of the basics."], TSMAPI.Design:GetInlineColor("advanced"))
TSM:Printf(L["More advanced options are now designated by %sred text|r. Beginners are encouraged to come back to these once they have a solid understanding of the basics."], TSMAPI.Design:GetInlineColor("advanced"))
end,
timeout = 0,
preferredIndex = 3,
@@ -137,4 +137,4 @@ function TSM:GetTSMFrameSelectionPath()
tinsert(path, {type="Icon", value=TSM.Frame.selected.info.name})
private:FramePathHelper(TSM.Frame, path)
return path
end
end