Skip to content

Commit

Permalink
Version 3.0 - Test release
Browse files Browse the repository at this point in the history
Known issues:
 - Updates notes missing
 - Profile management options not yet working correctly
 - Hide while stationery display option not working
 - Memory costly timer solution for throttled speed updates not yet replaced with a different solution that saves more on memory
 - Travel Speed Display text freaking out when changed until a UI reload
  • Loading branch information
Arxareon committed Jul 20, 2024
1 parent 31df720 commit 5967eff
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 47 deletions.
6 changes: 3 additions & 3 deletions MovementSpeed/Main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -996,17 +996,17 @@ local function CreateSpeedDisplayOptionsPage(display)

--Notification
print(addonChat .. wt.Color(ns.strings.chat.preset.response:gsub(
"#PRESET", wt.Color(ns.strings.presets[1], ns.colors.green[2])
"#PRESET", wt.Color(options[display].position.presetList[i].title, ns.colors.green[2])
), ns.colors.yellow[2]))
end,
custom = {
getData = function() return MovementSpeedDB.profiles[MovementSpeedDBC.activeProfile].data.customPreset end,
defaultsTable = ns.profileDefault.customPreset,
onSave = function() print(addonChat .. wt.Color(ns.strings.chat.save.response:gsub(
"#CUSTOM", wt.Color(ns.strings.presets[1], ns.colors.green[2])
"#CUSTOM", wt.Color(ns.strings.misc.custom, ns.colors.green[2])
), ns.colors.yellow[2])) end,
onReset = function() print(addonChat .. wt.Color(ns.strings.chat.reset.response:gsub(
"#CUSTOM", wt.Color(ns.strings.presets[1], ns.colors.green[2])
"#CUSTOM", wt.Color(ns.strings.misc.custom, ns.colors.green[2])
), ns.colors.yellow[2])) end
}
},
Expand Down
46 changes: 28 additions & 18 deletions MovementSpeed/Main_Classic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,9 @@ local function CreateUpdateOptions(panel, optionsKey)
title = ns.strings.options.speedDisplay.update.frequency.label,
tooltip = { lines = { { text = ns.strings.options.speedDisplay.update.frequency.tooltip, }, } },
arrange = { newRow = false, },
value = { min = 0.05, max = 1, increment = 0.05 },
min = 0.05,
max = 1,
increment = 0.05,
altStep = 0.2,
events = { OnValueChanged = function(_, value) end, },
dependencies = {
Expand Down Expand Up @@ -515,7 +517,9 @@ local function CreateSpeedValueOptions(panel, optionsKey)
title = ns.strings.options.speedValue.fractionals.label,
tooltip = { lines = { { text = ns.strings.options.speedValue.fractionals.tooltip, }, } },
arrange = { newRow = false, },
value = { min = 0, max = 4, increment = 1 },
min = 0,
max = 4,
increment = 1,
dependencies = { { frame = options.playerSpeed.visibility.hidden, evaluate = function(state) return not state end }, },
optionsKey = optionsKey,
getData = function() return MovementSpeedDB.profiles[MovementSpeedDBC.activeProfile].data.playerSpeed.value.fractionals end,
Expand Down Expand Up @@ -590,18 +594,20 @@ local function CreateFontOptions(panel, optionsKey)
default = GetFontID(ns.profileDefault.playerSpeed.font.family)
})
--Update the font of the dropdown items
if options.playerSpeed.font.family.frame then for i = 1, #options.playerSpeed.font.family.widgets do if options.playerSpeed.font.family.widgets[i].label then
local _, size, flags = options.playerSpeed.font.family.widgets[i].label:GetFont()
options.playerSpeed.font.family.widgets[i].label:SetFont(ns.fonts[i].path, size, flags)
if options.playerSpeed.font.family.frame then for i = 1, #options.playerSpeed.font.family.toggles do if options.playerSpeed.font.family.toggles[i].label then
local _, size, flags = options.playerSpeed.font.family.toggles[i].label:GetFont()
options.playerSpeed.font.family.toggles[i].label:SetFont(ns.fonts[i].path, size, flags)
end end end

options.playerSpeed.font.size = wt.CreateNumericSlider({
parent = panel,
name = "Size",
title = ns.strings.options.speedDisplay.font.size.label,
tooltip = { lines = { { text = ns.strings.options.speedDisplay.font.size.tooltip .. "\n\n" .. ns.strings.misc.default .. ": " .. ns.profileDefault.playerSpeed.font.size, }, } },
tooltip = { lines = { { text = ns.strings.options.speedDisplay.font.size.tooltip, }, } },
arrange = { newRow = false, },
value = { min = 8, max = 64, increment = 1 },
min = 8,
max = 64,
increment = 1,
altStep = 3,
dependencies = { { frame = options.playerSpeed.visibility.hidden, evaluate = function(state) return not state end }, },
optionsKey = optionsKey,
Expand Down Expand Up @@ -773,9 +779,9 @@ local function CreateSpeedDisplayOptionsPage()
data = {
position = {
anchor = "TOP",
relativeTo = MinimapBackdrop,
relativeTo = Minimap,
relativePoint = "BOTTOM",
offset = { y = -2 }
offset = { x = 2, y = -14 }
},
keepInBounds = true,
layer = {
Expand All @@ -800,10 +806,10 @@ local function CreateSpeedDisplayOptionsPage()
getData = function() return MovementSpeedDB.profiles[MovementSpeedDBC.activeProfile].data.customPreset end,
defaultsTable = ns.profileDefault.customPreset,
onSave = function() print(addonChat .. wt.Color(ns.strings.chat.save.response:gsub(
"#CUSTOM", wt.Color(options.playerSpeed.position.presetList[1].title, ns.colors.green[2])
"#CUSTOM", wt.Color(ns.strings.misc.custom, ns.colors.green[2])
), ns.colors.yellow[2])) end,
onReset = function() print(addonChat .. wt.Color(ns.strings.chat.reset.response:gsub(
"#CUSTOM", wt.Color(options.playerSpeed.position.presetList[1].title, ns.colors.green[2])
"#CUSTOM", wt.Color(ns.strings.misc.custom, ns.colors.green[2])
), ns.colors.yellow[2])) end
}
},
Expand Down Expand Up @@ -915,7 +921,9 @@ local function CreateTargetSpeedValueOptions(panel)
title = ns.strings.options.speedValue.fractionals.label,
tooltip = { lines = { { text = ns.strings.options.speedValue.fractionals.tooltip, }, } },
arrange = { newRow = false, },
value = { min = 0, max = 4, increment = 1 },
min = 0,
max = 4,
increment = 1,
dependencies = { { frame = options.targetSpeed.enabled, }, },
optionsKey = ns.name .. "TargetSpeed",
getData = function() return MovementSpeedDB.profiles[MovementSpeedDBC.activeProfile].data.targetSpeed.value.fractionals end,
Expand Down Expand Up @@ -1052,6 +1060,7 @@ local commandManager = wt.RegisterChatCommands(ns.name, { ns.chat.keyword }, {
if j + 1 <= #options.playerSpeed.position.presetList then
list = list .. " " .. wt.Color(j + 1, ns.colors.green[2]) .. wt.Color(" - " .. options.playerSpeed.position.presetList[j + 1].name, ns.colors.yellow[2])
end

print(list)
end
end,
Expand Down Expand Up @@ -1168,9 +1177,9 @@ local function _CreateContextMenu(parent)
-- events = { OnClick = function() options.targetSpeed.page.open() end, },
-- })
-- wt.AddContextButton(optionsMenu, contextMenu, {
-- title = ns.strings.options.advanced.title,
-- tooltip = { lines = { { text = ns.strings.options.advanced.description:gsub("#ADDON", addonTitle), }, } },
-- events = { OnClick = function() options.advanced.page.open() end, },
-- title = wt.GetStrings("dataManagement").title,
-- tooltip = { lines = { { text = wt.GetStrings("dataManagement").description:gsub("#ADDON", addonTitle), }, } },
-- events = { OnClick = function() options.dataManagement.page.open() end, },
-- })

--Presets submenu
Expand Down Expand Up @@ -1223,6 +1232,7 @@ frames.main = wt.CreateBaseFrame({
onEvent = {
ADDON_LOADED = function(self, addon)
if addon ~= ns.name then return end

self:UnregisterEvent("ADDON_LOADED")

--[ Data ]
Expand Down Expand Up @@ -1285,8 +1295,8 @@ frames.main = wt.CreateBaseFrame({
options.travelSpeed.page.load(true)
options.targetSpeed.page.load(true)
options.dataManagement.page.load(true)
else print(addonChat .. wt.Color(ns.strings.options.advanced.backup.error, ns.colors.yellow[2])) end end,
onImportAllProfiles = function(success) if not success then print(addonChat .. wt.Color(ns.strings.options.advanced.backup.error, ns.colors.yellow[2])) end end,
else print(addonChat .. wt.Color(wt.GetStrings("backup").error, ns.colors.yellow[2])) end end,
onImportAllProfiles = function(success) if not success then print(addonChat .. wt.GetStrings("backup").error, ns.colors.yellow[2]) end end,
valueChecker = CheckValidity,
onRecovery = GetRecoveryMap
})
Expand All @@ -1313,7 +1323,7 @@ frames.main = wt.CreateBaseFrame({
CreateContextMenu()
wt.SetPosition(frames.playerSpeed.display, wt.AddMissing({ relativePoint = MovementSpeedDB.profiles[MovementSpeedDBC.activeProfile].data.playerSpeed.position.anchor, }, MovementSpeedDB.profiles[MovementSpeedDBC.activeProfile].data.playerSpeed.position))
wt.ConvertToAbsolutePosition(frames.playerSpeed.display)
SetDisplayValues("playerSpeed", MovementSpeedDB.profiles[MovementSpeedDBC.activeProfile].data)
SetDisplayValues(MovementSpeedDB.profiles[MovementSpeedDBC.activeProfile].data)
end,
PLAYER_ENTERING_WORLD = function(self)
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
Expand Down
2 changes: 1 addition & 1 deletion MovementSpeed/MovementSpeed-Classic.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 11502
## Interface: 11503
## Title: Movement Speed |TInterface/AddOns/MovementSpeed/Textures/Logo.tga:0|t
## Notes: View the movement speed of anyone in customizable displays and tooltips with fast updates.
## IconTexture: Interface/AddOns/MovementSpeed/Textures/Logo.tga
Expand Down
2 changes: 1 addition & 1 deletion MovementSpeed/MovementSpeed-Mainline.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100206
## Interface: 100207
## Title: Movement Speed
## Notes: View the movement speed of anyone in customizable displays and tooltips with fast updates.
## IconTexture: Interface/AddOns/MovementSpeed/Textures/Logo.tga
Expand Down
2 changes: 1 addition & 1 deletion MovementSpeed/MovementSpeed.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100206 #Fallback to the Mainline version
## Interface: 100207 #Fallback to the Mainline version
## Title: Movement Speed
## Notes: View the movement speed of anyone in customizable displays and tooltips with fast updates.
## IconTexture: Interface/AddOns/MovementSpeed/Textures/Logo.tga
Expand Down
22 changes: 12 additions & 10 deletions MovementSpeed/WidgetToolbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1327,25 +1327,27 @@ function WidgetTools.frame:ADDON_LOADED(addon)
frame:HookScript("OnEvent", function(_, event, key, down) if event == "MODIFIER_STATE_CHANGED" and key:find(t.modifier) then
if down > 0 then SetCursor("Interface/Cursor/ui-cursor-move.crosshair") else SetCursor(nil) end
end end)
end
end
end

for i = 1, #t.triggers do
t.triggers[i]:EnableMouse(movable)
for i = 1, #t.triggers do
t.triggers[i]:EnableMouse(true)

if movable then
t.triggers[i]:HookScript("OnEnter", function()
if not t.cursor or not frame:IsMovable() then return end

if not modifier or modifier() then SetCursor("Interface/Cursor/ui-cursor-move.crosshair") else frame:RegisterEvent("MODIFIER_STATE_CHANGED") end
if not modifier then SetCursor("Interface/Cursor/ui-cursor-move.crosshair") else
if modifier() then SetCursor("Interface/Cursor/ui-cursor-move.crosshair") end

frame:RegisterEvent("MODIFIER_STATE_CHANGED")
end
end)

t.triggers[i]:HookScript("OnLeave", function()
if not t.cursor or not frame:IsMovable() then return end

if modifier and not hadEvent then frame:UnregisterEvent("MODIFIER_STATE_CHANGED") end

SetCursor(nil)

if modifier and not hadEvent then frame:UnregisterEvent("MODIFIER_STATE_CHANGED") end
end)

t.triggers[i]:HookScript("OnMouseDown", function()
Expand Down Expand Up @@ -1410,7 +1412,7 @@ function WidgetTools.frame:ADDON_LOADED(addon)
if t.triggers[i]:HasScript("OnUpdate") then t.triggers[i]:SetScript("OnUpdate", nil) end
end)
end
end
else for i = 1, #t.triggers do t.triggers[i]:EnableMouse(false) end end
end

---Set the visibility of a frame based on the value provided
Expand Down Expand Up @@ -9264,7 +9266,7 @@ function WidgetTools.frame:ADDON_LOADED(addon)
---@param t positionOptionsCreationData Parameters are to be provided in this table
---***
---@return positionPanel|nil table Components of the options panel wrapped in a table
function wt.CreatePositionOptions(addon, t)
function wt. CreatePositionOptions(addon, t)
if not addon or not IsAddOnLoaded(addon) then return end

--[ Wrapper Table ]
Expand Down
22 changes: 12 additions & 10 deletions WidgetTools/WidgetToolbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1327,25 +1327,27 @@ function WidgetTools.frame:ADDON_LOADED(addon)
frame:HookScript("OnEvent", function(_, event, key, down) if event == "MODIFIER_STATE_CHANGED" and key:find(t.modifier) then
if down > 0 then SetCursor("Interface/Cursor/ui-cursor-move.crosshair") else SetCursor(nil) end
end end)
end
end
end

for i = 1, #t.triggers do
t.triggers[i]:EnableMouse(movable)
for i = 1, #t.triggers do
t.triggers[i]:EnableMouse(true)

if movable then
t.triggers[i]:HookScript("OnEnter", function()
if not t.cursor or not frame:IsMovable() then return end

if not modifier or modifier() then SetCursor("Interface/Cursor/ui-cursor-move.crosshair") else frame:RegisterEvent("MODIFIER_STATE_CHANGED") end
if not modifier then SetCursor("Interface/Cursor/ui-cursor-move.crosshair") else
if modifier() then SetCursor("Interface/Cursor/ui-cursor-move.crosshair") end

frame:RegisterEvent("MODIFIER_STATE_CHANGED")
end
end)

t.triggers[i]:HookScript("OnLeave", function()
if not t.cursor or not frame:IsMovable() then return end

if modifier and not hadEvent then frame:UnregisterEvent("MODIFIER_STATE_CHANGED") end

SetCursor(nil)

if modifier and not hadEvent then frame:UnregisterEvent("MODIFIER_STATE_CHANGED") end
end)

t.triggers[i]:HookScript("OnMouseDown", function()
Expand Down Expand Up @@ -1410,7 +1412,7 @@ function WidgetTools.frame:ADDON_LOADED(addon)
if t.triggers[i]:HasScript("OnUpdate") then t.triggers[i]:SetScript("OnUpdate", nil) end
end)
end
end
else for i = 1, #t.triggers do t.triggers[i]:EnableMouse(false) end end
end

---Set the visibility of a frame based on the value provided
Expand Down Expand Up @@ -9264,7 +9266,7 @@ function WidgetTools.frame:ADDON_LOADED(addon)
---@param t positionOptionsCreationData Parameters are to be provided in this table
---***
---@return positionPanel|nil table Components of the options panel wrapped in a table
function wt.CreatePositionOptions(addon, t)
function wt. CreatePositionOptions(addon, t)
if not addon or not IsAddOnLoaded(addon) then return end

--[ Wrapper Table ]
Expand Down
2 changes: 1 addition & 1 deletion WidgetTools/WidgetTools-Classic.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 11502
## Interface: 11503
## Title: Widget Tools |TInterface/AddOns/WidgetTools/Textures/Logo.tga:0|t
## Notes: Responsible for doing the heavy lifting for dependant addons in the background.
## IconTexture: Interface/AddOns/WidgetTools/Textures/Logo.tga
Expand Down
2 changes: 1 addition & 1 deletion WidgetTools/WidgetTools-Mainline.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100206
## Interface: 100207
## Title: Widget Tools
## Notes: Responsible for doing the heavy lifting for dependant addons in the background.
## IconTexture: Interface/AddOns/WidgetTools/Textures/Logo.tga
Expand Down
2 changes: 1 addition & 1 deletion WidgetTools/WidgetTools.toc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## Interface: 100206 #Fallback to the Mainline version
## Interface: 100207 #Fallback to the Mainline version
## Title: Widget Tools
## Notes: Responsible for doing the heavy lifting for dependant addons in the background.
## IconTexture: Interface/AddOns/WidgetTools/Textures/Logo.tga
Expand Down

0 comments on commit 5967eff

Please sign in to comment.