fix(libs): restore ElvUI-namespaced Ace3 stack clobbered by sweep

The coa-ace3 sweep (commits 0c130e0..5ea6e44, before coa-elvui was added to
EXCLUDED_FORKS in coa-ace3 tools/sweep.py) overwrote ElvUI's customized,
-ElvUI-namespaced Ace3 libs with plain canonical ones. ElvUI registers libs
as AceLocale-3.0-ElvUI and the AceConfig-3.0-ElvUI family (plus -ElvUI
widgets that don't exist in canonical), so the clobber left them
unregistered: ElvUI failed to init (16 locale 'L' errors) and /ec would not
open. Restores ElvUI/Libraries/Ace3/AceLocale-3.0 and the
ElvUI_OptionsUI/Libraries/Ace3 stack to their pre-sweep state (5021fd1).
coa-elvui is now in EXCLUDED_FORKS, so this won't be re-clobbered.
This commit is contained in:
2026-05-25 19:30:48 +02:00
parent 49a3d4c81c
commit 4a1cf548ef
28 changed files with 915 additions and 855 deletions
@@ -31,21 +31,26 @@ local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR)
if not AceGUI then return end -- No upgrade needed
-- Lua APIs
local tinsert, wipe = table.insert, table.wipe
local tconcat, tinsert = table.concat, table.insert
local select, pairs, next, type = select, pairs, next, type
local error, assert = error, assert
local setmetatable, rawget = setmetatable, rawget
local math_max, math_min, math_ceil = math.max, math.min, math.ceil
local error, assert, loadstring = error, assert, loadstring
local setmetatable, rawget, rawset = setmetatable, rawget, rawset
local math_max = math.max
-- WoW APIs
local UIParent = UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: geterrorhandler, LibStub
--local con = LibStub("AceConsole-3.0",true)
AceGUI.WidgetRegistry = AceGUI.WidgetRegistry or {}
AceGUI.LayoutRegistry = AceGUI.LayoutRegistry or {}
AceGUI.WidgetBase = AceGUI.WidgetBase or {}
AceGUI.WidgetContainerBase = AceGUI.WidgetContainerBase or {}
AceGUI.WidgetVersions = AceGUI.WidgetVersions or {}
AceGUI.tooltip = AceGUI.tooltip or CreateFrame("GameTooltip", "AceGUITooltip", UIParent, "GameTooltipTemplate")
-- local upvalues
local WidgetRegistry = AceGUI.WidgetRegistry
@@ -61,10 +66,39 @@ local function errorhandler(err)
return geterrorhandler()(err)
end
local function CreateDispatcher(argCount)
local code = [[
local xpcall, eh = ...
local method, ARGS
local function call() return method(ARGS) end
local function dispatch(func, ...)
method = func
if not method then return end
ARGS = ...
return xpcall(call, eh)
end
return dispatch
]]
local ARGS = {}
for i = 1, argCount do ARGS[i] = "arg"..i end
code = code:gsub("ARGS", tconcat(ARGS, ", "))
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler)
end
local Dispatchers = setmetatable({}, {__index=function(self, argCount)
local dispatcher = CreateDispatcher(argCount)
rawset(self, argCount, dispatcher)
return dispatcher
end})
Dispatchers[0] = function(func)
return xpcall(func, errorhandler)
end
local function safecall(func, ...)
if func then
return xpcall(func, errorhandler, ...)
end
return Dispatchers[select("#", ...)](func, ...)
end
-- Recycling functions
@@ -88,38 +122,38 @@ do
AceGUI.objPools = AceGUI.objPools or {}
local objPools = AceGUI.objPools
--Returns a new instance, if none are available either returns a new table or calls the given contructor
function newWidget(widgetType)
if not WidgetRegistry[widgetType] then
function newWidget(type)
if not WidgetRegistry[type] then
error("Attempt to instantiate unknown widget type", 2)
end
if not objPools[widgetType] then
objPools[widgetType] = {}
if not objPools[type] then
objPools[type] = {}
end
local newObj = next(objPools[widgetType])
local newObj = next(objPools[type])
if not newObj then
newObj = WidgetRegistry[widgetType]()
newObj.AceGUIWidgetVersion = WidgetVersions[widgetType]
newObj = WidgetRegistry[type]()
newObj.AceGUIWidgetVersion = WidgetVersions[type]
else
objPools[widgetType][newObj] = nil
objPools[type][newObj] = nil
-- if the widget is older then the latest, don't even try to reuse it
-- just forget about it, and grab a new one.
if not newObj.AceGUIWidgetVersion or newObj.AceGUIWidgetVersion < WidgetVersions[widgetType] then
return newWidget(widgetType)
if not newObj.AceGUIWidgetVersion or newObj.AceGUIWidgetVersion < WidgetVersions[type] then
return newWidget(type)
end
end
return newObj
end
-- Releases an instance to the Pool
function delWidget(obj,widgetType)
if not objPools[widgetType] then
objPools[widgetType] = {}
function delWidget(obj,type)
if not objPools[type] then
objPools[type] = {}
end
if objPools[widgetType][obj] then
if objPools[type][obj] then
error("Attempt to Release Widget that is already released", 2)
end
objPools[widgetType][obj] = true
objPools[type][obj] = true
end
end
@@ -135,9 +169,9 @@ end
-- OnAcquire function on it, before returning.
-- @param type The type of the widget.
-- @return The newly created widget.
function AceGUI:Create(widgetType)
if WidgetRegistry[widgetType] then
local widget = newWidget(widgetType)
function AceGUI:Create(type)
if WidgetRegistry[type] then
local widget = newWidget(type)
if rawget(widget, "Acquire") then
widget.OnAcquire = widget.Acquire
@@ -155,7 +189,7 @@ function AceGUI:Create(widgetType)
if widget.OnAcquire then
widget:OnAcquire()
else
error(("Widget type %s doesn't supply an OnAcquire Function"):format(widgetType))
error(("Widget type %s doesn't supply an OnAcquire Function"):format(type))
end
-- Set the default Layout ("List")
safecall(widget.SetLayout, widget, "List")
@@ -583,25 +617,25 @@ AceGUI.counts = AceGUI.counts or {}
-- This is used by widgets that require a named frame, e.g. when a Blizzard
-- Template requires it.
-- @param type The widget type
function AceGUI:GetNextWidgetNum(widgetType)
if not self.counts[widgetType] then
self.counts[widgetType] = 0
function AceGUI:GetNextWidgetNum(type)
if not self.counts[type] then
self.counts[type] = 0
end
self.counts[widgetType] = self.counts[widgetType] + 1
return self.counts[widgetType]
self.counts[type] = self.counts[type] + 1
return self.counts[type]
end
--- Return the number of created widgets for this type.
-- In contrast to GetNextWidgetNum, the number is not incremented.
-- @param widgetType The widget type
function AceGUI:GetWidgetCount(widgetType)
return self.counts[widgetType] or 0
-- @param type The widget type
function AceGUI:GetWidgetCount(type)
return self.counts[type] or 0
end
--- Return the version of the currently registered widget type.
-- @param widgetType The widget type
function AceGUI:GetWidgetVersion(widgetType)
return WidgetVersions[widgetType]
-- @param type The widget type
function AceGUI:GetWidgetVersion(type)
return WidgetVersions[type]
end
-------------
@@ -764,6 +798,7 @@ AceGUI:RegisterLayout("Flow",
usedwidth = 0
rowstart = frame
rowstartoffset = frameoffset
if child.DoLayout then
child:DoLayout()
@@ -806,8 +841,7 @@ local GetCellAlign = function (dir, tableObj, colObj, cellObj, cell, child)
or colObj and (colObj["align" .. dir] or colObj.align)
or tableObj["align" .. dir] or tableObj.align
or "CENTERLEFT"
local val
child, cell = child or 0, cell or 0
local child, cell, val = child or 0, cell or 0, nil
if type(fn) == "string" then
fn = fn:lower()
@@ -821,7 +855,7 @@ local GetCellAlign = function (dir, tableObj, colObj, cellObj, cell, child)
val = fn
end
return fn, math_max(0, math_min(val, cell))
return fn, max(0, min(val, cell))
end
-- Get width or height for multiple cells combined
@@ -830,7 +864,7 @@ local GetCellDimension = function (dir, laneDim, from, to, space)
for cell=from,to do
dim = dim + (laneDim[cell] or 0)
end
return dim + math_max(0, to - from) * (space or 0)
return dim + max(0, to - from) * (space or 0)
end
--[[ Options
@@ -876,7 +910,7 @@ AceGUI:RegisterLayout("Table",
repeat
n = n + 1
local col = (n - 1) % #cols + 1
local row = math_ceil(n / #cols)
local row = ceil(n / #cols)
local rowspan = rowspans[col]
local cell = rowspan and rowspan.child or child
local cellObj = cell:GetUserData("cell")
@@ -892,7 +926,7 @@ AceGUI:RegisterLayout("Table",
end
-- Colspan
local colspan = math_max(0, math_min((cellObj and cellObj.colspan or 1) - 1, #cols - col))
local colspan = max(0, min((cellObj and cellObj.colspan or 1) - 1, #cols - col))
n = n + colspan
-- Place the cell
@@ -909,7 +943,7 @@ AceGUI:RegisterLayout("Table",
end
end
local rows = math_ceil(n / #cols)
local rows = ceil(n / #cols)
-- Determine fixed size cols and collect weights
local extantH, totalWeight = totalH, 0
@@ -934,16 +968,16 @@ AceGUI:RegisterLayout("Table",
f:ClearAllPoints()
local childH = f:GetWidth() or 0
laneH[col] = math_max(laneH[col], childH - GetCellDimension("H", laneH, colStart[child], col - 1, spaceH))
laneH[col] = max(laneH[col], childH - GetCellDimension("H", laneH, colStart[child], col - 1, spaceH))
end
end
laneH[col] = math_max(colObj.min or colObj[1] or 0, math_min(laneH[col], colObj.max or colObj[2] or laneH[col]))
laneH[col] = max(colObj.min or colObj[1] or 0, min(laneH[col], colObj.max or colObj[2] or laneH[col]))
else
-- Rel./Abs. width
laneH[col] = colObj.width < 1 and colObj.width * totalH or colObj.width
end
extantH = math_max(0, extantH - laneH[col])
extantH = max(0, extantH - laneH[col])
end
end
@@ -982,7 +1016,7 @@ AceGUI:RegisterLayout("Table",
child:DoLayout()
end
rowV = math_max(rowV, (f:GetHeight() or 0) - GetCellDimension("V", laneV, rowStart[child], row - 1, spaceV))
rowV = max(rowV, (f:GetHeight() or 0) - GetCellDimension("V", laneV, rowStart[child], row - 1, spaceV))
end
end
@@ -13,6 +13,7 @@
<Script file="widgets\AceGUIContainer-Window.lua"/>
<!-- Widgets -->
<Script file="widgets\AceGUIWidget-Button.lua"/>
<Script file="widgets\AceGUIWidget-Button-ElvUI.lua"/>
<Script file="widgets\AceGUIWidget-CheckBox.lua"/>
<Script file="widgets\AceGUIWidget-ColorPicker.lua"/>
<Script file="widgets\AceGUIWidget-DropDown.lua"/>
@@ -2,7 +2,7 @@
BlizOptionsGroup Container
Simple container widget for the integration of AceGUI into the Blizzard Interface Options
-------------------------------------------------------------------------------]]
local Type, Version = "BlizOptionsGroup", 26
local Type, Version = "BlizOptionsGroup", 21
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -99,11 +99,7 @@ local methods = {
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
-- CoA-compat: InterfaceOptionsFramePanelContainer is a global from the stock 3.3.5
-- Interface Options frame; on the CoA reworked FrameXML it can be nil at the time
-- AceGUI widgets are constructed. Fall back to UIParent so CreateFrame doesn't blow up.
local _parent = InterfaceOptionsFramePanelContainer or UIParent
local frame = CreateFrame("Frame", nil, _parent)
local frame = CreateFrame("Frame")
frame:Hide()
-- support functions for the Blizzard Interface Options
@@ -112,11 +108,6 @@ local function Constructor()
frame.default = default
frame.refresh = refresh
-- 10.0 support function aliases (cancel has been removed)
frame.OnCommit = okay
frame.OnDefault = default
frame.OnRefresh = refresh
frame:SetScript("OnHide", OnHide)
frame:SetScript("OnShow", OnShow)
@@ -2,7 +2,7 @@
DropdownGroup Container
Container controlled by a dropdown on the top.
-------------------------------------------------------------------------------]]
local Type, Version = "DropdownGroup", 22
local Type, Version = "DropdownGroup", 21
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -125,7 +125,7 @@ local function Constructor()
dropdown.frame:Show()
dropdown:SetLabel("")
local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
local border = CreateFrame("Frame", nil, frame)
border:SetPoint("TOPLEFT", 0, -26)
border:SetPoint("BOTTOMRIGHT", 0, 3)
border:SetBackdrop(PaneBackdrop)
@@ -1,7 +1,7 @@
--[[-----------------------------------------------------------------------------
Frame Container
-------------------------------------------------------------------------------]]
local Type, Version = "Frame", 30
local Type, Version = "Frame", 25
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -13,11 +13,15 @@ local wipe = table.wipe
local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: CLOSE
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local function Button_OnClick(frame)
PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT
PlaySound("gsTitleOptionExit")
frame.obj:Hide()
end
@@ -79,7 +83,6 @@ local methods = {
["OnAcquire"] = function(self)
self.frame:SetParent(UIParent)
self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
self.frame:SetFrameLevel(100) -- Lots of room to draw under it
self:SetTitle()
self:SetStatusText()
self:ApplyStatus()
@@ -176,21 +179,16 @@ local PaneBackdrop = {
}
local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
local frame = CreateFrame("Frame", nil, UIParent)
frame:Hide()
frame:EnableMouse(true)
frame:SetMovable(true)
frame:SetResizable(true)
frame:SetFrameStrata("FULLSCREEN_DIALOG")
frame:SetFrameLevel(100) -- Lots of room to draw under it
frame:SetBackdrop(FrameBackdrop)
frame:SetBackdropColor(0, 0, 0, 1)
if frame.SetResizeBounds then -- WoW 10.0
frame:SetResizeBounds(400, 200)
else
frame:SetMinResize(400, 200)
end
frame:SetMinResize(400, 200)
frame:SetToplevel(true)
frame:SetScript("OnShow", Frame_OnShow)
frame:SetScript("OnHide", Frame_OnClose)
@@ -203,7 +201,7 @@ local function Constructor()
closebutton:SetWidth(100)
closebutton:SetText(CLOSE)
local statusbg = CreateFrame("Button", nil, frame, "BackdropTemplate")
local statusbg = CreateFrame("Button", nil, frame)
statusbg:SetPoint("BOTTOMLEFT", 15, 15)
statusbg:SetPoint("BOTTOMRIGHT", -132, 15)
statusbg:SetHeight(24)
@@ -271,7 +269,7 @@ local function Constructor()
line2:SetHeight(8)
line2:SetPoint("BOTTOMRIGHT", -8, 8)
line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
x = 0.1 * 8/17
local x = 0.1 * 8/17
line2:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
local sizer_s = CreateFrame("Frame", nil, frame)
@@ -2,7 +2,7 @@
InlineGroup Container
Simple container widget that creates a visible "box" with an optional title.
-------------------------------------------------------------------------------]]
local Type, Version = "InlineGroup", 22
local Type, Version = "InlineGroup", 21
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -75,7 +75,7 @@ local function Constructor()
titletext:SetJustifyH("LEFT")
titletext:SetHeight(18)
local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
local border = CreateFrame("Frame", nil, frame)
border:SetPoint("TOPLEFT", 0, -17)
border:SetPoint("BOTTOMRIGHT", -1, 3)
border:SetBackdrop(PaneBackdrop)
@@ -187,7 +187,7 @@ local function Constructor()
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
scrollbg:SetAllPoints(scrollbar)
scrollbg:SetColorTexture(0, 0, 0, 0.4)
scrollbg:SetTexture(0, 0, 0, 0.4)
--Container Support
local content = CreateFrame("Frame", nil, scrollframe)
@@ -2,18 +2,22 @@
TabGroup Container
Container that uses tabs on top to switch between groups.
-------------------------------------------------------------------------------]]
local Type, Version = "TabGroup", 38
local Type, Version = "TabGroup", 31
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, table.wipe
local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, wipe
-- WoW APIs
local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent
local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: PanelTemplates_TabResize, PanelTemplates_SetDisabledTabState, PanelTemplates_SelectTab, PanelTemplates_DeselectTab
-- local upvalue storage used by BuildTabs
local widths = {}
local rowwidths = {}
@@ -22,143 +26,6 @@ local rowends = {}
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function PanelTemplates_TabResize(tab, padding, absoluteSize, minWidth, maxWidth, absoluteTextSize)
local tabName = tab:GetName();
local buttonMiddle = tab.Middle or tab.middleTexture or _G[tabName.."Middle"];
local buttonMiddleDisabled = tab.MiddleDisabled or (tabName and _G[tabName.."MiddleDisabled"]);
local left = tab.Left or tab.leftTexture or _G[tabName.."Left"];
local sideWidths = 2 * left:GetWidth();
local tabText = tab.Text or _G[tab:GetName().."Text"];
local highlightTexture = tab.HighlightTexture or (tabName and _G[tabName.."HighlightTexture"]);
local width, tabWidth;
local textWidth;
if ( absoluteTextSize ) then
textWidth = absoluteTextSize;
else
tabText:SetWidth(0);
textWidth = tabText:GetWidth();
end
-- If there's an absolute size specified then use it
if ( absoluteSize ) then
if ( absoluteSize < sideWidths) then
width = 1;
tabWidth = sideWidths
else
width = absoluteSize - sideWidths;
tabWidth = absoluteSize
end
tabText:SetWidth(width);
else
-- Otherwise try to use padding
if ( padding ) then
width = textWidth + padding;
else
width = textWidth + 24;
end
-- If greater than the maxWidth then cap it
if ( maxWidth and width > maxWidth ) then
if ( padding ) then
width = maxWidth + padding;
else
width = maxWidth + 24;
end
tabText:SetWidth(width);
else
tabText:SetWidth(0);
end
if (minWidth and width < minWidth) then
width = minWidth;
end
tabWidth = width + sideWidths;
end
if ( buttonMiddle ) then
buttonMiddle:SetWidth(width);
end
if ( buttonMiddleDisabled ) then
buttonMiddleDisabled:SetWidth(width);
end
tab:SetWidth(tabWidth);
if ( highlightTexture ) then
highlightTexture:SetWidth(tabWidth);
end
end
local function PanelTemplates_DeselectTab(tab)
local name = tab:GetName();
local left = tab.Left or _G[name.."Left"];
local middle = tab.Middle or _G[name.."Middle"];
local right = tab.Right or _G[name.."Right"];
left:Show();
middle:Show();
right:Show();
--tab:UnlockHighlight();
tab:Enable();
local text = tab.Text or _G[name.."Text"];
text:SetPoint("CENTER", tab, "CENTER", (tab.deselectedTextX or 0), (tab.deselectedTextY or 2));
local leftDisabled = tab.LeftDisabled or _G[name.."LeftDisabled"];
local middleDisabled = tab.MiddleDisabled or _G[name.."MiddleDisabled"];
local rightDisabled = tab.RightDisabled or _G[name.."RightDisabled"];
leftDisabled:Hide();
middleDisabled:Hide();
rightDisabled:Hide();
end
local function PanelTemplates_SelectTab(tab)
local name = tab:GetName();
local left = tab.Left or _G[name.."Left"];
local middle = tab.Middle or _G[name.."Middle"];
local right = tab.Right or _G[name.."Right"];
left:Hide();
middle:Hide();
right:Hide();
--tab:LockHighlight();
tab:Disable();
tab:SetDisabledFontObject(GameFontHighlightSmall);
local text = tab.Text or _G[name.."Text"];
text:SetPoint("CENTER", tab, "CENTER", (tab.selectedTextX or 0), (tab.selectedTextY or -3));
local leftDisabled = tab.LeftDisabled or _G[name.."LeftDisabled"];
local middleDisabled = tab.MiddleDisabled or _G[name.."MiddleDisabled"];
local rightDisabled = tab.RightDisabled or _G[name.."RightDisabled"];
leftDisabled:Show();
middleDisabled:Show();
rightDisabled:Show();
if GameTooltip:IsOwned(tab) then
GameTooltip:Hide();
end
end
local function PanelTemplates_SetDisabledTabState(tab)
local name = tab:GetName();
local left = tab.Left or _G[name.."Left"];
local middle = tab.Middle or _G[name.."Middle"];
local right = tab.Right or _G[name.."Right"];
left:Show();
middle:Show();
right:Show();
--tab:UnlockHighlight();
tab:Disable();
tab.text = tab:GetText();
-- Gray out text
tab:SetDisabledFontObject(GameFontDisableSmall);
local leftDisabled = tab.LeftDisabled or _G[name.."LeftDisabled"];
local middleDisabled = tab.MiddleDisabled or _G[name.."MiddleDisabled"];
local rightDisabled = tab.RightDisabled or _G[name.."RightDisabled"];
leftDisabled:Hide();
middleDisabled:Hide();
rightDisabled:Hide();
end
local function UpdateTabLook(frame)
if frame.disabled then
PanelTemplates_SetDisabledTabState(frame)
@@ -172,7 +39,7 @@ end
local function Tab_SetText(frame, text)
frame:_SetText(text)
local width = frame.obj.frame.width or frame.obj.frame:GetWidth() or 0
PanelTemplates_TabResize(frame, 0, nil, nil, width, frame:GetFontString():GetStringWidth())
PanelTemplates_TabResize(frame, 0, nil, width)
end
local function Tab_SetSelected(frame, selected)
@@ -196,7 +63,7 @@ Scripts
-------------------------------------------------------------------------------]]
local function Tab_OnClick(frame)
if not (frame.selected or frame.disabled) then
PlaySound(841) -- SOUNDKIT.IG_CHARACTER_INFO_TAB
PlaySound("igCharacterInfoTab")
frame.obj:SelectTab(frame.value)
end
end
@@ -236,64 +103,11 @@ local methods = {
["CreateTab"] = function(self, id)
local tabname = ("AceGUITabGroup%dTab%d"):format(self.num, id)
local tab = CreateFrame("Button", tabname, self.border)
tab:SetSize(115, 24)
tab.deselectedTextY = -3
tab.selectedTextY = -2
tab.LeftDisabled = tab:CreateTexture(tabname .. "LeftDisabled", "BORDER")
tab.LeftDisabled:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-ActiveTab")
tab.LeftDisabled:SetSize(20, 24)
tab.LeftDisabled:SetPoint("BOTTOMLEFT", 0, -3)
tab.LeftDisabled:SetTexCoord(0, 0.15625, 0, 1.0)
tab.MiddleDisabled = tab:CreateTexture(tabname .. "MiddleDisabled", "BORDER")
tab.MiddleDisabled:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-ActiveTab")
tab.MiddleDisabled:SetSize(88, 24)
tab.MiddleDisabled:SetPoint("LEFT", tab.LeftDisabled, "RIGHT")
tab.MiddleDisabled:SetTexCoord(0.15625, 0.84375, 0, 1.0)
tab.RightDisabled = tab:CreateTexture(tabname .. "RightDisabled", "BORDER")
tab.RightDisabled:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-ActiveTab")
tab.RightDisabled:SetSize(20, 24)
tab.RightDisabled:SetPoint("LEFT", tab.MiddleDisabled, "RIGHT")
tab.RightDisabled:SetTexCoord(0.84375, 1.0, 0, 1.0)
tab.Left = tab:CreateTexture(tabname .. "Left", "BORDER")
tab.Left:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-InActiveTab")
tab.Left:SetSize(20, 24)
tab.Left:SetPoint("TOPLEFT")
tab.Left:SetTexCoord(0, 0.15625, 0, 1.0)
tab.Middle = tab:CreateTexture(tabname .. "Middle", "BORDER")
tab.Middle:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-InActiveTab")
tab.Middle:SetSize(88, 24)
tab.Middle:SetPoint("LEFT", tab.Left, "RIGHT")
tab.Middle:SetTexCoord(0.15625, 0.84375, 0, 1.0)
tab.Right = tab:CreateTexture(tabname .. "Right", "BORDER")
tab.Right:SetTexture("Interface\\OptionsFrame\\UI-OptionsFrame-InActiveTab")
tab.Right:SetSize(20, 24)
tab.Right:SetPoint("LEFT", tab.Middle, "RIGHT")
tab.Right:SetTexCoord(0.84375, 1.0, 0, 1.0)
tab.Text = tab:CreateFontString(tabname .. "Text")
tab:SetFontString(tab.Text)
tab:SetNormalFontObject(GameFontNormalSmall)
tab:SetHighlightFontObject(GameFontHighlightSmall)
tab:SetDisabledFontObject(GameFontHighlightSmall)
tab:SetHighlightTexture("Interface\\PaperDollInfoFrame\\UI-Character-Tab-Highlight", "ADD")
tab.HighlightTexture = tab:GetHighlightTexture()
tab.HighlightTexture:ClearAllPoints()
tab.HighlightTexture:SetPoint("LEFT", tab, "LEFT", 10, -4)
tab.HighlightTexture:SetPoint("RIGHT", tab, "RIGHT", -10, -4)
_G[tabname .. "HighlightTexture"] = tab.HighlightTexture
local tab = CreateFrame("Button", tabname, self.border, "OptionsFrameTabButtonTemplate")
tab.obj = self
tab.id = id
tab.text = tab.Text -- compat
tab.text = _G[tabname .. "Text"]
tab.text:ClearAllPoints()
tab.text:SetPoint("LEFT", 14, -3)
tab.text:SetPoint("RIGHT", -12, -3)
@@ -441,7 +255,7 @@ local methods = {
end
for i = starttab, endtab do
PanelTemplates_TabResize(tabs[i], padding + 4, nil, nil, width, tabs[i]:GetFontString():GetStringWidth())
PanelTemplates_TabResize(tabs[i], padding + 4, nil, width)
end
starttab = endtab + 1
end
@@ -502,7 +316,7 @@ local function Constructor()
titletext:SetHeight(18)
titletext:SetText("")
local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
local border = CreateFrame("Frame", nil, frame)
border:SetPoint("TOPLEFT", 1, -27)
border:SetPoint("BOTTOMRIGHT", -1, 3)
border:SetBackdrop(PaneBackdrop)
@@ -2,18 +2,22 @@
TreeGroup Container
Container that uses a tree control to switch between groups.
-------------------------------------------------------------------------------]]
local Type, Version = "TreeGroup", 49
local Type, Version = "TreeGroup", 43
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type
local math_min, math_max, floor = math.min, math.max, math.floor
local math_min, math_max, floor = math.min, math.max, floor
local select, tremove, unpack, tconcat = select, table.remove, unpack, table.concat
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: GameTooltip, FONT_COLOR_CODE_CLOSE
-- Recycling functions
local new, del
do
@@ -155,7 +159,7 @@ end
local function FirstFrameUpdate(frame)
local self = frame.obj
frame:SetScript("OnUpdate", nil)
self:RefreshTree(nil, true)
self:RefreshTree()
end
local function BuildUniqueValue(...)
@@ -202,13 +206,11 @@ local function Button_OnEnter(frame)
self:Fire("OnButtonEnter", frame.uniquevalue, frame)
if self.enabletooltips then
local tooltip = AceGUI.tooltip
tooltip:SetOwner(frame, "ANCHOR_NONE")
tooltip:ClearAllPoints()
tooltip:SetPoint("LEFT",frame,"RIGHT")
tooltip:SetText(frame.text:GetText() or "", 1, .82, 0, 1, true)
GameTooltip:SetOwner(frame, "ANCHOR_NONE")
GameTooltip:SetPoint("LEFT",frame,"RIGHT")
GameTooltip:SetText(frame.text:GetText() or "", 1, .82, 0, 1)
tooltip:Show()
GameTooltip:Show()
end
end
@@ -217,7 +219,7 @@ local function Button_OnLeave(frame)
self:Fire("OnButtonLeave", frame.uniquevalue, frame)
if self.enabletooltips then
AceGUI.tooltip:Hide()
GameTooltip:Hide()
end
end
@@ -225,7 +227,7 @@ local function OnScrollValueChanged(frame, value)
if frame.obj.noupdate then return end
local self = frame.obj
local status = self.status or self.localstatus
status.scrollvalue = floor(value + 0.5)
status.scrollvalue = value
self:RefreshTree()
AceGUI:ClearFocus()
end
@@ -290,13 +292,10 @@ local methods = {
["OnAcquire"] = function(self)
self:SetTreeWidth(DEFAULT_TREE_WIDTH, DEFAULT_TREE_SIZABLE)
self:EnableButtonTooltips(true)
self.frame:SetScript("OnUpdate", FirstFrameUpdate)
end,
["OnRelease"] = function(self)
self.status = nil
self.tree = nil
self.frame:SetScript("OnUpdate", nil)
for k, v in pairs(self.localstatus) do
if k == "groups" then
for k2 in pairs(v) do
@@ -384,9 +383,13 @@ local methods = {
end
end,
["RefreshTree"] = function(self,scrollToSelection,fromOnUpdate)
["RefreshTree"] = function(self,scrollToSelection)
local buttons = self.buttons
local lines = self.lines
for i, v in ipairs(buttons) do
v:Hide()
end
while lines[1] do
local t = tremove(lines)
for k in pairs(t) do
@@ -412,11 +415,6 @@ local methods = {
local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18))
if maxlines <= 0 then return end
if self.frame:GetParent() == UIParent and not fromOnUpdate then
self.frame:SetScript("OnUpdate", FirstFrameUpdate)
return
end
local first, last
scrollToSelection = status.scrollToSelection
@@ -495,10 +493,6 @@ local methods = {
buttonnum = buttonnum + 1
end
-- We hide the remaining buttons after updating others to avoid a blizzard bug that keeps them interactable even if hidden when hidden before updating the buttons.
for i = buttonnum, #buttons do
buttons[i]:Hide()
end
end,
["SetSelected"] = function(self, value)
@@ -563,11 +557,7 @@ local methods = {
if maxtreewidth > 100 and status.treewidth > maxtreewidth then
self:SetTreeWidth(maxtreewidth, status.treesizable)
end
if treeframe.SetResizeBounds then
treeframe:SetResizeBounds(100, 1, maxtreewidth, 1600)
else
treeframe:SetMaxResize(maxtreewidth, 1600)
end
treeframe:SetMaxResize(maxtreewidth, 1600)
end,
["OnHeightSet"] = function(self, height)
@@ -629,7 +619,7 @@ local PaneBackdrop = {
local DraggerBackdrop = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = nil,
tile = true, tileSize = 16, edgeSize = 1,
tile = true, tileSize = 16, edgeSize = 0,
insets = { left = 3, right = 3, top = 7, bottom = 7 }
}
@@ -637,7 +627,7 @@ local function Constructor()
local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", nil, UIParent)
local treeframe = CreateFrame("Frame", nil, frame, "BackdropTemplate")
local treeframe = CreateFrame("Frame", nil, frame)
treeframe:SetPoint("TOPLEFT")
treeframe:SetPoint("BOTTOMLEFT")
treeframe:SetWidth(DEFAULT_TREE_WIDTH)
@@ -646,17 +636,13 @@ local function Constructor()
treeframe:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
treeframe:SetBackdropBorderColor(0.4, 0.4, 0.4)
treeframe:SetResizable(true)
if treeframe.SetResizeBounds then -- WoW 10.0
treeframe:SetResizeBounds(100, 1, 400, 1600)
else
treeframe:SetMinResize(100, 1)
treeframe:SetMaxResize(400, 1600)
end
treeframe:SetMinResize(100, 1)
treeframe:SetMaxResize(400, 1600)
treeframe:SetScript("OnUpdate", FirstFrameUpdate)
treeframe:SetScript("OnSizeChanged", Tree_OnSizeChanged)
treeframe:SetScript("OnMouseWheel", Tree_OnMouseWheel)
local dragger = CreateFrame("Frame", nil, treeframe, "BackdropTemplate")
local dragger = CreateFrame("Frame", nil, treeframe)
dragger:SetWidth(8)
dragger:SetPoint("TOP", treeframe, "TOPRIGHT")
dragger:SetPoint("BOTTOM", treeframe, "BOTTOMRIGHT")
@@ -679,9 +665,9 @@ local function Constructor()
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND")
scrollbg:SetAllPoints(scrollbar)
scrollbg:SetColorTexture(0,0,0,0.4)
scrollbg:SetTexture(0,0,0,0.4)
local border = CreateFrame("Frame", nil, frame, "BackdropTemplate")
local border = CreateFrame("Frame",nil,frame)
border:SetPoint("TOPLEFT", treeframe, "TOPRIGHT")
border:SetPoint("BOTTOMRIGHT")
border:SetBackdrop(PaneBackdrop)
@@ -7,6 +7,10 @@ local pairs, assert, type = pairs, assert, type
local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: GameFontNormal
----------------
-- Main Frame --
----------------
@@ -17,7 +21,7 @@ local CreateFrame, UIParent = CreateFrame, UIParent
]]
do
local Type = "Window"
local Version = 8
local Version = 5
local function frameOnShow(this)
this.obj:Fire("OnShow")
@@ -28,7 +32,7 @@ do
end
local function closeOnClick(this)
PlaySound(799) -- SOUNDKIT.GS_TITLE_OPTION_EXIT
PlaySound("gsTitleOptionExit")
this.obj:Hide()
end
@@ -182,75 +186,71 @@ do
frame:SetScript("OnShow",frameOnShow)
frame:SetScript("OnHide",frameOnClose)
if frame.SetResizeBounds then -- WoW 10.0
frame:SetResizeBounds(240,240)
else
frame:SetMinResize(240,240)
end
frame:SetMinResize(240,240)
frame:SetToplevel(true)
local titlebg = frame:CreateTexture(nil, "BACKGROUND")
titlebg:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Title-Background")
titlebg:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Title-Background]])
titlebg:SetPoint("TOPLEFT", 9, -6)
titlebg:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", -28, -24)
local dialogbg = frame:CreateTexture(nil, "BACKGROUND")
dialogbg:SetTexture("Interface\\Tooltips\\UI-Tooltip-Background")
dialogbg:SetTexture([[Interface\Tooltips\UI-Tooltip-Background]])
dialogbg:SetPoint("TOPLEFT", 8, -24)
dialogbg:SetPoint("BOTTOMRIGHT", -6, 8)
dialogbg:SetVertexColor(0, 0, 0, .75)
local topleft = frame:CreateTexture(nil, "BORDER")
topleft:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
topleft:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
topleft:SetWidth(64)
topleft:SetHeight(64)
topleft:SetPoint("TOPLEFT")
topleft:SetTexCoord(0.501953125, 0.625, 0, 1)
local topright = frame:CreateTexture(nil, "BORDER")
topright:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
topright:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
topright:SetWidth(64)
topright:SetHeight(64)
topright:SetPoint("TOPRIGHT")
topright:SetTexCoord(0.625, 0.75, 0, 1)
local top = frame:CreateTexture(nil, "BORDER")
top:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
top:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
top:SetHeight(64)
top:SetPoint("TOPLEFT", topleft, "TOPRIGHT")
top:SetPoint("TOPRIGHT", topright, "TOPLEFT")
top:SetTexCoord(0.25, 0.369140625, 0, 1)
local bottomleft = frame:CreateTexture(nil, "BORDER")
bottomleft:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
bottomleft:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
bottomleft:SetWidth(64)
bottomleft:SetHeight(64)
bottomleft:SetPoint("BOTTOMLEFT")
bottomleft:SetTexCoord(0.751953125, 0.875, 0, 1)
local bottomright = frame:CreateTexture(nil, "BORDER")
bottomright:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
bottomright:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
bottomright:SetWidth(64)
bottomright:SetHeight(64)
bottomright:SetPoint("BOTTOMRIGHT")
bottomright:SetTexCoord(0.875, 1, 0, 1)
local bottom = frame:CreateTexture(nil, "BORDER")
bottom:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
bottom:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
bottom:SetHeight(64)
bottom:SetPoint("BOTTOMLEFT", bottomleft, "BOTTOMRIGHT")
bottom:SetPoint("BOTTOMRIGHT", bottomright, "BOTTOMLEFT")
bottom:SetTexCoord(0.376953125, 0.498046875, 0, 1)
local left = frame:CreateTexture(nil, "BORDER")
left:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
left:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
left:SetWidth(64)
left:SetPoint("TOPLEFT", topleft, "BOTTOMLEFT")
left:SetPoint("BOTTOMLEFT", bottomleft, "TOPLEFT")
left:SetTexCoord(0.001953125, 0.125, 0, 1)
local right = frame:CreateTexture(nil, "BORDER")
right:SetTexture("Interface\\PaperDollInfoFrame\\UI-GearManager-Border")
right:SetTexture([[Interface\PaperDollInfoFrame\UI-GearManager-Border]])
right:SetWidth(64)
right:SetPoint("TOPRIGHT", topright, "BOTTOMRIGHT")
right:SetPoint("BOTTOMRIGHT", bottomright, "TOPRIGHT")
@@ -300,7 +300,7 @@ do
line2:SetHeight(8)
line2:SetPoint("BOTTOMRIGHT", -8, 8)
line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
x = 0.1 * 8/17
local x = 0.1 * 8/17
line2:SetTexCoord(0.05 - x, 0.5, 0.05, 0.5 + x, 0.05, 0.5 - x, 0.5 + x, 0.5)
local sizer_s = CreateFrame("Frame",nil,frame)
@@ -0,0 +1,179 @@
--[[-----------------------------------------------------------------------------
Button Widget (Modified to change text color on SetDisabled method)
Graphical Button.
-------------------------------------------------------------------------------]]
local Type, Version = "Button-ElvUI", 2
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs
local pairs = pairs
-- WoW APIs
local _G = _G
local PlaySound, CreateFrame, UIParent = PlaySound, CreateFrame, UIParent
local IsShiftKeyDown = IsShiftKeyDown
-- GLOBALS: GameTooltip, ElvUI
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
local dragdropButton
local function lockTooltip()
GameTooltip:SetOwner(UIParent, "ANCHOR_CURSOR")
GameTooltip:SetText(" ")
GameTooltip:Show()
end
local function dragdrop_OnMouseDown(frame, ...)
if frame.obj.dragOnMouseDown then
dragdropButton.mouseDownFrame = frame
dragdropButton:SetText(frame.obj.value or "Unknown")
dragdropButton:SetSize(frame:GetSize())
frame.obj.dragOnMouseDown(frame, ...)
end
end
local function dragdrop_OnMouseUp(frame, ...)
if frame.obj.dragOnMouseUp then
frame:SetAlpha(1)
GameTooltip:Hide()
dragdropButton:Hide()
if dragdropButton.enteredFrame and dragdropButton.enteredFrame ~= frame and dragdropButton.enteredFrame:IsMouseOver() then
frame.obj.dragOnMouseUp(frame, ...)
frame.obj.ActivateMultiControl(frame.obj, ...)
end
dragdropButton.enteredFrame = nil
dragdropButton.mouseDownFrame = nil
end
end
local function dragdrop_OnLeave(frame, ...)
if frame.obj.dragOnLeave then
if dragdropButton.mouseDownFrame then
lockTooltip()
end
if frame == dragdropButton.mouseDownFrame then
frame:SetAlpha(0)
dragdropButton:Show()
frame.obj.dragOnLeave(frame, ...)
end
end
end
local function dragdrop_OnEnter(frame, ...)
if frame.obj.dragOnEnter and dragdropButton:IsShown() then
dragdropButton.enteredFrame = frame
lockTooltip()
frame.obj.dragOnEnter(frame, ...)
end
end
local function dragdrop_OnClick(frame, ...)
local button = ...
if frame.obj.dragOnClick and button == "RightButton" then
frame.obj.dragOnClick(frame, ...)
frame.obj.ActivateMultiControl(frame.obj, ...)
elseif frame.obj.stateSwitchOnClick and (button == "LeftButton") and IsShiftKeyDown() then
frame.obj.stateSwitchOnClick(frame, ...)
frame.obj.ActivateMultiControl(frame.obj, ...)
end
end
local function Button_OnClick(frame, ...)
AceGUI:ClearFocus()
PlaySound("igMainMenuOption")
frame.obj:Fire("OnClick", ...)
end
local function Control_OnEnter(frame)
frame.obj:Fire("OnEnter")
end
local function Control_OnLeave(frame)
frame.obj:Fire("OnLeave")
end
--[[-----------------------------------------------------------------------------
Methods
-------------------------------------------------------------------------------]]
local methods = {
["OnAcquire"] = function(self)
-- restore default values
self:SetHeight(24)
self:SetWidth(200)
self:SetDisabled(false)
self:SetAutoWidth(false)
self:SetText()
end,
-- ["OnRelease"] = nil,
["SetText"] = function(self, text)
self.text:SetText(text)
if self.autoWidth then
self:SetWidth(self.text:GetStringWidth() + 30)
end
end,
["SetAutoWidth"] = function(self, autoWidth)
self.autoWidth = autoWidth
if self.autoWidth then
self:SetWidth(self.text:GetStringWidth() + 30)
end
end,
["SetDisabled"] = function(self, disabled)
self.disabled = disabled
if disabled then
self.frame:Disable()
self.text:SetTextColor(0.4, 0.4, 0.4)
else
self.frame:Enable()
self.text:SetTextColor(1, 0.82, 0)
end
end
}
--[[-----------------------------------------------------------------------------
Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate2")
frame:Hide()
frame:EnableMouse(true)
frame:RegisterForClicks("AnyUp")
frame:SetScript("OnClick", Button_OnClick)
frame:SetScript("OnEnter", Control_OnEnter)
frame:SetScript("OnLeave", Control_OnLeave)
-- dragdrop
if not dragdropButton then
dragdropButton = CreateFrame("Button", "ElvUIAceGUI30DragDropButton", UIParent, "UIPanelButtonTemplate")
dragdropButton:SetFrameStrata("TOOLTIP")
dragdropButton:SetFrameLevel(5)
dragdropButton:SetPoint('BOTTOM', GameTooltip, "BOTTOM", 0, 10)
dragdropButton:Hide()
ElvUI[1]:GetModule('Skins'):HandleButton(dragdropButton)
end
frame:HookScript("OnClick", dragdrop_OnClick)
frame:HookScript("OnEnter", dragdrop_OnEnter)
frame:HookScript("OnLeave", dragdrop_OnLeave)
frame:HookScript("OnMouseUp", dragdrop_OnMouseUp)
frame:HookScript("OnMouseDown", dragdrop_OnMouseDown)
local text = frame:GetFontString()
text:ClearAllPoints()
text:SetPoint("TOPLEFT", 15, -1)
text:SetPoint("BOTTOMRIGHT", -15, 1)
text:SetJustifyV("MIDDLE")
local widget = {
text = text,
frame = frame,
type = Type
}
for method, func in pairs(methods) do
widget[method] = func
end
return AceGUI:RegisterAsWidget(widget)
end
AceGUI:RegisterWidgetType(Type, Constructor, Version)
@@ -2,7 +2,7 @@
Button Widget
Graphical Button.
-------------------------------------------------------------------------------]]
local Type, Version = "Button", 24
local Type, Version = "Button", 23
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -18,7 +18,7 @@ Scripts
-------------------------------------------------------------------------------]]
local function Button_OnClick(frame, ...)
AceGUI:ClearFocus()
PlaySound(852) -- SOUNDKIT.IG_MAINMENU_OPTION
PlaySound("igMainMenuOption")
frame.obj:Fire("OnClick", ...)
end
@@ -74,7 +74,7 @@ Constructor
-------------------------------------------------------------------------------]]
local function Constructor()
local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate")
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate2")
frame:Hide()
frame:EnableMouse(true)
@@ -12,6 +12,10 @@ local select, pairs = select, pairs
local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: SetDesaturation, GameFontHighlight
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
@@ -56,9 +60,9 @@ local function CheckBox_OnMouseUp(frame)
self:ToggleChecked()
if self.checked then
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
PlaySound("igMainMenuOptionCheckBoxOn")
else -- for both nil and false (tristate)
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
PlaySound("igMainMenuOptionCheckBoxOff")
end
self:Fire("OnValueChanged", self.checked)
@@ -195,14 +199,13 @@ local methods = {
["SetDescription"] = function(self, desc)
if desc then
if not self.desc then
local f = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
f:ClearAllPoints()
f:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21)
f:SetWidth(self.frame.width - 30)
f:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0)
f:SetJustifyH("LEFT")
f:SetJustifyV("TOP")
self.desc = f
local desc = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
desc:ClearAllPoints()
desc:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21)
desc:SetWidth(self.frame.width - 30)
desc:SetJustifyH("LEFT")
desc:SetJustifyV("TOP")
self.desc = desc
end
self.desc:Show()
--self.text:SetFontObject(GameFontNormal)
@@ -1,7 +1,7 @@
--[[-----------------------------------------------------------------------------
ColorPicker Widget
-------------------------------------------------------------------------------]]
local Type, Version = "ColorPicker", 28
local Type, Version = "ColorPicker-ElvUI", 25
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -11,24 +11,21 @@ local pairs = pairs
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
-- Unfortunately we have no way to realistically detect if a client uses inverted alpha
-- as no API will tell you. Wrath uses the old colorpicker, era uses the new one, both are inverted
local INVERTED_ALPHA = (WOW_PROJECT_ID ~= WOW_PROJECT_MAINLINE)
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: ColorPickerFrame, OpacitySliderFrame, ColorPPDefault
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
local function ColorCallback(self, r, g, b, a, isAlpha)
if INVERTED_ALPHA and a then
a = 1 - a
end
-- this will block an infinite loop from `E.GrabColorPickerValues`
-- which is caused when we set values into the color picker again on `OnValueChanged`
if ColorPickerFrame.noColorCallback then return end
if not self.HasAlpha then
a = 1
end
-- no change, skip update
if r == self.r and g == self.g and b == self.b and a == self.a then
return
end
self:SetColor(r, g, b, a)
if ColorPickerFrame:IsVisible() then
--colorpicker is still open
@@ -61,63 +58,37 @@ local function ColorSwatch_OnClick(frame)
ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10)
ColorPickerFrame:SetClampedToScreen(true)
if ColorPickerFrame.SetupColorPickerAndShow then -- 10.2.5 color picker overhaul
local r2, g2, b2, a2 = self.r, self.g, self.b, (self.a or 1)
if INVERTED_ALPHA then
a2 = 1 - a2
end
local info = {
swatchFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = ColorPickerFrame:GetColorAlpha()
ColorCallback(self, r, g, b, a)
end,
hasOpacity = self.HasAlpha,
opacityFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = ColorPickerFrame:GetColorAlpha()
ColorCallback(self, r, g, b, a, true)
end,
opacity = a2,
cancelFunc = function()
ColorCallback(self, r2, g2, b2, a2, true)
end,
r = r2,
g = g2,
b = b2,
}
ColorPickerFrame:SetupColorPickerAndShow(info)
else
ColorPickerFrame.func = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a)
end
ColorPickerFrame.hasOpacity = self.HasAlpha
ColorPickerFrame.opacityFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a, true)
end
local r, g, b, a = self.r, self.g, self.b, 1 - (self.a or 1)
if self.HasAlpha then
ColorPickerFrame.opacity = a
end
ColorPickerFrame:SetColorRGB(r, g, b)
ColorPickerFrame.cancelFunc = function()
ColorCallback(self, r, g, b, a, true)
end
ColorPickerFrame:Show()
ColorPickerFrame.func = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = 1 - OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a)
end
ColorPickerFrame.hasOpacity = self.HasAlpha
ColorPickerFrame.opacityFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB()
local a = 1 - OpacitySliderFrame:GetValue()
ColorCallback(self, r, g, b, a, true)
end
local r, g, b, a = self.r, self.g, self.b, self.a
if self.HasAlpha then
ColorPickerFrame.opacity = 1 - (a or 0)
end
ColorPickerFrame:SetColorRGB(r, g, b)
if ColorPPDefault and self.dR and self.dG and self.dB then
local alpha = 1
if self.dA then alpha = 1 - self.dA end
if not ColorPPDefault.colors then ColorPPDefault.colors = {} end
ColorPPDefault.colors.r, ColorPPDefault.colors.g, ColorPPDefault.colors.b, ColorPPDefault.colors.a = self.dR, self.dG, self.dB, alpha
end
ColorPickerFrame.cancelFunc = function()
ColorCallback(self, r, g, b, a, true)
end
ColorPickerFrame:Show()
end
AceGUI:ClearFocus()
end
@@ -141,11 +112,15 @@ local methods = {
self.text:SetText(text)
end,
["SetColor"] = function(self, r, g, b, a)
["SetColor"] = function(self, r, g, b, a, defaultR, defaultG, defaultB, defaultA)
self.r = r
self.g = g
self.b = b
self.a = a or 1
self.dR = defaultR or self.dR
self.dG = defaultG or self.dG
self.dB = defaultB or self.dB
self.dA = defaultA or self.dA
self.colorSwatch:SetVertexColor(r, g, b, a)
end,
@@ -187,7 +162,7 @@ local function Constructor()
colorSwatch.background = texture
texture:SetWidth(16)
texture:SetHeight(16)
texture:SetColorTexture(1, 1, 1)
texture:SetTexture(1, 1, 1)
texture:SetPoint("CENTER", colorSwatch)
texture:Show()
@@ -41,7 +41,7 @@ local ItemBase = {
-- NOTE: The ItemBase version is added to each item's version number
-- to ensure proper updates on ItemBase changes.
-- Use at least 1000er steps.
version = 2000,
version = 1000,
counter = 0,
}
@@ -178,7 +178,7 @@ function ItemBase.Create(type)
highlight:Hide()
self.highlight = highlight
local check = frame:CreateTexture(nil, "OVERLAY")
local check = frame:CreateTexture("OVERLAY")
check:SetWidth(16)
check:SetHeight(16)
check:SetPoint("LEFT",frame,"LEFT",3,-1)
@@ -186,7 +186,7 @@ function ItemBase.Create(type)
check:Hide()
self.check = check
local sub = frame:CreateTexture(nil, "OVERLAY")
local sub = frame:CreateTexture("OVERLAY")
sub:SetWidth(16)
sub:SetHeight(16)
sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1)
@@ -323,7 +323,7 @@ end
-- Does not close the pullout on click.
do
local widgetType = "Dropdown-Item-Toggle"
local widgetVersion = 4
local widgetVersion = 3
local function UpdateToggle(self)
if self.value then
@@ -343,9 +343,9 @@ do
if self.disabled then return end
self.value = not self.value
if self.value then
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
PlaySound("igMainMenuOptionCheckBoxOn")
else
PlaySound(857) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_OFF
PlaySound("igMainMenuOptionCheckBoxOff")
end
UpdateToggle(self)
self:Fire("OnValueChanged", self.value)
@@ -440,7 +440,7 @@ end
-- A single line to separate items
do
local widgetType = "Dropdown-Item-Separator"
local widgetVersion = 2
local widgetVersion = 1
-- exported, override
local function SetDisabled(self, disabled)
@@ -455,7 +455,7 @@ do
local line = self.frame:CreateTexture(nil, "OVERLAY")
line:SetHeight(1)
line:SetColorTexture(.5, .5, .5)
line:SetTexture(.5, .5, .5)
line:SetPoint("LEFT", self.frame, "LEFT", 10, 0)
line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0)
@@ -4,13 +4,17 @@ local AceGUI = LibStub("AceGUI-3.0")
-- Lua APIs
local min, max, floor = math.min, math.max, math.floor
local select, pairs, ipairs, type, tostring = select, pairs, ipairs, type, tostring
local tsort = table.sort
local tsort, tonumber = table.sort, tonumber
-- WoW APIs
local PlaySound = PlaySound
local UIParent, CreateFrame = UIParent, CreateFrame
local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: CLOSE
local function fixlevels(parent,...)
local i = 1
local child = select(i, ...)
@@ -35,7 +39,7 @@ end
do
local widgetType = "Dropdown-Pullout"
local widgetVersion = 5
local widgetVersion = 3
--[[ Static data ]]--
@@ -189,7 +193,12 @@ do
local height = 8
for i, item in pairs(items) do
item:SetPoint("TOP", itemFrame, "TOP", 0, -2 + (i - 1) * -16)
if i == 1 then
item:SetPoint("TOP", itemFrame, "TOP", 0, -2)
else
item:SetPoint("TOP", items[i-1].frame, "BOTTOM", 0, 1)
end
item:Show()
height = height + 16
@@ -249,7 +258,7 @@ do
local function Constructor()
local count = AceGUI:GetNextWidgetNum(widgetType)
local frame = CreateFrame("Frame", "AceGUI30Pullout"..count, UIParent, "BackdropTemplate")
local frame = CreateFrame("Frame", "AceGUI30Pullout"..count, UIParent)
local self = {}
self.count = count
self.type = widgetType
@@ -300,7 +309,7 @@ do
scrollFrame.obj = self
itemFrame.obj = self
local slider = CreateFrame("Slider", "AceGUI30PulloutScrollbar"..count, scrollFrame, "BackdropTemplate")
local slider = CreateFrame("Slider", "AceGUI30PulloutScrollbar"..count, scrollFrame)
slider:SetOrientation("VERTICAL")
slider:SetHitRectInsets(0, 0, -10, 0)
slider:SetBackdrop(sliderBackdrop)
@@ -347,7 +356,7 @@ end
do
local widgetType = "Dropdown"
local widgetVersion = 36
local widgetVersion = 35
--[[ Static data ]]--
@@ -372,6 +381,7 @@ do
local function Dropdown_TogglePullout(this)
local self = this.obj
PlaySound("igMainMenuOptionCheckBoxOn") -- missleading name, but the Blizzard code uses this sound
if self.open then
self.open = nil
self.pullout:Close()
@@ -589,21 +599,47 @@ do
return tostring(x) < tostring(y)
end
end
local function SetList(self, list, order, itemType)
-- these were added by ElvUI
local sortStr1, sortStr2 = "%((%d+)%)", "%[(%d+)]"
local sortValue = function(a,b)
if a and b and (a[2] and b[2]) then
local a2 = tonumber(a[2]:match(sortStr1) or a[2]:match(sortStr2))
local b2 = tonumber(b[2]:match(sortStr1) or b[2]:match(sortStr2))
if a2 and b2 and (a2 ~= b2) then
return a2 < b2 -- try to sort by the number inside of brackets if we can
end
return a[2] < b[2]
end
end
local function SetList(self, list, order, itemType, sortByValue)
self.list = list or {}
self.pullout:Clear()
self.hasClose = nil
if not list then return end
if type(order) ~= "table" then
for v in pairs(list) do
sortlist[#sortlist + 1] = v
end
tsort(sortlist, sortTbl)
if sortByValue then -- added by ElvUI
for k, v in pairs(list) do
sortlist[#sortlist + 1] = {k,v}
end
tsort(sortlist, sortValue)
for i, key in ipairs(sortlist) do
AddListItem(self, key, list[key], itemType)
sortlist[i] = nil
for i, sortedList in ipairs(sortlist) do
AddListItem(self, sortedList[1], sortedList[2], itemType)
sortlist[i] = nil
end
else -- this is the default way (unchanged by ElvUI)
for v in pairs(list) do
sortlist[#sortlist + 1] = v
end
tsort(sortlist, sortTbl)
for i, key in ipairs(sortlist) do
AddListItem(self, key, list[key], itemType)
sortlist[i] = nil
end
end
else
for i, key in ipairs(order) do
@@ -1,7 +1,7 @@
--[[-----------------------------------------------------------------------------
EditBox Widget
-------------------------------------------------------------------------------]]
local Type, Version = "EditBox", 29
local Type, Version = "EditBox", 28
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -10,20 +10,20 @@ local tostring, pairs = tostring, pairs
-- WoW APIs
local PlaySound = PlaySound
local GetCursorInfo, ClearCursor = GetCursorInfo, ClearCursor
local GetCursorInfo, ClearCursor, GetSpellInfo = GetCursorInfo, ClearCursor, GetSpellInfo
local CreateFrame, UIParent = CreateFrame, UIParent
local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: AceGUIEditBoxInsertLink, ChatFontNormal, OKAY
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
if not AceGUIEditBoxInsertLink then
-- upgradeable hook
if ChatFrameUtil and ChatFrameUtil.InsertLink then
hooksecurefunc(ChatFrameUtil, "InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end)
elseif ChatEdit_InsertLink then
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end)
end
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end)
end
function _G.AceGUIEditBoxInsertLink(text)
@@ -73,23 +73,19 @@ local function EditBox_OnEnterPressed(frame)
local value = frame:GetText()
local cancel = self:Fire("OnEnterPressed", value)
if not cancel then
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
PlaySound("igMainMenuOptionCheckBoxOn")
HideButton(self)
end
end
local function EditBox_OnReceiveDrag(frame)
local self = frame.obj
local type, id, info, extra = GetCursorInfo()
local type, id, info = GetCursorInfo()
local name
if type == "item" then
name = info
elseif type == "spell" then
if C_Spell and C_Spell.GetSpellName then
name = C_Spell.GetSpellName(extra)
else
name = GetSpellInfo(id, info)
end
name = GetSpellInfo(id, info)
elseif type == "macro" then
name = GetMacroInfo(id)
end
@@ -132,7 +132,7 @@ local function Constructor()
widget[method] = func
end
widget.SetText = function(self, ...) print("AceGUI-3.0-Icon: SetText is deprecated! Use SetLabel instead!"); self:SetLabel(...) end
widget.SetText = widget.SetLabel
return AceGUI:RegisterAsWidget(widget)
end
@@ -2,7 +2,7 @@
Keybinding Widget
Set Keybindings in the Config UI.
-------------------------------------------------------------------------------]]
local Type, Version = "Keybinding", 27
local Type, Version = "Keybinding", 25
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -13,6 +13,10 @@ local pairs = pairs
local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: NOT_BOUND
--[[-----------------------------------------------------------------------------
Scripts
-------------------------------------------------------------------------------]]
@@ -31,14 +35,12 @@ local function Keybinding_OnClick(frame, button)
if self.waitingForKey then
frame:EnableKeyboard(false)
frame:EnableMouseWheel(false)
frame:EnableGamePadButton(false)
self.msgframe:Hide()
frame:UnlockHighlight()
self.waitingForKey = nil
else
frame:EnableKeyboard(true)
frame:EnableMouseWheel(true)
frame:EnableGamePadButton(true)
self.msgframe:Show()
frame:LockHighlight()
self.waitingForKey = true
@@ -74,7 +76,6 @@ local function Keybinding_OnKeyDown(frame, key)
frame:EnableKeyboard(false)
frame:EnableMouseWheel(false)
frame:EnableGamePadButton(false)
self.msgframe:Hide()
frame:UnlockHighlight()
self.waitingForKey = nil
@@ -122,7 +123,6 @@ local methods = {
self:SetDisabled(false)
self.button:EnableKeyboard(false)
self.button:EnableMouseWheel(false)
self.button:EnableGamePadButton(false)
end,
-- ["OnRelease"] = nil,
@@ -188,7 +188,7 @@ local function Constructor()
local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", nil, UIParent)
local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate")
local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate2")
button:EnableMouse(true)
button:EnableMouseWheel(false)
@@ -199,12 +199,10 @@ local function Constructor()
button:SetScript("OnKeyDown", Keybinding_OnKeyDown)
button:SetScript("OnMouseDown", Keybinding_OnMouseDown)
button:SetScript("OnMouseWheel", Keybinding_OnMouseWheel)
button:SetScript("OnGamePadButtonDown", Keybinding_OnKeyDown)
button:SetPoint("BOTTOMLEFT")
button:SetPoint("BOTTOMRIGHT")
button:SetHeight(24)
button:EnableKeyboard(false)
button:EnableGamePadButton(false)
local text = button:GetFontString()
text:SetPoint("LEFT", 7, 0)
@@ -216,7 +214,7 @@ local function Constructor()
label:SetJustifyH("CENTER")
label:SetHeight(18)
local msgframe = CreateFrame("Frame", nil, UIParent, "BackdropTemplate")
local msgframe = CreateFrame("Frame", nil, UIParent)
msgframe:SetHeight(30)
msgframe:SetBackdrop(ControlBackdrop)
msgframe:SetBackdropColor(0,0,0)
@@ -2,7 +2,7 @@
Label Widget
Displays text and optionally an icon.
-------------------------------------------------------------------------------]]
local Type, Version = "Label", 28
local Type, Version = "Label", 27
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -12,6 +12,10 @@ local max, select, pairs = math.max, select, pairs
-- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: GameFontHighlightSmall
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
@@ -125,16 +129,12 @@ local methods = {
end,
["SetFont"] = function(self, font, height, flags)
if not self.fontObject then
self.fontObject = CreateFont("AceGUI30LabelFont" .. AceGUI:GetNextWidgetNum(Type))
end
self.fontObject:SetFont(font, height, flags)
self:SetFontObject(self.fontObject)
self.label:SetFont(font, height, flags)
UpdateImageAnchor(self)
end,
["SetFontObject"] = function(self, font)
self.label:SetFontObject(font or GameFontHighlightSmall)
UpdateImageAnchor(self)
self:SetFont((font or GameFontHighlightSmall):GetFont())
end,
["SetImageSize"] = function(self, width, height)
@@ -1,4 +1,4 @@
local Type, Version = "MultiLineEditBox", 33
local Type, Version = "MultiLineEditBox", 28
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -6,21 +6,21 @@ if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
local pairs = pairs
-- WoW APIs
local GetCursorInfo, ClearCursor = GetCursorInfo, ClearCursor
local GetCursorInfo, GetSpellInfo, ClearCursor = GetCursorInfo, GetSpellInfo, ClearCursor
local CreateFrame, UIParent = CreateFrame, UIParent
local _G = _G
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: ACCEPT, ChatFontNormal
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
if not AceGUIMultiLineEditBoxInsertLink then
-- upgradeable hook
if ChatFrameUtil and ChatFrameUtil.InsertLink then
hooksecurefunc(ChatFrameUtil, "InsertLink", function(...) return _G.AceGUIMultiLineEditBoxInsertLink(...) end)
elseif ChatEdit_InsertLink then
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIMultiLineEditBoxInsertLink(...) end)
end
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIMultiLineEditBoxInsertLink(...) end)
end
function _G.AceGUIMultiLineEditBoxInsertLink(text)
@@ -104,13 +104,9 @@ local function OnMouseUp(self)
end
local function OnReceiveDrag(self) -- EditBox / ScrollFrame
local type, id, info, extra = GetCursorInfo()
local type, id, info = GetCursorInfo()
if type == "spell" then
if C_Spell and C_Spell.GetSpellName then
info = C_Spell.GetSpellName(extra)
else
info = GetSpellInfo(id, info)
end
info = GetSpellInfo(id, info)
elseif type ~= "item" then
return
end
@@ -149,14 +145,6 @@ local function OnVerticalScroll(self, offset)
editBox:SetHitRectInsets(0, 0, offset, editBox:GetHeight() - offset - self:GetHeight())
end
local function OnScrollRangeChanged(self, xrange, yrange)
if yrange == 0 then
self.obj.editBox:SetHitRectInsets(0, 0, 0, 0)
else
OnVerticalScroll(self, self:GetVerticalScroll())
end
end
local function OnShowFocus(frame)
frame.obj.editBox:SetFocus()
frame:SetScript("OnShow", nil)
@@ -269,6 +257,8 @@ local methods = {
["SetCursorPosition"] = function(self, ...)
return self.editBox:SetCursorPosition(...)
end,
}
--[[-----------------------------------------------------------------------------
@@ -293,7 +283,7 @@ local function Constructor()
label:SetText(ACCEPT)
label:SetHeight(10)
local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate")
local button = CreateFrame("Button", ("%s%dButton"):format(Type, widgetNum), frame, "UIPanelButtonTemplate2")
button:SetPoint("BOTTOMLEFT", 0, 4)
button:SetHeight(22)
button:SetWidth(label:GetStringWidth() + 24)
@@ -307,7 +297,7 @@ local function Constructor()
text:SetPoint("BOTTOMRIGHT", button, "BOTTOMRIGHT", -5, 1)
text:SetJustifyV("MIDDLE")
local scrollBG = CreateFrame("Frame", nil, frame, "BackdropTemplate")
local scrollBG = CreateFrame("Frame", nil, frame)
scrollBG:SetBackdrop(backdrop)
scrollBG:SetBackdropColor(0, 0, 0)
scrollBG:SetBackdropBorderColor(0.4, 0.4, 0.4)
@@ -331,7 +321,6 @@ local function Constructor()
scrollFrame:SetScript("OnReceiveDrag", OnReceiveDrag)
scrollFrame:SetScript("OnSizeChanged", OnSizeChanged)
scrollFrame:HookScript("OnVerticalScroll", OnVerticalScroll)
scrollFrame:HookScript("OnScrollRangeChanged", OnScrollRangeChanged)
local editBox = CreateFrame("EditBox", ("%s%dEdit"):format(Type, widgetNum), scrollFrame)
editBox:SetAllPoints()
@@ -2,7 +2,7 @@
Slider Widget
Graphical Slider, like, for Range values.
-------------------------------------------------------------------------------]]
local Type, Version = "Slider", 24
local Type, Version = "Slider", 20
local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -14,6 +14,10 @@ local tonumber, pairs = tonumber, pairs
local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: GameFontHighlightSmall
--[[-----------------------------------------------------------------------------
Support functions
-------------------------------------------------------------------------------]]
@@ -27,13 +31,13 @@ local function UpdateText(self)
end
local function UpdateLabels(self)
local min_value, max_value = (self.min or 0), (self.max or 100)
local min, max = (self.min or 0), (self.max or 100)
if self.ispercent then
self.lowtext:SetFormattedText("%s%%", (min_value * 100))
self.hightext:SetFormattedText("%s%%", (max_value * 100))
self.lowtext:SetFormattedText("%s%%", (min * 100))
self.hightext:SetFormattedText("%s%%", (max * 100))
else
self.lowtext:SetText(min_value)
self.hightext:SetText(max_value)
self.lowtext:SetText(min)
self.hightext:SetText(max)
end
end
@@ -56,10 +60,6 @@ end
local function Slider_OnValueChanged(frame, newvalue)
local self = frame.obj
if not frame.setup then
if self.step and self.step > 0 then
local min_value = self.min or 0
newvalue = floor((newvalue - min_value) / self.step + 0.5) * self.step + min_value
end
if newvalue ~= self.value and not self.disabled then
self.value = newvalue
self:Fire("OnValueChanged", newvalue)
@@ -103,7 +103,7 @@ local function EditBox_OnEnterPressed(frame)
end
if value then
PlaySound(856) -- SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON
PlaySound("igMainMenuOptionCheckBoxOn")
self.slider:SetValue(value)
self:Fire("OnMouseUp", value)
end
@@ -171,13 +171,16 @@ local methods = {
self.label:SetText(text)
end,
["SetSliderValues"] = function(self, min_value, max_value, step)
["SetSliderValues"] = function(self, min, max, step)
if type(min) == 'function' then min = min() end -- ElvUI
if type(max) == 'function' then max = max() end -- ElvUI
local frame = self.slider
frame.setup = true
self.min = min_value
self.max = max_value
self.min = min
self.max = max
self.step = step
frame:SetMinMaxValues(min_value or 0,max_value or 100)
frame:SetMinMaxValues(min or 0,max or 100)
UpdateLabels(self)
frame:SetValueStep(step or 1)
if self.value then
@@ -221,7 +224,7 @@ local function Constructor()
label:SetJustifyH("CENTER")
label:SetHeight(15)
local slider = CreateFrame("Slider", nil, frame, "BackdropTemplate")
local slider = CreateFrame("Slider", nil, frame)
slider:SetOrientation("HORIZONTAL")
slider:SetHeight(15)
slider:SetHitRectInsets(0, 0, -10, 0)
@@ -243,7 +246,7 @@ local function Constructor()
local hightext = slider:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
hightext:SetPoint("TOPRIGHT", slider, "BOTTOMRIGHT", -2, 3)
local editbox = CreateFrame("EditBox", nil, frame, "BackdropTemplate")
local editbox = CreateFrame("EditBox", nil, frame)
editbox:SetAutoFocus(false)
editbox:SetFontObject(GameFontHighlightSmall)
editbox:SetPoint("TOP", slider, "BOTTOM")
@@ -273,7 +276,6 @@ local function Constructor()
widget[method] = func
end
slider.obj, editbox.obj = widget, widget
C_Timer.After(0.3, function() editbox:SetText(" ") UpdateText(widget) end) -- Workaround for font loading issue, making the editboxes blank until the text is changed
return AceGUI:RegisterAsWidget(widget)
end