From 9d4c4230434d829af42ec58ed5644decfd234c68 Mon Sep 17 00:00:00 2001 From: Arxareon Date: Sat, 5 Aug 2023 17:46:46 +0200 Subject: [PATCH] Version 2.9 - Release Changes: - Positioning the speed displays next to other frames via Presets (like Under Minimap) will now dynamically be updated to follow those frames instead of being assigned to a static position. After you move a frame, reapply the desired now updated preset to move the display back in relation to it. - The Travel Speed feature (offering estimated speed values even during Dragonriding) will now be enabled by default (as a replacement when the Player Speed value is not available). - Added more value step options to the other sliders as well. The default step value is now 1 for the position offset values. - The settings category page shortcuts have been removed in WotLK Classic (because the new Settings window broke the feature - I may readd them when the issue gets resolved). The shortcuts have been replaced by an Options button in the right-click menu of the speed displays. - The custom context menus have been replaced with the basic menu until their quirks are ironed out. - Scrolling has been improved in WotLK Classic. - Other small fixes, changes & improvements. --- CopyToWoW.ps1 | 1 + MovementSpeed/Main.lua | 673 ++++++++++++----------- MovementSpeed/Main_Classic.lua | 621 +++++++++++---------- MovementSpeed/Main_WotLK.lua | 623 +++++++++++---------- MovementSpeed/MovementSpeed-BCC.toc | 4 +- MovementSpeed/MovementSpeed-Classic.toc | 4 +- MovementSpeed/MovementSpeed-Mainline.toc | 4 +- MovementSpeed/MovementSpeed-Wrath.toc | 4 +- MovementSpeed/MovementSpeed.toc | 4 +- MovementSpeed/Resources.lua | 25 +- 10 files changed, 1045 insertions(+), 918 deletions(-) diff --git a/CopyToWoW.ps1 b/CopyToWoW.ps1 index 63d56b0..d00b2e0 100644 --- a/CopyToWoW.ps1 +++ b/CopyToWoW.ps1 @@ -19,6 +19,7 @@ $clients += "_xptr_" #Dragonflight PTR X $clients += "_classic_" #Wrath of the Lich King $clients += "_classic_ptr_" #Wrath of the Lick King PTR $clients += "_classic_era_" #Classic +$clients += "_classic_era_ptr_" #Classic PTR <# INSTALLATION #> diff --git a/MovementSpeed/Main.lua b/MovementSpeed/Main.lua index a046eb3..0a9e9a6 100644 --- a/MovementSpeed/Main.lua +++ b/MovementSpeed/Main.lua @@ -60,7 +60,7 @@ local dbDefault = { frequency = 0.15, }, travelSpeed = { - enabled = false, + enabled = true, replacement = true, throttle = true, frequency = 0.15, @@ -90,11 +90,13 @@ local presets = { }, }, { - name = ns.strings.options.speedDisplay.position.presets.list[1], --Under Default Minimap + name = ns.strings.options.speedDisplay.position.presets.list[1], --Under Minimap data = { position = { - anchor = "RIGHT", - offset = { x = -100, y = 222 } + anchor = "TOP", + relativeTo = MinimapBackdrop, + relativePoint = "BOTTOM", + offset = { y = -2 } }, layer = { strata = "MEDIUM" @@ -258,16 +260,16 @@ local function CheckDBs(dbCheck, dbSample, dbcCheck, dbcSample) }) --Convert value type units - dbCheck.speedDisplay.value.units = { + if type(dbCheck.speedDisplay.value.units) == "number" then dbCheck.speedDisplay.value.units = { dbCheck.speedDisplay.value.units == 0 or dbCheck.speedDisplay.value.units == 2, dbCheck.speedDisplay.value.units == 1 or dbCheck.speedDisplay.value.units == 2, false - } - dbCheck.targetSpeed.value.units = { + } end + if type(dbCheck.targetSpeed.value.units) == "number" then dbCheck.targetSpeed.value.units = { dbCheck.targetSpeed.value.units == 0 or dbCheck.targetSpeed.value.units == 2, dbCheck.targetSpeed.value.units == 1 or dbCheck.targetSpeed.value.units == 2, false - } + } end end --[ Speed Update ] @@ -291,9 +293,6 @@ local function UpdateTravelSpeed() speed.travel.coords.x, speed.travel.coords.y = math.abs(speed.travel.coords.x), math.abs(speed.travel.coords.y) else speed.travel.yards = 0 end - -- print(db.travelSpeed.throttle) --FIXME - -- wt.Dump(speed.travel, delta) - pastPosition = currentPosition lastTime = time end @@ -331,7 +330,7 @@ local function UpdateSpeedText(template, units) "#COORDS", wt.Color(ns.strings.speedValue.coordPair, ns.colors.blue[2]) ), ns.colors.blue[1]) end - speedText[template] = speedText[template]:sub(#ns.strings.speedValue.separator + 1) + speedText[template] = speedText[template]:sub(#ns.strings.speedValue.separator) end local function UpdateMapInfo() @@ -418,18 +417,21 @@ local function ApplyPreset(i) wt.SetPosition(frames.main, presets[i].data.position) frames.main:SetFrameStrata(presets[i].data.layer.strata) - --Update the options widgets - frames.options.speedDisplays.visibility.hidden.setState(false) - frames.options.speedDisplays.visibility.hidden:SetAttribute("loaded", true) --Update dependent widgets - frames.options.speedDisplays.position.anchor.setSelected(presets[i].data.position.anchor) - frames.options.speedDisplays.position.xOffset.setValue(presets[i].data.position.offset.x) - frames.options.speedDisplays.position.yOffset.setValue(presets[i].data.position.offset.y) - frames.options.speedDisplays.position.frameStrata.setSelected(presets[i].data.layer.strata) + --Convert to absolute position + wt.ConvertToAbsolutePosition(frames.main) --Update the DBs dbc.hidden = false - wt.CopyValues(presets[i].data.position, db.speedDisplay.position) + wt.CopyValues(wt.PackPosition(frames.main:GetPoint()), db.speedDisplay.position) db.speedDisplay.layer.strata = presets[i].data.layer.strata + + --Update the options widgets + frames.options.speedDisplays.visibility.hidden.setState(false) + frames.options.speedDisplays.visibility.hidden:SetAttribute("loaded", true) --Update dependent widgets + frames.options.speedDisplays.position.anchor.setSelected(db.speedDisplay.position.anchor) + frames.options.speedDisplays.position.xOffset.setValue(db.speedDisplay.position.offset.x) + frames.options.speedDisplays.position.yOffset.setValue(db.speedDisplay.position.offset.y) + frames.options.speedDisplays.position.frameStrata.setSelected(db.speedDisplay.layer.strata) end --Save the current display position & visibility to the custom preset @@ -468,7 +470,8 @@ end --- - **wrap**? boolean *optional* ― Allow this line to be wrapped | ***Default:*** true local function GetSpeedDisplayTooltipLines(type) return { - { text = ns.strings[type .. "Speed"].text, }, + { text = ns.strings.speedTooltip.description }, + { text = ns.strings.speedTooltip[type .. "Speed"], }, { text = "\n" .. ns.strings.speedTooltip.text[1]:gsub("#YARDS", wt.Color(wt.FormatThousands(speed[type].yards, 2, true), ns.colors.yellow[2])), font = GameTooltipText, @@ -950,93 +953,97 @@ local function CreateAboutInfo(panel) end --Create the category page -local function CreateMainOptions() frames.options.main.page = wt.CreateOptionsCategory({ - addon = addonNameSpace, - name = "Main", - description = ns.strings.options.main.description:gsub("#ADDON", addonTitle), - logo = ns.textures.logo, - titleLogo = true, - initialize = function(canvas) - --Panel: Shortcuts - -- wt.CreatePanel({ --FIXME: Reinstate once opening settings subcategories programmatically is once again supported in Dragonflight - -- parent = canvas, - -- name = "Shortcuts", - -- title = ns.strings.options.main.shortcuts.title, - -- description = ns.strings.options.main.shortcuts.description:gsub("#ADDON", addonTitle), - -- arrange = {}, - -- initialize = CreateOptionsShortcuts, - -- arrangement = {} - -- }) - - --Panel: About - wt.CreatePanel({ - parent = canvas, - name = "About", - title = ns.strings.options.main.about.title, - description = ns.strings.options.main.about.description:gsub("#ADDON", addonTitle), - arrange = {}, - size = { height = 258 }, - initialize = CreateAboutInfo, - arrangement = { - flip = true, - resize = false - } - }) - - --Panel: Sponsors - local top = GetAddOnMetadata(addonNameSpace, "X-TopSponsors") - local normal = GetAddOnMetadata(addonNameSpace, "X-Sponsors") - if top or normal then - local sponsorsPanel = wt.CreatePanel({ +local function CreateMainOptions() + ---@type optionsPage + frames.options.main.page = wt.CreateOptionsCategory({ + addon = addonNameSpace, + name = "Main", + description = ns.strings.options.main.description:gsub("#ADDON", addonTitle), + logo = ns.textures.logo, + titleLogo = true, + initialize = function(canvas) + --Panel: Shortcuts + -- wt.CreatePanel({ --FIXME: Reinstate once opening settings subcategories programmatically is once again supported in Dragonflight + -- parent = canvas, + -- name = "Shortcuts", + -- title = ns.strings.options.main.shortcuts.title, + -- description = ns.strings.options.main.shortcuts.description:gsub("#ADDON", addonTitle), + -- arrange = {}, + -- initialize = CreateOptionsShortcuts, + -- arrangement = {} + -- }) + + --Panel: About + wt.CreatePanel({ parent = canvas, - name = "Sponsors", - title = ns.strings.options.main.sponsors.title, - description = ns.strings.options.main.sponsors.description, + name = "About", + title = ns.strings.options.main.about.title, + description = ns.strings.options.main.about.description:gsub("#ADDON", addonTitle), arrange = {}, - size = { height = 64 + (top and normal and 24 or 0) }, - initialize = function(panel) - if top then - wt.CreateText({ - parent = panel, - name = "Top", - position = { offset = { x = 16, y = -33 } }, - width = panel:GetWidth() - 32, - text = top:gsub("|", " • "), - font = "GameFontNormalLarge", - justify = { h = "LEFT", }, - }) - end - if normal then - wt.CreateText({ - parent = panel, - name = "Normal", - position = { offset = { x = 16, y = -33 -(top and 24 or 0) } }, - width = panel:GetWidth() - 32, - text = normal:gsub("|", " • "), - font = "GameFontHighlightMedium", - justify = { h = "LEFT", }, - }) - end - end, - }) - wt.CreateText({ - parent = sponsorsPanel, - name = "DescriptionHeart", - position = { offset = { x = _G[sponsorsPanel:GetName() .. "Description"]:GetStringWidth() + 16, y = -10 } }, - text = "♥", - font = "ChatFontSmall", - justify = { h = "LEFT", }, + size = { height = 258 }, + initialize = CreateAboutInfo, + arrangement = { + flip = true, + resize = false + } }) - end - end, - arrangement = {} -}) end + + --Panel: Sponsors + local top = GetAddOnMetadata(addonNameSpace, "X-TopSponsors") + local normal = GetAddOnMetadata(addonNameSpace, "X-Sponsors") + if top or normal then + local sponsorsPanel = wt.CreatePanel({ + parent = canvas, + name = "Sponsors", + title = ns.strings.options.main.sponsors.title, + description = ns.strings.options.main.sponsors.description, + arrange = {}, + size = { height = 64 + (top and normal and 24 or 0) }, + initialize = function(panel) + if top then + wt.CreateText({ + parent = panel, + name = "Top", + position = { offset = { x = 16, y = -33 } }, + width = panel:GetWidth() - 32, + text = top:gsub("|", " • "), + font = "GameFontNormalLarge", + justify = { h = "LEFT", }, + }) + end + if normal then + wt.CreateText({ + parent = panel, + name = "Normal", + position = { offset = { x = 16, y = -33 -(top and 24 or 0) } }, + width = panel:GetWidth() - 32, + text = normal:gsub("|", " • "), + font = "GameFontHighlightMedium", + justify = { h = "LEFT", }, + }) + end + end, + }) + wt.CreateText({ + parent = sponsorsPanel, + name = "DescriptionHeart", + position = { offset = { x = _G[sponsorsPanel:GetName() .. "Description"]:GetStringWidth() + 16, y = -10 } }, + text = "♥", + font = "ChatFontSmall", + justify = { h = "LEFT", }, + }) + end + end, + arrangement = {} + }) +end --[ Speed Display ] --Create the widgets local function CreateVisibilityOptions(panel) --Checkbox: Hidden + ---@type checkbox frames.options.speedDisplays.visibility.hidden = wt.CreateCheckbox({ parent = panel, name = "Hidden", @@ -1052,6 +1059,7 @@ local function CreateVisibilityOptions(panel) }) --Checkbox: Auto-hide toggle + ---@type checkbox frames.options.speedDisplays.visibility.autoHide = wt.CreateCheckbox({ parent = panel, name = "AutoHide", @@ -1067,6 +1075,7 @@ local function CreateVisibilityOptions(panel) }) --Checkbox: Status notice + ---@type checkbox frames.options.speedDisplays.visibility.status = wt.CreateCheckbox({ parent = panel, name = "StatusNotice", @@ -1088,6 +1097,7 @@ local function CreatePositionOptions(panel) presetItems[i].title = presets[i].name presetItems[i].onSelect = function() ApplyPreset(i) end end + ---@type dropdown frames.options.speedDisplays.position.presets = wt.CreateDropdown({ parent = panel, name = "ApplyPreset", @@ -1154,6 +1164,7 @@ local function CreatePositionOptions(panel) }) --Selector: Anchor point + ---@type specialSelector frames.options.speedDisplays.position.anchor = wt.CreateSpecialSelector({ parent = panel, name = "AnchorPoint", @@ -1173,6 +1184,7 @@ local function CreatePositionOptions(panel) }) --Slider: X offset + ---@type slider frames.options.speedDisplays.position.xOffset = wt.CreateSlider({ parent = panel, name = "OffsetX", @@ -1195,6 +1207,7 @@ local function CreatePositionOptions(panel) }) --Slider: Y offset + ---@type slider frames.options.speedDisplays.position.yOffset = wt.CreateSlider({ parent = panel, name = "OffsetY", @@ -1217,6 +1230,7 @@ local function CreatePositionOptions(panel) }) --Selector: Frame strata + ---@type specialSelector frames.options.speedDisplays.position.frameStrata = wt.CreateSpecialSelector({ parent = panel, name = "FrameStrata", @@ -1237,6 +1251,7 @@ local function CreatePositionOptions(panel) end local function CreatePlayerSpeedOptions(panel) --Checkbox: Throttle + ---@type checkbox frames.options.playerSpeed.throttle = wt.CreateCheckbox({ parent = panel, name = "Throttle", @@ -1256,6 +1271,7 @@ local function CreatePlayerSpeedOptions(panel) }) --Slider: Frequency + ---@type slider frames.options.playerSpeed.frequency = wt.CreateSlider({ parent = panel, name = "Frequency", @@ -1263,6 +1279,7 @@ local function CreatePlayerSpeedOptions(panel) tooltip = { lines = { { text = ns.strings.options.speedDisplay.update.frequency.tooltip, }, } }, arrange = { newRow = false, }, value = { min = 0.05, max = 1, increment = 0.05 }, + altStep = 0.2, dependencies = { { frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end }, { frame = frames.options.playerSpeed.throttle }, @@ -1277,6 +1294,7 @@ local function CreatePlayerSpeedOptions(panel) end local function CreateTravelSpeedOptions(panel) --Checkbox: Enabled + ---@type checkbox frames.options.travelSpeed.enabled = wt.CreateCheckbox({ parent = panel, title = ns.strings.options.speedDisplay.travelSpeed.enabled.label, @@ -1303,6 +1321,7 @@ local function CreateTravelSpeedOptions(panel) }) --Checkbox: Replacement + ---@type checkbox frames.options.travelSpeed.replacement = wt.CreateCheckbox({ parent = panel, name = "Replacement", @@ -1323,6 +1342,7 @@ local function CreateTravelSpeedOptions(panel) }) --Checkbox: Throttle + ---@type checkbox frames.options.travelSpeed.throttle = wt.CreateCheckbox({ parent = panel, name = "Throttle", @@ -1346,6 +1366,7 @@ local function CreateTravelSpeedOptions(panel) }) --Slider: Frequency + ---@type slider frames.options.travelSpeed.frequency = wt.CreateSlider({ parent = panel, name = "Frequency", @@ -1353,6 +1374,7 @@ local function CreateTravelSpeedOptions(panel) tooltip = { lines = { { text = ns.strings.options.speedDisplay.update.frequency.tooltip, }, } }, arrange = { newRow = false, }, value = { min = 0.05, max = 1, increment = 0.05 }, + altStep = 0.2, dependencies = { { frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end }, { frame = frames.options.travelSpeed.enabled, }, @@ -1400,6 +1422,7 @@ local function CreateSpeedValueOptions(panel) }) --Slider: Fractionals + ---@type slider frames.options.speedDisplays.value.fractionals = wt.CreateSlider({ parent = panel, name = "Fractionals", @@ -1417,6 +1440,7 @@ local function CreateSpeedValueOptions(panel) }) --Checkbox: No trim + ---@type checkbox frames.options.speedDisplays.value.noTrim = wt.CreateCheckbox({ parent = panel, name = "NoTrim", @@ -1448,6 +1472,7 @@ local function CreateFontOptions(panel) } or nil), } end + ---@type dropdown frames.options.speedDisplays.font.family = wt.CreateDropdown({ parent = panel, name = "Family", @@ -1504,6 +1529,7 @@ local function CreateFontOptions(panel) end --Slider: Font size + ---@type slider frames.options.speedDisplays.font.size = wt.CreateSlider({ parent = panel, name = "Size", @@ -1511,6 +1537,7 @@ local function CreateFontOptions(panel) tooltip = { lines = { { text = ns.strings.options.speedDisplay.font.size.tooltip .. "\n\n" .. ns.strings.misc.default .. ": " .. dbDefault.speedDisplay.font.size, }, } }, arrange = { newRow = false, }, value = { min = 8, max = 64, increment = 1 }, + altStep = 3, dependencies = { { frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end }, }, optionsData = { optionsKey = addonNameSpace .. "SpeedDisplays", @@ -1524,6 +1551,7 @@ local function CreateFontOptions(panel) }) --Selector: Text alignment + ---@type specialSelector frames.options.speedDisplays.font.alignment = wt.CreateSpecialSelector({ parent = panel, name = "Alignment", @@ -1550,6 +1578,7 @@ local function CreateFontOptions(panel) }) --Checkbox: Value coloring + ---@type checkbox frames.options.speedDisplays.font.valueColoring = wt.CreateCheckbox({ parent = panel, name = "ValueColoring", @@ -1572,6 +1601,7 @@ local function CreateFontOptions(panel) }) --Color Picker: Font color + ---@type colorPicker frames.options.speedDisplays.font.color = wt.CreateColorPicker({ parent = panel, name = "Color", @@ -1592,6 +1622,7 @@ local function CreateFontOptions(panel) end local function CreateBackgroundOptions(panel) --Checkbox: Visible + ---@type checkbox frames.options.speedDisplays.background.visible = wt.CreateCheckbox({ parent = panel, name = "Visible", @@ -1614,6 +1645,7 @@ local function CreateBackgroundOptions(panel) }) --Color Picker: Background color + ---@type colorPicker frames.options.speedDisplays.background.colors.bg = wt.CreateColorPicker({ parent = panel, name = "Color", @@ -1638,6 +1670,7 @@ local function CreateBackgroundOptions(panel) }) --Color Picker: Border color + ---@type colorPicker frames.options.speedDisplays.background.colors.border = wt.CreateColorPicker({ parent = panel, name = "BorderColor", @@ -1667,136 +1700,140 @@ local function CreateBackgroundOptions(panel) end --Create the category page -local function CreateSpeedDisplayOptions() frames.options.speedDisplays.page = wt.CreateOptionsCategory({ - parent = frames.options.main.page.category, - addon = addonNameSpace, - name = "SpeedDisplays", - title = ns.strings.options.speedDisplay.title, - description = ns.strings.options.speedDisplay.description:gsub("#ADDON", addonTitle), - logo = ns.textures.logo, - scroll = { speed = 0.21 }, - optionsKeys = { addonNameSpace .. "SpeedDisplays" }, - storage = { - { - workingTable = dbc, - storageTable = MovementSpeedDBC, - defaultsTable = dbcDefault, - }, - { - workingTable = db.playerSpeed, - storageTable = MovementSpeedDB.playerSpeed, - defaultsTable = dbDefault.playerSpeed, - }, - { - workingTable = db.travelSpeed, - storageTable = MovementSpeedDB.travelSpeed, - defaultsTable = dbDefault.travelSpeed, - }, - { - workingTable = db.speedDisplay, - storageTable = MovementSpeedDB.speedDisplay, - defaultsTable = dbDefault.speedDisplay, +local function CreateSpeedDisplayOptions() + ---@type optionsPage + frames.options.speedDisplays.page = wt.CreateOptionsCategory({ + parent = frames.options.main.page.category, + addon = addonNameSpace, + name = "SpeedDisplays", + title = ns.strings.options.speedDisplay.title, + description = ns.strings.options.speedDisplay.description:gsub("#ADDON", addonTitle), + logo = ns.textures.logo, + scroll = { speed = 0.21 }, + optionsKeys = { addonNameSpace .. "SpeedDisplays" }, + storage = { + { + workingTable = dbc, + storageTable = MovementSpeedDBC, + defaultsTable = dbcDefault, + }, + { + workingTable = db.playerSpeed, + storageTable = MovementSpeedDB.playerSpeed, + defaultsTable = dbDefault.playerSpeed, + }, + { + workingTable = db.travelSpeed, + storageTable = MovementSpeedDB.travelSpeed, + defaultsTable = dbDefault.travelSpeed, + }, + { + workingTable = db.speedDisplay, + storageTable = MovementSpeedDB.speedDisplay, + defaultsTable = dbDefault.speedDisplay, + }, }, - }, - onSave = function() MovementSpeedDB = wt.Clone(db) end, - onDefault = function(user) - ResetCustomPreset() - if not user then return end + onSave = function() MovementSpeedDB = wt.Clone(db) end, + onDefault = function(user) + ResetCustomPreset() + if not user then return end - --Notification - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.reset.response:gsub( - "#CUSTOM", wt.Color(presets[1].name, ns.colors.green[2]) - ), ns.colors.yellow[2])) - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( - "#CATEGORY", wt.Color(ns.strings.options.speedDisplay.title, ns.colors.green[2]) - ), ns.colors.yellow[2])) - end, - initialize = function(canvas) - --Panel: Visibility - wt.CreatePanel({ - parent = canvas, - name = "Visibility", - title = ns.strings.options.speedDisplay.visibility.title, - description = ns.strings.options.speedDisplay.visibility.description:gsub("#ADDON", addonTitle), - arrange = {}, - initialize = CreateVisibilityOptions, - arrangement = {} - }) + --Notification + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.reset.response:gsub( + "#CUSTOM", wt.Color(presets[1].name, ns.colors.green[2]) + ), ns.colors.yellow[2])) + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( + "#CATEGORY", wt.Color(ns.strings.options.speedDisplay.title, ns.colors.green[2]) + ), ns.colors.yellow[2])) + end, + initialize = function(canvas) + --Panel: Visibility + wt.CreatePanel({ + parent = canvas, + name = "Visibility", + title = ns.strings.options.speedDisplay.visibility.title, + description = ns.strings.options.speedDisplay.visibility.description:gsub("#ADDON", addonTitle), + arrange = {}, + initialize = CreateVisibilityOptions, + arrangement = {} + }) - --Panel: Position - wt.CreatePanel({ - parent = canvas, - name = "Position", - title = ns.strings.options.speedDisplay.position.title, - description = ns.strings.options.speedDisplay.position.description, - arrange = {}, - initialize = CreatePositionOptions, - arrangement = {} - }) + --Panel: Position + wt.CreatePanel({ + parent = canvas, + name = "Position", + title = ns.strings.options.speedDisplay.position.title, + description = ns.strings.options.speedDisplay.position.description, + arrange = {}, + initialize = CreatePositionOptions, + arrangement = {} + }) - --Panel: Player Speed - wt.CreatePanel({ - parent = canvas, - name = "PlayerSpeed", - title = ns.strings.options.speedDisplay.playerSpeed.title, - description = ns.strings.options.speedDisplay.playerSpeed.description, - arrange = {}, - initialize = CreatePlayerSpeedOptions, - arrangement = {} - }) + --Panel: Player Speed + wt.CreatePanel({ + parent = canvas, + name = "PlayerSpeed", + title = ns.strings.options.speedDisplay.playerSpeed.title, + description = ns.strings.options.speedDisplay.playerSpeed.description, + arrange = {}, + initialize = CreatePlayerSpeedOptions, + arrangement = {} + }) - --Panel: Travel Speed - wt.CreatePanel({ - parent = canvas, - name = "TravelSpeed", - title = ns.strings.options.speedDisplay.travelSpeed.title, - description = ns.strings.options.speedDisplay.travelSpeed.description, - arrange = {}, - initialize = CreateTravelSpeedOptions, - arrangement = {} - }) + --Panel: Travel Speed + wt.CreatePanel({ + parent = canvas, + name = "TravelSpeed", + title = ns.strings.options.speedDisplay.travelSpeed.title, + description = ns.strings.options.speedDisplay.travelSpeed.description, + arrange = {}, + initialize = CreateTravelSpeedOptions, + arrangement = {} + }) - --Panel: Value - wt.CreatePanel({ - parent = canvas, - name = "Value", - title = ns.strings.options.speedValue.title, - description = ns.strings.options.speedValue.description, - arrange = {}, - initialize = CreateSpeedValueOptions, - arrangement = {} - }) + --Panel: Value + wt.CreatePanel({ + parent = canvas, + name = "Value", + title = ns.strings.options.speedValue.title, + description = ns.strings.options.speedValue.description, + arrange = {}, + initialize = CreateSpeedValueOptions, + arrangement = {} + }) - --Panel: Font - wt.CreatePanel({ - parent = canvas, - name = "Font", - title = ns.strings.options.speedDisplay.font.title, - description = ns.strings.options.speedDisplay.font.description, - arrange = {}, - initialize = CreateFontOptions, - arrangement = {} - }) + --Panel: Font + wt.CreatePanel({ + parent = canvas, + name = "Font", + title = ns.strings.options.speedDisplay.font.title, + description = ns.strings.options.speedDisplay.font.description, + arrange = {}, + initialize = CreateFontOptions, + arrangement = {} + }) - --Panel: Background - wt.CreatePanel({ - parent = canvas, - name = "Background", - title = ns.strings.options.speedDisplay.background.title, - description = ns.strings.options.speedDisplay.background.description:gsub("#ADDON", addonTitle), - arrange = {}, - initialize = CreateBackgroundOptions, - arrangement = {} - }) - end, - arrangement = {} -}) end + --Panel: Background + wt.CreatePanel({ + parent = canvas, + name = "Background", + title = ns.strings.options.speedDisplay.background.title, + description = ns.strings.options.speedDisplay.background.description:gsub("#ADDON", addonTitle), + arrange = {}, + initialize = CreateBackgroundOptions, + arrangement = {} + }) + end, + arrangement = {} + }) +end --[ Target Speed ] --Create the widgets local function CreateTargetSpeedTooltipOptions(panel) --Checkbox: Enabled + ---@type checkbox frames.options.targetSpeed.enabled = wt.CreateCheckbox({ parent = panel, name = "Enabled", @@ -1831,6 +1868,7 @@ local function CreateTargetSpeedValueOptions(panel) }) --Slider: Fractionals + ---@type slider frames.options.targetSpeed.value.fractionals = wt.CreateSlider({ parent = panel, name = "Fractionals", @@ -1847,6 +1885,7 @@ local function CreateTargetSpeedValueOptions(panel) }) --Checkbox: No trim + ---@type checkbox frames.options.targetSpeed.value.noTrim = wt.CreateCheckbox({ parent = panel, name = "NoTrim", @@ -1864,52 +1903,55 @@ local function CreateTargetSpeedValueOptions(panel) end --Create the category page -local function CreateTargetSpeedOptions() frames.options.targetSpeed.page = wt.CreateOptionsCategory({ - parent = frames.options.main.page.category, - addon = addonNameSpace, - name = "TargetSpeed", - title = ns.strings.options.targetSpeed.title, - 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, - }, }, - onDefault = function(user) - if not user then return end - - --Notification - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( - "#CATEGORY", wt.Color(ns.strings.options.targetSpeed.title, ns.colors.green[2]) - ), ns.colors.yellow[2])) - end, - initialize = function(canvas) - --Panel: Tooltip integration - wt.CreatePanel({ - parent = canvas, - name = "TargetSpeed", - title = ns.strings.options.targetSpeed.mouseover.title, - description = ns.strings.options.targetSpeed.mouseover.description, - arrange = {}, - initialize = CreateTargetSpeedTooltipOptions, - arrangement = {} - }) +local function CreateTargetSpeedOptions() + ---@type optionsPage + frames.options.targetSpeed.page = wt.CreateOptionsCategory({ + parent = frames.options.main.page.category, + addon = addonNameSpace, + name = "TargetSpeed", + title = ns.strings.options.targetSpeed.title, + 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, + }, }, + onDefault = function(user) + if not user then return end - --Panel: Value - wt.CreatePanel({ - parent = canvas, - name = "Value", - title = ns.strings.options.speedValue.title, - description = ns.strings.options.speedValue.description, - arrange = {}, - initialize = CreateTargetSpeedValueOptions, - arrangement = {} - }) - end, - arrangement = {} -}) end + --Notification + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( + "#CATEGORY", wt.Color(ns.strings.options.targetSpeed.title, ns.colors.green[2]) + ), ns.colors.yellow[2])) + end, + initialize = function(canvas) + --Panel: Tooltip integration + wt.CreatePanel({ + parent = canvas, + name = "TargetSpeed", + title = ns.strings.options.targetSpeed.mouseover.title, + description = ns.strings.options.targetSpeed.mouseover.description, + arrange = {}, + initialize = CreateTargetSpeedTooltipOptions, + arrangement = {} + }) + + --Panel: Value + wt.CreatePanel({ + parent = canvas, + name = "Value", + title = ns.strings.options.speedValue.title, + description = ns.strings.options.speedValue.description, + arrange = {}, + initialize = CreateTargetSpeedValueOptions, + arrangement = {} + }) + end, + arrangement = {} + }) +end --[ Advanced ] @@ -1972,6 +2014,7 @@ local function CreateBackupOptions(panel) }) --Checkbox: Compact + ---@type checkbox frames.options.advanced.backup.compact = wt.CreateCheckbox({ parent = panel, name = "Compact", @@ -2028,57 +2071,60 @@ local function CreateBackupOptions(panel) end --Create the category page -local function CreateAdvancedOptions() frames.options.advanced.page = wt.CreateOptionsCategory({ - parent = frames.options.main.page.category, - addon = addonNameSpace, - name = "Advanced", - title = ns.strings.options.advanced.title, - description = ns.strings.options.advanced.description:gsub("#ADDON", addonTitle), - logo = ns.textures.logo, - optionsKeys = { addonNameSpace .. "Advanced" }, - onDefault = function() - ResetCustomPreset() - - --Notification - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.reset.response:gsub( - "#CUSTOM", wt.Color(presets[1].name, ns.colors.green[2]) - ), ns.colors.yellow[2])) - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( - "#CATEGORY", wt.Color(ns.strings.options.speedDisplay.title, ns.colors.green[2]) - ), ns.colors.yellow[2])) - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( - "#CATEGORY", wt.Color(ns.strings.options.targetSpeed.title, ns.colors.green[2]) - ), ns.colors.yellow[2])) - end, - initialize = function(canvas) - --Panel: Profiles - wt.CreatePanel({ - parent = canvas, - name = "Profiles", - title = ns.strings.options.advanced.profiles.title, - description = ns.strings.options.advanced.profiles.description:gsub("#ADDON", addonTitle), - arrange = {}, - size = { height = 64 }, - initialize = CreateOptionsProfiles, - }) +local function CreateAdvancedOptions() + ---@type optionsPage + frames.options.advanced.page = wt.CreateOptionsCategory({ + parent = frames.options.main.page.category, + addon = addonNameSpace, + name = "Advanced", + title = ns.strings.options.advanced.title, + description = ns.strings.options.advanced.description:gsub("#ADDON", addonTitle), + logo = ns.textures.logo, + optionsKeys = { addonNameSpace .. "Advanced" }, + onDefault = function() + ResetCustomPreset() - --Panel: Backup - wt.CreatePanel({ - parent = canvas, - name = "Backup", - title = ns.strings.options.advanced.backup.title, - description = ns.strings.options.advanced.backup.description:gsub("#ADDON", addonTitle), - arrange = {}, - size = { height = canvas:GetHeight() - 200 }, - initialize = CreateBackupOptions, - arrangement = { - flip = true, - resize = false - } - }) - end, - arrangement = {} -}) end + --Notification + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.reset.response:gsub( + "#CUSTOM", wt.Color(presets[1].name, ns.colors.green[2]) + ), ns.colors.yellow[2])) + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( + "#CATEGORY", wt.Color(ns.strings.options.speedDisplay.title, ns.colors.green[2]) + ), ns.colors.yellow[2])) + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( + "#CATEGORY", wt.Color(ns.strings.options.targetSpeed.title, ns.colors.green[2]) + ), ns.colors.yellow[2])) + end, + initialize = function(canvas) + --Panel: Profiles + wt.CreatePanel({ + parent = canvas, + name = "Profiles", + title = ns.strings.options.advanced.profiles.title, + description = ns.strings.options.advanced.profiles.description:gsub("#ADDON", addonTitle), + arrange = {}, + size = { height = 64 }, + initialize = CreateOptionsProfiles, + }) + + --Panel: Backup + wt.CreatePanel({ + parent = canvas, + name = "Backup", + title = ns.strings.options.advanced.backup.title, + description = ns.strings.options.advanced.backup.description:gsub("#ADDON", addonTitle), + arrange = {}, + size = { height = canvas:GetHeight() - 200 }, + initialize = CreateBackupOptions, + arrangement = { + flip = true, + resize = false + } + }) + end, + arrangement = {} + }) +end --[[ CHAT CONTROL ]] @@ -2339,7 +2385,7 @@ local function AddonLoaded(self, addon) wt.SetPosition(self, db.speedDisplay.position) --Make movable - wt.SetMovability(frames.main, true, "SHIFT", { frames.playerSpeed.display, frames.travelSpeed.display }, { + wt.SetMovability(frames.main, true, "SHIFT", { frames.playerSpeed.display, frames.travelSpeed.display, }, { onStop = function() --Save the position (for account-wide use) wt.CopyValues(wt.PackPosition(frames.main:GetPoint()), db.speedDisplay.position) @@ -2400,6 +2446,7 @@ end --Set up the speed display context menu local function _CreateContextMenu(parent) + ---@type contextMenu local contextMenu = wt.CreateContextMenu({ parent = parent, }) --[ Items ] @@ -2507,7 +2554,7 @@ frames.main = wt.CreateFrame({ --Tooltip wt.AddTooltip(display, { tooltip = ns.tooltip, - title = ns.strings.playerSpeed.title, + title = ns.strings.speedTooltip.title:gsub("#SPEED", ns.strings.options.speedDisplay.playerSpeed.title), anchor = "ANCHOR_BOTTOMRIGHT", offset = { y = display:GetHeight() }, flipColors = true @@ -2543,7 +2590,7 @@ frames.main = wt.CreateFrame({ --Tooltip wt.AddTooltip(display, { tooltip = ns.tooltip, - title = ns.strings.travelSpeed.title, + title = ns.strings.speedTooltip.title:gsub("#SPEED", ns.strings.options.speedDisplay.travelSpeed.title), anchor = "ANCHOR_BOTTOMRIGHT", offset = { y = display:GetHeight() }, flipColors = true diff --git a/MovementSpeed/Main_Classic.lua b/MovementSpeed/Main_Classic.lua index a72b693..b3c3f14 100644 --- a/MovementSpeed/Main_Classic.lua +++ b/MovementSpeed/Main_Classic.lua @@ -84,7 +84,7 @@ local presets = { }, }, { - name = ns.strings.options.speedDisplay.position.presets.classicList[1], --Under Minimap Clock + name = ns.strings.options.speedDisplay.position.presets.list[1], --Under Minimap data = { position = { anchor = "TOPRIGHT", @@ -235,16 +235,16 @@ local function CheckDBs(dbCheck, dbSample, dbcCheck, dbcSample) }) --Convert value type units - dbCheck.speedDisplay.value.units = { + if type(dbCheck.speedDisplay.value.units) == "number" then dbCheck.speedDisplay.value.units = { dbCheck.speedDisplay.value.units == 0 or dbCheck.speedDisplay.value.units == 2, dbCheck.speedDisplay.value.units == 1 or dbCheck.speedDisplay.value.units == 2, false - } - dbCheck.targetSpeed.value.units = { + } end + if type(dbCheck.targetSpeed.value.units) == "number" then dbCheck.targetSpeed.value.units = { dbCheck.targetSpeed.value.units == 0 or dbCheck.targetSpeed.value.units == 2, dbCheck.targetSpeed.value.units == 1 or dbCheck.targetSpeed.value.units == 2, false - } + } end end --[ Speed Update ] @@ -280,7 +280,7 @@ local function UpdateSpeedText(template, units) "#YARDS", wt.Color("#YARDS", ns.colors.yellow[2]) ), ns.colors.yellow[1]) end - speedText[template] = speedText[template]:sub(#ns.strings.speedValue.separator + 1) + speedText[template] = speedText[template]:sub(#ns.strings.speedValue.separator) end --[ Speed Displays ] @@ -361,18 +361,21 @@ local function ApplyPreset(i) wt.SetPosition(frames.main, presets[i].data.position) frames.main:SetFrameStrata(presets[i].data.layer.strata) - --Update the options widgets - frames.options.speedDisplays.visibility.hidden.setState(false) - frames.options.speedDisplays.visibility.hidden:SetAttribute("loaded", true) --Update dependent widgets - frames.options.speedDisplays.position.anchor.setSelected(presets[i].data.position.anchor) - frames.options.speedDisplays.position.xOffset.setValue(presets[i].data.position.offset.x) - frames.options.speedDisplays.position.yOffset.setValue(presets[i].data.position.offset.y) - frames.options.speedDisplays.position.frameStrata.setSelected(presets[i].data.layer.strata) + --Convert to absolute position + wt.ConvertToAbsolutePosition(frames.main) --Update the DBs dbc.hidden = false - wt.CopyValues(presets[i].data.position, db.speedDisplay.position) + wt.CopyValues(wt.PackPosition(frames.main:GetPoint()), db.speedDisplay.position) db.speedDisplay.layer.strata = presets[i].data.layer.strata + + --Update the options widgets + frames.options.speedDisplays.visibility.hidden.setState(false) + frames.options.speedDisplays.visibility.hidden:SetAttribute("loaded", true) --Update dependent widgets + frames.options.speedDisplays.position.anchor.setSelected(db.speedDisplay.position.anchor) + frames.options.speedDisplays.position.xOffset.setValue(db.speedDisplay.position.offset.x) + frames.options.speedDisplays.position.yOffset.setValue(db.speedDisplay.position.offset.y) + frames.options.speedDisplays.position.frameStrata.setSelected(db.speedDisplay.layer.strata) end --Save the current display position & visibility to the custom preset @@ -411,7 +414,8 @@ end --- - **wrap**? boolean *optional* ― Allow this line to be wrapped | ***Default:*** true local function GetSpeedDisplayTooltipLines(type) return { - { text = ns.strings[type .. "Speed"].text, }, + { text = ns.strings.speedTooltip.description }, + { text = ns.strings.speedTooltip[type .. "Speed"], }, { text = "\n" .. ns.strings.speedTooltip.text[1]:gsub("#YARDS", wt.Color(wt.FormatThousands(speed[type].yards, 2, true), ns.colors.yellow[2])), font = GameTooltipText, @@ -831,93 +835,97 @@ local function CreateAboutInfo(panel) end --Create the category page -local function CreateMainOptions() frames.options.main.page = wt.CreateOptionsCategory({ - addon = addonNameSpace, - name = "Main", - description = ns.strings.options.main.description:gsub("#ADDON", addonTitle), - logo = ns.textures.logo, - titleLogo = true, - initialize = function(canvas) - --Panel: Shortcuts - wt.CreatePanel({ - parent = canvas, - name = "Shortcuts", - title = ns.strings.options.main.shortcuts.title, - description = ns.strings.options.main.shortcuts.description:gsub("#ADDON", addonTitle), - arrange = {}, - initialize = CreateOptionsShortcuts, - arrangement = {} - }) - - --Panel: About - wt.CreatePanel({ - parent = canvas, - name = "About", - title = ns.strings.options.main.about.title, - description = ns.strings.options.main.about.description:gsub("#ADDON", addonTitle), - arrange = {}, - size = { height = 258 }, - initialize = CreateAboutInfo, - arrangement = { - flip = true, - resize = false - } - }) - - --Panel: Sponsors - local top = GetAddOnMetadata(addonNameSpace, "X-TopSponsors") - local normal = GetAddOnMetadata(addonNameSpace, "X-Sponsors") - if top or normal then - local sponsorsPanel = wt.CreatePanel({ +local function CreateMainOptions() + ---@type optionsPage + frames.options.main.page = wt.CreateOptionsCategory({ + addon = addonNameSpace, + name = "Main", + description = ns.strings.options.main.description:gsub("#ADDON", addonTitle), + logo = ns.textures.logo, + titleLogo = true, + initialize = function(canvas) + --Panel: Shortcuts + wt.CreatePanel({ parent = canvas, - name = "Sponsors", - title = ns.strings.options.main.sponsors.title, - description = ns.strings.options.main.sponsors.description, + name = "Shortcuts", + title = ns.strings.options.main.shortcuts.title, + description = ns.strings.options.main.shortcuts.description:gsub("#ADDON", addonTitle), arrange = {}, - size = { height = 64 + (top and normal and 24 or 0) }, - initialize = function(panel) - if top then - wt.CreateText({ - parent = panel, - name = "Top", - position = { offset = { x = 16, y = -33 } }, - width = panel:GetWidth() - 32, - text = top:gsub("|", " • "), - font = "GameFontNormalLarge", - justify = { h = "LEFT", }, - }) - end - if normal then - wt.CreateText({ - parent = panel, - name = "Normal", - position = { offset = { x = 16, y = -33 -(top and 24 or 0) } }, - width = panel:GetWidth() - 32, - text = normal:gsub("|", " • "), - font = "GameFontHighlightMedium", - justify = { h = "LEFT", }, - }) - end - end, + initialize = CreateOptionsShortcuts, + arrangement = {} }) - wt.CreateText({ - parent = sponsorsPanel, - name = "DescriptionHeart", - position = { offset = { x = _G[sponsorsPanel:GetName() .. "Description"]:GetStringWidth() + 16, y = -10 } }, - text = "♥", - font = "ChatFontSmall", - justify = { h = "LEFT", }, + + --Panel: About + wt.CreatePanel({ + parent = canvas, + name = "About", + title = ns.strings.options.main.about.title, + description = ns.strings.options.main.about.description:gsub("#ADDON", addonTitle), + arrange = {}, + size = { height = 258 }, + initialize = CreateAboutInfo, + arrangement = { + flip = true, + resize = false + } }) - end - end, - arrangement = {} -}) end + + --Panel: Sponsors + local top = GetAddOnMetadata(addonNameSpace, "X-TopSponsors") + local normal = GetAddOnMetadata(addonNameSpace, "X-Sponsors") + if top or normal then + local sponsorsPanel = wt.CreatePanel({ + parent = canvas, + name = "Sponsors", + title = ns.strings.options.main.sponsors.title, + description = ns.strings.options.main.sponsors.description, + arrange = {}, + size = { height = 64 + (top and normal and 24 or 0) }, + initialize = function(panel) + if top then + wt.CreateText({ + parent = panel, + name = "Top", + position = { offset = { x = 16, y = -33 } }, + width = panel:GetWidth() - 32, + text = top:gsub("|", " • "), + font = "GameFontNormalLarge", + justify = { h = "LEFT", }, + }) + end + if normal then + wt.CreateText({ + parent = panel, + name = "Normal", + position = { offset = { x = 16, y = -33 -(top and 24 or 0) } }, + width = panel:GetWidth() - 32, + text = normal:gsub("|", " • "), + font = "GameFontHighlightMedium", + justify = { h = "LEFT", }, + }) + end + end, + }) + wt.CreateText({ + parent = sponsorsPanel, + name = "DescriptionHeart", + position = { offset = { x = _G[sponsorsPanel:GetName() .. "Description"]:GetStringWidth() + 16, y = -10 } }, + text = "♥", + font = "ChatFontSmall", + justify = { h = "LEFT", }, + }) + end + end, + arrangement = {} + }) +end --[ Speed Display ] --Create the widgets local function CreateVisibilityOptions(panel) --Checkbox: Hidden + ---@type checkbox frames.options.speedDisplays.visibility.hidden = wt.CreateCheckbox({ parent = panel, name = "Hidden", @@ -933,6 +941,7 @@ local function CreateVisibilityOptions(panel) }) --Checkbox: Auto-hide toggle + ---@type checkbox frames.options.speedDisplays.visibility.autoHide = wt.CreateCheckbox({ parent = panel, name = "AutoHide", @@ -948,6 +957,7 @@ local function CreateVisibilityOptions(panel) }) --Checkbox: Status notice + ---@type checkbox frames.options.speedDisplays.visibility.status = wt.CreateCheckbox({ parent = panel, name = "StatusNotice", @@ -969,6 +979,7 @@ local function CreatePositionOptions(panel) presetItems[i].title = presets[i].name presetItems[i].onSelect = function() ApplyPreset(i) end end + ---@type dropdown frames.options.speedDisplays.position.presets = wt.CreateDropdown({ parent = panel, name = "ApplyPreset", @@ -1035,6 +1046,7 @@ local function CreatePositionOptions(panel) }) --Selector: Anchor point + ---@type specialSelector frames.options.speedDisplays.position.anchor = wt.CreateSpecialSelector({ parent = panel, name = "AnchorPoint", @@ -1054,6 +1066,7 @@ local function CreatePositionOptions(panel) }) --Slider: X offset + ---@type slider frames.options.speedDisplays.position.xOffset = wt.CreateSlider({ parent = panel, name = "OffsetX", @@ -1076,6 +1089,7 @@ local function CreatePositionOptions(panel) }) --Slider: Y offset + ---@type slider frames.options.speedDisplays.position.yOffset = wt.CreateSlider({ parent = panel, name = "OffsetY", @@ -1098,6 +1112,7 @@ local function CreatePositionOptions(panel) }) --Selector: Frame strata + ---@type specialSelector frames.options.speedDisplays.position.frameStrata = wt.CreateSpecialSelector({ parent = panel, name = "FrameStrata", @@ -1118,6 +1133,7 @@ local function CreatePositionOptions(panel) end local function CreatePlayerSpeedOptions(panel) --Checkbox: Throttle + ---@type checkbox frames.options.playerSpeed.throttle = wt.CreateCheckbox({ parent = panel, name = "Throttle", @@ -1137,6 +1153,7 @@ local function CreatePlayerSpeedOptions(panel) }) --Slider: Frequency + ---@type slider frames.options.playerSpeed.frequency = wt.CreateSlider({ parent = panel, name = "Frequency", @@ -1144,6 +1161,7 @@ local function CreatePlayerSpeedOptions(panel) tooltip = { lines = { { text = ns.strings.options.speedDisplay.update.frequency.tooltip, }, } }, arrange = { newRow = false, }, value = { min = 0.05, max = 1, increment = 0.05 }, + altStep = 0.2, dependencies = { { frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end }, { frame = frames.options.playerSpeed.throttle }, @@ -1182,6 +1200,7 @@ local function CreateSpeedValueOptions(panel) }) --Slider: Fractionals + ---@type slider frames.options.speedDisplays.value.fractionals = wt.CreateSlider({ parent = panel, name = "Fractionals", @@ -1199,6 +1218,7 @@ local function CreateSpeedValueOptions(panel) }) --Checkbox: No trim + ---@type checkbox frames.options.speedDisplays.value.noTrim = wt.CreateCheckbox({ parent = panel, name = "NoTrim", @@ -1230,6 +1250,7 @@ local function CreateFontOptions(panel) } or nil), } end + ---@type dropdown frames.options.speedDisplays.font.family = wt.CreateDropdown({ parent = panel, name = "Family", @@ -1278,6 +1299,7 @@ local function CreateFontOptions(panel) end --Slider: Font size + ---@type slider frames.options.speedDisplays.font.size = wt.CreateSlider({ parent = panel, name = "Size", @@ -1285,6 +1307,7 @@ local function CreateFontOptions(panel) tooltip = { lines = { { text = ns.strings.options.speedDisplay.font.size.tooltip .. "\n\n" .. ns.strings.misc.default .. ": " .. dbDefault.speedDisplay.font.size, }, } }, arrange = { newRow = false, }, value = { min = 8, max = 64, increment = 1 }, + altStep = 3, dependencies = { { frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end }, }, optionsData = { optionsKey = addonNameSpace .. "SpeedDisplays", @@ -1298,6 +1321,7 @@ local function CreateFontOptions(panel) }) --Selector: Text alignment + ---@type specialSelector frames.options.speedDisplays.font.alignment = wt.CreateSpecialSelector({ parent = panel, name = "Alignment", @@ -1320,6 +1344,7 @@ local function CreateFontOptions(panel) }) --Checkbox: Value coloring + ---@type checkbox frames.options.speedDisplays.font.valueColoring = wt.CreateCheckbox({ parent = panel, name = "ValueColoring", @@ -1339,6 +1364,7 @@ local function CreateFontOptions(panel) }) --Color Picker: Font color + ---@type colorPicker frames.options.speedDisplays.font.color = wt.CreateColorPicker({ parent = panel, name = "Color", @@ -1359,6 +1385,7 @@ local function CreateFontOptions(panel) end local function CreateBackgroundOptions(panel) --Checkbox: Visible + ---@type checkbox frames.options.speedDisplays.background.visible = wt.CreateCheckbox({ parent = panel, name = "Visible", @@ -1378,6 +1405,7 @@ local function CreateBackgroundOptions(panel) }) --Color Picker: Background color + ---@type colorPicker frames.options.speedDisplays.background.colors.bg = wt.CreateColorPicker({ parent = panel, name = "Color", @@ -1399,6 +1427,7 @@ local function CreateBackgroundOptions(panel) }) --Color Picker: Border color + ---@type colorPicker frames.options.speedDisplays.background.colors.border = wt.CreateColorPicker({ parent = panel, name = "BorderColor", @@ -1423,120 +1452,124 @@ local function CreateBackgroundOptions(panel) end --Create the category page -local function CreateSpeedDisplayOptions() frames.options.speedDisplays.page = wt.CreateOptionsCategory({ - parent = frames.options.main.page.category, - addon = addonNameSpace, - name = "SpeedDisplays", - title = ns.strings.options.speedDisplay.title, - description = ns.strings.options.speedDisplay.description:gsub("#ADDON", addonTitle), - logo = ns.textures.logo, - scroll = { speed = 114, }, - optionsKeys = { addonNameSpace .. "SpeedDisplays" }, - storage = { - { - workingTable = dbc, - storageTable = MovementSpeedDBC, - defaultsTable = dbcDefault, - }, - { - workingTable = db.playerSpeed, - storageTable = MovementSpeedDB.playerSpeed, - defaultsTable = dbDefault.playerSpeed, - }, - { - workingTable = db.speedDisplay, - storageTable = MovementSpeedDB.speedDisplay, - defaultsTable = dbDefault.speedDisplay, +local function CreateSpeedDisplayOptions() + ---@type optionsPage + frames.options.speedDisplays.page = wt.CreateOptionsCategory({ + parent = frames.options.main.page.category, + addon = addonNameSpace, + name = "SpeedDisplays", + title = ns.strings.options.speedDisplay.title, + description = ns.strings.options.speedDisplay.description:gsub("#ADDON", addonTitle), + logo = ns.textures.logo, + scroll = { speed = 114, }, + optionsKeys = { addonNameSpace .. "SpeedDisplays" }, + storage = { + { + workingTable = dbc, + storageTable = MovementSpeedDBC, + defaultsTable = dbcDefault, + }, + { + workingTable = db.playerSpeed, + storageTable = MovementSpeedDB.playerSpeed, + defaultsTable = dbDefault.playerSpeed, + }, + { + workingTable = db.speedDisplay, + storageTable = MovementSpeedDB.speedDisplay, + defaultsTable = dbDefault.speedDisplay, + }, }, - }, - onSave = function() MovementSpeedDB = wt.Clone(db) end, - onDefault = function(user) - ResetCustomPreset() - if not user then return end + onSave = function() MovementSpeedDB = wt.Clone(db) end, + onDefault = function(user) + ResetCustomPreset() + if not user then return end - --Notification - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.reset.response:gsub( - "#CUSTOM", wt.Color(presets[1].name, ns.colors.green[2]) - ), ns.colors.yellow[2])) - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( - "#CATEGORY", wt.Color(ns.strings.options.speedDisplay.title, ns.colors.green[2]) - ), ns.colors.yellow[2])) - end, - initialize = function(canvas) - --Panel: Visibility - wt.CreatePanel({ - parent = canvas, - name = "Visibility", - title = ns.strings.options.speedDisplay.visibility.title, - description = ns.strings.options.speedDisplay.visibility.description:gsub("#ADDON", addonTitle), - arrange = {}, - initialize = CreateVisibilityOptions, - arrangement = {} - }) + --Notification + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.reset.response:gsub( + "#CUSTOM", wt.Color(presets[1].name, ns.colors.green[2]) + ), ns.colors.yellow[2])) + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( + "#CATEGORY", wt.Color(ns.strings.options.speedDisplay.title, ns.colors.green[2]) + ), ns.colors.yellow[2])) + end, + initialize = function(canvas) + --Panel: Visibility + wt.CreatePanel({ + parent = canvas, + name = "Visibility", + title = ns.strings.options.speedDisplay.visibility.title, + description = ns.strings.options.speedDisplay.visibility.description:gsub("#ADDON", addonTitle), + arrange = {}, + initialize = CreateVisibilityOptions, + arrangement = {} + }) - --Panel: Position - wt.CreatePanel({ - parent = canvas, - name = "Position", - title = ns.strings.options.speedDisplay.position.title, - description = ns.strings.options.speedDisplay.position.description, - arrange = {}, - initialize = CreatePositionOptions, - arrangement = {} - }) + --Panel: Position + wt.CreatePanel({ + parent = canvas, + name = "Position", + title = ns.strings.options.speedDisplay.position.title, + description = ns.strings.options.speedDisplay.position.description, + arrange = {}, + initialize = CreatePositionOptions, + arrangement = {} + }) - --Panel: Player Speed - wt.CreatePanel({ - parent = canvas, - name = "PlayerSpeed", - title = ns.strings.options.speedDisplay.playerSpeed.title, - description = ns.strings.options.speedDisplay.playerSpeed.description, - arrange = {}, - initialize = CreatePlayerSpeedOptions, - arrangement = {} - }) + --Panel: Player Speed + wt.CreatePanel({ + parent = canvas, + name = "PlayerSpeed", + title = ns.strings.options.speedDisplay.playerSpeed.title, + description = ns.strings.options.speedDisplay.playerSpeed.description, + arrange = {}, + initialize = CreatePlayerSpeedOptions, + arrangement = {} + }) - --Panel: Value - wt.CreatePanel({ - parent = canvas, - name = "Value", - title = ns.strings.options.speedValue.title, - description = ns.strings.options.speedValue.description, - arrange = {}, - initialize = CreateSpeedValueOptions, - arrangement = {} - }) + --Panel: Value + wt.CreatePanel({ + parent = canvas, + name = "Value", + title = ns.strings.options.speedValue.title, + description = ns.strings.options.speedValue.description, + arrange = {}, + initialize = CreateSpeedValueOptions, + arrangement = {} + }) - --Panel: Font - wt.CreatePanel({ - parent = canvas, - name = "Font", - title = ns.strings.options.speedDisplay.font.title, - description = ns.strings.options.speedDisplay.font.description, - arrange = {}, - initialize = CreateFontOptions, - arrangement = {} - }) + --Panel: Font + wt.CreatePanel({ + parent = canvas, + name = "Font", + title = ns.strings.options.speedDisplay.font.title, + description = ns.strings.options.speedDisplay.font.description, + arrange = {}, + initialize = CreateFontOptions, + arrangement = {} + }) - --Panel: Background - wt.CreatePanel({ - parent = canvas, - name = "Background", - title = ns.strings.options.speedDisplay.background.title, - description = ns.strings.options.speedDisplay.background.description:gsub("#ADDON", addonTitle), - arrange = {}, - initialize = CreateBackgroundOptions, - arrangement = {} - }) - end, - arrangement = {} -}) end + --Panel: Background + wt.CreatePanel({ + parent = canvas, + name = "Background", + title = ns.strings.options.speedDisplay.background.title, + description = ns.strings.options.speedDisplay.background.description:gsub("#ADDON", addonTitle), + arrange = {}, + initialize = CreateBackgroundOptions, + arrangement = {} + }) + end, + arrangement = {} + }) +end --[ Target Speed ] --Create the widgets local function CreateTargetSpeedTooltipOptions(panel) --Checkbox: Enabled + ---@type checkbox frames.options.targetSpeed.enabled = wt.CreateCheckbox({ parent = panel, name = "Enabled", @@ -1571,6 +1604,7 @@ local function CreateTargetSpeedValueOptions(panel) }) --Slider: Fractionals + ---@type slider frames.options.targetSpeed.value.fractionals = wt.CreateSlider({ parent = panel, name = "Fractionals", @@ -1587,6 +1621,7 @@ local function CreateTargetSpeedValueOptions(panel) }) --Checkbox: No trim + ---@type checkbox frames.options.targetSpeed.value.noTrim = wt.CreateCheckbox({ parent = panel, name = "NoTrim", @@ -1604,52 +1639,55 @@ local function CreateTargetSpeedValueOptions(panel) end --Create the category page -local function CreateTargetSpeedOptions() frames.options.targetSpeed.page = wt.CreateOptionsCategory({ - parent = frames.options.main.page.category, - addon = addonNameSpace, - name = "TargetSpeed", - title = ns.strings.options.targetSpeed.title, - 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, - }, }, - onDefault = function(user) - if not user then return end - - --Notification - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( - "#CATEGORY", wt.Color(ns.strings.options.targetSpeed.title, ns.colors.green[2]) - ), ns.colors.yellow[2])) - end, - initialize = function(canvas) - --Panel: Tooltip integration - wt.CreatePanel({ - parent = canvas, - name = "TargetSpeed", - title = ns.strings.options.targetSpeed.mouseover.title, - description = ns.strings.options.targetSpeed.mouseover.description, - arrange = {}, - initialize = CreateTargetSpeedTooltipOptions, - arrangement = {} - }) +local function CreateTargetSpeedOptions() + ---@type optionsPage + frames.options.targetSpeed.page = wt.CreateOptionsCategory({ + parent = frames.options.main.page.category, + addon = addonNameSpace, + name = "TargetSpeed", + title = ns.strings.options.targetSpeed.title, + 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, + }, }, + onDefault = function(user) + if not user then return end - --Panel: Value - wt.CreatePanel({ - parent = canvas, - name = "Value", - title = ns.strings.options.speedValue.title, - description = ns.strings.options.speedValue.description, - arrange = {}, - initialize = CreateTargetSpeedValueOptions, - arrangement = {} - }) - end, - arrangement = {} -}) end + --Notification + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( + "#CATEGORY", wt.Color(ns.strings.options.targetSpeed.title, ns.colors.green[2]) + ), ns.colors.yellow[2])) + end, + initialize = function(canvas) + --Panel: Tooltip integration + wt.CreatePanel({ + parent = canvas, + name = "TargetSpeed", + title = ns.strings.options.targetSpeed.mouseover.title, + description = ns.strings.options.targetSpeed.mouseover.description, + arrange = {}, + initialize = CreateTargetSpeedTooltipOptions, + arrangement = {} + }) + + --Panel: Value + wt.CreatePanel({ + parent = canvas, + name = "Value", + title = ns.strings.options.speedValue.title, + description = ns.strings.options.speedValue.description, + arrange = {}, + initialize = CreateTargetSpeedValueOptions, + arrangement = {} + }) + end, + arrangement = {} + }) +end --[ Advanced ] @@ -1712,6 +1750,7 @@ local function CreateBackupOptions(panel) }) --Checkbox: Compact + ---@type checkbox frames.options.advanced.backup.compact = wt.CreateCheckbox({ parent = panel, name = "Compact", @@ -1768,57 +1807,60 @@ local function CreateBackupOptions(panel) end --Create the category page -local function CreateAdvancedOptions() frames.options.advanced.page = wt.CreateOptionsCategory({ - parent = frames.options.main.page.category, - addon = addonNameSpace, - name = "Advanced", - title = ns.strings.options.advanced.title, - description = ns.strings.options.advanced.description:gsub("#ADDON", addonTitle), - logo = ns.textures.logo, - optionsKeys = { addonNameSpace .. "Advanced" }, - onDefault = function() - ResetCustomPreset() - - --Notification - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.reset.response:gsub( - "#CUSTOM", wt.Color(presets[1].name, ns.colors.green[2]) - ), ns.colors.yellow[2])) - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( - "#CATEGORY", wt.Color(ns.strings.options.speedDisplay.title, ns.colors.green[2]) - ), ns.colors.yellow[2])) - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( - "#CATEGORY", wt.Color(ns.strings.options.targetSpeed.title, ns.colors.green[2]) - ), ns.colors.yellow[2])) - end, - initialize = function(canvas) - --Panel: Profiles - wt.CreatePanel({ - parent = canvas, - name = "Profiles", - title = ns.strings.options.advanced.profiles.title, - description = ns.strings.options.advanced.profiles.description:gsub("#ADDON", addonTitle), - arrange = {}, - size = { height = 64 }, - initialize = CreateOptionsProfiles, - }) +local function CreateAdvancedOptions() + ---@type optionsPage + frames.options.advanced.page = wt.CreateOptionsCategory({ + parent = frames.options.main.page.category, + addon = addonNameSpace, + name = "Advanced", + title = ns.strings.options.advanced.title, + description = ns.strings.options.advanced.description:gsub("#ADDON", addonTitle), + logo = ns.textures.logo, + optionsKeys = { addonNameSpace .. "Advanced" }, + onDefault = function() + ResetCustomPreset() - --Panel: Backup - wt.CreatePanel({ - parent = canvas, - name = "Backup", - title = ns.strings.options.advanced.backup.title, - description = ns.strings.options.advanced.backup.description:gsub("#ADDON", addonTitle), - arrange = {}, - size = { height = canvas:GetHeight() - 200 }, - initialize = CreateBackupOptions, - arrangement = { - flip = true, - resize = false - } - }) - end, - arrangement = {} -}) end + --Notification + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.reset.response:gsub( + "#CUSTOM", wt.Color(presets[1].name, ns.colors.green[2]) + ), ns.colors.yellow[2])) + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( + "#CATEGORY", wt.Color(ns.strings.options.speedDisplay.title, ns.colors.green[2]) + ), ns.colors.yellow[2])) + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( + "#CATEGORY", wt.Color(ns.strings.options.targetSpeed.title, ns.colors.green[2]) + ), ns.colors.yellow[2])) + end, + initialize = function(canvas) + --Panel: Profiles + wt.CreatePanel({ + parent = canvas, + name = "Profiles", + title = ns.strings.options.advanced.profiles.title, + description = ns.strings.options.advanced.profiles.description:gsub("#ADDON", addonTitle), + arrange = {}, + size = { height = 64 }, + initialize = CreateOptionsProfiles, + }) + + --Panel: Backup + wt.CreatePanel({ + parent = canvas, + name = "Backup", + title = ns.strings.options.advanced.backup.title, + description = ns.strings.options.advanced.backup.description:gsub("#ADDON", addonTitle), + arrange = {}, + size = { height = canvas:GetHeight() - 200 }, + initialize = CreateBackupOptions, + arrangement = { + flip = true, + resize = false + } + }) + end, + arrangement = {} + }) +end --[[ CHAT CONTROL ]] @@ -2124,6 +2166,7 @@ end --Set up the speed display context menu local function _CreateContextMenu(parent) + ---@type contextMenu local contextMenu = wt.CreateContextMenu({ parent = parent, }) --[ Items ] @@ -2246,7 +2289,7 @@ frames.main = wt.CreateFrame({ --Tooltip wt.AddTooltip(display, { tooltip = ns.tooltip, - title = ns.strings.playerSpeed.title, + title = ns.strings.speedTooltip.title:gsub("#SPEED", ns.strings.options.speedDisplay.playerSpeed.title), anchor = "ANCHOR_BOTTOMRIGHT", offset = { y = display:GetHeight() }, flipColors = true diff --git a/MovementSpeed/Main_WotLK.lua b/MovementSpeed/Main_WotLK.lua index 2ec697c..ecd2ac4 100644 --- a/MovementSpeed/Main_WotLK.lua +++ b/MovementSpeed/Main_WotLK.lua @@ -84,7 +84,7 @@ local presets = { }, }, { - name = ns.strings.options.speedDisplay.position.presets.classicList[1], --Under Minimap Clock + name = ns.strings.options.speedDisplay.position.presets.list[1], --Under Minimap data = { position = { anchor = "TOPRIGHT", @@ -235,16 +235,16 @@ local function CheckDBs(dbCheck, dbSample, dbcCheck, dbcSample) }) --Convert value type units - dbCheck.speedDisplay.value.units = { + if type(dbCheck.speedDisplay.value.units) == "number" then dbCheck.speedDisplay.value.units = { dbCheck.speedDisplay.value.units == 0 or dbCheck.speedDisplay.value.units == 2, dbCheck.speedDisplay.value.units == 1 or dbCheck.speedDisplay.value.units == 2, false - } - dbCheck.targetSpeed.value.units = { + } end + if type(dbCheck.targetSpeed.value.units) == "number" then dbCheck.targetSpeed.value.units = { dbCheck.targetSpeed.value.units == 0 or dbCheck.targetSpeed.value.units == 2, dbCheck.targetSpeed.value.units == 1 or dbCheck.targetSpeed.value.units == 2, false - } + } end end --[ Speed Update ] @@ -280,7 +280,7 @@ local function UpdateSpeedText(template, units) "#YARDS", wt.Color("#YARDS", ns.colors.yellow[2]) ), ns.colors.yellow[1]) end - speedText[template] = speedText[template]:sub(#ns.strings.speedValue.separator + 1) + speedText[template] = speedText[template]:sub(#ns.strings.speedValue.separator) end --[ Speed Displays ] @@ -361,18 +361,21 @@ local function ApplyPreset(i) wt.SetPosition(frames.main, presets[i].data.position) frames.main:SetFrameStrata(presets[i].data.layer.strata) - --Update the options widgets - frames.options.speedDisplays.visibility.hidden.setState(false) - frames.options.speedDisplays.visibility.hidden:SetAttribute("loaded", true) --Update dependent widgets - frames.options.speedDisplays.position.anchor.setSelected(presets[i].data.position.anchor) - frames.options.speedDisplays.position.xOffset.setValue(presets[i].data.position.offset.x) - frames.options.speedDisplays.position.yOffset.setValue(presets[i].data.position.offset.y) - frames.options.speedDisplays.position.frameStrata.setSelected(presets[i].data.layer.strata) + --Convert to absolute position + wt.ConvertToAbsolutePosition(frames.main) --Update the DBs dbc.hidden = false - wt.CopyValues(presets[i].data.position, db.speedDisplay.position) + wt.CopyValues(wt.PackPosition(frames.main:GetPoint()), db.speedDisplay.position) db.speedDisplay.layer.strata = presets[i].data.layer.strata + + --Update the options widgets + frames.options.speedDisplays.visibility.hidden.setState(false) + frames.options.speedDisplays.visibility.hidden:SetAttribute("loaded", true) --Update dependent widgets + frames.options.speedDisplays.position.anchor.setSelected(db.speedDisplay.position.anchor) + frames.options.speedDisplays.position.xOffset.setValue(db.speedDisplay.position.offset.x) + frames.options.speedDisplays.position.yOffset.setValue(db.speedDisplay.position.offset.y) + frames.options.speedDisplays.position.frameStrata.setSelected(db.speedDisplay.layer.strata) end --Save the current display position & visibility to the custom preset @@ -411,7 +414,8 @@ end --- - **wrap**? boolean *optional* ― Allow this line to be wrapped | ***Default:*** true local function GetSpeedDisplayTooltipLines(type) return { - { text = ns.strings[type .. "Speed"].text, }, + { text = ns.strings.speedTooltip.description }, + { text = ns.strings.speedTooltip[type .. "Speed"], }, { text = "\n" .. ns.strings.speedTooltip.text[1]:gsub("#YARDS", wt.Color(wt.FormatThousands(speed[type].yards, 2, true), ns.colors.yellow[2])), font = GameTooltipText, @@ -830,93 +834,97 @@ local function CreateAboutInfo(panel) end --Create the category page -local function CreateMainOptions() frames.options.main.page = wt.CreateOptionsCategory({ - addon = addonNameSpace, - name = "Main", - description = ns.strings.options.main.description:gsub("#ADDON", addonTitle), - logo = ns.textures.logo, - titleLogo = true, - initialize = function(canvas) - --Panel: Shortcuts - -- wt.CreatePanel({ --FIXME: Reinstate once opening settings subcategories programmatically is once again supported in Dragonflight - -- parent = canvas, - -- name = "Shortcuts", - -- title = ns.strings.options.main.shortcuts.title, - -- description = ns.strings.options.main.shortcuts.description:gsub("#ADDON", addonTitle), - -- arrange = {}, - -- initialize = CreateOptionsShortcuts, - -- arrangement = {} - -- }) - - --Panel: About - wt.CreatePanel({ - parent = canvas, - name = "About", - title = ns.strings.options.main.about.title, - description = ns.strings.options.main.about.description:gsub("#ADDON", addonTitle), - arrange = {}, - size = { height = 258 }, - initialize = CreateAboutInfo, - arrangement = { - flip = true, - resize = false - } - }) - - --Panel: Sponsors - local top = GetAddOnMetadata(addonNameSpace, "X-TopSponsors") - local normal = GetAddOnMetadata(addonNameSpace, "X-Sponsors") - if top or normal then - local sponsorsPanel = wt.CreatePanel({ +local function CreateMainOptions() + ---@type optionsPage + frames.options.main.page = wt.CreateOptionsCategory({ + addon = addonNameSpace, + name = "Main", + description = ns.strings.options.main.description:gsub("#ADDON", addonTitle), + logo = ns.textures.logo, + titleLogo = true, + initialize = function(canvas) + --Panel: Shortcuts + -- wt.CreatePanel({ --FIXME: Reinstate once opening settings subcategories programmatically is once again supported in Dragonflight + -- parent = canvas, + -- name = "Shortcuts", + -- title = ns.strings.options.main.shortcuts.title, + -- description = ns.strings.options.main.shortcuts.description:gsub("#ADDON", addonTitle), + -- arrange = {}, + -- initialize = CreateOptionsShortcuts, + -- arrangement = {} + -- }) + + --Panel: About + wt.CreatePanel({ parent = canvas, - name = "Sponsors", - title = ns.strings.options.main.sponsors.title, - description = ns.strings.options.main.sponsors.description, + name = "About", + title = ns.strings.options.main.about.title, + description = ns.strings.options.main.about.description:gsub("#ADDON", addonTitle), arrange = {}, - size = { height = 64 + (top and normal and 24 or 0) }, - initialize = function(panel) - if top then - wt.CreateText({ - parent = panel, - name = "Top", - position = { offset = { x = 16, y = -33 } }, - width = panel:GetWidth() - 32, - text = top:gsub("|", " • "), - font = "GameFontNormalLarge", - justify = { h = "LEFT", }, - }) - end - if normal then - wt.CreateText({ - parent = panel, - name = "Normal", - position = { offset = { x = 16, y = -33 -(top and 24 or 0) } }, - width = panel:GetWidth() - 32, - text = normal:gsub("|", " • "), - font = "GameFontHighlightMedium", - justify = { h = "LEFT", }, - }) - end - end, - }) - wt.CreateText({ - parent = sponsorsPanel, - name = "DescriptionHeart", - position = { offset = { x = _G[sponsorsPanel:GetName() .. "Description"]:GetStringWidth() + 16, y = -10 } }, - text = "♥", - font = "ChatFontSmall", - justify = { h = "LEFT", }, + size = { height = 258 }, + initialize = CreateAboutInfo, + arrangement = { + flip = true, + resize = false + } }) - end - end, - arrangement = {} -}) end + + --Panel: Sponsors + local top = GetAddOnMetadata(addonNameSpace, "X-TopSponsors") + local normal = GetAddOnMetadata(addonNameSpace, "X-Sponsors") + if top or normal then + local sponsorsPanel = wt.CreatePanel({ + parent = canvas, + name = "Sponsors", + title = ns.strings.options.main.sponsors.title, + description = ns.strings.options.main.sponsors.description, + arrange = {}, + size = { height = 64 + (top and normal and 24 or 0) }, + initialize = function(panel) + if top then + wt.CreateText({ + parent = panel, + name = "Top", + position = { offset = { x = 16, y = -33 } }, + width = panel:GetWidth() - 32, + text = top:gsub("|", " • "), + font = "GameFontNormalLarge", + justify = { h = "LEFT", }, + }) + end + if normal then + wt.CreateText({ + parent = panel, + name = "Normal", + position = { offset = { x = 16, y = -33 -(top and 24 or 0) } }, + width = panel:GetWidth() - 32, + text = normal:gsub("|", " • "), + font = "GameFontHighlightMedium", + justify = { h = "LEFT", }, + }) + end + end, + }) + wt.CreateText({ + parent = sponsorsPanel, + name = "DescriptionHeart", + position = { offset = { x = _G[sponsorsPanel:GetName() .. "Description"]:GetStringWidth() + 16, y = -10 } }, + text = "♥", + font = "ChatFontSmall", + justify = { h = "LEFT", }, + }) + end + end, + arrangement = {} + }) +end --[ Speed Display ] --Create the widgets local function CreateVisibilityOptions(panel) --Checkbox: Hidden + ---@type checkbox frames.options.speedDisplays.visibility.hidden = wt.CreateCheckbox({ parent = panel, name = "Hidden", @@ -932,6 +940,7 @@ local function CreateVisibilityOptions(panel) }) --Checkbox: Auto-hide toggle + ---@type checkbox frames.options.speedDisplays.visibility.autoHide = wt.CreateCheckbox({ parent = panel, name = "AutoHide", @@ -947,6 +956,7 @@ local function CreateVisibilityOptions(panel) }) --Checkbox: Status notice + ---@type checkbox frames.options.speedDisplays.visibility.status = wt.CreateCheckbox({ parent = panel, name = "StatusNotice", @@ -968,6 +978,7 @@ local function CreatePositionOptions(panel) presetItems[i].title = presets[i].name presetItems[i].onSelect = function() ApplyPreset(i) end end + ---@type dropdown frames.options.speedDisplays.position.presets = wt.CreateDropdown({ parent = panel, name = "ApplyPreset", @@ -1034,6 +1045,7 @@ local function CreatePositionOptions(panel) }) --Selector: Anchor point + ---@type specialSelector frames.options.speedDisplays.position.anchor = wt.CreateSpecialSelector({ parent = panel, name = "AnchorPoint", @@ -1053,6 +1065,7 @@ local function CreatePositionOptions(panel) }) --Slider: X offset + ---@type slider frames.options.speedDisplays.position.xOffset = wt.CreateSlider({ parent = panel, name = "OffsetX", @@ -1075,6 +1088,7 @@ local function CreatePositionOptions(panel) }) --Slider: Y offset + ---@type slider frames.options.speedDisplays.position.yOffset = wt.CreateSlider({ parent = panel, name = "OffsetY", @@ -1097,6 +1111,7 @@ local function CreatePositionOptions(panel) }) --Selector: Frame strata + ---@type specialSelector frames.options.speedDisplays.position.frameStrata = wt.CreateSpecialSelector({ parent = panel, name = "FrameStrata", @@ -1117,6 +1132,7 @@ local function CreatePositionOptions(panel) end local function CreatePlayerSpeedOptions(panel) --Checkbox: Throttle + ---@type checkbox frames.options.playerSpeed.throttle = wt.CreateCheckbox({ parent = panel, name = "Throttle", @@ -1136,6 +1152,7 @@ local function CreatePlayerSpeedOptions(panel) }) --Slider: Frequency + ---@type slider frames.options.playerSpeed.frequency = wt.CreateSlider({ parent = panel, name = "Frequency", @@ -1143,6 +1160,7 @@ local function CreatePlayerSpeedOptions(panel) tooltip = { lines = { { text = ns.strings.options.speedDisplay.update.frequency.tooltip, }, } }, arrange = { newRow = false, }, value = { min = 0.05, max = 1, increment = 0.05 }, + altStep = 0.2, dependencies = { { frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end }, { frame = frames.options.playerSpeed.throttle }, @@ -1181,6 +1199,7 @@ local function CreateSpeedValueOptions(panel) }) --Slider: Fractionals + ---@type slider frames.options.speedDisplays.value.fractionals = wt.CreateSlider({ parent = panel, name = "Fractionals", @@ -1198,6 +1217,7 @@ local function CreateSpeedValueOptions(panel) }) --Checkbox: No trim + ---@type checkbox frames.options.speedDisplays.value.noTrim = wt.CreateCheckbox({ parent = panel, name = "NoTrim", @@ -1229,6 +1249,7 @@ local function CreateFontOptions(panel) } or nil), } end + ---@type dropdown frames.options.speedDisplays.font.family = wt.CreateDropdown({ parent = panel, name = "Family", @@ -1277,6 +1298,7 @@ local function CreateFontOptions(panel) end --Slider: Font size + ---@type slider frames.options.speedDisplays.font.size = wt.CreateSlider({ parent = panel, name = "Size", @@ -1284,6 +1306,7 @@ local function CreateFontOptions(panel) tooltip = { lines = { { text = ns.strings.options.speedDisplay.font.size.tooltip .. "\n\n" .. ns.strings.misc.default .. ": " .. dbDefault.speedDisplay.font.size, }, } }, arrange = { newRow = false, }, value = { min = 8, max = 64, increment = 1 }, + altStep = 3, dependencies = { { frame = frames.options.speedDisplays.visibility.hidden, evaluate = function(state) return not state end }, }, optionsData = { optionsKey = addonNameSpace .. "SpeedDisplays", @@ -1297,6 +1320,7 @@ local function CreateFontOptions(panel) }) --Selector: Text alignment + ---@type specialSelector frames.options.speedDisplays.font.alignment = wt.CreateSpecialSelector({ parent = panel, name = "Alignment", @@ -1319,6 +1343,7 @@ local function CreateFontOptions(panel) }) --Checkbox: Value coloring + ---@type checkbox frames.options.speedDisplays.font.valueColoring = wt.CreateCheckbox({ parent = panel, name = "ValueColoring", @@ -1338,6 +1363,7 @@ local function CreateFontOptions(panel) }) --Color Picker: Font color + ---@type colorPicker frames.options.speedDisplays.font.color = wt.CreateColorPicker({ parent = panel, name = "Color", @@ -1358,6 +1384,7 @@ local function CreateFontOptions(panel) end local function CreateBackgroundOptions(panel) --Checkbox: Visible + ---@type checkbox frames.options.speedDisplays.background.visible = wt.CreateCheckbox({ parent = panel, name = "Visible", @@ -1377,6 +1404,7 @@ local function CreateBackgroundOptions(panel) }) --Color Picker: Background color + ---@type colorPicker frames.options.speedDisplays.background.colors.bg = wt.CreateColorPicker({ parent = panel, name = "Color", @@ -1398,6 +1426,7 @@ local function CreateBackgroundOptions(panel) }) --Color Picker: Border color + ---@type colorPicker frames.options.speedDisplays.background.colors.border = wt.CreateColorPicker({ parent = panel, name = "BorderColor", @@ -1422,120 +1451,124 @@ local function CreateBackgroundOptions(panel) end --Create the category page -local function CreateSpeedDisplayOptions() frames.options.speedDisplays.page = wt.CreateOptionsCategory({ - parent = frames.options.main.page.category, - addon = addonNameSpace, - name = "SpeedDisplays", - title = ns.strings.options.speedDisplay.title, - description = ns.strings.options.speedDisplay.description:gsub("#ADDON", addonTitle), - logo = ns.textures.logo, - scroll = { speed = 0.21 }, - optionsKeys = { addonNameSpace .. "SpeedDisplays" }, - storage = { - { - workingTable = dbc, - storageTable = MovementSpeedDBC, - defaultsTable = dbcDefault, - }, - { - workingTable = db.playerSpeed, - storageTable = MovementSpeedDB.playerSpeed, - defaultsTable = dbDefault.playerSpeed, - }, - { - workingTable = db.speedDisplay, - storageTable = MovementSpeedDB.speedDisplay, - defaultsTable = dbDefault.speedDisplay, +local function CreateSpeedDisplayOptions() + ---@type optionsPage + frames.options.speedDisplays.page = wt.CreateOptionsCategory({ + parent = frames.options.main.page.category, + addon = addonNameSpace, + name = "SpeedDisplays", + title = ns.strings.options.speedDisplay.title, + description = ns.strings.options.speedDisplay.description:gsub("#ADDON", addonTitle), + logo = ns.textures.logo, + scroll = { speed = 0.21 }, + optionsKeys = { addonNameSpace .. "SpeedDisplays" }, + storage = { + { + workingTable = dbc, + storageTable = MovementSpeedDBC, + defaultsTable = dbcDefault, + }, + { + workingTable = db.playerSpeed, + storageTable = MovementSpeedDB.playerSpeed, + defaultsTable = dbDefault.playerSpeed, + }, + { + workingTable = db.speedDisplay, + storageTable = MovementSpeedDB.speedDisplay, + defaultsTable = dbDefault.speedDisplay, + }, }, - }, - onSave = function() MovementSpeedDB = wt.Clone(db) end, - onDefault = function(user) - ResetCustomPreset() - if not user then return end + onSave = function() MovementSpeedDB = wt.Clone(db) end, + onDefault = function(user) + ResetCustomPreset() + if not user then return end - --Notification - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.reset.response:gsub( - "#CUSTOM", wt.Color(presets[1].name, ns.colors.green[2]) - ), ns.colors.yellow[2])) - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( - "#CATEGORY", wt.Color(ns.strings.options.speedDisplay.title, ns.colors.green[2]) - ), ns.colors.yellow[2])) - end, - initialize = function(canvas) - --Panel: Visibility - wt.CreatePanel({ - parent = canvas, - name = "Visibility", - title = ns.strings.options.speedDisplay.visibility.title, - description = ns.strings.options.speedDisplay.visibility.description:gsub("#ADDON", addonTitle), - arrange = {}, - initialize = CreateVisibilityOptions, - arrangement = {} - }) + --Notification + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.reset.response:gsub( + "#CUSTOM", wt.Color(presets[1].name, ns.colors.green[2]) + ), ns.colors.yellow[2])) + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( + "#CATEGORY", wt.Color(ns.strings.options.speedDisplay.title, ns.colors.green[2]) + ), ns.colors.yellow[2])) + end, + initialize = function(canvas) + --Panel: Visibility + wt.CreatePanel({ + parent = canvas, + name = "Visibility", + title = ns.strings.options.speedDisplay.visibility.title, + description = ns.strings.options.speedDisplay.visibility.description:gsub("#ADDON", addonTitle), + arrange = {}, + initialize = CreateVisibilityOptions, + arrangement = {} + }) - --Panel: Position - wt.CreatePanel({ - parent = canvas, - name = "Position", - title = ns.strings.options.speedDisplay.position.title, - description = ns.strings.options.speedDisplay.position.description, - arrange = {}, - initialize = CreatePositionOptions, - arrangement = {} - }) + --Panel: Position + wt.CreatePanel({ + parent = canvas, + name = "Position", + title = ns.strings.options.speedDisplay.position.title, + description = ns.strings.options.speedDisplay.position.description, + arrange = {}, + initialize = CreatePositionOptions, + arrangement = {} + }) - --Panel: Player Speed - wt.CreatePanel({ - parent = canvas, - name = "PlayerSpeed", - title = ns.strings.options.speedDisplay.playerSpeed.title, - description = ns.strings.options.speedDisplay.playerSpeed.description, - arrange = {}, - initialize = CreatePlayerSpeedOptions, - arrangement = {} - }) + --Panel: Player Speed + wt.CreatePanel({ + parent = canvas, + name = "PlayerSpeed", + title = ns.strings.options.speedDisplay.playerSpeed.title, + description = ns.strings.options.speedDisplay.playerSpeed.description, + arrange = {}, + initialize = CreatePlayerSpeedOptions, + arrangement = {} + }) - --Panel: Value - wt.CreatePanel({ - parent = canvas, - name = "Value", - title = ns.strings.options.speedValue.title, - description = ns.strings.options.speedValue.description, - arrange = {}, - initialize = CreateSpeedValueOptions, - arrangement = {} - }) + --Panel: Value + wt.CreatePanel({ + parent = canvas, + name = "Value", + title = ns.strings.options.speedValue.title, + description = ns.strings.options.speedValue.description, + arrange = {}, + initialize = CreateSpeedValueOptions, + arrangement = {} + }) - --Panel: Font - wt.CreatePanel({ - parent = canvas, - name = "Font", - title = ns.strings.options.speedDisplay.font.title, - description = ns.strings.options.speedDisplay.font.description, - arrange = {}, - initialize = CreateFontOptions, - arrangement = {} - }) + --Panel: Font + wt.CreatePanel({ + parent = canvas, + name = "Font", + title = ns.strings.options.speedDisplay.font.title, + description = ns.strings.options.speedDisplay.font.description, + arrange = {}, + initialize = CreateFontOptions, + arrangement = {} + }) - --Panel: Background - wt.CreatePanel({ - parent = canvas, - name = "Background", - title = ns.strings.options.speedDisplay.background.title, - description = ns.strings.options.speedDisplay.background.description:gsub("#ADDON", addonTitle), - arrange = {}, - initialize = CreateBackgroundOptions, - arrangement = {} - }) - end, - arrangement = {} -}) end + --Panel: Background + wt.CreatePanel({ + parent = canvas, + name = "Background", + title = ns.strings.options.speedDisplay.background.title, + description = ns.strings.options.speedDisplay.background.description:gsub("#ADDON", addonTitle), + arrange = {}, + initialize = CreateBackgroundOptions, + arrangement = {} + }) + end, + arrangement = {} + }) +end --[ Target Speed ] --Create the widgets local function CreateTargetSpeedTooltipOptions(panel) --Checkbox: Enabled + ---@type checkbox frames.options.targetSpeed.enabled = wt.CreateCheckbox({ parent = panel, name = "Enabled", @@ -1570,6 +1603,7 @@ local function CreateTargetSpeedValueOptions(panel) }) --Slider: Fractionals + ---@type slider frames.options.targetSpeed.value.fractionals = wt.CreateSlider({ parent = panel, name = "Fractionals", @@ -1586,6 +1620,7 @@ local function CreateTargetSpeedValueOptions(panel) }) --Checkbox: No trim + ---@type checkbox frames.options.targetSpeed.value.noTrim = wt.CreateCheckbox({ parent = panel, name = "NoTrim", @@ -1603,52 +1638,55 @@ local function CreateTargetSpeedValueOptions(panel) end --Create the category page -local function CreateTargetSpeedOptions() frames.options.targetSpeed.page = wt.CreateOptionsCategory({ - parent = frames.options.main.page.category, - addon = addonNameSpace, - name = "TargetSpeed", - title = ns.strings.options.targetSpeed.title, - 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, - }, }, - onDefault = function(user) - if not user then return end - - --Notification - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( - "#CATEGORY", wt.Color(ns.strings.options.targetSpeed.title, ns.colors.green[2]) - ), ns.colors.yellow[2])) - end, - initialize = function(canvas) - --Panel: Tooltip integration - wt.CreatePanel({ - parent = canvas, - name = "TargetSpeed", - title = ns.strings.options.targetSpeed.mouseover.title, - description = ns.strings.options.targetSpeed.mouseover.description, - arrange = {}, - initialize = CreateTargetSpeedTooltipOptions, - arrangement = {} - }) +local function CreateTargetSpeedOptions() + ---@type optionsPage + frames.options.targetSpeed.page = wt.CreateOptionsCategory({ + parent = frames.options.main.page.category, + addon = addonNameSpace, + name = "TargetSpeed", + title = ns.strings.options.targetSpeed.title, + 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, + }, }, + onDefault = function(user) + if not user then return end - --Panel: Value - wt.CreatePanel({ - parent = canvas, - name = "Value", - title = ns.strings.options.speedValue.title, - description = ns.strings.options.speedValue.description, - arrange = {}, - initialize = CreateTargetSpeedValueOptions, - arrangement = {} - }) - end, - arrangement = {} -}) end + --Notification + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( + "#CATEGORY", wt.Color(ns.strings.options.targetSpeed.title, ns.colors.green[2]) + ), ns.colors.yellow[2])) + end, + initialize = function(canvas) + --Panel: Tooltip integration + wt.CreatePanel({ + parent = canvas, + name = "TargetSpeed", + title = ns.strings.options.targetSpeed.mouseover.title, + description = ns.strings.options.targetSpeed.mouseover.description, + arrange = {}, + initialize = CreateTargetSpeedTooltipOptions, + arrangement = {} + }) + + --Panel: Value + wt.CreatePanel({ + parent = canvas, + name = "Value", + title = ns.strings.options.speedValue.title, + description = ns.strings.options.speedValue.description, + arrange = {}, + initialize = CreateTargetSpeedValueOptions, + arrangement = {} + }) + end, + arrangement = {} + }) +end --[ Advanced ] @@ -1711,6 +1749,7 @@ local function CreateBackupOptions(panel) }) --Checkbox: Compact + ---@type checkbox frames.options.advanced.backup.compact = wt.CreateCheckbox({ parent = panel, name = "Compact", @@ -1767,57 +1806,60 @@ local function CreateBackupOptions(panel) end --Create the category page -local function CreateAdvancedOptions() frames.options.advanced.page = wt.CreateOptionsCategory({ - parent = frames.options.main.page.category, - addon = addonNameSpace, - name = "Advanced", - title = ns.strings.options.advanced.title, - description = ns.strings.options.advanced.description:gsub("#ADDON", addonTitle), - logo = ns.textures.logo, - optionsKeys = { addonNameSpace .. "Advanced" }, - onDefault = function() - ResetCustomPreset() - - --Notification - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.reset.response:gsub( - "#CUSTOM", wt.Color(presets[1].name, ns.colors.green[2]) - ), ns.colors.yellow[2])) - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( - "#CATEGORY", wt.Color(ns.strings.options.speedDisplay.title, ns.colors.green[2]) - ), ns.colors.yellow[2])) - print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( - "#CATEGORY", wt.Color(ns.strings.options.targetSpeed.title, ns.colors.green[2]) - ), ns.colors.yellow[2])) - end, - initialize = function(canvas) - --Panel: Profiles - wt.CreatePanel({ - parent = canvas, - name = "Profiles", - title = ns.strings.options.advanced.profiles.title, - description = ns.strings.options.advanced.profiles.description:gsub("#ADDON", addonTitle), - arrange = {}, - size = { height = 64 }, - initialize = CreateOptionsProfiles, - }) +local function CreateAdvancedOptions() + ---@type optionsPage + frames.options.advanced.page = wt.CreateOptionsCategory({ + parent = frames.options.main.page.category, + addon = addonNameSpace, + name = "Advanced", + title = ns.strings.options.advanced.title, + description = ns.strings.options.advanced.description:gsub("#ADDON", addonTitle), + logo = ns.textures.logo, + optionsKeys = { addonNameSpace .. "Advanced" }, + onDefault = function() + ResetCustomPreset() - --Panel: Backup - wt.CreatePanel({ - parent = canvas, - name = "Backup", - title = ns.strings.options.advanced.backup.title, - description = ns.strings.options.advanced.backup.description:gsub("#ADDON", addonTitle), - arrange = {}, - size = { height = canvas:GetHeight() - 200 }, - initialize = CreateBackupOptions, - arrangement = { - flip = true, - resize = false - } - }) - end, - arrangement = {} -}) end + --Notification + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.reset.response:gsub( + "#CUSTOM", wt.Color(presets[1].name, ns.colors.green[2]) + ), ns.colors.yellow[2])) + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( + "#CATEGORY", wt.Color(ns.strings.options.speedDisplay.title, ns.colors.green[2]) + ), ns.colors.yellow[2])) + print(wt.Color(addonTitle .. ":", ns.colors.green[1]) .. " " .. wt.Color(ns.strings.chat.defaults.response:gsub( + "#CATEGORY", wt.Color(ns.strings.options.targetSpeed.title, ns.colors.green[2]) + ), ns.colors.yellow[2])) + end, + initialize = function(canvas) + --Panel: Profiles + wt.CreatePanel({ + parent = canvas, + name = "Profiles", + title = ns.strings.options.advanced.profiles.title, + description = ns.strings.options.advanced.profiles.description:gsub("#ADDON", addonTitle), + arrange = {}, + size = { height = 64 }, + initialize = CreateOptionsProfiles, + }) + + --Panel: Backup + wt.CreatePanel({ + parent = canvas, + name = "Backup", + title = ns.strings.options.advanced.backup.title, + description = ns.strings.options.advanced.backup.description:gsub("#ADDON", addonTitle), + arrange = {}, + size = { height = canvas:GetHeight() - 200 }, + initialize = CreateBackupOptions, + arrangement = { + flip = true, + resize = false + } + }) + end, + arrangement = {} + }) +end --[[ CHAT CONTROL ]] @@ -2123,6 +2165,7 @@ end --Set up the speed display context menu local function _CreateContextMenu(parent) + ---@type contextMenu local contextMenu = wt.CreateContextMenu({ parent = parent, }) --[ Items ] @@ -2227,7 +2270,7 @@ frames.main = wt.CreateFrame({ --Tooltip wt.AddTooltip(display, { tooltip = ns.tooltip, - title = ns.strings.playerSpeed.title, + title = ns.strings.speedTooltip.title:gsub("#SPEED", ns.strings.options.speedDisplay.playerSpeed.title), anchor = "ANCHOR_BOTTOMRIGHT", offset = { y = display:GetHeight() }, flipColors = true diff --git a/MovementSpeed/MovementSpeed-BCC.toc b/MovementSpeed/MovementSpeed-BCC.toc index d83eed0..d762dda 100644 --- a/MovementSpeed/MovementSpeed-BCC.toc +++ b/MovementSpeed/MovementSpeed-BCC.toc @@ -1,8 +1,8 @@ ## Interface: 20504 ## Title: Movement Speed |TInterface/AddOns/MovementSpeed/Textures/Logo.tga:0|t ## Version: 2.9 -## X-Day: 24 -## X-Month: 7 +## X-Day: 5 +## X-Month: 8 ## X-Year: 2023 ## Author: Barnabas Nagy (Arxareon) ## X-Sponsors: Celierra diff --git a/MovementSpeed/MovementSpeed-Classic.toc b/MovementSpeed/MovementSpeed-Classic.toc index 1ce8960..5005d4d 100644 --- a/MovementSpeed/MovementSpeed-Classic.toc +++ b/MovementSpeed/MovementSpeed-Classic.toc @@ -2,8 +2,8 @@ ## Title: Movement Speed |TInterface/AddOns/MovementSpeed/Textures/Logo.tga:0|t ## IconTexture: Interface/AddOns/MovementSpeed/Textures/Logo.tga ## Version: 2.9 -## X-Day: 24 -## X-Month: 7 +## X-Day: 5 +## X-Month: 8 ## X-Year: 2023 ## Author: Barnabas Nagy (Arxareon) ## X-Sponsors: Celierra diff --git a/MovementSpeed/MovementSpeed-Mainline.toc b/MovementSpeed/MovementSpeed-Mainline.toc index 0058337..8656a69 100644 --- a/MovementSpeed/MovementSpeed-Mainline.toc +++ b/MovementSpeed/MovementSpeed-Mainline.toc @@ -2,8 +2,8 @@ ## Title: Movement Speed ## IconTexture: Interface/AddOns/MovementSpeed/Textures/Logo.tga ## Version: 2.9 -## X-Day: 24 -## X-Month: 7 +## X-Day: 5 +## X-Month: 8 ## X-Year: 2023 ## Author: Barnabas Nagy (Arxareon) ## X-Sponsors: Celierra diff --git a/MovementSpeed/MovementSpeed-Wrath.toc b/MovementSpeed/MovementSpeed-Wrath.toc index 0bfe569..32a5496 100644 --- a/MovementSpeed/MovementSpeed-Wrath.toc +++ b/MovementSpeed/MovementSpeed-Wrath.toc @@ -2,8 +2,8 @@ ## Title: Movement Speed |TInterface/AddOns/MovementSpeed/Textures/Logo.tga:0|t ## IconTexture: Interface/AddOns/MovementSpeed/Textures/Logo.tga ## Version: 2.9 -## X-Day: 24 -## X-Month: 7 +## X-Day: 5 +## X-Month: 8 ## X-Year: 2023 ## Author: Barnabas Nagy (Arxareon) ## X-Sponsors: Celierra diff --git a/MovementSpeed/MovementSpeed.toc b/MovementSpeed/MovementSpeed.toc index b3bc642..9150db3 100644 --- a/MovementSpeed/MovementSpeed.toc +++ b/MovementSpeed/MovementSpeed.toc @@ -2,8 +2,8 @@ ## Title: Movement Speed ## IconTexture: Interface/AddOns/MovementSpeed/Textures/Logo.tga ## Version: 2.9 -## X-Day: 24 -## X-Month: 7 +## X-Day: 5 +## X-Month: 8 ## X-Year: 2023 ## Author: Barnabas Nagy (Arxareon) ## X-Sponsors: Celierra diff --git a/MovementSpeed/Resources.lua b/MovementSpeed/Resources.lua index 903190d..897735e 100644 --- a/MovementSpeed/Resources.lua +++ b/MovementSpeed/Resources.lua @@ -226,9 +226,11 @@ local changelogDB = { "#H_If you encounter any issues, do not hesitate to report them! Try including when & how they occur, and which other addons are you using to give me the best chance of being able to reproduce & fix them. Try proving any LUA script error messages and if you know how, taint logs as well (when relevant). Thanks a lot for helping!_#", }, { - "#V_Version 2.9_# #H_(7/24/2023)_#", + "#V_Version 2.9_# #H_(8/5/2023)_#", "#C_Changes:_#", - "Added more value step options to the other sliders as well. The default step value is now 1 for the offset values.", + "Positioning the speed displays next to other frames via Presets (like Under Minimap) will now dynamically be updated to follow those frames instead of being assigned to a static position. After you move a frame, reapply the desired now updated preset to move the display back in relation to it.", + "The Travel Speed feature (offering estimated speed values even during Dragonriding) will now be enabled by default (as a replacement when the Player Speed value is not available).", + "Added more value step options to the other sliders as well. The default step value is now 1 for the position offset values.", "The settings category page shortcuts have been removed in WotLK Classic (because the new Settings window broke the feature - I may readd them when the issue gets resolved). The shortcuts have been replaced by an Options button in the right-click menu of the speed displays.", "The custom context menus have been replaced with the basic menu until their quirks are ironed out.", "Scrolling has been improved in WotLK Classic.", @@ -370,12 +372,7 @@ local english = { presets = { label = "Apply a Preset", tooltip = "Change the position of the speed display by choosing and applying one of these presets.", - list = { - "Under Default Minimap", - }, - classicList = { - "Under Minimap Clock", - }, + list = { "Under Minimap", }, select = "Select a preset…", }, savePreset = { @@ -586,16 +583,12 @@ local english = { error = "Hold SHIFT until the mouse button is released to save the position.", }, }, - playerSpeed = { - title = "Player Speed details:", - text = "Calculated from the Speed stat, modified by various effects, movement activity.", - }, - travelSpeed = { - title = "Travel Speed details:", - text = "Calculated from tracking your horizontal movement through the world map.", - }, targetSpeed = "Speed: #SPEED", speedTooltip = { + title = "#SPEED details:", + description = "An live summary of your movement status.", + playerSpeed = "Calculated based the Speed stat, various effects & the type of movement activity.", + travelSpeed = "Calculated by tracking your horizontal movement through the current zone map.", text = { "#YARDS yards / second.", "#PERCENT of the base running speed.",