Skip to content

Commit

Permalink
Add support for toggling text monochrome mode and the text outline fo…
Browse files Browse the repository at this point in the history
…r the Clock/Coordinates/ZoneText, closes #174
  • Loading branch information
funkydude committed Jun 1, 2023
1 parent 2d8aef9 commit 700282b
Show file tree
Hide file tree
Showing 18 changed files with 406 additions and 8 deletions.
49 changes: 47 additions & 2 deletions Clock.lua
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,32 @@ local options = {
mod:UpdateLayout()
end
},
monochrome = {
type = "toggle",
name = L.monochrome,
desc = L.monochromeDesc,
order = 9.1,
get = function() return mod.db.monochrome end,
set = function(_, v)
mod.db.monochrome = v
mod:UpdateLayout()
end
},
outline = {
type = "select",
name = L.outline,
order = 9.2,
values = {
NONE = L.none,
OUTLINE = L.thin,
THICKOUTLINE = L.thick,
},
get = function() return mod.db.outline end,
set = function(_, v)
mod.db.outline = v
mod:UpdateLayout()
end
},
fade = {
type = "multiselect",
name = function()
Expand Down Expand Up @@ -162,8 +188,19 @@ function mod:OnInitialize(profile)
borderColor = {r = 0, g = 0, b = 0, a = 1},
fontColor = {},
font = media:GetDefault("font"),
monochrome = false,
outline = "NONE",
}
end

-- XXX temp 10.1.0
if not profile.clock.monochrome then
profile.clock.monochrome = false
end
if not profile.clock.outline then
profile.clock.outline = "NONE"
end

self.db = profile.clock
end

Expand Down Expand Up @@ -206,8 +243,16 @@ function mod:UpdateLayout()
sm.core.button.SetPoint(TimeManagerClockButton, "TOP", Minimap, "BOTTOM", mod.db.xOffset, mod.db.yOffset)
TimeManagerClockButton:SetBackdropColor(mod.db.bgColor.r, mod.db.bgColor.g, mod.db.bgColor.b, mod.db.bgColor.a)
TimeManagerClockButton:SetBackdropBorderColor(mod.db.borderColor.r, mod.db.borderColor.g, mod.db.borderColor.b, mod.db.borderColor.a)
local a, b, c = GameFontHighlightSmall:GetFont()
sm.core.font.SetFont(TimeManagerClockTicker, mod.db.font and media:Fetch("font", mod.db.font) or a, mod.db.fontsize or b, c)
local a, b = GameFontHighlightSmall:GetFont()
local flags = nil
if mod.db.monochrome and mod.db.outline ~= "NONE" then
flags = "MONOCHROME," .. mod.db.outline
elseif mod.db.monochrome then
flags = "MONOCHROME"
elseif mod.db.outline ~= "NONE" then
flags = mod.db.outline
end
sm.core.font.SetFont(TimeManagerClockTicker, mod.db.font and media:Fetch("font", mod.db.font) or a, mod.db.fontsize or b, flags)
if mod.db.fontColor.r then
sm.core.font.SetTextColor(TimeManagerClockTicker, mod.db.fontColor.r, mod.db.fontColor.g, mod.db.fontColor.b, mod.db.fontColor.a)
end
Expand Down
51 changes: 48 additions & 3 deletions Coordinates.lua
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,32 @@ local options = {
mod:Update()
end
},
monochrome = {
type = "toggle",
name = L.monochrome,
desc = L.monochromeDesc,
order = 10.1,
get = function() return mod.db.monochrome end,
set = function(_, v)
mod.db.monochrome = v
mod:Update()
end
},
outline = {
type = "select",
name = L.outline,
order = 10.2,
values = {
NONE = L.none,
OUTLINE = L.thin,
THICKOUTLINE = L.thick,
},
get = function() return mod.db.outline end,
set = function(_, v)
mod.db.outline = v
mod:Update()
end
},
updateRate = {
type = "range",
name = L.updateRate,
Expand Down Expand Up @@ -208,14 +234,25 @@ function mod:OnInitialize(profile)
xOffset = 0,
yOffset = 10,
font = media:GetDefault("font"),
monochrome = false,
outline = "NONE",
}
end
self.db = profile.coordinates

-- XXX temp 9.0.1
if not profile.coordinates.coordPrecision then
profile.coordinates.enabled = true
profile.coordinates.coordPrecision = "%d,%d"
end
-- XXX temp 10.1.0
if not profile.coordinates.monochrome then
profile.coordinates.monochrome = false
end
if not profile.coordinates.outline then
profile.coordinates.outline = "NONE"
end

self.db = profile.coordinates
end

function mod:OnEnable()
Expand Down Expand Up @@ -287,8 +324,16 @@ function mod:Update()
coordsText:SetTextColor(c.r or 1, c.g or 1, c.b or 1, c.a or 1)
end

local _, b, c = coordsText:GetFont()
coordsText:SetFont(media:Fetch("font", mod.db.font), mod.db.fontSize or b, c)
local _, b = coordsText:GetFont()
local flags = nil
if mod.db.monochrome and mod.db.outline ~= "NONE" then
flags = "MONOCHROME," .. mod.db.outline
elseif mod.db.monochrome then
flags = "MONOCHROME"
elseif mod.db.outline ~= "NONE" then
flags = mod.db.outline
end
coordsText:SetFont(media:Fetch("font", mod.db.font), mod.db.fontSize or b, flags)

if mod.db.coordPrecision == "%.2f, %.2f" then
coordsText:SetText("99.99, 99.99")
Expand Down
1 change: 1 addition & 0 deletions SexyMap.toc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ localization\enUS.lua
localization\deDE.lua
localization\ruRU.lua
localization\esES.lua
localization\esMX.lua
localization\frFR.lua
localization\itIT.lua
localization\koKR.lua
Expand Down
1 change: 1 addition & 0 deletions SexyMap_TBC.toc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ localization\enUS.lua
localization\deDE.lua
localization\ruRU.lua
localization\esES.lua
localization\esMX.lua
localization\frFR.lua
localization\itIT.lua
localization\koKR.lua
Expand Down
1 change: 1 addition & 0 deletions SexyMap_Vanilla.toc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ localization\enUS.lua
localization\deDE.lua
localization\ruRU.lua
localization\esES.lua
localization\esMX.lua
localization\frFR.lua
localization\itIT.lua
localization\koKR.lua
Expand Down
1 change: 1 addition & 0 deletions SexyMap_Wrath.toc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ localization\enUS.lua
localization\deDE.lua
localization\ruRU.lua
localization\esES.lua
localization\esMX.lua
localization\frFR.lua
localization\itIT.lua
localization\koKR.lua
Expand Down
49 changes: 47 additions & 2 deletions ZoneText.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,32 @@ local options = {
mod:UpdateLayout()
end
},
monochrome = {
type = "toggle",
name = L.monochrome,
desc = L.monochromeDesc,
order = 9.1,
get = function() return mod.db.monochrome end,
set = function(_, v)
mod.db.monochrome = v
mod:UpdateLayout()
end
},
outline = {
type = "select",
name = L.outline,
order = 9.2,
values = {
NONE = L.none,
OUTLINE = L.thin,
THICKOUTLINE = L.thick,
},
get = function() return mod.db.outline end,
set = function(_, v)
mod.db.outline = v
mod:UpdateLayout()
end
},
fade = {
type = "multiselect",
name = function()
Expand Down Expand Up @@ -186,8 +212,19 @@ function mod:OnInitialize(profile)
fontColor = {},
font = media:GetDefault("font"),
useSecureButton = false,
monochrome = false,
outline = "NONE",
}
end

-- XXX temp 10.1.0
if not profile.zonetext.monochrome then
profile.zonetext.monochrome = false
end
if not profile.zonetext.outline then
profile.zonetext.outline = "NONE"
end

self.db = profile.zonetext
end

Expand Down Expand Up @@ -324,8 +361,16 @@ function mod:UpdateLayout()
zoneTextButton:SetPoint("BOTTOM", Minimap, "TOP", mod.db.xOffset, mod.db.yOffset)
zoneTextButton:SetBackdropColor(mod.db.bgColor.r, mod.db.bgColor.g, mod.db.bgColor.b, mod.db.bgColor.a)
zoneTextButton:SetBackdropBorderColor(mod.db.borderColor.r, mod.db.borderColor.g, mod.db.borderColor.b, mod.db.borderColor.a)
local a, b, c = GameFontNormal:GetFont()
zoneTextFont:SetFont(mod.db.font and media:Fetch("font", mod.db.font) or a, mod.db.fontsize or b, c)
local a, b = GameFontNormal:GetFont()
local flags = nil
if mod.db.monochrome and mod.db.outline ~= "NONE" then
flags = "MONOCHROME," .. mod.db.outline
elseif mod.db.monochrome then
flags = "MONOCHROME"
elseif mod.db.outline ~= "NONE" then
flags = mod.db.outline
end
zoneTextFont:SetFont(mod.db.font and media:Fetch("font", mod.db.font) or a, mod.db.fontsize or b, flags)

self:ZoneChanged()
end
Expand Down
6 changes: 6 additions & 0 deletions localization/deDE.lua
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,9 @@ L.pvpCaptureBar = "PvP Aufnahmeleisten"
--L.zoneTextCombatClick = "|cFF33FF99SexyMap|r: To toggle the World Map in combat, you must enable the feature in the Zone Text options."
--L.zoneTextSecureButtonEnable = "Allow clicking in combat"
--L.zoneTextSecureButtonEnableDesc = "Normally you can click the Zone Text to toggle your World Map, but not in combat without this feature enabled.\n\n|cffff0000WARNING!|r Don't enable this feature unless you understand what it does. Turning this on will prevent ALL of your addons from making certain changes to your minimap in combat, such as moving it or hiding it."
L.none = "Nichts"
L.thin = "Dünn"
L.thick = "Dick"
L.outline = "Kontur"
L.monochrome = "Monochrom"
L.monochromeDesc = "Schaltet den Monochrom-Filter an/aus, der die Schriftenkantenglättung entfernt."
6 changes: 6 additions & 0 deletions localization/enUS.lua
Original file line number Diff line number Diff line change
Expand Up @@ -218,3 +218,9 @@ L["Zone Text"] = "Zone Text"
L.zoneTextCombatClick = "|cFF33FF99SexyMap|r: To toggle the World Map in combat, you must enable the feature in the Zone Text options."
L.zoneTextSecureButtonEnable = "Allow clicking in combat"
L.zoneTextSecureButtonEnableDesc = "Normally you can click the Zone Text to toggle your World Map, but not in combat without this feature enabled.\n\n|cffff0000WARNING!|r Don't enable this feature unless you understand what it does. Turning this on will prevent ALL of your addons from making certain changes to your minimap in combat, such as moving it or hiding it."
L.none = "None"
L.thin = "Thin"
L.thick = "Thick"
L.outline = "Outline"
L.monochrome = "Monochrome"
L.monochromeDesc = "Toggles the monochrome flag, removing any smoothing of the font edges."
8 changes: 7 additions & 1 deletion localization/esES.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

if GetLocale() ~= "esES" and GetLocale() ~= "esMX" then return end
if GetLocale() ~= "esES" then return end
local _, sm = ...
local L = sm.L
--L.dayNightButton = "Day/Night Indicator"
Expand Down Expand Up @@ -191,3 +191,9 @@ L.pvpCaptureBar = "PvP Capturar Barr"
--L.zoneTextCombatClick = "|cFF33FF99SexyMap|r: To toggle the World Map in combat, you must enable the feature in the Zone Text options."
--L.zoneTextSecureButtonEnable = "Allow clicking in combat"
--L.zoneTextSecureButtonEnableDesc = "Normally you can click the Zone Text to toggle your World Map, but not in combat without this feature enabled.\n\n|cffff0000WARNING!|r Don't enable this feature unless you understand what it does. Turning this on will prevent ALL of your addons from making certain changes to your minimap in combat, such as moving it or hiding it."
L.none = "Ninguno"
L.thin = "Fino"
L.thick = "Grueso"
L.outline = "Contorno"
L.monochrome = "Monocromo"
L.monochromeDesc = "Activa la opción monocromo, eliminando el suavizado de los bordes de la fuente."
Loading

0 comments on commit 700282b

Please sign in to comment.