From 58644cda46561f1768a1b8f9c82340da0beb0d08 Mon Sep 17 00:00:00 2001 From: Tercio Jose Date: Tue, 23 Apr 2024 21:25:34 -0300 Subject: [PATCH] Framework update, preparing to release --- Libs/DF/auras.lua | 28 ++++++++----- Libs/DF/buildmenu.lua | 13 +++++- Libs/DF/button.lua | 18 ++++++-- Libs/DF/cooltip.lua | 6 ++- Libs/DF/definitions.lua | 11 +++-- Libs/DF/editor.lua | 87 +++++++++++++++++++++++++++++++++++---- Libs/DF/fw.lua | 62 +++++++++++++++++++++++----- Libs/DF/icon.lua | 1 + Libs/DF/icongeneric.lua | 1 + Libs/DF/keybind.lua | 13 ++++-- Libs/DF/math.lua | 7 ++++ Libs/DF/panel.lua | 47 +++++++++++++++++++-- Libs/DF/picture.lua | 2 +- Libs/DF/scrollbox.lua | 91 +++++++++++++++++++++++++++++++++++++++-- Libs/DF/textentry.lua | 16 +++++++- Libs/DF/unitframe.lua | 1 + boot.lua | 10 ++++- 17 files changed, 358 insertions(+), 56 deletions(-) diff --git a/Libs/DF/auras.lua b/Libs/DF/auras.lua index d1b88f1ed..33942382d 100644 --- a/Libs/DF/auras.lua +++ b/Libs/DF/auras.lua @@ -9,9 +9,13 @@ local detailsFramework = DF local _ local tinsert = table.insert -local GetSpellInfo = GetSpellInfo +local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end local lower = string.lower -local GetSpellBookItemInfo = GetSpellBookItemInfo +local SpellBookItemTypeMap = Enum.SpellBookItemType and {[Enum.SpellBookItemType.Spell] = "SPELL", [Enum.SpellBookItemType.None] = "NONE", [Enum.SpellBookItemType.Flyout] = "FLYOUT", [Enum.SpellBookItemType.FutureSpell] = "FUTURESPELL", [Enum.SpellBookItemType.PetAction] = "PETACTION" } or {} +local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", si.spellID end end +local SPELLBOOK_BANK_PLAYER = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Player or "player" +local GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines +local GetSpellTabInfo = GetSpellTabInfo or function(tabLine) local skillLine = C_SpellBook.GetSpellBookSkillLineInfo(tabLine) if skillLine then return skillLine.name, skillLine.iconID, skillLine.itemIndexOffset, skillLine.numSpellBookItems, skillLine.isGuild, skillLine.offSpecID end end local unpack = unpack local CreateFrame = CreateFrame local GameTooltip = GameTooltip @@ -1042,15 +1046,17 @@ end function DF:GetAllPlayerSpells(include_lower_case) local playerSpells = {} - local tab, tabTex, offset, numSpells = GetSpellTabInfo(2) - for i = 1, numSpells do - local index = offset + i - local spellType, spellId = GetSpellBookItemInfo(index, "player") - if (spellType == "SPELL") then - local spellName = GetSpellInfo(spellId) - tinsert(playerSpells, spellName) - if (include_lower_case) then - tinsert(playerSpells, lower(spellName)) + for i = 1, GetNumSpellTabs() do + local _, _, offset, numSpells = GetSpellTabInfo(i) + for i = 1, numSpells do + local index = offset + i + local spellType, spellId = GetSpellBookItemInfo(index, SPELLBOOK_BANK_PLAYER) + if (spellType == "SPELL") then + local spellName = GetSpellInfo(spellId) + tinsert(playerSpells, spellName) + if (include_lower_case) then + tinsert(playerSpells, lower(spellName)) + end end end end diff --git a/Libs/DF/buildmenu.lua b/Libs/DF/buildmenu.lua index 53378e613..c75f916cf 100644 --- a/Libs/DF/buildmenu.lua +++ b/Libs/DF/buildmenu.lua @@ -103,6 +103,14 @@ local onWidgetSetInUse = function(widget, widgetTable) widget.childrenids = widgetTable.childrenids end widget.children_follow_enabled = widgetTable.children_follow_enabled + + if (widgetTable.disabled) then + widget:Disable() + else + if (not widget:IsEnabled()) then + widget:Enable() + end + end end local setWidgetId = function(parent, widgetTable, widgetObject) @@ -367,15 +375,18 @@ local setRangeProperties = function(parent, widget, widgetTable, currentXOffset, widget.bAttachButtonsToLeft = bAttachSliderButtonsToLeft + local currentValue = widgetTable.get() + if (bIsDecimals) then widget.slider:SetValueStep(0.01) else widget.slider:SetValueStep(widgetTable.step or 1) + currentValue = math.floor(currentValue) end widget.useDecimals = bIsDecimals widget.slider:SetMinMaxValues(widgetTable.min, widgetTable.max) - widget.slider:SetValue(widgetTable.get() or 0) + widget.slider:SetValue(currentValue or 0) widget.ivalue = widget.slider:GetValue() if (widgetWidth) then diff --git a/Libs/DF/button.lua b/Libs/DF/button.lua index c5c1e4ac5..bab7eddbc 100644 --- a/Libs/DF/button.lua +++ b/Libs/DF/button.lua @@ -385,6 +385,7 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin) ---add an icon to the left of the button text ---short method truncates the text: false = do nothing, nil = increate the button width, 1 = decrease the font size, 2 = truncate the text + ---@param self table ---@param texture any ---@param width number|nil ---@param height number|nil @@ -395,7 +396,8 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin) ---@param leftPadding number|nil ---@param textHeight number|nil ---@param shortMethod any - function ButtonMetaFunctions:SetIcon(texture, width, height, layout, texcoord, overlay, textDistance, leftPadding, textHeight, shortMethod) + ---@param filterMode any + function ButtonMetaFunctions:SetIcon(texture, width, height, layout, texcoord, overlay, textDistance, leftPadding, textHeight, shortMethod, filterMode) if (not self.icon) then self.icon = self:CreateTexture(nil, "artwork") self.icon:SetSize(self.height * 0.8, self.height * 0.8) @@ -424,10 +426,10 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin) local r, g, b, a = detailsFramework:ParseColors(texture) self.icon:SetColorTexture(r, g, b, a) else - self.icon:SetTexture(texture) + self.icon:SetTexture(texture, nil, nil, filterMode) end else - self.icon:SetTexture(texture) + self.icon:SetTexture(texture, nil, nil, filterMode) end self.icon:SetSize(width or self.height * 0.8, height or self.height * 0.8) @@ -468,6 +470,13 @@ detailsFramework:Mixin(ButtonMetaFunctions, detailsFramework.ScriptHookMixin) end end + ---@param self df_button + function ButtonMetaFunctions:SetIconFilterMode(filterMode) + if (self.icon) then + self.icon:SetTexture(self.icon:GetTexture(), nil, nil, filterMode) + end + end + ---query if the button is enabled or not ---@return boolean function ButtonMetaFunctions:IsEnabled() @@ -888,6 +897,7 @@ end ---@field SetTextColor fun(self: df_button, color: any) set the button text color ---@field SetText fun(self: df_button, text: string) set the button text ---@field SetClickFunction fun(self: df_button, func: function, param1: any, param2: any, clickType: "left"|"right"|nil) + ---@field SetIconFilterMode fun(self: df_button, filterMode: any) set the filter mode for the icon, execute after SetIcon() ---create a Details Framework button ---@param parent frame @@ -1097,7 +1107,7 @@ end ---@param callback function ---@param alpha number|nil ---@param buttonTemplate table|nil - ---@return table|nil + ---@return df_colorpickbutton function detailsFramework:CreateColorPickButton(parent, name, member, callback, alpha, buttonTemplate) return detailsFramework:NewColorPickButton(parent, name, member, callback, alpha, buttonTemplate) end diff --git a/Libs/DF/cooltip.lua b/Libs/DF/cooltip.lua index 94b8e32be..0370a2c42 100644 --- a/Libs/DF/cooltip.lua +++ b/Libs/DF/cooltip.lua @@ -15,6 +15,10 @@ local wipe = table.wipe local insert = table.insert local max = math.max +local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end +local SPELLBOOK_BANK_PLAYER = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Player or "player" +local IsPassiveSpell = IsPassiveSpell or C_Spell.IsSpellPassive + --api locals local PixelUtil = PixelUtil or DFPixelUtil local version = 24 @@ -1945,7 +1949,7 @@ function DF:CreateCoolTip() local spellDescription = GetSpellDescription(spellId) local cooldownTime, globalCooldown = GetSpellBaseCooldown(spellId) --local cooldown = cooldownTime / 1000 - local bIsPassive = IsPassiveSpell(spellId, "player") + local bIsPassive = IsPassiveSpell(spellId, SPELLBOOK_BANK_PLAYER) local chargesAvailable, maxCharges, chargeCooldownStart, rechargeTime, chargeModRate = GetSpellCharges(spellId) local tResourceCost = GetSpellPowerCost(spellId) diff --git a/Libs/DF/definitions.lua b/Libs/DF/definitions.lua index dcbeb0843..0a52271b8 100644 --- a/Libs/DF/definitions.lua +++ b/Libs/DF/definitions.lua @@ -223,7 +223,7 @@ ---@field CreateTextureInfo fun(self:table, texture:atlasname|texturepath|textureid, width:number?, height:number?, left:number?, right:number?, top:number?, bottom:number?, imageWidthnumber?, imageHeightnumber?) : table deprecated, use: DetailsFramework:CreateAtlas() ---@field ApplyStandardBackdrop fun(self:table, frame:frame, bUseSolidColor:boolean?, alphaScale:number?) ---@field NewLabel fun(self:table, parent:frame, container:frame, name:string?, member:string?, text:string|table, font:string?, size:any?, color:any?, layer:drawlayer?) : df_label ----@field CreateLabel fun(self:table, parent:frame, text:string, size:any?, color:any?, font:string?, member:string?, name:string?, layer:drawlayer?) : df_label +---@field CreateLabel fun(self:table, parent:frame, text:any, size:any?, color:any?, font:string?, member:string?, name:string?, layer:drawlayer?) : df_label ---@field CreateDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown ---@field CreateFontDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown ---@field CreateColorDropDown fun(self:table, parent:frame, func:function, default:any, width:number?, height:number?, member:string?, name:string?, template:table?) : df_dropdown @@ -248,7 +248,7 @@ ---@field CreateCheckboxGroup fun(self:table, parent:frame, radioOptions:df_radiooptions[], name:string?, options:table?, anchorOptions:table?) : df_checkboxgroup ---@field CreateRadioGroup fun(self:table, parent:frame, radioOptions:df_radiooptions[], name:string?, options:table?, anchorOptions:table?) : df_radiogroup ---@field CreateScrollBox fun(self:table, parent:frame, name:string, refreshFunc:function, data:table, width:number, height:number, lineAmount:number, lineHeight:number, createLineFunc:function?, autoAmount:boolean?, noScroll:boolean?, noBackdrop:boolean?) : df_scrollbox ----@field CreateAuraScrollBox fun(self:table, parent:frame, name:string?, data:table?, onRemoveCallback:function?, options:table?) : df_aurascrollbox +---@field CreateAuraScrollBox fun(self:table, parent:frame, name:string?, data:table?, onRemoveCallback:function?, options:table?, onSetupAuraClick:function?) : df_aurascrollbox ---@field CreateGridScrollBox fun(self:table, parent:frame, name:string?, refreshFunc:function, data:table?, createColumnFrameFunc:function, options:table?) : df_gridscrollbox ---@field CreateCanvasScrollBox fun(self:table, parent:frame, child:frame?, name:string?, options:table?) : df_canvasscrollbox ---@field CreateTabContainer fun(self:table, parent:frame, title:string, frameName:string, tabList:df_tabinfotable[], optionsTable:table?, hookList:table?, languageInfo:table?) : df_tabcontainer @@ -264,7 +264,7 @@ ---@field RandomBool fun(self:table, odds: number?) : boolean return a random boolean ---@field CreateHighlightTexture fun(self:table, parent:frame, parentKey:string?, alpha:number?, name:string?) : texture ---@field CreateIconRowGeneric fun(self:table, parent:frame, name:string?, options:table?) ----@field CreateColorPickButton fun(self:table, parent:frame, name:string?, member:string?, callback:function, alpha:number?, buttonTemplate:table?) : df_button +---@field CreateColorPickButton fun(self:table, parent:frame, name:string?, member:string?, callback:function, alpha:number?, buttonTemplate:table?) : df_colorpickbutton ---@field CreateSlider fun(self:table, parent:frame, width:number?, height:number?, minValue:number?, maxValue:number?, step:number?, defaultv:number?, isDecemal:boolean?, member:string?, name:string?, label:string?, sliderTemplate:string|table?, labelTemplate:string|table?) : df_slider, df_label? ---@field CreateFrameContainer fun(self:table, parent:frame, options:table?, frameName:string?) : df_framecontainer create a frame container, which is a frame that envelops another frame, and can be moved, resized, etc. ---@field CreateAnimation fun(self:table, animationGroup:animationgroup, animationType:animationtype, order:number, duration:number, arg1:any, arg2:any, arg3:any, arg4:any, arg5:any, arg6:any, arg7:any, arg8:any) : animation @@ -307,15 +307,18 @@ ---@field GetParentKeyPath fun(self:table, object:uiobject) : string ---@field GetParentNamePath fun(self:table, object:uiobject) : string ---@field GetAsianNumberSymbols fun(self:table) : string, string, string return the abbreviation for 1,000 10,000 and 100,000,000 ----@field GetBestFontForLanguage fun(self:table, languageId:string?, western:string?, cyrillic:string?, china:string? korean:string?, taiwan:string?) : string +---@field GetBestFontForLanguage fun(self:table, languageId:string?, western:string?, cyrillic:string?, china:string?, korean:string?, taiwan:string?) : string ---@field CreateGlowOverlay fun(self:table, parent:frame, antsColor:any, glowColor:any) : frame ---@field CreateAnts fun(self:table, parent:frame, antTable:df_anttable, leftOffset:number?, rightOffset:number?, topOffset:number?, bottomOffset:number?) : frame ---@field CreateBorder fun(self:table, parent:frame, alpha1:number?, alpha2:number?, alpha3:number?) : frame +---@field CreateMenuWithGridScrollBox fun(self:table, parent:frame, name:string?, refreshMeFunc:function, refreshButtonFunc:function, clickFunc:function, onCreateButton:function, gridScrollBoxOptions:df_gridscrollbox_options) : df_gridscrollbox create a scrollbox with a grid layout to be used as a menu +---@field CreateSearchBox fun(self:table, parent:frame, callback:function) : df_searchbox ---@field ---@field + --[=[ Wrapped objects: when using the following functions, the object will be wrapped in a table, e.g. detailsFramework:CreateButton() will return a table with the button, the button will be accessible through the "button" key. The wrapper table will have the same metatable as the wrapped object, so you can call methods on the wrapper table as if it was the wrapped object. diff --git a/Libs/DF/editor.lua b/Libs/DF/editor.lua index ce7d11ad0..947fdde6d 100644 --- a/Libs/DF/editor.lua +++ b/Libs/DF/editor.lua @@ -64,6 +64,55 @@ local _ --which object attributes are used to build the editor menu for each object type local attributes = { ---@type df_editor_attribute[] + Texture = { + { + key = "texture", + label = "Texture", + widget = "textentry", + default = "", + setter = function(widget, value) widget:SetTexture(value) end, + }, + { + key = "width", + label = "Width", + widget = "range", + minvalue = 5, + maxvalue = 120, + setter = function(widget, value) widget:SetWidth(value) end + }, + { + key = "height", + label = "Height", + widget = "range", + minvalue = 5, + maxvalue = 120, + setter = function(widget, value) widget:SetHeight(value) end + }, + {widget = "blank"}, + { + key = "anchor", + label = "Anchor", + widget = "anchordropdown", + setter = function(widget, value) detailsFramework:SetAnchor(widget, value, widget:GetParent()) end + }, + { + key = "anchoroffsetx", + label = "Anchor X Offset", + widget = "range", + minvalue = -20, + maxvalue = 20, + setter = function(widget, value) detailsFramework:SetAnchor(widget, value, widget:GetParent()) end + }, + { + key = "anchoroffsety", + label = "Anchor Y Offset", + widget = "range", + minvalue = -20, + maxvalue = 20, + setter = function(widget, value) detailsFramework:SetAnchor(widget, value, widget:GetParent()) end + }, + }, + FontString = { { key = "text", @@ -147,16 +196,16 @@ local attributes = { key = "anchoroffsetx", label = "Anchor X Offset", widget = "range", - minvalue = -100, - maxvalue = 100, + minvalue = -20, + maxvalue = 20, setter = function(widget, value) detailsFramework:SetAnchor(widget, value, widget:GetParent()) end }, { key = "anchoroffsety", label = "Anchor Y Offset", widget = "range", - minvalue = -100, - maxvalue = 100, + minvalue = -20, + maxvalue = 20, setter = function(widget, value) detailsFramework:SetAnchor(widget, value, widget:GetParent()) end }, { @@ -291,6 +340,7 @@ detailsFramework.EditorMixin = { local objectRegistered = self:GetObjectById(id) assert(type(objectRegistered) == "table", "EditObjectById() object not found.") self:EditObject(objectRegistered) + self.objectSelector:RefreshMe() end, EditObjectByIndex = function(self, index) @@ -298,6 +348,7 @@ detailsFramework.EditorMixin = { local objectRegistered = self:GetObjectByIndex(index) assert(type(objectRegistered) == "table", "EditObjectById() object not found.") self:EditObject(objectRegistered) + self.objectSelector:RefreshMe() end, ---@param self df_editor @@ -389,6 +440,8 @@ detailsFramework.EditorMixin = { local profileTable, profileMap = self:GetEditingProfile() profileMap = profileMap or {} + local conditionalKeys = profileMap.enable_if or {} + if (not object or not profileTable) then return end @@ -405,6 +458,10 @@ detailsFramework.EditorMixin = { if (objectType == "FontString") then ---@cast object fontstring attributeList = attributes[objectType] + + elseif (objectType == "Texture") then + ---@cast object texture + attributeList = attributes[objectType] end --if there's extra options, add the attributeList to a new table and right after the extra options @@ -445,6 +502,8 @@ detailsFramework.EditorMixin = { value = profileTable[profileKey] end + --print(value, profileKey, profileTable, option.key) + --if no value is found, attempt to get a default if (type(value) == "nil") then value = option.default @@ -456,11 +515,11 @@ detailsFramework.EditorMixin = { local maxValue = option.maxvalue if (option.key == "anchoroffsetx") then - minValue = -object:GetParent():GetWidth()/2 - maxValue = object:GetParent():GetWidth()/2 + minValue = -math.floor(object:GetParent():GetWidth()/10) + maxValue = math.floor(object:GetParent():GetWidth()/10) elseif (option.key == "anchoroffsety") then - minValue = -object:GetParent():GetHeight()/2 - maxValue = object:GetParent():GetHeight()/2 + minValue = -math.floor(object:GetParent():GetHeight()/10) + maxValue = math.floor(object:GetParent():GetHeight()/10) end if (bHasValue) then @@ -470,7 +529,7 @@ detailsFramework.EditorMixin = { anchorSettings = parentTable end - menuOptions[#menuOptions+1] = { + local optionTable = { type = option.widget, name = option.label, get = function() return value end, @@ -526,6 +585,16 @@ detailsFramework.EditorMixin = { usedecimals = option.usedecimals, id = option.key, } + + --disabled = true + if (conditionalKeys[option.key]) then + local bIsEnabled = conditionalKeys[option.key](object, profileTable, profileKey) + if (not bIsEnabled) then + optionTable.disabled = true + end + end + + menuOptions[#menuOptions+1] = optionTable end end end diff --git a/Libs/DF/fw.lua b/Libs/DF/fw.lua index ba91a433e..23cb77dbb 100644 --- a/Libs/DF/fw.lua +++ b/Libs/DF/fw.lua @@ -1,6 +1,6 @@ -local dversion = 529 +local dversion = 531 local major, minor = "DetailsFramework-1.0", dversion local DF, oldminor = LibStub:NewLibrary(major, minor) @@ -28,6 +28,17 @@ local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE local UnitPlayerControlled = UnitPlayerControlled local UnitIsTapDenied = UnitIsTapDenied +-- TWW compatibility: +local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end +local GetSpellBookItemName = GetSpellBookItemName or C_SpellBook.GetSpellBookItemName +local GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines +local GetSpellTabInfo = GetSpellTabInfo or function(tabLine) local skillLine = C_SpellBook.GetSpellBookSkillLineInfo(tabLine) if skillLine then return skillLine.name, skillLine.iconID, skillLine.itemIndexOffset, skillLine.numSpellBookItems, skillLine.isGuild, skillLine.offSpecID end end +local SpellBookItemTypeMap = Enum.SpellBookItemType and {[Enum.SpellBookItemType.Spell] = "SPELL", [Enum.SpellBookItemType.None] = "NONE", [Enum.SpellBookItemType.Flyout] = "FLYOUT", [Enum.SpellBookItemType.FutureSpell] = "FUTURESPELL", [Enum.SpellBookItemType.PetAction] = "PETACTION" } or {} +local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", si.spellID end end +local SPELLBOOK_BANK_PLAYER = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Player or "player" +local SPELLBOOK_BANK_PET = Enum.SpellBookSpellBank and Enum.SpellBookSpellBank.Pet or "pet" +local IsPassiveSpell = IsPassiveSpell or C_Spell.IsSpellPassive + SMALL_NUMBER = 0.000001 ALPHA_BLEND_AMOUNT = 0.8400251 @@ -1344,6 +1355,10 @@ function DF:AddClassIconToText(text, playerName, englishClassName, useSpec, icon spec = spec end end + else + if (type(useSpec) == "number") then + local specId, specName = GetSpecializationInfoByID(useSpec) + end end end @@ -1370,6 +1385,33 @@ function DF:AddClassIconToText(text, playerName, englishClassName, useSpec, icon return text end +function DF:AddClassIconToString(text, engClass, size) + size = size or 16 + local tcoords = CLASS_ICON_TCOORDS[engClass] + if (tcoords) then + local l, r, t, b = unpack(tcoords) + return "|TInterface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes:" .. size .. ":" .. size .. ":0:0:256:256:" .. (l * 256) .. ":" .. (r * 256) .. ":" .. (t * 256) .. ":" .. (b * 256) .. "|t " .. text + end +end + +function DF:AddSpecIconToString(text, specId, size) + size = size or 16 + + if (not specId) then + --get the player specId + local specIndex = GetSpecialization() + specId = GetSpecializationInfo(specIndex) + if (not specId) then + return + end + end + + local id, name, description, icon = GetSpecializationInfoByID(specId) + if (id) then + return "|T" .. icon .. ":" .. size .. ":" .. size .. ":0:0|t " .. text + end +end + ---create a table with information about a texture (deprecated, use: DetailsFramework:CreateAtlas()) ---@param texture any ---@param textureWidth any @@ -1691,7 +1733,7 @@ function DF:GetSpellBookSpells() local tabEnd = offset + numSpells for j = offset, tabEnd - 1 do - local spellType, spellId = GetSpellBookItemInfo(j, "player") + local spellType, spellId = GetSpellBookItemInfo(j, SPELLBOOK_BANK_PLAYER) if (spellId) then if (spellType ~= "FLYOUT") then @@ -1776,7 +1818,7 @@ function DF:GetAvailableSpells() offset = offset + 1 local tabEnd = offset + numSpells for entryOffset = offset, tabEnd - 1 do - local spellType, spellId = GetSpellBookItemInfo(entryOffset, "player") + local spellType, spellId = GetSpellBookItemInfo(entryOffset, SPELLBOOK_BANK_PLAYER) local spellData = LIB_OPEN_RAID_COOLDOWNS_INFO[spellId] if (spellData) then local raceId = spellData.raceid @@ -1785,7 +1827,7 @@ function DF:GetAvailableSpells() if (raceId[playerRaceId]) then spellId = C_SpellBook.GetOverrideSpell(spellId) local spellName = GetSpellInfo(spellId) - local bIsPassive = IsPassiveSpell(spellId, "player") + local bIsPassive = IsPassiveSpell(spellId, SPELLBOOK_BANK_PLAYER) if (spellName and not bIsPassive) then completeListOfSpells[spellId] = true end @@ -1795,7 +1837,7 @@ function DF:GetAvailableSpells() if (raceId == playerRaceId) then spellId = C_SpellBook.GetOverrideSpell(spellId) local spellName = GetSpellInfo(spellId) - local bIsPassive = IsPassiveSpell(spellId, "player") + local bIsPassive = IsPassiveSpell(spellId, SPELLBOOK_BANK_PLAYER) if (spellName and not bIsPassive) then completeListOfSpells[spellId] = true end @@ -1813,12 +1855,12 @@ function DF:GetAvailableSpells() offset = offset + 1 local tabEnd = offset + numSpells for entryOffset = offset, tabEnd - 1 do - local spellType, spellId = GetSpellBookItemInfo(entryOffset, "player") + local spellType, spellId = GetSpellBookItemInfo(entryOffset, SPELLBOOK_BANK_PLAYER) if (spellId) then if (spellType == "SPELL") then spellId = C_SpellBook.GetOverrideSpell(spellId) local spellName = GetSpellInfo(spellId) - local bIsPassive = IsPassiveSpell(spellId, "player") + local bIsPassive = IsPassiveSpell(spellId, SPELLBOOK_BANK_PLAYER) if (spellName and not bIsPassive) then completeListOfSpells[spellId] = bIsOffSpec == false end @@ -1858,10 +1900,10 @@ function DF:GetAvailableSpells() local numPetSpells = getNumPetSpells() if (numPetSpells) then for i = 1, numPetSpells do - local spellName, _, unmaskedSpellId = GetSpellBookItemName(i, "pet") + local spellName, _, unmaskedSpellId = GetSpellBookItemName(i, SPELLBOOK_BANK_PET) if (unmaskedSpellId) then unmaskedSpellId = C_SpellBook.GetOverrideSpell(unmaskedSpellId) - local bIsPassive = IsPassiveSpell(unmaskedSpellId, "pet") + local bIsPassive = IsPassiveSpell(unmaskedSpellId, SPELLBOOK_BANK_PET) if (spellName and not bIsPassive) then completeListOfSpells[unmaskedSpellId] = true end @@ -3178,7 +3220,7 @@ function DF:CreateAnimation(animationGroup, animationType, order, duration, arg1 anim:SetToAlpha(arg2) elseif (animationType == "SCALE") then - if (DF.IsDragonflight() or DF.IsNonRetailWowWithRetailAPI()) then + if (DF.IsDragonflight() or DF.IsNonRetailWowWithRetailAPI() or DF.IsWarWow()) then anim:SetScaleFrom(arg1, arg2) anim:SetScaleTo(arg3, arg4) else diff --git a/Libs/DF/icon.lua b/Libs/DF/icon.lua index bd83e2675..207fa5335 100644 --- a/Libs/DF/icon.lua +++ b/Libs/DF/icon.lua @@ -9,6 +9,7 @@ local unpack = unpack local CreateFrame = CreateFrame local PixelUtil = PixelUtil local GetTime = GetTime +local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end detailsFramework.GrowDirectionBySide = { [1] = 1, diff --git a/Libs/DF/icongeneric.lua b/Libs/DF/icongeneric.lua index e4d880949..55fbdc841 100644 --- a/Libs/DF/icongeneric.lua +++ b/Libs/DF/icongeneric.lua @@ -102,6 +102,7 @@ local CreateFrame = CreateFrame local PixelUtil = PixelUtil local GetTime = GetTime local Clamp = detailsFramework.Math.Clamp +local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end local spellIconCache = {} local spellNameCache = {} diff --git a/Libs/DF/keybind.lua b/Libs/DF/keybind.lua index ba6e16776..dab62b3c3 100644 --- a/Libs/DF/keybind.lua +++ b/Libs/DF/keybind.lua @@ -26,7 +26,7 @@ local IsShiftKeyDown = _G["IsShiftKeyDown"] local IsControlKeyDown = _G["IsControlKeyDown"] local IsAltKeyDown = _G["IsAltKeyDown"] local CreateFrame = _G["CreateFrame"] -local GetSpellInfo = _G["GetSpellInfo"] +local GetSpellInfo = _G["GetSpellInfo"] or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end local unpack = unpack ---@diagnostic disable-line ---@alias actionidentifier string a string in the format of "spell-spellId" or "macro-macroName" or "system-target", etc, used to pass information about the action more easily @@ -940,6 +940,10 @@ detailsFramework.KeybindMixin = { self.Header = DetailsFramework:CreateHeader(self, headerTable, headerOptions) self.Header:SetPoint("topleft", self, "topleft", 0, 0) + --this is a hack to hide the background black texture column of the header + --making the area more clean for the create macro button + self.Header.columnHeadersCreated[2].Center:SetAlpha(0) + local onClickCreateMacroButton = function() --~macro local newMacroName = "New @Macro (" .. math.random(10000, 99999) .. ")" local actionIdentifier = "macro-" .. newMacroName @@ -970,10 +974,13 @@ detailsFramework.KeybindMixin = { macroEditBox:SetFocus() end - local createMacroButton = detailsFramework:CreateButton(self.Header, onClickCreateMacroButton, 100, 20, "Create Macro Keybind", nil, nil, nil, "CreateMacroButton", "$parentCreateMacroButton", 0, DARK_BUTTON_TEMPLATE, detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) - createMacroButton:SetPoint("left", self.Header, "left", 0, 0) + local createMacroButton = detailsFramework:CreateButton(self.Header, onClickCreateMacroButton, 200, 32, "Create Macro Keybind", nil, nil, nil, "CreateMacroButton", "$parentCreateMacroButton", 0, DARK_BUTTON_TEMPLATE, detailsFramework:GetTemplate("font", "OPTIONS_FONT_TEMPLATE")) + createMacroButton:SetPoint("left", self.Header, "left", 2, 0) createMacroButton:SetFrameLevel(self.Header:GetFrameLevel()+10) createMacroButton:SetIcon(136377) + createMacroButton:SetTemplate("OPTIONS_CIRCLEBUTTON_TEMPLATE") + createMacroButton:SetScale(0.9) + createMacroButton:SetFontSize(13) local keybindScroll = detailsFramework:CreateScrollBox(self, "$parentScrollBox", detailsFramework.KeybindMixin.RefreshKeybindScroll, {}, scroll_width, scroll_height, scroll_lines, scroll_line_height) ---@cast keybindScroll df_keybindscroll diff --git a/Libs/DF/math.lua b/Libs/DF/math.lua index a07792263..6bbb5e431 100644 --- a/Libs/DF/math.lua +++ b/Libs/DF/math.lua @@ -39,7 +39,14 @@ DF.Math = {} ---@field GetObjectCoordinates fun(object: uiobject) : objectcoordinates return the coordinates of the four corners of an object ---@field MultiplyBy fun(value: number, ...) : ... multiply all the passed values by value. ---@field MapRangeColor fun(inputX: number, inputY: number, outputX: number, outputY: number, red: number, green: number, blue: number) : number, number, number +---@field RandomFraction fun(minValue: number, maxValue: number) : number +---return a random fraction between two values, example: RandomFraction(.2, .3) returns a number between .2 and .3, 0.25, 0.28, 0.21, etc +function DF.Math.RandomFraction(minValue, maxValue) + minValue = minValue or 0 + maxValue = maxValue or 1 + return DF.Math.MapRangeClamped(0, 1, minValue, maxValue, math.random()) +end ---find distance between two units ---@param unitId1 string diff --git a/Libs/DF/panel.lua b/Libs/DF/panel.lua index 7132e2bcb..554baca43 100644 --- a/Libs/DF/panel.lua +++ b/Libs/DF/panel.lua @@ -15,6 +15,13 @@ local floor = math.floor --lua local local loadstring = loadstring --lua local local CreateFrame = CreateFrame +-- TWW compatibility: +local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end +local GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines +local GetSpellTabInfo = GetSpellTabInfo or function(tabLine) local skillLine = C_SpellBook.GetSpellBookSkillLineInfo(tabLine) if skillLine then return skillLine.name, skillLine.iconID, skillLine.itemIndexOffset, skillLine.numSpellBookItems, skillLine.isGuild, skillLine.offSpecID end end +local SpellBookItemTypeMap = Enum.SpellBookItemType and {[Enum.SpellBookItemType.Spell] = "SPELL", [Enum.SpellBookItemType.None] = "NONE", [Enum.SpellBookItemType.Flyout] = "FLYOUT", [Enum.SpellBookItemType.FutureSpell] = "FUTURESPELL", [Enum.SpellBookItemType.PetAction] = "PETACTION" } or {} +local GetSpellBookItemInfo = GetSpellBookItemInfo or function(...) local si = C_SpellBook.GetSpellBookItemInfo(...) if si then return SpellBookItemTypeMap[si.itemType] or "NONE", si.spellID end end + local IS_WOW_PROJECT_MAINLINE = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE local IS_WOW_PROJECT_CLASSIC_ERA = WOW_PROJECT_ID == WOW_PROJECT_CLASSIC @@ -4059,6 +4066,7 @@ local default_radiogroup_options = { ---@field _optionid number ---@field _set function ---@field _callback function +---@field _param any ---@field __width number ---@field __height number @@ -4079,6 +4087,10 @@ local default_radiogroup_options = { ---@field RadioOnClick fun(checkbox:df_radiogroup_checkbox, fixedParam:any, value:boolean) ---@field RefreshCheckbox fun(self:df_checkboxgroup, checkbox:df_radiogroup_checkbox, optionTable:table, optionId:number) +local radio_checkbox_onclick_extraspace = function(self) + self:GetParent():GetObject():OnSwitch() --as the parent of self is a Switch object from DetailsFramework, it need to run :GetObject() to get the capsule object +end + ---@type df_radiogroupmixin detailsFramework.RadioGroupCoreFunctions = { allCheckBoxes = {}, @@ -4144,6 +4156,12 @@ detailsFramework.RadioGroupCoreFunctions = { checkbox:SetTemplate(detailsFramework:GetTemplate("switch", "OPTIONS_CHECKBOX_BRIGHT_TEMPLATE")) checkbox:SetAsCheckBox() + local extraSpaceToClick = CreateFrame("button", "$parentExtraSpaceToClick", checkbox.widget) + extraSpaceToClick:SetPoint("topleft", checkbox.widget, "topright", 0, 0) + extraSpaceToClick:SetPoint("bottomleft", checkbox.widget, "bottomright", 0, 0) + extraSpaceToClick:SetScript("OnClick", radio_checkbox_onclick_extraspace) + checkbox.extraSpaceToClick = extraSpaceToClick + if (self.options.rounded_corner_preset) then checkbox:SetBackdrop(nil) detailsFramework:AddRoundedCornersToFrame(checkbox, self.options.rounded_corner_preset) @@ -4189,7 +4207,7 @@ detailsFramework.RadioGroupCoreFunctions = { end if (radioGroup.options.on_click_option) then - detailsFramework:QuickDispatch(radioGroup.options.on_click_option, radioGroup, checkbox, fixedParam, checkbox._optionid) + detailsFramework:QuickDispatch(radioGroup.options.on_click_option, radioGroup, checkbox, checkbox._param, checkbox._optionid) end end, @@ -4205,9 +4223,10 @@ detailsFramework.RadioGroupCoreFunctions = { checkbox._callback = optionTable.callback checkbox._set = self.options.is_radio and optionTable.callback or optionTable.set checkbox._optionid = optionId + checkbox._param = optionTable.param or optionId checkbox:SetFixedParameter(optionTable.param or optionId) - local bIsChecked = type(optionTable.get) == "function" and detailsFramework:Dispatch(optionTable.get) or false + local bIsChecked = (type(optionTable.selected) == "boolean" and optionTable.selected) or (type(optionTable.get) == "function" and detailsFramework:Dispatch(optionTable.get)) or false checkbox:SetValue(bIsChecked) checkbox.Label.text = optionTable.name @@ -4215,11 +4234,19 @@ detailsFramework.RadioGroupCoreFunctions = { checkbox.Label.textcolor = self.options.text_color checkbox.Label.outline = self.options.text_outline + checkbox.Label:ClearAllPoints() + if (optionTable.texture) then checkbox.Icon:SetTexture(optionTable.texture) checkbox.Icon:SetSize(width, height) checkbox.Icon:SetPoint("left", checkbox, "right", self.AnchorOptions.icon_offset_x, 0) - checkbox.Label:SetPoint("left", checkbox.Icon, "right", 2, 0) + + if (self.options.text_padding) then + checkbox.Label:SetPoint("left", checkbox.Icon, "right", self.options.text_padding, 0) + else + checkbox.Label:SetPoint("left", checkbox.Icon, "right", 2, 0) + end + checkbox.tooltip = optionTable.tooltip if (optionTable.texcoord) then @@ -4244,7 +4271,11 @@ detailsFramework.RadioGroupCoreFunctions = { end else checkbox.Icon:SetTexture("") - checkbox.Label:SetPoint("left", checkbox, "right", 2, 0) + if (self.options.text_padding) then + checkbox.Label:SetPoint("left", checkbox, "right", self.options.text_padding, 0) + else + checkbox.Label:SetPoint("left", checkbox, "right", 2, 0) + end end checkbox.__width = width + (checkbox.Icon:IsShown() and (checkbox.Icon:GetWidth() + 2)) + (checkbox.Label:GetStringWidth()) + 2 @@ -4252,6 +4283,10 @@ detailsFramework.RadioGroupCoreFunctions = { checkbox.__height = height + (checkbox.Icon:IsShown() and (checkbox.Icon:GetHeight() + 2)) checkbox.widget.__height = checkbox.__height + + if (optionTable.checkbox_template) then + checkbox:SetTemplate(optionTable.checkbox_template) + end end, Refresh = function(self) @@ -4267,6 +4302,8 @@ detailsFramework.RadioGroupCoreFunctions = { self:RefreshCheckbox(checkbox, optionsTable, optionId) totalWidth = totalWidth + checkbox.__width + checkbox.extraSpaceToClick:SetWidth(checkbox.__width) + if (checkbox:GetHeight() > maxHeight) then maxHeight = checkbox:GetHeight() end @@ -4341,6 +4378,8 @@ detailsFramework.RadioGroupCoreFunctions = { ---@field backdrop table? ---@field backdrop_color table? ---@field backdrop_border_color table? +---@field checkbox_template string? +---@field on_click_option fun(self:df_checkboxgroup, checkbox:df_radiogroup_checkbox, param:any, optionId:number) --[=[ radionOptions: an index table with options for the radio group {name = "", set = func (self, param, value), param = value, get = func, texture = "", texcoord = {}} diff --git a/Libs/DF/picture.lua b/Libs/DF/picture.lua index 772ab411f..15fdb306e 100644 --- a/Libs/DF/picture.lua +++ b/Libs/DF/picture.lua @@ -346,7 +346,7 @@ detailsFramework:Mixin(ImageMetaFunctions, detailsFramework.ScriptHookMixin) ---@type df_gradienttable local gradientTable = texture - if (detailsFramework.IsDragonflight() or detailsFramework.IsNonRetailWowWithRetailAPI()) then + if (detailsFramework.IsDragonflight() or detailsFramework.IsNonRetailWowWithRetailAPI() or detailsFramework.IsWarWow()) then ImageObject.image:SetColorTexture(1, 1, 1, 1) local fromColor = detailsFramework:FormatColor("tablemembers", gradientTable.fromColor) local toColor = detailsFramework:FormatColor("tablemembers", gradientTable.toColor) diff --git a/Libs/DF/scrollbox.lua b/Libs/DF/scrollbox.lua index d259cc27f..cd751d60a 100644 --- a/Libs/DF/scrollbox.lua +++ b/Libs/DF/scrollbox.lua @@ -6,7 +6,7 @@ if (not detailsFramework or not DetailsFrameworkCanLoad) then end local CreateFrame = CreateFrame -local GetSpellInfo = GetSpellInfo +local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end local GameTooltip = GameTooltip local unpack = unpack @@ -143,6 +143,7 @@ detailsFramework.ScrollBoxFunctions = { ---@param data table The data to be set. SetData = function(self, data) self.data = data + self.data_original = data if (self.OnSetData) then detailsFramework:CoreDispatch((self:GetName() or "ScrollBox") .. ":OnSetData()", self.OnSetData, self, self.data) end @@ -362,6 +363,7 @@ local grid_scrollbox_options = { } ---@class df_gridscrollbox : df_scrollbox +---@field RefreshMe fun(self:df_gridscrollbox) ---create a scrollbox with a grid layout ---@param parent frame @@ -410,6 +412,7 @@ function detailsFramework:CreateGridScrollBox(parent, name, refreshFunc, data, c end local onSetData = function(self, data) + self.data_original = data local newData = {} for i = 1, #data, columnsPerLine do @@ -464,6 +467,11 @@ function detailsFramework:CreateGridScrollBox(parent, name, refreshFunc, data, c return scrollBox end +---@class df_gridscrollbox_menu : df_gridscrollbox +---@field data_original table the data passed into :SetData() +---@field searchBox df_searchbox +---@field Select fun(self:df_gridscrollbox_menu, value:any, key:string) --select a line by a value on a key, example: :Select("Power Infusion", "spellName") + ---create a scrollbox with a grid layout to be used as a menu ---@param parent frame ---@param name string? @@ -472,7 +480,7 @@ end ---@param clickFunc fun(button:button, data:table) ---@param onCreateButton fun(button:button, lineIndex:number, columnIndex:number) ---@param gridScrollBoxOptions df_gridscrollbox_options ----@return df_gridscrollbox +---@return df_gridscrollbox_menu function detailsFramework:CreateMenuWithGridScrollBox(parent, name, refreshMeFunc, refreshButtonFunc, clickFunc, onCreateButton, gridScrollBoxOptions) local dataSelected = nil local gridScrollBox @@ -528,6 +536,8 @@ function detailsFramework:CreateMenuWithGridScrollBox(parent, name, refreshMeFun detailsFramework:AddRoundedCornersToFrame(button.widget, gridScrollBoxOptions.roundedFramePreset) button.textsize = 11 + line.button = button + button:SetHook("OnEnter", function(self) local dfButton = self:GetObject() GameCooltip:Reset() @@ -555,6 +565,8 @@ function detailsFramework:CreateMenuWithGridScrollBox(parent, name, refreshMeFun end gridScrollBox = detailsFramework:CreateGridScrollBox(parent, name, refreshLine, {}, createButton, gridScrollBoxOptions) + ---@cast gridScrollBox df_gridscrollbox_menu + gridScrollBox:SetBackdrop({}) gridScrollBox:SetBackdropColor(0, 0, 0, 0) gridScrollBox:SetBackdropBorderColor(0, 0, 0, 0) @@ -562,10 +574,45 @@ function detailsFramework:CreateMenuWithGridScrollBox(parent, name, refreshMeFun gridScrollBox:Show() gridScrollBox.searchBox = searchBox - searchBox:SetPoint("bottomleft", gridScrollBox, "topleft", 0, 2) searchBox:SetWidth(gridScrollBoxOptions.width) + function gridScrollBox:Select(value, key) + local bFoundResult = false + local originalData + + for _, data in ipairs(gridScrollBox.data_original) do + originalData = data + + if (type(value) == string) then + value = value:lower() + local dataValue = data[key]:lower() + if (dataValue == value) then + dataSelected = originalData + bFoundResult = true + break + end + else + if (data[key] == value) then + dataSelected = originalData + bFoundResult = true + break + end + end + end + + if (bFoundResult) then + for _, line in ipairs(gridScrollBox:GetFrames()) do + local button = line.button + if (button.data == originalData) then + gridScrollBox:Refresh() + onClickButtonSelectorButton(nil, nil, button, originalData) + break + end + end + end + end + function gridScrollBox:RefreshMe() xpcall(refreshMeFunc, geterrorhandler(), gridScrollBox, searchBox:GetText()) end @@ -613,7 +660,8 @@ local auraScrollDefaultSettings = { ---@param data table? --can be set later with :SetData() ---@param onAuraRemoveCallback function? ---@param options df_aurascrollbox_options? -function detailsFramework:CreateAuraScrollBox(parent, name, data, onAuraRemoveCallback, options) +---@param onSetupAuraClick function? +function detailsFramework:CreateAuraScrollBox(parent, name, data, onAuraRemoveCallback, options, onSetupAuraClick) --hack the construction of the options table here, as the scrollbox is created much later options = options or {} local scrollOptions = {} @@ -663,6 +711,11 @@ function detailsFramework:CreateAuraScrollBox(parent, name, data, onAuraRemoveCa GameTooltip:AddLine(" ") GameTooltip:Show() end + + if (line.setupbutton:IsShown()) then + + end + line:SetBackdropColor(unpack(options.backdrop_onenter)) local bTrackByName = line.Flag --the user entered the spell name to track the spell (and not a spellId) @@ -748,12 +801,42 @@ function detailsFramework:CreateAuraScrollBox(parent, name, data, onAuraRemoveCa removeButton:SetPoint("topright", line, "topright", 0, 0) removeButton:GetNormalTexture():SetDesaturated(true) + local setupAuraButton = CreateFrame("button", "$parentSetupButton", line) + setupAuraButton:SetSize(16, 16) + setupAuraButton:SetPoint("right", removeButton, "left", -4, 0) + setupAuraButton:SetScript("OnClick", onSetupAuraClick) + + line:SetScript("OnMouseUp", function(self, button) + if (onSetupAuraClick) then + setupAuraButton:Click() + end + end) + + local clickToSetupText = setupAuraButton:CreateFontString("$parentText", "overlay", "GameFontNormal") + clickToSetupText:SetText("click to setup") + clickToSetupText:SetPoint("right", setupAuraButton, "left", -2, 0) + detailsFramework:SetFontSize(clickToSetupText, 9) + + local setupAuraTexture = setupAuraButton:CreateTexture(nil, "overlay") + setupAuraTexture:SetAllPoints() + setupAuraTexture:SetTexture([[Interface\ICONS\INV_Misc_Wrench_01.blp]]) + setupAuraTexture:SetTexCoord(0.1, 0.9, 0.1, 0.9) + + setupAuraButton.Texture = setupAuraTexture + setupAuraButton.Text = clickToSetupText + + if (not onSetupAuraClick) then + setupAuraButton:Hide() + end + iconTexture:SetPoint("left", line, "left", 2, 0) spellNameFontString:SetPoint("left", iconTexture, "right", 3, 0) line.icon = iconTexture line.name = spellNameFontString line.removebutton = removeButton + line.setupbutton = setupAuraButton + line.clicktosetuptext = clickToSetupText return line end diff --git a/Libs/DF/textentry.lua b/Libs/DF/textentry.lua index 52dbb2eb0..b44536e74 100644 --- a/Libs/DF/textentry.lua +++ b/Libs/DF/textentry.lua @@ -438,7 +438,8 @@ detailsFramework.TextEntryCounter = detailsFramework.TextEntryCounter or 1 local OnTabPressed = function(textentry) local capsule = textentry.MyObject - local kill = capsule:RunHooksForWidget("OnTabPressed", textentry, byUser, capsule) + local bByUser = false + local kill = capsule:RunHooksForWidget("OnTabPressed", textentry, bByUser, capsule) if (kill) then return end @@ -583,6 +584,7 @@ end ---@param labelTemplate table? ---@return df_textentry function detailsFramework:CreateTextEntry(parent, textChangedCallback, width, height, member, name, labelText, textentryTemplate, labelTemplate) +---@diagnostic disable-next-line: return-type-mismatch return detailsFramework:NewTextEntry(parent, parent, name, member, width, height, textChangedCallback, nil, nil, nil, labelText, textentryTemplate, labelTemplate) end @@ -726,16 +728,26 @@ function detailsFramework:NewTextEntry(parent, container, name, member, width, h return newTextEntryObject, withLabel end +---@class df_searchbox : df_textentry +---@field ClearSearchButton button +---@field MagnifyingGlassTexture texture +---@field SearchFontString fontstring +---@field BottomLineTexture texture +---@field PressEnter fun(self:df_searchbox) +---@field ClearFocus fun(self:df_searchbox) + ---create a search box with no backdrop, a magnifying glass icon and a clear search button ---@param parent frame ---@param callback any ----@return df_textentry +---@return df_searchbox function detailsFramework:CreateSearchBox(parent, callback) local onSearchPressEnterCallback = function(_, _, text, self) callback(self) end local searchBox = detailsFramework:CreateTextEntry(parent, onSearchPressEnterCallback, 220, 26) + ---@cast searchBox df_searchbox + searchBox:SetAsSearchBox() searchBox:SetTextInsets(25, 5, 0, 0) searchBox:SetBackdrop(nil) diff --git a/Libs/DF/unitframe.lua b/Libs/DF/unitframe.lua index 976285aa7..0549b286b 100644 --- a/Libs/DF/unitframe.lua +++ b/Libs/DF/unitframe.lua @@ -33,6 +33,7 @@ local UnitIsTapDenied = UnitIsTapDenied local max = math.max local min = math.min local abs = math.abs +local GetSpellInfo = GetSpellInfo or function(spellID) if not spellID then return nil end local si = C_Spell.GetSpellInfo(spellID) if si then return si.name, nil, si.iconID, si.castTime, si.minRange, si.maxRange, si.spellID, si.originalIconID end end local IS_WOW_PROJECT_MAINLINE = WOW_PROJECT_ID == WOW_PROJECT_MAINLINE local IS_WOW_PROJECT_NOT_MAINLINE = WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE diff --git a/boot.lua b/boot.lua index bab674883..6cf63886c 100644 --- a/boot.lua +++ b/boot.lua @@ -18,8 +18,8 @@ local addonName, Details222 = ... local version, build, date, tocversion = GetBuildInfo() - Details.build_counter = 12580 - Details.alpha_build_counter = 12580 --if this is higher than the regular counter, use it instead + Details.build_counter = 12650 + Details.alpha_build_counter = 12650 --if this is higher than the regular counter, use it instead Details.dont_open_news = true Details.game_version = version Details.userversion = version .. " " .. Details.build_counter @@ -183,6 +183,12 @@ do local Loc = _G.LibStub("AceLocale-3.0"):GetLocale("Details") local news = { + {"v10.2.6.12650.156", "April 23th, 2024"}, + "Framework and Backend upgrades.", + "Added prist's void tendrils to crowd control list.", + "Fixes for asian clients where the spell names were not showing properly when the spell name is too long.", + "Cataclysm Clasic and MOP Remix are now working.", + {"v10.2.6.12578.156", "March 25th, 2024"}, "Added phase and elapsed time for boss wipes on the segment selection menu.", "Added an option to toggle between rounded and squared tooltips.",