Skip to content

Commit

Permalink
Version 2.7
Browse files Browse the repository at this point in the history
 - Fixed an issue with actions being blocked after closing the Settings panel in certain situation (like changing Keybindings) in Dragonflight
 - The current version will now run in the WotLK Classic 3.4.2 PTR but it's not yet fully polished (as parts of the UI are still being modernized).
 - Other minor improvements
  • Loading branch information
Arxareon committed May 17, 2023
1 parent 464d4a1 commit 75010b5
Show file tree
Hide file tree
Showing 17 changed files with 350 additions and 314 deletions.
4 changes: 2 additions & 2 deletions MovementSpeed/MovementSpeed-BCC.toc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Interface: 20504
## Title: Movement Speed |TInterface/AddOns/MovementSpeed/Textures/Logo.tga:0|t
## Version: 2.6
## X-Day: 4
## Version: 2.7
## X-Day: 17
## X-Month: 5
## X-Year: 2023
## Author: Barnabas Nagy (Arxareon)
Expand Down
4 changes: 2 additions & 2 deletions MovementSpeed/MovementSpeed-Classic.toc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Interface: 11403
## Title: Movement Speed |TInterface/AddOns/MovementSpeed/Textures/Logo.tga:0|t
## Version: 2.6
## X-Day: 4
## Version: 2.7
## X-Day: 17
## X-Month: 5
## X-Year: 2023
## Author: Barnabas Nagy (Arxareon)
Expand Down
4 changes: 2 additions & 2 deletions MovementSpeed/MovementSpeed-Mainline.toc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Interface: 100100
## Title: Movement Speed
## IconTexture: Interface/AddOns/MovementSpeed/Textures/Logo.tga
## Version: 2.6
## X-Day: 4
## Version: 2.7
## X-Day: 17
## X-Month: 5
## X-Year: 2023
## Author: Barnabas Nagy (Arxareon)
Expand Down
4 changes: 2 additions & 2 deletions MovementSpeed/MovementSpeed-Wrath.toc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
## Interface: 30401
## Title: Movement Speed |TInterface/AddOns/MovementSpeed/Textures/Logo.tga:0|t
## Version: 2.6
## X-Day: 4
## Version: 2.7
## X-Day: 17
## X-Month: 5
## X-Year: 2023
## Author: Barnabas Nagy (Arxareon)
Expand Down
57 changes: 24 additions & 33 deletions MovementSpeed/MovementSpeed.lua
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ end
local function CreateMainOptions() frames.options.main.page = wt.CreateOptionsCategory({
addon = addonNameSpace,
name = "Main",
description = ns.strings.options.main.description:gsub("#ADDON", addonTitle):gsub("#KEYWORD", "/" .. ns.chat.keyword),
description = ns.strings.options.main.description:gsub("#ADDON", addonTitle),
logo = ns.textures.logo,
titleLogo = true,
initialize = function(canvas)
Expand Down Expand Up @@ -1336,6 +1336,7 @@ local function CreateSpeedValueOptions(panel)
UpdateDisplaySizes = function()
--Player Speed
SetDisplaySize("playerSpeed")

--Travel Speed
SetDisplaySize("travelSpeed")
end,
Expand Down Expand Up @@ -1411,6 +1412,7 @@ local function CreateFontOptions(panel)
UpdateDisplayFonts = function()
--Player Speed
frames.playerSpeed.text:SetFont(db.speedDisplay.font.family, db.speedDisplay.font.size, "THINOUTLINE")

--Travel Speed
frames.travelSpeed.text:SetFont(db.speedDisplay.font.family, db.speedDisplay.font.size, "THINOUTLINE")
end,
Expand All @@ -1420,6 +1422,7 @@ local function CreateFontOptions(panel)
local text = frames.playerSpeed.text:GetText()
frames.playerSpeed.text:SetText("")
frames.playerSpeed.text:SetText(text)

--Travel Speed
text = frames.travelSpeed.text:GetText()
frames.travelSpeed.text:SetText("")
Expand All @@ -1430,6 +1433,7 @@ local function CreateFontOptions(panel)
local label = _G[frames.options.speedDisplays.font.family.toggle:GetName() .. "Text"]
local _, size, flags = label:GetFont()
label:SetFont(ns.fonts[frames.options.speedDisplays.font.family.getSelected()].path, size, flags)

--Refresh the text so the font will be applied right away (if the font is loaded)
local text = label:GetText()
label:SetText("")
Expand Down Expand Up @@ -1483,6 +1487,7 @@ local function CreateFontOptions(panel)
--Player Speed
frames.playerSpeed.text:SetJustifyH(db.speedDisplay.font.alignment)
wt.SetPosition(frames.playerSpeed.text, { anchor = db.speedDisplay.font.alignment, })

--Travel Speed
frames.travelSpeed.text:SetJustifyH(db.speedDisplay.font.alignment)
wt.SetPosition(frames.travelSpeed.text, { anchor = db.speedDisplay.font.alignment, })
Expand All @@ -1505,6 +1510,7 @@ local function CreateFontOptions(panel)
onChange = { UpdateDisplayFontColors = function()
--Player Speed
frames.playerSpeed.text:SetTextColor(wt.UnpackColor(db.speedDisplay.font.valueColoring and ns.colors.grey[2] or db.speedDisplay.font.color))

--Travel Speed
frames.travelSpeed.text:SetTextColor(wt.UnpackColor(db.speedDisplay.font.valueColoring and ns.colors.grey[2] or db.speedDisplay.font.color))
end, }
Expand All @@ -1518,7 +1524,6 @@ local function CreateFontOptions(panel)
title = ns.strings.options.speedDisplay.font.color.label,
tooltip = { lines = { { text = ns.strings.options.speedDisplay.font.color.tooltip, }, } },
arrange = { newRow = false, },
setColors = function() return frames.playerSpeed.text:GetTextColor() end,
dependencies = {
{ frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end },
{ frame = frames.options.speedDisplays.font.valueColoring, evaluate = function(state) return not state end },
Expand Down Expand Up @@ -1547,6 +1552,7 @@ local function CreateBackgroundOptions(panel)
onChange = { ToggleDisplayBackdrops = function()
--Player Speed
SetDisplayBackdrop("playerSpeed", db.speedDisplay.background.visible, db.speedDisplay.background.colors.bg, db.speedDisplay.background.colors.border)

--Travel Speed
SetDisplayBackdrop("travelSpeed", db.speedDisplay.background.visible, db.speedDisplay.background.colors.bg, db.speedDisplay.background.colors.border)
end, }
Expand All @@ -1556,13 +1562,9 @@ local function CreateBackgroundOptions(panel)
--Color Picker: Background color
frames.options.speedDisplays.background.colors.bg = wt.CreateColorPicker({
parent = panel,
name = "BackgroundColor",
name = "Color",
title = ns.strings.options.speedDisplay.background.colors.bg.label,
arrange = { newRow = false, },
setColors = function()
if frames.options.speedDisplays.background.visible.getState() then return frames.playerSpeed.display:GetBackdropColor() end
return wt.UnpackColor(db.speedDisplay.background.colors.bg)
end,
dependencies = {
{ frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end },
{ frame = frames.options.speedDisplays.background.visible, },
Expand All @@ -1571,9 +1573,10 @@ local function CreateBackgroundOptions(panel)
optionsKey = addonNameSpace .. "SpeedDisplays",
workingTable = db.speedDisplay.background.colors,
storageKey = "bg",
onChange = { UpdateDisplayBackdropBackgroundColors = function()
onChange = { UpdateDisplayBackgroundColors = function()
--Player Speed
if frames.playerSpeed.display:GetBackdrop() ~= nil then frames.playerSpeed.display:SetBackdropColor(wt.UnpackColor(db.speedDisplay.background.colors.bg)) end

--Travel Speed
if frames.travelSpeed.display:GetBackdrop() ~= nil then frames.travelSpeed.display:SetBackdropColor(wt.UnpackColor(db.speedDisplay.background.colors.bg)) end
end }
Expand All @@ -1586,10 +1589,6 @@ local function CreateBackgroundOptions(panel)
name = "BorderColor",
title = ns.strings.options.speedDisplay.background.colors.border.label,
arrange = { newRow = false, },
setColors = function()
if frames.options.speedDisplays.background.visible.getState() then return frames.playerSpeed.display:GetBackdropBorderColor() end
return wt.UnpackColor(db.speedDisplay.background.colors.border)
end,
dependencies = {
{ frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end },
{ frame = frames.options.speedDisplays.background.visible, },
Expand All @@ -1598,11 +1597,12 @@ local function CreateBackgroundOptions(panel)
optionsKey = addonNameSpace .. "SpeedDisplays",
workingTable = db.speedDisplay.background.colors,
storageKey = "border",
onChange = { UpdateDisplayBackdropBorderColors = function()
onChange = { UpdateDisplayBorderColors = function()
--Player Speed
if frames.playerSpeed.display:GetBackdrop() ~= nil then
frames.playerSpeed.display:SetBackdropBorderColor(wt.UnpackColor(db.speedDisplay.background.colors.border))
end

--Travel Speed
if frames.travelSpeed.display:GetBackdrop() ~= nil then
frames.travelSpeed.display:SetBackdropBorderColor(wt.UnpackColor(db.speedDisplay.background.colors.border))
Expand Down Expand Up @@ -1644,9 +1644,7 @@ local function CreateSpeedDisplayOptions() frames.options.speedDisplays.page = w
defaultsTable = dbDefault.speedDisplay,
},
},
onSave = function()
MovementSpeedDB = wt.Clone(db)
end,
onSave = function() MovementSpeedDB = wt.Clone(db) end,
onDefault = function(user)
ResetCustomPreset()
if not user then return end
Expand Down Expand Up @@ -1820,13 +1818,11 @@ local function CreateTargetSpeedOptions() frames.options.targetSpeed.page = wt.C
description = ns.strings.options.targetSpeed.description:gsub("#ADDON", addonTitle),
logo = ns.textures.logo,
optionsKeys = { addonNameSpace .. "TargetSpeed" },
storage = {
{
workingTable = db.targetSpeed,
storageTable = MovementSpeedDB.targetSpeed,
defaultsTable = dbDefault.targetSpeed,
},
},
storage = { {
workingTable = db.targetSpeed,
storageTable = MovementSpeedDB.targetSpeed,
defaultsTable = dbDefault.targetSpeed,
}, },
onDefault = function(user)
if not user then return end

Expand Down Expand Up @@ -2261,7 +2257,7 @@ local function CreateContextMenu(parent)
wt.AddContextButton(contextMenu, contextMenu, {
-- title = ns.strings.options.main.name,
title = ns.strings.misc.options,
tooltip = { lines = { { text = ns.strings.options.main.description:gsub("#ADDON", addonTitle):gsub("#KEYWORD", "/" .. ns.chat.keyword), }, } },
tooltip = { lines = { { text = ns.strings.options.main.description:gsub("#ADDON", addonTitle), }, } },
events = { OnClick = function() frames.options.main.page.open() end, },
})
-- wt.AddContextButton(optionsMenu, contextMenu, {
Expand All @@ -2285,15 +2281,10 @@ local function CreateContextMenu(parent)
title = ns.strings.options.speedDisplay.position.presets.label,
tooltip = { lines = { { text = ns.strings.options.speedDisplay.position.presets.tooltip, }, } },
})

wt.AddContextButton(presetsMenu, contextMenu, {
title = presets[1].name,
events = { OnClick = function() commandManager.handleCommand(ns.chat.commands.preset, 1) end, },
})
wt.AddContextButton(presetsMenu, contextMenu, {
title = presets[2].name,
events = { OnClick = function() commandManager.handleCommand(ns.chat.commands.preset, 2) end, },
})
for i = 1, #presets do wt.AddContextButton(presetsMenu, contextMenu, {
title = presets[i].name,
events = { OnClick = function() commandManager.handleCommand(ns.chat.commands.preset, i) end, },
}) end
end

--Frames & events
Expand Down
4 changes: 2 additions & 2 deletions MovementSpeed/MovementSpeed.toc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
## Interface: 100100 #Fallback to the Mainline version
## Title: Movement Speed
## IconTexture: Interface/AddOns/MovementSpeed/Textures/Logo.tga
## Version: 2.6
## X-Day: 4
## Version: 2.7
## X-Day: 17
## X-Month: 5
## X-Year: 2023
## Author: Barnabas Nagy (Arxareon)
Expand Down
53 changes: 17 additions & 36 deletions MovementSpeed/MovementSpeedClassic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -798,7 +798,7 @@ end
local function CreateMainOptions() frames.options.main.page = wt.CreateOptionsCategory({
addon = addonNameSpace,
name = "Main",
description = ns.strings.options.main.description:gsub("#ADDON", addonTitle):gsub("#KEYWORD", "/" .. ns.chat.keyword),
description = ns.strings.options.main.description:gsub("#ADDON", addonTitle),
logo = ns.textures.logo,
titleLogo = true,
initialize = function(canvas)
Expand Down Expand Up @@ -1209,6 +1209,7 @@ local function CreateFontOptions(panel)
local label = _G[frames.options.speedDisplays.font.family.toggle:GetName() .. "Text"]
local _, size, flags = label:GetFont()
label:SetFont(ns.fonts[frames.options.speedDisplays.font.family.getSelected()].path, size, flags)

--Refresh the text so the font will be applied right away (if the font is loaded)
local text = label:GetText()
label:SetText("")
Expand Down Expand Up @@ -1292,7 +1293,6 @@ local function CreateFontOptions(panel)
title = ns.strings.options.speedDisplay.font.color.label,
tooltip = { lines = { { text = ns.strings.options.speedDisplay.font.color.tooltip, }, } },
arrange = { newRow = false, },
setColors = function() return frames.playerSpeed.text:GetTextColor() end,
dependencies = {
{ frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end },
{ frame = frames.options.speedDisplays.font.valueColoring, evaluate = function(state) return not state end },
Expand Down Expand Up @@ -1328,13 +1328,9 @@ local function CreateBackgroundOptions(panel)
--Color Picker: Background color
frames.options.speedDisplays.background.colors.bg = wt.CreateColorPicker({
parent = panel,
name = "BackgroundColor",
name = "Color",
title = ns.strings.options.speedDisplay.background.colors.bg.label,
arrange = { newRow = false, },
setColors = function()
if frames.options.speedDisplays.background.visible.getState() then return frames.playerSpeed.display:GetBackdropColor() end
return wt.UnpackColor(db.speedDisplay.background.colors.bg)
end,
dependencies = {
{ frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end },
{ frame = frames.options.speedDisplays.background.visible, },
Expand All @@ -1343,7 +1339,7 @@ local function CreateBackgroundOptions(panel)
optionsKey = addonNameSpace .. "SpeedDisplays",
workingTable = db.speedDisplay.background.colors,
storageKey = "bg",
onChange = { UpdateDisplayBackdropBackgroundColors = function()
onChange = { UpdateDisplayBackgroundColors = function()
--Player Speed
if frames.playerSpeed.display:GetBackdrop() ~= nil then frames.playerSpeed.display:SetBackdropColor(wt.UnpackColor(db.speedDisplay.background.colors.bg)) end
end }
Expand All @@ -1356,10 +1352,6 @@ local function CreateBackgroundOptions(panel)
name = "BorderColor",
title = ns.strings.options.speedDisplay.background.colors.border.label,
arrange = { newRow = false, },
setColors = function()
if frames.options.speedDisplays.background.visible.getState() then return frames.playerSpeed.display:GetBackdropBorderColor() end
return wt.UnpackColor(db.speedDisplay.background.colors.border)
end,
dependencies = {
{ frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end },
{ frame = frames.options.speedDisplays.background.visible, },
Expand All @@ -1368,7 +1360,7 @@ local function CreateBackgroundOptions(panel)
optionsKey = addonNameSpace .. "SpeedDisplays",
workingTable = db.speedDisplay.background.colors,
storageKey = "border",
onChange = { UpdateDisplayBackdropBorderColors = function()
onChange = { UpdateDisplayBorderColors = function()
--Player Speed
if frames.playerSpeed.display:GetBackdrop() ~= nil then
frames.playerSpeed.display:SetBackdropBorderColor(wt.UnpackColor(db.speedDisplay.background.colors.border))
Expand Down Expand Up @@ -1405,9 +1397,7 @@ local function CreateSpeedDisplayOptions() frames.options.speedDisplays.page = w
defaultsTable = dbDefault.speedDisplay,
},
},
onSave = function()
MovementSpeedDB = wt.Clone(db)
end,
onSave = function() MovementSpeedDB = wt.Clone(db) end,
onDefault = function(user)
ResetCustomPreset()
if not user then return end
Expand Down Expand Up @@ -1570,13 +1560,11 @@ local function CreateTargetSpeedOptions() frames.options.targetSpeed.page = wt.C
description = ns.strings.options.targetSpeed.description:gsub("#ADDON", addonTitle),
logo = ns.textures.logo,
optionsKeys = { addonNameSpace .. "TargetSpeed" },
storage = {
{
workingTable = db.targetSpeed,
storageTable = MovementSpeedDB.targetSpeed,
defaultsTable = dbDefault.targetSpeed,
},
},
storage = { {
workingTable = db.targetSpeed,
storageTable = MovementSpeedDB.targetSpeed,
defaultsTable = dbDefault.targetSpeed,
}, },
onDefault = function(user)
if not user then return end

Expand Down Expand Up @@ -1999,13 +1987,11 @@ local function CreateContextMenu(parent)
wt.AddContextLabel(contextMenu, { text = addonTitle, })

--Options submenu
local optionsMenu = wt.AddContextSubmenu(contextMenu, {
title = ns.strings.misc.options,
})
local optionsMenu = wt.AddContextSubmenu(contextMenu, { title = ns.strings.misc.options, })

wt.AddContextButton(optionsMenu, contextMenu, {
title = ns.strings.options.main.name,
tooltip = { lines = { { text = ns.strings.options.main.description:gsub("#ADDON", addonTitle):gsub("#KEYWORD", "/" .. ns.chat.keyword), }, } },
tooltip = { lines = { { text = ns.strings.options.main.description:gsub("#ADDON", addonTitle), }, } },
events = { OnClick = function() frames.options.main.page.open() end, },
})
wt.AddContextButton(optionsMenu, contextMenu, {
Expand All @@ -2029,15 +2015,10 @@ local function CreateContextMenu(parent)
title = ns.strings.options.speedDisplay.position.presets.label,
tooltip = { lines = { { text = ns.strings.options.speedDisplay.position.presets.tooltip, }, } },
})

wt.AddContextButton(presetsMenu, contextMenu, {
title = presets[1].name,
events = { OnClick = function() commandManager.handleCommand(ns.chat.commands.preset, 1) end, },
})
wt.AddContextButton(presetsMenu, contextMenu, {
title = presets[2].name,
events = { OnClick = function() commandManager.handleCommand(ns.chat.commands.preset, 2) end, },
})
for i = 1, #presets do wt.AddContextButton(presetsMenu, contextMenu, {
title = presets[i].name,
events = { OnClick = function() commandManager.handleCommand(ns.chat.commands.preset, i) end, },
}) end
end

--Frames & events
Expand Down
Loading

0 comments on commit 75010b5

Please sign in to comment.