Port XML templates to Lua, update AceGUI/AceConfig, fix $parent nil frame issues on our game version

This commit is contained in:
NoM0Re
2025-07-29 18:02:22 +02:00
committed by GitHub
parent dce683db43
commit 9d0cc562b9
48 changed files with 1235 additions and 1128 deletions
+4 -5
View File
@@ -123,7 +123,7 @@ globals = {
"SecondsFormatterMixin", "SecondsFormatterMixin",
"SecureButton_GetModifiedUnit", "SecureButton_GetModifiedUnit",
"SlashCmdList", "SlashCmdList",
"SearchBoxTemplate_OnTextChanged", "WA_SearchBoxTemplate_OnTextChanged",
"SmoothStatusBarMixin", "SmoothStatusBarMixin",
"STATICPOPUP_NUMDIALOGS", "STATICPOPUP_NUMDIALOGS",
"StaticPopup_Show", "StaticPopup_Show",
@@ -19551,7 +19551,6 @@ globals = {
"ZOOM_OUT", "ZOOM_OUT",
"ZOOM_OUT_BUTTON_TEXT", "ZOOM_OUT_BUTTON_TEXT",
"_RECORDING_WARNING_CORRUPTED", "_RECORDING_WARNING_CORRUPTED",
"GetNumPartyMembers", "GetNumRaidMembers", "noop", "tInvert", "DeltaLerp", "GetNumPartyMembers", "GetNumRaidMembers", "noop", "tInvert", "DeltaLerp",
"GetNumEquipmentSets", "GetEquipmentSetInfo", "CR_HASTE_MELEE", "CR_HASTE_RANGED", "GetNumEquipmentSets", "GetEquipmentSetInfo", "CR_HASTE_MELEE", "CR_HASTE_RANGED",
"CR_CRIT_TAKEN_MELEE", "CR_CRIT_TAKEN_RANGED", "CR_CRIT_TAKEN_SPELL", "CR_CRIT_TAKEN_MELEE", "CR_CRIT_TAKEN_RANGED", "CR_CRIT_TAKEN_SPELL",
@@ -19566,12 +19565,12 @@ globals = {
"CreateFontStringPool", "ActorPoolMixin", "ActorPool_Hide", "ActorPool_HideAndClearModel", "CreateFontStringPool", "ActorPoolMixin", "ActorPool_Hide", "ActorPool_HideAndClearModel",
"CreateActorPool", "FramePoolCollectionMixin", "CreateFramePoolCollection", "CreateActorPool", "FramePoolCollectionMixin", "CreateFramePoolCollection",
"FixedSizeFramePoolCollectionMixin", "CreateFixedSizeFramePoolCollection", "FixedSizeFramePoolCollectionMixin", "CreateFixedSizeFramePoolCollection",
"WA_MaximizeMinimizeButtonFrame_Mixin", "WA_PortraitFrameTemplate_Mixin", "SecondsToMinutes", "MinutesToSeconds", "HasTimePassed",
"WA_UpdateNineSliceBorders", "SecondsToMinutes", "MinutesToSeconds", "HasTimePassed",
"SecondsFormatterConstants", "ConvertSecondsToUnits", "SecondsToClock", "SecondsFormatterConstants", "ConvertSecondsToUnits", "SecondsToClock",
"MinutesToTime", "FormatShortDate", "NUMBER_ABBREVIATION_DATA", "WeakAurasProfilingReportTitleText", "MinutesToTime", "FormatShortDate", "NUMBER_ABBREVIATION_DATA", "WeakAurasProfilingReportTitleText",
"WeakAurasRealTimeProfiling", "WeakAurasRealTimeProfilingTitleText", "seconds", "NUM_CHAT_WINDOWS", "WeakAurasRealTimeProfiling", "WeakAurasRealTimeProfilingTitleText", "seconds", "NUM_CHAT_WINDOWS",
"GetNumGlyphSockets", "GetGlyphLink", "GetGlyphSocketInfo", "APIDocumentationMixin", "BaseAPIMixin", "GetNumGlyphSockets", "GetGlyphLink", "GetGlyphSocketInfo", "APIDocumentationMixin", "BaseAPIMixin",
"EventsAPIMixin", "FieldsAPIMixin", "FunctionsAPIMixin", "SystemsAPIMixin", "TablesAPIMixin", "EventsAPIMixin", "FieldsAPIMixin", "FunctionsAPIMixin", "SystemsAPIMixin", "TablesAPIMixin",
"CopyToClipboard", "ChatFrame_OpenChat", "ChatTypeInfo" "CopyToClipboard", "ChatFrame_OpenChat", "ChatTypeInfo", "EditBox_ClearFocus", "EditBox_ClearHighlight",
"EditBox_HighlightText"
} }
+2 -2
View File
@@ -24,7 +24,7 @@ do -- boilerplate & static values
Archivist.storeMap = {} Archivist.storeMap = {}
Archivist.activeStores = {} Archivist.activeStores = {}
namespace.Archivist = Archivist namespace.Archivist = Archivist
local unloader = CreateFrame("FRAME") local unloader = CreateFrame("Frame")
unloader:RegisterEvent("PLAYER_LOGOUT") unloader:RegisterEvent("PLAYER_LOGOUT")
unloader:SetScript("OnEvent", function() unloader:SetScript("OnEvent", function()
Archivist:DeInitialize() Archivist:DeInitialize()
@@ -33,7 +33,7 @@ do -- boilerplate & static values
-- Archivist is installed as a standalone addon. -- Archivist is installed as a standalone addon.
-- The Archive is in the default location, ACHV_DB -- The Archive is in the default location, ACHV_DB
_G.Archivist = Archivist _G.Archivist = Archivist
local loader = CreateFrame("frame") local loader = CreateFrame("Frame")
loader:RegisterEvent("ADDON_LOADED") loader:RegisterEvent("ADDON_LOADED")
loader:SetScript("OnEvent", function(self, _, addon) loader:SetScript("OnEvent", function(self, _, addon)
if addon == addonName then if addon == addonName then
+6 -3
View File
@@ -13,7 +13,8 @@ profileData.auras = {}
local currentProfileState, ProfilingTimer local currentProfileState, ProfilingTimer
local RealTimeProfilingWindow = CreateFrame("Frame", "WeakAurasRealTimeProfiling", UIParent, "WA_PortraitFrameTemplate") local RealTimeProfilingWindow = CreateFrame("Frame", "WeakAurasRealTimeProfiling", UIParent)
WeakAuras.XMLTemplates["PortraitFrameTemplate"](RealTimeProfilingWindow)
RealTimeProfilingWindow:HidePortrait(RealTimeProfilingWindow) RealTimeProfilingWindow:HidePortrait(RealTimeProfilingWindow)
Private.frames["RealTime Profiling Window"] = RealTimeProfilingWindow Private.frames["RealTime Profiling Window"] = RealTimeProfilingWindow
RealTimeProfilingWindow.width = 500 RealTimeProfilingWindow.width = 500
@@ -57,7 +58,8 @@ end
local profilePopup local profilePopup
local function CreateProfilePopup() local function CreateProfilePopup()
local frame = CreateFrame("Frame", "WeakAurasProfilingReport", UIParent, "WA_PortraitFrameTemplate") local frame = CreateFrame("Frame", "WeakAurasProfilingReport", UIParent)
WeakAuras.XMLTemplates["PortraitFrameTemplate"](frame)
frame:HidePortrait(frame) frame:HidePortrait(frame)
WeakAurasProfilingReportTitleText:SetText(L["WeakAuras Profiling Report"]) WeakAurasProfilingReportTitleText:SetText(L["WeakAuras Profiling Report"])
frame:SetMovable(true) frame:SetMovable(true)
@@ -598,7 +600,8 @@ function RealTimeProfilingWindow:Init()
self.statsFrameText = statsFrameText self.statsFrameText = statsFrameText
statsFrameText:SetPoint("BOTTOMLEFT", 15, 25) statsFrameText:SetPoint("BOTTOMLEFT", 15, 25)
local minimizeButton = CreateFrame("Button", nil, self, "WA_MaximizeMinimizeButtonFrameTemplate") local minimizeButton = CreateFrame("Button", nil, self)
WeakAuras.XMLTemplates["MaximizeMinimizeButtonFrameTemplate"](minimizeButton)
minimizeButton:SetPoint("RIGHT", self.CloseButton, "LEFT") minimizeButton:SetPoint("RIGHT", self.CloseButton, "LEFT")
minimizeButton:SetOnMaximizedCallback(function() minimizeButton:SetOnMaximizedCallback(function()
self.minimized = false self.minimized = false
+458 -111
View File
@@ -1,129 +1,476 @@
if not WeakAuras.IsLibsOK() then return end
function WA_MaximizeMinimizeButtonFrame_Mixin(frame) local AddonName = ...
if frame and frame.init then return end local Private = select(2, ...)
frame.init = true
frame.isMinimized = false
frame.maximizedCallback = nil
frame.minimizedCallback = nil
local methods = {
OnShow = function(self)
if self.isMinimized then
self:SetMaximizedLook()
else
self:SetMinimizedLook()
end
end,
IsMinimized = function(self)
return self.isMinimized
end,
SetOnMaximizedCallback = function(self, callback)
self.maximizedCallback = callback
end,
SetOnMinimizedCallback = function(self, callback)
self.minimizedCallback = callback
end,
Maximize = function(self, skipCallback)
if self.maximizedCallback and not skipCallback then
self:maximizedCallback()
end
self.isMinimized = false
self:SetMinimizedLook()
end,
Minimize = function(self, skipCallback)
if self.minimizedCallback and not skipCallback then
self:minimizedCallback()
end
self.isMinimized = true
self:SetMaximizedLook()
end,
SetMinimizedLook = function(self)
self.MaximizeButton:Hide()
self.MinimizeButton:Show()
end,
SetMaximizedLook = function(self)
self.MaximizeButton:Show()
self.MinimizeButton:Hide()
end,
}
for name, func in pairs(methods) do
frame[name] = func
end
end
function WA_PortraitFrameTemplate_Mixin(frame)
if frame and frame.init then return end
frame.init = true
frame.Bg:SetVertexColor(0.5882, 0.6275, 0.6706, 0.8) -- approx. PANEL_BACKGROUND_COLOR #ff1f1e21
frame.layoutType = "PortraitMode"
local methods = {
ShowPortrait = function(self)
self.PortraitContainer:Show();
self.NineSlice.TopLeftCorner:Show();
self.NineSlice.TopLeftCornerNoPortrait:Hide();
self.layoutType = "PortraitMode"
end,
HidePortrait = function(self)
self.PortraitContainer:Hide();
self.NineSlice.TopLeftCorner:Hide();
self.NineSlice.TopLeftCornerNoPortrait:Show();
self.layoutType = "NoPortraitMode"
end,
GetFrameLayoutType = function(self)
return self.layoutType or self:GetParent().layoutType;
end
}
for name, func in pairs(methods) do
frame[name] = func
end
end
local function setCorner(corner, point, relativeTo, x, y, width, height) local function setCorner(corner, point, relativeTo, x, y, width, height)
corner:ClearAllPoints() corner:ClearAllPoints()
corner:SetPoint(point, relativeTo, x, y) corner:SetPoint(point, relativeTo, x, y)
corner:SetSize(width, height) corner:SetSize(width, height)
end end
local function setEdge(edge, point1, relativeTo1, point2, relativeTo2, width, height) local function setEdge(edge, point1, relativeTo1, point2, relativeTo2, width, height)
edge:ClearAllPoints() edge:ClearAllPoints()
edge:SetSize(width, height) edge:SetSize(width, height)
edge:SetPoint(point1, relativeTo1, point2, 0, 0) edge:SetPoint(point1, relativeTo1, point2, 0, 0)
edge:SetPoint(point2, relativeTo2, point1, 0, 0) edge:SetPoint(point2, relativeTo2, point1, 0, 0)
end end
function WA_UpdateNineSliceBorders(frame) local function UpdateNineSliceBorders(frame)
local NineSlice = frame.NineSlice local NineSlice = frame.NineSlice
if not NineSlice then return end local PortaitMode = frame:GetFrameLayoutType() == "PortraitMode"
local PortaitMode = frame:GetFrameLayoutType() == "PortraitMode" local topLeftCorner = PortaitMode and NineSlice.TopLeftCorner or NineSlice.TopLeftCornerNoPortrait
local topEdgeRelativeTo = PortaitMode and NineSlice.TopLeftCorner or NineSlice.TopLeftCornerNoPortrait
local leftEdgeRelativeTo = PortaitMode and NineSlice.TopLeftCorner or NineSlice.TopLeftCornerNoPortrait
-- Top Left Corner
setCorner(topLeftCorner, "TOPLEFT", NineSlice, -13, 16, 75, 75)
-- Top Right Corner
setCorner(NineSlice.TopRightCorner, "TOPRIGHT", NineSlice, 4, 16, 75, 75)
-- Bottom Left Corner
setCorner(NineSlice.BottomLeftCorner, "BOTTOMLEFT", NineSlice, -13, -3, 32, 32)
-- Bottom Right Corner
setCorner(NineSlice.BottomRightCorner, "BOTTOMRIGHT", NineSlice, 4, -3, 32, 32)
-- Top Edge
setEdge(NineSlice.TopEdge, "TOPLEFT", topEdgeRelativeTo, "TOPRIGHT", NineSlice.TopRightCorner, 32, 75)
-- Bottom Edge
setEdge(NineSlice.BottomEdge, "BOTTOMLEFT", NineSlice.BottomLeftCorner, "BOTTOMRIGHT", NineSlice.BottomRightCorner, 32, 32)
-- Left Edge
setEdge(NineSlice.LeftEdge, "TOPLEFT", leftEdgeRelativeTo, "BOTTOMLEFT", NineSlice.BottomLeftCorner, 75, 8)
-- Right Edge
setEdge(NineSlice.RightEdge, "TOPLEFT", NineSlice.TopRightCorner, "BOTTOMLEFT", NineSlice.BottomRightCorner, 75, 8)
end
local topLeftCorner = PortaitMode and NineSlice.TopLeftCorner or NineSlice.TopLeftCornerNoPortrait local function InputBoxInstructions_OnTextChanged(self)
local topEdgeRelativeTo = PortaitMode and NineSlice.TopLeftCorner or NineSlice.TopLeftCornerNoPortrait if self:GetText() == "" then
local leftEdgeRelativeTo = PortaitMode and NineSlice.TopLeftCorner or NineSlice.TopLeftCornerNoPortrait self.Instructions:Show();
else
self.Instructions:Hide();
end
end
local function InputBoxInstructions_UpdateColorForEnabledState(self, color)
if color then
self:SetTextColor(color.r, color.g, color.b, color.a);
end
end
local function InputBoxInstructions_OnDisable(self)
InputBoxInstructions_UpdateColorForEnabledState(self, self.disabledColor);
end
local function InputBoxInstructions_OnEnable(self)
InputBoxInstructions_UpdateColorForEnabledState(self, self.enabledColor);
end
local function SearchBoxTemplate_OnEditFocusLost(self)
if ( self:GetText() == "" ) then
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6);
self.clearButton:Hide();
end
end
local function SearchBoxTemplate_OnEditFocusGained(self)
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0);
self.clearButton:Show();
end
function WA_SearchBoxTemplate_OnTextChanged(self)
if ( not self:HasFocus() and self:GetText() == "" ) then
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6);
self.clearButton:Hide();
else
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0);
self.clearButton:Show();
end
InputBoxInstructions_OnTextChanged(self);
end
local function SearchBoxTemplate_ClearText(self)
self:SetText("");
self:ClearFocus();
end
local function SearchBoxTemplateClearButton_OnClick(self)
PlaySound("igMainMenuOptionCheckBoxOn");
SearchBoxTemplate_ClearText(self:GetParent());
end
local function GetParentName(frame)
return frame:GetName() or frame
end
WeakAuras.XMLTemplates = {
-- InputBoxTemplate (Retail 11.1.7 (61967))
["InputBoxTemplate"] = function(frame)
frame:EnableMouse(true)
-- Left Texture
local left = frame:CreateTexture(nil, "BACKGROUND")
left:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\CommonSearch")
left:SetSize(8, 20)
left:SetPoint("LEFT", frame, "LEFT", -5, 0)
left:SetTexCoord(0.886719, 0.949219, 0.335938, 0.648438)
frame.Left = left
-- Right Texture
local right = frame:CreateTexture(nil, "BACKGROUND")
right:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\CommonSearch")
right:SetSize(8, 20)
right:SetPoint("RIGHT", frame, "RIGHT", 0, 0)
right:SetTexCoord(0.00390625, 0.0664062, 0.664062, 0.976562)
frame.Right = right
-- Middle Texture (zwischen Left und Right)
local middle = frame:CreateTexture(nil, "BACKGROUND")
middle:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\CommonSearch")
middle:SetSize(10, 20)
middle:SetTexCoord(0.00390625, 0.878906, 0.335938, 0.648438)
middle:SetPoint("LEFT", left, "RIGHT")
middle:SetPoint("RIGHT", right, "LEFT")
frame.Middle = middle
-- FontString
local fontString = frame:CreateFontString(nil, "ARTWORK", "ChatFontNormal")
frame.FontString = fontString
-- Scripts
frame:SetScript("OnEscapePressed", function(self)
EditBox_ClearFocus(self)
end)
frame:SetScript("OnEditFocusLost", function(self)
EditBox_ClearHighlight(self)
end)
frame:SetScript("OnEditFocusGained", function(self)
EditBox_HighlightText(self)
end)
end,
-- InputBoxInstructionsTemplate (Retail 11.1.7 (61967))
["InputBoxInstructionsTemplate"] = function(frame)
WeakAuras.XMLTemplates["InputBoxTemplate"](frame) -- Inherits from InputBoxTemplate
--[[ Optional
frame.disabledColor = { r = 0.35, g = 0.35, b = 0.35, a = 1 }
frame.enabledColor = { r = 1, g = 1, b = 1, a = 1 }
]]
-- Instructions FontString
local instructions = frame:CreateFontString(nil, "ARTWORK", "GameFontDisableSmall")
instructions:SetJustifyH("LEFT")
instructions:SetJustifyV("MIDDLE")
instructions:SetAllPoints(frame)
instructions:SetTextColor(0.35, 0.35, 0.35)
frame.Instructions = instructions
-- Skripts
frame:SetScript("OnTextChanged", InputBoxInstructions_OnTextChanged)
frame:SetScript("OnDisable", InputBoxInstructions_OnDisable)
frame:SetScript("OnEnable", InputBoxInstructions_OnEnable)
-- FontObject
frame:SetFontObject("GameFontHighlightSmall")
end,
-- SearchBoxTemplate (Retail 11.1.7 (61967))
["SearchBoxTemplate"] = function(frame)
WeakAuras.XMLTemplates["InputBoxInstructionsTemplate"](frame) -- Inherits from InputBoxInstructionsTemplate
frame:SetAutoFocus(false)
frame:SetTextInsets(16, 20, 0, 0);
frame.instructionText = SEARCH
frame.Instructions:SetText(frame.instructionText);
frame.Instructions:ClearAllPoints();
frame.Instructions:SetPoint("TOPLEFT", frame, "TOPLEFT", 16, 0);
frame.Instructions:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -20, 0);
-- Search-Icon
local searchIcon = frame:CreateTexture(GetParentName(frame) .. "SearchIcon", "OVERLAY")
searchIcon:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\CommonSearch")
searchIcon:SetSize(10, 10)
searchIcon:SetPoint("LEFT", 1, -1)
searchIcon:SetTexCoord(0.0742188, 0.167969, 0.664062, 0.851562)
searchIcon:SetVertexColor(0.6, 0.6, 0.6);
frame.searchIcon = searchIcon
-- Clear-Button
local clearButton = CreateFrame("Button", GetParentName(frame) .. "ClearButton", frame)
clearButton:SetSize(17, 17)
clearButton:SetPoint("RIGHT", -3, 0)
clearButton:Hide()
frame.clearButton = clearButton
local texture = clearButton:CreateTexture(nil, "ARTWORK")
texture:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\CommonSearch")
texture:SetAlpha(0.5)
texture:SetSize(10, 10)
texture:SetPoint("TOPLEFT", 3, -3)
texture:SetTexCoord(0.175781, 0.253906, 0.664062, 0.820312)
clearButton.texture = texture
-- Clear-Button Scripts
clearButton:SetScript("OnEnter", function(self)
self.texture:SetAlpha(1.0)
end)
clearButton:SetScript("OnLeave", function(self)
self.texture:SetAlpha(0.5)
end)
clearButton:SetScript("OnMouseDown", function(self)
if self:IsEnabled() then
self.texture:SetPoint("TOPLEFT", self, "TOPLEFT", 4, -4)
end
end)
clearButton:SetScript("OnMouseUp", function(self)
self.texture:SetPoint("TOPLEFT", self, "TOPLEFT", 3, -3)
end)
clearButton:SetScript("OnClick", SearchBoxTemplateClearButton_OnClick)
-- EditBox Scripts
frame:SetScript("OnEscapePressed", EditBox_ClearFocus)
frame:SetScript("OnEnterPressed", EditBox_ClearFocus)
frame:SetScript("OnEditFocusLost", SearchBoxTemplate_OnEditFocusLost)
frame:SetScript("OnEditFocusGained", SearchBoxTemplate_OnEditFocusGained)
frame:SetScript("OnTextChanged", WA_SearchBoxTemplate_OnTextChanged)
end,
-- PortraitFrameTemplate (Retail 11.1.7 (61967))
-- This is an empty frame with space for a portrait/icon in the top left corner.
["PortraitFrameTemplate"] = function(frame)
frame:SetSize(338, 424)
-- NineSlice Borders
local nineSlice = CreateFrame("Frame", nil, frame)
nineSlice:SetAllPoints(frame)
nineSlice:SetFrameLevel(125)
frame.NineSlice = nineSlice
-- Top Left Corner -- Top Left Corner
setCorner(topLeftCorner, "TOPLEFT", NineSlice, -13, 16, 75, 75) local topLeftCorner = nineSlice:CreateTexture(nil, "OVERLAY")
topLeftCorner:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\UIFrameMetal2x")
topLeftCorner:SetSize(75, 75)
topLeftCorner:SetPoint("TOPLEFT", frame, "TOPLEFT", -13, 16)
topLeftCorner:SetTexCoord(0.00195312, 0.294922, 0.298828, 0.591797)
nineSlice.TopLeftCorner = topLeftCorner
-- Top Left Corner No Portrait
local topLeftCornerNoPortrait = nineSlice:CreateTexture(nil, "OVERLAY")
topLeftCornerNoPortrait:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\UIFrameMetal2x")
topLeftCornerNoPortrait:SetSize(75, 75)
topLeftCornerNoPortrait:SetPoint("TOPLEFT", frame, "TOPLEFT", -8, 16)
topLeftCornerNoPortrait:SetTexCoord(0.00195312, 0.294922, 0.00195312, 0.294922)
topLeftCornerNoPortrait:Hide()
nineSlice.TopLeftCornerNoPortrait = topLeftCornerNoPortrait
-- Top Right Corner -- Top Right Corner
setCorner(NineSlice.TopRightCorner, "TOPRIGHT", NineSlice, 4, 16, 75, 75) local topRightCorner = nineSlice:CreateTexture(nil, "OVERLAY")
topRightCorner:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\UIFrameMetal2x")
topRightCorner:SetSize(75, 75)
topRightCorner:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 4, 16)
topRightCorner:SetTexCoord(0.298828, 0.591797, 0.00195312, 0.294922)
nineSlice.TopRightCorner = topRightCorner
-- Bottom Left Corner -- Bottom Left Corner
setCorner(NineSlice.BottomLeftCorner, "BOTTOMLEFT", NineSlice, -13, -3, 32, 32) local bottomLeftCorner = nineSlice:CreateTexture(nil, "OVERLAY")
bottomLeftCorner:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\UIFrameMetal2x")
bottomLeftCorner:SetSize(32, 32)
bottomLeftCorner:SetPoint("BOTTOMLEFT", frame, "BOTTOMLEFT", -13, -3)
bottomLeftCorner:SetTexCoord(0.298828, 0.423828, 0.298828, 0.423828)
nineSlice.BottomLeftCorner = bottomLeftCorner
-- Bottom Right Corner -- Bottom Right Corner
setCorner(NineSlice.BottomRightCorner, "BOTTOMRIGHT", NineSlice, 4, -3, 32, 32) local bottomRightCorner = nineSlice:CreateTexture(nil, "OVERLAY")
bottomRightCorner:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\UIFrameMetal2x")
bottomRightCorner:SetSize(32, 32)
bottomRightCorner:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", 4, -3)
bottomRightCorner:SetTexCoord(0.427734, 0.552734, 0.298828, 0.423828)
nineSlice.BottomRightCorner = bottomRightCorner
-- Top Edge -- Top Edge
setEdge(NineSlice.TopEdge, "TOPLEFT", topEdgeRelativeTo, "TOPRIGHT", NineSlice.TopRightCorner, 32, 75) local topEdge = nineSlice:CreateTexture(nil, "OVERLAY")
topEdge:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\UIFrameMetalHorizontal2x")
topEdge:SetSize(32, 75)
topEdge:SetPoint("TOPLEFT", topLeftCorner, "TOPRIGHT", 0, 0)
topEdge:SetPoint("TOPRIGHT", topRightCorner, "TOPLEFT", 0, 0)
topEdge:SetHorizTile(true)
topEdge:SetTexCoord(0.0, 1.0, 0.00390625, 0.589844)
nineSlice.TopEdge = topEdge
-- Bottom Edge -- Bottom Edge
setEdge(NineSlice.BottomEdge, "BOTTOMLEFT", NineSlice.BottomLeftCorner, "BOTTOMRIGHT", NineSlice.BottomRightCorner, 32, 32) local bottomEdge = nineSlice:CreateTexture(nil, "OVERLAY")
bottomEdge:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\UIFrameMetalHorizontal2x")
bottomEdge:SetSize(32, 32)
bottomEdge:SetPoint("BOTTOMLEFT", bottomLeftCorner, "BOTTOMRIGHT", 0, 0)
bottomEdge:SetPoint("BOTTOMRIGHT", bottomRightCorner, "BOTTOMLEFT", 0, 0)
bottomEdge:SetHorizTile(true)
bottomEdge:SetTexCoord(0.0, 0.5, 0.597656, 0.847656)
nineSlice.BottomEdge = bottomEdge
-- Left Edge -- Left Edge
setEdge(NineSlice.LeftEdge, "TOPLEFT", leftEdgeRelativeTo, "BOTTOMLEFT", NineSlice.BottomLeftCorner, 75, 8) local leftEdge = nineSlice:CreateTexture(nil, "OVERLAY")
leftEdge:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\UIFrameMetalVertical2x")
leftEdge:SetSize(75, 8)
leftEdge:SetPoint("TOPLEFT", topLeftCorner, "BOTTOMLEFT", 0, 0)
leftEdge:SetPoint("BOTTOMLEFT", bottomLeftCorner, "TOPLEFT", 0, 0)
leftEdge:SetVertTile(true)
leftEdge:SetTexCoord(0.00195312, 0.294922, 0.0, 1.0)
nineSlice.LeftEdge = leftEdge
-- Right Edge -- Right Edge
setEdge(NineSlice.RightEdge, "TOPLEFT", NineSlice.TopRightCorner, "BOTTOMLEFT", NineSlice.BottomRightCorner, 75, 8) local rightEdge = nineSlice:CreateTexture(nil, "OVERLAY")
end rightEdge:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\UIFrameMetalVertical2x")
rightEdge:SetSize(75, 8)
rightEdge:SetPoint("TOPLEFT", topRightCorner, "BOTTOMLEFT", 0, 0)
rightEdge:SetPoint("BOTTOMLEFT", bottomRightCorner, "TOPLEFT", 0, 0)
rightEdge:SetVertTile(true)
rightEdge:SetTexCoord(0.298828, 0.591797, 0.0, 1.0)
nineSlice.RightEdge = rightEdge
-- Portrait Container
local portraitContainer = CreateFrame("Frame", nil, frame)
portraitContainer:SetSize(1, 1)
portraitContainer:SetPoint("TOPLEFT")
portraitContainer:SetFrameLevel(120)
frame.PortraitContainer = portraitContainer
-- Portrait
local portrait = portraitContainer:CreateTexture(nil, "ARTWORK")
portrait:SetSize(62, 62)
portrait:SetPoint("TOPLEFT", portraitContainer, "TOPLEFT", -5, 7)
portraitContainer.portrait = portrait
-- Title Container
local titleContainer = CreateFrame("Frame", nil, frame)
titleContainer:SetSize(0, 20)
titleContainer:SetPoint("TOPLEFT", frame, "TOPLEFT", 58, -1)
titleContainer:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -24, -1)
titleContainer:SetFrameLevel(126)
frame.TitleContainer = titleContainer
-- Title Text
local titleText = titleContainer:CreateFontString(GetParentName(frame) .. "TitleText", "OVERLAY", "GameFontNormal")
titleText:SetText("")
titleText:SetWordWrap(false)
titleText:SetPoint("TOP", titleContainer, "TOP", 0, -5)
titleText:SetPoint("LEFT", titleContainer, "LEFT")
titleText:SetPoint("RIGHT", titleContainer, "RIGHT")
titleContainer.TitleText = titleText
-- Close Button
local closeButton = CreateFrame("Button", nil, frame, "UIPanelCloseButton")
closeButton:SetSize(24, 24)
closeButton:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, 0)
closeButton:SetFrameLevel(128)
frame.CloseButton = closeButton
closeButton:SetNormalTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\redbutton2x")
closeButton:GetNormalTexture():SetTexCoord(0.152344, 0.292969, 0.0078125, 0.304688)
closeButton:SetPushedTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\redbutton2x")
closeButton:GetPushedTexture():SetTexCoord(0.152344, 0.292969, 0.320312, 0.617188)
closeButton:SetDisabledTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\redbutton2x")
closeButton:GetDisabledTexture():SetTexCoord(0.152344, 0.292969, 0.632812, 0.929688)
closeButton:SetHighlightTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\redbutton2x", "ADD")
closeButton:GetHighlightTexture():SetTexCoord(0.449219, 0.589844, 0.0078125, 0.304688)
-- Background
local bgTexture = frame:CreateTexture(nil, "BACKGROUND")
bgTexture:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\UI-Background-Rock")
bgTexture:SetHorizTile(true)
bgTexture:SetVertTile(true)
bgTexture:SetPoint("TOPLEFT", frame, "TOPLEFT", 2, -21)
bgTexture:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -2, 2)
frame.Bg = bgTexture
-- Border
local topTileStreaks = frame:CreateTexture(nil, "BORDER")
topTileStreaks:SetTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\UIFrameHorizontal")
topTileStreaks:SetSize(256, 43)
topTileStreaks:SetPoint("TOPLEFT", frame, "TOPLEFT", 6, -21)
topTileStreaks:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -2, -21)
topTileStreaks:SetHorizTile(true)
topTileStreaks:SetTexCoord(0.0, 1.0, 0.0078125, 0.34375)
frame.TopTileStreaks = topTileStreaks
-- Mixin
frame.Bg:SetVertexColor(0.5882, 0.6275, 0.6706, 0.8) -- approx. PANEL_BACKGROUND_COLOR #ff1f1e21
frame.layoutType = "PortraitMode"
frame.ShowPortrait = function(self)
self.PortraitContainer:Show();
self.NineSlice.TopLeftCorner:Show();
self.NineSlice.TopLeftCornerNoPortrait:Hide();
self.layoutType = "PortraitMode"
end
frame.HidePortrait = function(self)
self.PortraitContainer:Hide();
self.NineSlice.TopLeftCorner:Hide();
self.NineSlice.TopLeftCornerNoPortrait:Show();
self.layoutType = "NoPortraitMode"
end
frame.GetFrameLayoutType = function(self)
return self.layoutType or self:GetParent().layoutType;
end
-- update NineSlice Borders on SizeChanged, since they like to be scuffed when the frame is resized
frame:SetScript("OnSizeChanged", function(self)
UpdateNineSliceBorders(self);
end)
end,
-- MaximizeMinimizeButtonFrameTemplate (Retail 11.1.7 (61967))
["MaximizeMinimizeButtonFrameTemplate"] = function(frame)
frame:SetSize(24, 24)
frame:SetFrameLevel(127)
-- Maximize Button
local maximizeButton = CreateFrame("Button", "MaximizeButton", frame)
maximizeButton:SetAllPoints(frame)
maximizeButton:Hide()
frame.MaximizeButton = maximizeButton
maximizeButton:SetNormalTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\redbutton2x")
maximizeButton:GetNormalTexture():SetTexCoord(0.300781, 0.441406, 0.0078125, 0.304688)
maximizeButton:SetPushedTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\redbutton2x")
maximizeButton:GetPushedTexture():SetTexCoord(0.300781, 0.441406, 0.320312, 0.617188)
maximizeButton:SetDisabledTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\redbutton2x")
maximizeButton:GetDisabledTexture():SetTexCoord(0.300781, 0.441406, 0.632812, 0.929688)
maximizeButton:SetHighlightTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\redbutton2x", "ADD")
maximizeButton:GetHighlightTexture():SetTexCoord(0.449219, 0.589844, 0.0078125, 0.304688)
-- Minimize Button
local minimizeButton = CreateFrame("Button", "MinimizeButton", frame)
minimizeButton:SetAllPoints(frame)
frame.MinimizeButton = minimizeButton
minimizeButton:SetNormalTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\redbutton2x")
minimizeButton:GetNormalTexture():SetTexCoord(0.00390625, 0.144531, 0.0078125, 0.304688)
minimizeButton:SetPushedTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\redbutton2x")
minimizeButton:GetPushedTexture():SetTexCoord(0.00390625, 0.144531, 0.320312, 0.617188)
minimizeButton:SetDisabledTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\redbutton2x")
minimizeButton:GetDisabledTexture():SetTexCoord(0.00390625, 0.144531, 0.632812, 0.929688)
minimizeButton:SetHighlightTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\redbutton2x", "ADD")
minimizeButton:GetHighlightTexture():SetTexCoord(0.449219, 0.589844, 0.0078125, 0.304688)
-- Mixin
frame.isMinimized = false
frame.OnShow = function(self)
if self.isMinimized then
self:SetMaximizedLook()
else
self:SetMinimizedLook()
end
end
frame.IsMinimized = function(self)
return self.isMinimized
end
frame.SetOnMaximizedCallback = function(self, callback)
self.maximizedCallback = callback
end
frame.SetOnMinimizedCallback = function(self, callback)
self.minimizedCallback = callback
end
frame.Maximize = function(self, skipCallback)
if self.maximizedCallback and not skipCallback then
self:maximizedCallback()
end
self.isMinimized = false
self:SetMinimizedLook()
end
frame.Minimize = function(self, skipCallback)
if self.minimizedCallback and not skipCallback then
self:minimizedCallback()
end
self.isMinimized = true
self:SetMaximizedLook()
end
frame.SetMinimizedLook = function(self)
self.MaximizeButton:Hide()
self.MinimizeButton:Show()
end
frame.SetMaximizedLook = function(self)
self.MaximizeButton:Show()
self.MinimizeButton:Hide()
end
frame:SetScript("OnShow", function(self)
self:OnShow();
end)
maximizeButton:SetScript("OnClick", function(self)
self:GetParent():Maximize();
PlaySound("igMainMenuOptionCheckBoxOn");
end)
minimizeButton:SetScript("OnClick", function(self)
self:GetParent():Minimize();
PlaySound("igMainMenuOptionCheckBoxOn");
end)
end,
}
-342
View File
@@ -1,342 +0,0 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd">
<!--
*******************************************************************************
PortraitFrameTemplate (Retail 11.0.5 (57171))
This is an empty frame with space for a portrait/icon in the top left corner.
*******************************************************************************
-->
<Frame name="WA_PortraitFrameTemplate" virtual="true" frameLevel="1">
<Size x="338" y="424"/>
<Frames>
<!-- NineSlice Borders -->
<Frame name="$parentNineSlice" parentKey="NineSlice" setAllPoints="true" frameLevel="3">
<Layers>
<Layer level="OVERLAY">
<!-- Top Left Corner -->
<Texture name="$parentTopLeftCorner" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetal2x" parentKey="TopLeftCorner">
<Size x="75" y="75"/>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="-13" y="16"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.00195312" right="0.294922" top="0.298828" bottom="0.591797"/>
</Texture>
<Texture name="$parentTopLeftCornerNoPortrait" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetal2x" parentKey="TopLeftCornerNoPortrait" hidden="true">
<Size x="75" y="75"/>
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="-8" y="16"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.00195312" right="0.294922" top="0.00195312" bottom="0.294922"/>
</Texture>
<!-- Top Right Corner -->
<Texture name="$parentTopRightCorner" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetal2x" parentKey="TopRightCorner">
<Size x="75" y="75"/>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="4" y="16"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.298828" right="0.591797" top="0.00195312" bottom="0.294922"/>
</Texture>
<!-- Bottom Left Corner -->
<Texture name="$parentBottomLeftCorner" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetal2x" parentKey="BottomLeftCorner">
<Size x="32" y="32"/>
<Anchors>
<Anchor point="BOTTOMLEFT">
<Offset>
<AbsDimension x="-13" y="-3"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.298828" right="0.423828" top="0.298828" bottom="0.423828"/>
</Texture>
<!-- Bottom Right Corner -->
<Texture name="$parentBottomRightCorner" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetal2x" parentKey="BottomRightCorner">
<Size x="32" y="32"/>
<Anchors>
<Anchor point="BOTTOMRIGHT">
<Offset>
<AbsDimension x="4" y="-3"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.427734" right="0.552734" top="0.298828" bottom="0.423828"/>
</Texture>
<!-- Top Edge -->
<Texture name="$parentTopEdge" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetalHorizontal2x" parentKey="TopEdge" horizTile="true">
<Size x="32" y="75"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTopLeftCorner" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="TOPRIGHT" relativeTo="$parentTopRightCorner" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.00000000" right="1.00000000" top="0.00390625" bottom="0.589844"/>
</Texture>
<!-- Bottom Edge -->
<Texture name="$parentBottomEdge" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetalHorizontal2x" parentKey="BottomEdge" horizTile="true">
<Size x="32" y="32"/>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parentBottomLeftCorner" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMRIGHT" relativeTo="$parentBottomRightCorner" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.00000000" right="0.50000000" top="0.597656" bottom="0.847656"/>
</Texture>
<!-- Left Edge -->
<Texture name="$parentLeftEdge" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetalVertical2x" parentKey="LeftEdge" vertTile="true">
<Size x="75" y="8"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTopLeftCorner" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMLEFT" relativeTo="$parentBottomLeftCorner" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.00195312" right="0.294922" top="0" bottom="1"/>
</Texture>
<!-- Right Edge -->
<Texture name="$parentRightEdge" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameMetalVertical2x" parentKey="RightEdge" vertTile="true">
<Size x="75" y="8"/>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parentTopRightCorner" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMLEFT" relativeTo="$parentBottomRightCorner" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
<TexCoords left="0.298828" right="0.591797" top="0" bottom="1"/>
</Texture>
</Layer>
</Layers>
</Frame>
<!-- Portrait Container -->
<Frame parentKey="PortraitContainer" frameLevel="3">
<Size x="1" y="1"/>
<Anchors>
<Anchor point="TOPLEFT"/>
</Anchors>
<Layers>
<Layer level="ARTWORK">
<!-- Portrait -->
<Texture name="$parentPortrait" parentKey="portrait">
<Size x="62" y="62"/>
<Anchors>
<Anchor point="TOPLEFT" x="-5" y="7"/>
</Anchors>
</Texture>
</Layer>
</Layers>
</Frame>
<!-- Title Container -->
<Frame parentKey="TitleContainer" frameLevel="4">
<Size x="0" y="20"/>
<Anchors>
<Anchor point="TOPLEFT" x="58" y="-1"/>
<Anchor point="TOPRIGHT" x="-24" y="-1"/>
</Anchors>
<Layers>
<Layer level="OVERLAY">
<FontString name="$parentTitleText" inherits="GameFontNormal" text="" parentKey="TitleText" wordwrap="false">
<Anchors>
<Anchor point="TOP" x="0" y="-5"/>
<Anchor point="LEFT"/>
<Anchor point="RIGHT"/>
</Anchors>
</FontString>
</Layer>
</Layers>
</Frame>
<!-- Close Button -->
<Button parentKey="CloseButton" inherits="UIPanelCloseButton" frameLevel="4">
<Size x="24" y="24"/>
<Anchors>
<Anchor point="TOPRIGHT" x="0" y="0"/>
</Anchors>
<NormalTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.152344" right="0.292969" top="0.0078125" bottom="0.304688"/>
</NormalTexture>
<PushedTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.152344" right="0.292969" top="0.320312" bottom="0.617188"/>
</PushedTexture>
<DisabledTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.152344" right="0.292969" top="0.632812" bottom="0.929688"/>
</DisabledTexture>
<HighlightTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x" alphaMode="ADD">
<TexCoords left="0.449219" right="0.589844" top="0.0078125" bottom="0.304688"/>
</HighlightTexture>
</Button>
</Frames>
<Layers>
<Layer level="BACKGROUND">
<Texture parentKey="Bg" file="Interface\AddOns\WeakAuras\Media\Textures\UI-Background-Rock" horizTile="true" vertTile="true">
<Anchors>
<Anchor point="TOPLEFT" x="2" y="-21"/>
<Anchor point="BOTTOMRIGHT" x="-2" y="2"/>
</Anchors>
</Texture>
</Layer>
<Layer level="BORDER">
<Texture parentKey="TopTileStreaks" file="Interface\AddOns\WeakAuras\Media\Textures\UIFrameHorizontal" horizTile="true">
<Size x="256" y="43"/>
<Anchors>
<Anchor point="TOPLEFT" x="6" y="-21"/>
<Anchor point="TOPRIGHT" x="-2" y="-21"/>
</Anchors>
<TexCoords left="0.00000000" right="1.00000000" top="0.0078125" bottom="0.34375"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>
WA_PortraitFrameTemplate_Mixin(self);
</OnLoad>
<OnSizeChanged>
WA_UpdateNineSliceBorders(self);
</OnSizeChanged>
</Scripts>
</Frame>
<!--
*******************************************************************************
MaximizeMinimizeButtonFrameTemplate (Retail 11.0.5 (57171))
Maximize and Minimize Button with mixedin Callbacks.
*******************************************************************************
-->
<Frame name="WA_MaximizeMinimizeButtonFrameTemplate" virtual="true" frameLevel="4">
<Size x="24" y="24"/>
<Frames>
<Button name="MaximizeButton" parentKey="MaximizeButton" setAllPoints="true" hidden="true">
<Scripts>
<OnClick>
self:GetParent():Maximize();
PlaySound("igMainMenuOptionCheckBoxOn");
</OnClick>
</Scripts>
<NormalTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.300781" right="0.441406" top="0.0078125" bottom="0.304688"/>
</NormalTexture>
<PushedTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.300781" right="0.441406" top="0.320312" bottom="0.617188"/>
</PushedTexture>
<DisabledTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.300781" right="0.441406" top="0.632812" bottom="0.929688"/>
</DisabledTexture>
<HighlightTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x" alphaMode="ADD">
<TexCoords left="0.449219" right="0.589844" top="0.0078125" bottom="0.304688"/>
</HighlightTexture>
</Button>
<Button name="$parentMinimizeButton" parentKey="MinimizeButton" setAllPoints="true">
<Scripts>
<OnClick>
self:GetParent():Minimize();
PlaySound("igMainMenuOptionCheckBoxOn");
</OnClick>
</Scripts>
<NormalTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.00390625" right="0.144531" top="0.0078125" bottom="0.304688"/>
</NormalTexture>
<PushedTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.00390625" right="0.144531" top="0.320312" bottom="0.617188"/>
</PushedTexture>
<DisabledTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x">
<TexCoords left="0.00390625" right="0.144531" top="0.632812" bottom="0.929688"/>
</DisabledTexture>
<HighlightTexture file="Interface\AddOns\WeakAuras\Media\Textures\redbutton2x" alphaMode="ADD">
<TexCoords left="0.449219" right="0.589844" top="0.0078125" bottom="0.304688"/>
</HighlightTexture>
</Button>
</Frames>
<Scripts>
<OnLoad>
WA_MaximizeMinimizeButtonFrame_Mixin(self);
</OnLoad>
<OnShow>
self:OnShow();
</OnShow>
</Scripts>
</Frame>
<!--
*******************************************************************************
InputBoxTemplate (Retail 11.0.5 (57171))
*******************************************************************************
-->
<EditBox name="WA_InputBoxTemplate" enableMouse="true" virtual="true">
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentLeft" parentKey="Left" file="Interface\AddOns\WeakAuras\Media\Textures\CommonSearch">
<Size x="8" y="20"/>
<Anchors>
<Anchor point="LEFT" x="-5" y="0"/>
</Anchors>
<TexCoords left="0.886719" right="0.949219" top="0.335938" bottom="0.648438"/>
</Texture>
<Texture name="$parentRight" parentKey="Right" file="Interface\AddOns\WeakAuras\Media\Textures\CommonSearch">
<Size x="8" y="20"/>
<Anchors>
<Anchor point="RIGHT" x="0" y="0"/>
</Anchors>
<TexCoords left="0.00390625" right="0.0664062" top="0.664062" bottom="0.976562"/>
</Texture>
<Texture name="$parentMiddle" parentKey="Middle" file="Interface\AddOns\WeakAuras\Media\Textures\CommonSearch">
<Size x="10" y="20"/>
<Anchors>
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT"/>
<Anchor point="RIGHT" relativeTo="$parentRight" relativePoint="LEFT"/>
</Anchors>
<TexCoords left="0.00390625" right="0.878906" top="0.335938" bottom="0.648438"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnEscapePressed>
EditBox_ClearFocus(self);
</OnEscapePressed>
<OnEditFocusLost>
EditBox_ClearHighlight(self);
</OnEditFocusLost>
<OnEditFocusGained>
EditBox_HighlightText(self);
</OnEditFocusGained>
</Scripts>
<FontString inherits="ChatFontNormal"/>
</EditBox>
</Ui>
+1 -2
View File
@@ -21,14 +21,13 @@
## SavedVariables: WeakAurasSaved ## SavedVariables: WeakAurasSaved
## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibGetFrame-1.0, LibGroupTalents, !!AddonLocale, CustomNames, BigWigs, DBM-Core ## OptionalDeps: Ace3, LibCompress, LibSharedMedia-3.0, AceGUI-3.0-SharedMediaWidgets, Masque, GTFO, LibButtonGlow-1.0, LibSpellRange-1.0, LibRangeCheck-2.0, LibDBIcon-1.0, LibGetFrame-1.0, LibGroupTalents, !!AddonLocale, CustomNames, BigWigs, DBM-Core
Templates.lua
Templates.xml
Compatibility.lua Compatibility.lua
Pools.lua Pools.lua
# External code + initialization # External code + initialization
embeds.xml embeds.xml
Init.lua Init.lua
Templates.lua
locales.xml locales.xml
TimeUtil.lua TimeUtil.lua
ArchiveTypes\Repository.lua ArchiveTypes\Repository.lua
@@ -54,7 +54,8 @@ local methods = {
Constructor Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent) local widgetNum = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", Type .. widgetNum, UIParent)
frame:SetFrameStrata("FULLSCREEN_DIALOG") frame:SetFrameStrata("FULLSCREEN_DIALOG")
--Container Support --Container Support
@@ -644,7 +644,7 @@ local function Constructor()
local num = AceGUI:GetNextWidgetNum(Type) local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", nil, UIParent)
local treeframe = CreateFrame("Frame", nil, frame) local treeframe = CreateFrame("Frame", ("AceConfigDialogTreeFrame%d"):format(num), frame)
treeframe:SetPoint("TOPLEFT") treeframe:SetPoint("TOPLEFT")
treeframe:SetPoint("BOTTOMLEFT") treeframe:SetPoint("BOTTOMLEFT")
treeframe:SetWidth(DEFAULT_TREE_WIDTH) treeframe:SetWidth(DEFAULT_TREE_WIDTH)
@@ -1828,7 +1828,8 @@ local function Constructor()
view.visibility = 0; view.visibility = 0;
local renamebox = CreateFrame("EditBox", nil, button, "WA_InputBoxTemplate"); local renamebox = CreateFrame("EditBox", nil, button);
WeakAuras.XMLTemplates["InputBoxTemplate"](renamebox)
renamebox:SetHeight(14); renamebox:SetHeight(14);
renamebox:SetPoint("TOP", button, "TOP"); renamebox:SetPoint("TOP", button, "TOP");
renamebox:SetPoint("LEFT", icon, "RIGHT", 6, 0); renamebox:SetPoint("LEFT", icon, "RIGHT", 6, 0);
@@ -309,11 +309,11 @@ local backdrop = {
} }
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent) local widgetNum = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", ("%s%Frame"):format(Type, widgetNum), UIParent)
frame:Hide() frame:Hide()
frame:SetScript("OnShow", OnFrameShow); frame:SetScript("OnShow", OnFrameShow);
local widgetNum = AceGUI:GetNextWidgetNum(Type)
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
label:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -4) label:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -4)
@@ -284,10 +284,9 @@ local backdrop = {
} }
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:Hide()
local widgetNum = AceGUI:GetNextWidgetNum(Type) local widgetNum = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", ("%s%Frame"):format(Type, widgetNum), UIParent)
frame:Hide()
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
label:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -4) label:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -4)
@@ -194,7 +194,8 @@ local function Constructor()
deleteButton:SetPushedTexture(delPushed) deleteButton:SetPushedTexture(delPushed)
button.deleteHighlight = delHighlight button.deleteHighlight = delHighlight
local renameEditBox = CreateFrame("EditBox", nil, button, "WA_InputBoxTemplate") local renameEditBox = CreateFrame("EditBox", nil, button)
WeakAuras.XMLTemplates["InputBoxTemplate"](renameEditBox)
renameEditBox:SetHeight(14) renameEditBox:SetHeight(14)
renameEditBox:SetPoint("TOPLEFT", title, "TOPLEFT") renameEditBox:SetPoint("TOPLEFT", title, "TOPLEFT")
renameEditBox:SetPoint("BOTTOMRIGHT", title, "BOTTOMRIGHT") renameEditBox:SetPoint("BOTTOMRIGHT", title, "BOTTOMRIGHT")
@@ -306,7 +306,8 @@ local function Constructor()
rightbutton:SetDisabledTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\spinboxrightp") rightbutton:SetDisabledTexture("Interface\\AddOns\\WeakAuras\\Media\\Textures\\spinboxrightp")
rightbutton:SetScript("OnClick", SpinBox_OnValueUp) rightbutton:SetScript("OnClick", SpinBox_OnValueUp)
local editbox = CreateFrame("EditBox", nil, frame, "WA_InputBoxTemplate") local editbox = CreateFrame("EditBox", nil, frame)
WeakAuras.XMLTemplates["InputBoxTemplate"](editbox)
editbox:SetAutoFocus(false) editbox:SetAutoFocus(false)
editbox:SetFontObject(ChatFontNormal) editbox:SetFontObject(ChatFontNormal)
editbox:SetHeight(19) editbox:SetHeight(19)
@@ -3,7 +3,7 @@
-- as well as associate it with a slash command. -- as well as associate it with a slash command.
-- @class file -- @class file
-- @name AceConfig-3.0 -- @name AceConfig-3.0
-- @release $Id: AceConfig-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $ -- @release $Id: AceConfig-3.0.lua 1335 2024-05-05 19:35:16Z nevcairiel $
--[[ --[[
AceConfig-3.0 AceConfig-3.0
@@ -27,7 +27,7 @@ if not AceConfig then return end
local pcall, error, type, pairs = pcall, error, type, pairs local pcall, error, type, pairs = pcall, error, type, pairs
-- ------------------------------------------------------------------- -- -------------------------------------------------------------------
-- :RegisterOptionsTable(appName, options, slashcmd, persist) -- :RegisterOptionsTable(appName, options, slashcmd)
-- --
-- - appName - (string) application name -- - appName - (string) application name
-- - options - table or function ref, see AceConfigRegistry -- - options - table or function ref, see AceConfigRegistry
@@ -5,4 +5,4 @@
<Include file="AceConfigDialog-3.0\AceConfigDialog-3.0.xml"/> <Include file="AceConfigDialog-3.0\AceConfigDialog-3.0.xml"/>
<!--<Include file="AceConfigDropdown-3.0\AceConfigDropdown-3.0.xml"/>--> <!--<Include file="AceConfigDropdown-3.0\AceConfigDropdown-3.0.xml"/>-->
<Script file="AceConfig-3.0.lua"/> <Script file="AceConfig-3.0.lua"/>
</Ui> </Ui>
@@ -1,7 +1,7 @@
--- AceConfigCmd-3.0 handles access to an options table through the "command line" interface via the ChatFrames. --- AceConfigCmd-3.0 handles access to an options table through the "command line" interface via the ChatFrames.
-- @class file -- @class file
-- @name AceConfigCmd-3.0 -- @name AceConfigCmd-3.0
-- @release $Id: AceConfigCmd-3.0.lua 1202 2019-05-15 23:11:22Z nevcairiel $ -- @release $Id: AceConfigCmd-3.0.lua 1284 2022-09-25 09:15:30Z nevcairiel $
--[[ --[[
AceConfigCmd-3.0 AceConfigCmd-3.0
@@ -37,17 +37,10 @@ local error, assert = error, assert
-- WoW APIs -- WoW APIs
local _G = _G 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: LibStub, SELECTED_CHAT_FRAME, DEFAULT_CHAT_FRAME
local L = setmetatable({}, { -- TODO: replace with proper locale local L = setmetatable({}, { -- TODO: replace with proper locale
__index = function(self,k) return k end __index = function(self,k) return k end
}) })
local function print(msg) local function print(msg)
(SELECTED_CHAT_FRAME or DEFAULT_CHAT_FRAME):AddMessage(msg) (SELECTED_CHAT_FRAME or DEFAULT_CHAT_FRAME):AddMessage(msg)
end end
@@ -401,7 +394,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
return return
end end
local str = strsub(info.input,inputpos); local strInput = strsub(info.input,inputpos);
if tab.type=="execute" then if tab.type=="execute" then
------------ execute -------------------------------------------- ------------ execute --------------------------------------------
@@ -414,21 +407,21 @@ local function handle(info, inputpos, tab, depth, retfalse)
local res = true local res = true
if tab.pattern then if tab.pattern then
if not(type(tab.pattern)=="string") then err(info, inputpos, "'pattern' - expected a string") end if type(tab.pattern)~="string" then err(info, inputpos, "'pattern' - expected a string") end
if not strmatch(str, tab.pattern) then if not strmatch(strInput, tab.pattern) then
usererr(info, inputpos, "'"..str.."' - " .. L["invalid input"]) usererr(info, inputpos, "'"..strInput.."' - " .. L["invalid input"])
return return
end end
end end
do_final(info, inputpos, tab, "set", str) do_final(info, inputpos, tab, "set", strInput)
elseif tab.type=="toggle" then elseif tab.type=="toggle" then
------------ toggle -------------------------------------------- ------------ toggle --------------------------------------------
local b local b
local str = strtrim(strlower(str)) local str = strtrim(strlower(strInput))
if str=="" then if str=="" then
b = callmethod(info, inputpos, tab, "get") b = callmethod(info, inputpos, tab, "get")
@@ -465,9 +458,9 @@ local function handle(info, inputpos, tab, depth, retfalse)
elseif tab.type=="range" then elseif tab.type=="range" then
------------ range -------------------------------------------- ------------ range --------------------------------------------
local val = tonumber(str) local val = tonumber(strInput)
if not val then if not val then
usererr(info, inputpos, "'"..str.."' - "..L["expected number"]) usererr(info, inputpos, "'"..strInput.."' - "..L["expected number"])
return return
end end
if type(info.step)=="number" then if type(info.step)=="number" then
@@ -487,7 +480,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
elseif tab.type=="select" then elseif tab.type=="select" then
------------ select ------------------------------------ ------------ select ------------------------------------
local str = strtrim(strlower(str)) local str = strtrim(strlower(strInput))
local values = tab.values local values = tab.values
if type(values) == "function" or type(values) == "string" then if type(values) == "function" or type(values) == "string" then
@@ -528,7 +521,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
elseif tab.type=="multiselect" then elseif tab.type=="multiselect" then
------------ multiselect ------------------------------------------- ------------ multiselect -------------------------------------------
local str = strtrim(strlower(str)) local str = strtrim(strlower(strInput))
local values = tab.values local values = tab.values
if type(values) == "function" or type(values) == "string" then if type(values) == "function" or type(values) == "string" then
@@ -565,7 +558,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
--check that the opt is valid --check that the opt is valid
local ok local ok
for k,v in pairs(values) do for k in pairs(values) do
if strlower(k)==opt then if strlower(k)==opt then
opt = k -- overwrite with key (in case of case mismatches) opt = k -- overwrite with key (in case of case mismatches)
ok = true ok = true
@@ -634,7 +627,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
elseif tab.type=="color" then elseif tab.type=="color" then
------------ color -------------------------------------------- ------------ color --------------------------------------------
local str = strtrim(strlower(str)) local str = strtrim(strlower(strInput))
if str == "" then if str == "" then
--TODO: Show current value --TODO: Show current value
return return
@@ -706,7 +699,7 @@ local function handle(info, inputpos, tab, depth, retfalse)
elseif tab.type=="keybinding" then elseif tab.type=="keybinding" then
------------ keybinding -------------------------------------------- ------------ keybinding --------------------------------------------
local str = strtrim(strlower(str)) local str = strtrim(strlower(strInput))
if str == "" then if str == "" then
--TODO: Show current value --TODO: Show current value
return return
@@ -1,4 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd"> ..\FrameXML\UI.xsd">
<Script file="AceConfigCmd-3.0.lua"/> <Script file="AceConfigCmd-3.0.lua"/>
</Ui> </Ui>
@@ -1,13 +1,13 @@
--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables. --- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables.
-- @class file -- @class file
-- @name AceConfigDialog-3.0 -- @name AceConfigDialog-3.0
-- @release $Id: AceConfigDialog-3.0.lua 1225 2019-08-06 13:37:52Z nevcairiel $ -- @release $Id: AceConfigDialog-3.0.lua 1351 2024-07-24 18:23:24Z funkehdude $
local LibStub = LibStub local LibStub = LibStub
local gui = LibStub("AceGUI-3.0") local gui = LibStub("AceGUI-3.0")
local reg = LibStub("AceConfigRegistry-3.0") local reg = LibStub("AceConfigRegistry-3.0")
local MAJOR, MINOR = "AceConfigDialog-3.0", 78 local MAJOR, MINOR = "AceConfigDialog-3.0", 87
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR) local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfigDialog then return end if not AceConfigDialog then return end
@@ -15,69 +15,39 @@ if not AceConfigDialog then return end
AceConfigDialog.OpenFrames = AceConfigDialog.OpenFrames or {} AceConfigDialog.OpenFrames = AceConfigDialog.OpenFrames or {}
AceConfigDialog.Status = AceConfigDialog.Status or {} AceConfigDialog.Status = AceConfigDialog.Status or {}
AceConfigDialog.frame = AceConfigDialog.frame or CreateFrame("Frame") AceConfigDialog.frame = AceConfigDialog.frame or CreateFrame("Frame")
AceConfigDialog.tooltip = AceConfigDialog.tooltip or CreateFrame("GameTooltip", "AceConfigDialogTooltip", UIParent, "GameTooltipTemplate")
AceConfigDialog.frame.apps = AceConfigDialog.frame.apps or {} AceConfigDialog.frame.apps = AceConfigDialog.frame.apps or {}
AceConfigDialog.frame.closing = AceConfigDialog.frame.closing or {} AceConfigDialog.frame.closing = AceConfigDialog.frame.closing or {}
AceConfigDialog.frame.closeAllOverride = AceConfigDialog.frame.closeAllOverride or {} AceConfigDialog.frame.closeAllOverride = AceConfigDialog.frame.closeAllOverride or {}
-- Lua APIs -- Lua APIs
local tconcat, tinsert, tsort, tremove = table.concat, table.insert, table.sort, table.remove local tinsert, tsort, tremove, wipe = table.insert, table.sort, table.remove, table.wipe
local strmatch, format = string.match, string.format local strmatch, format = string.match, string.format
local assert, loadstring, error = assert, loadstring, error local error = error
local pairs, next, select, type, unpack, wipe = pairs, next, select, type, unpack, wipe local pairs, next, select, type, unpack, ipairs = pairs, next, select, type, unpack, ipairs
local rawset, tostring, tonumber = rawset, tostring, tonumber local tostring, tonumber = tostring, tonumber
local math_min, math_max, math_floor = math.min, math.max, math.floor local math_min, math_max, math_floor = math.min, math.max, math.floor
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded
-- List them here for Mikk's FindGlobals script
-- GLOBALS: NORMAL_FONT_COLOR, GameTooltip, StaticPopupDialogs, ACCEPT, CANCEL, StaticPopup_Show
-- GLOBALS: PlaySound, GameFontHighlight, GameFontHighlightSmall, GameFontHighlightLarge
-- GLOBALS: CloseSpecialWindows, InterfaceOptions_AddCategory, geterrorhandler
local emptyTbl = {} local emptyTbl = {}
--[[ --[[
xpcall safecall implementation pcall safecall implementation
]] ]]
local xpcall = xpcall local pcall = pcall
local function errorhandler(err) local function errorhandler(err)
return geterrorhandler()(err) return geterrorhandler()(err)
end 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, ...) local function safecall(func, ...)
return Dispatchers[select("#", ...)](func, ...) if func then
local ret = {pcall(func, ...)}
if not ret[1] then
errorhandler(ret[2])
end
return unpack(ret)
end
end end
local width_multiplier = 170 local width_multiplier = 170
@@ -181,6 +151,7 @@ local stringIsLiteral = {
width = true, width = true,
image = true, image = true,
fontSize = true, fontSize = true,
tooltipHyperlink = true
} }
--Is Never a function or method --Is Never a function or method
@@ -222,9 +193,8 @@ local function GetOptionsMemberValue(membername, option, options, path, appName,
--We have a function to call --We have a function to call
local info = new() local info = new()
--traverse the options table, picking up the handler and filling the info with the path --traverse the options table, picking up the handler and filling the info with the path
local handler
local group = options local group = options
handler = group.handler or handler local handler = group.handler
for i = 1, #path do for i = 1, #path do
group = GetSubOption(group, path[i]) group = GetSubOption(group, path[i])
@@ -533,8 +503,17 @@ local function OptionOnMouseOver(widget, event)
local options = user.options local options = user.options
local path = user.path local path = user.path
local appName = user.appName local appName = user.appName
local tooltip = AceConfigDialog.tooltip
tooltip:SetOwner(widget.frame, "ANCHOR_TOPRIGHT")
local tooltipHyperlink = GetOptionsMemberValue("tooltipHyperlink", opt, options, path, appName)
if tooltipHyperlink then
tooltip:SetHyperlink(tooltipHyperlink)
tooltip:Show()
return
end
GameTooltip:SetOwner(widget.frame, "ANCHOR_TOPRIGHT")
local name = GetOptionsMemberValue("name", opt, options, path, appName) local name = GetOptionsMemberValue("name", opt, options, path, appName)
local desc = GetOptionsMemberValue("desc", opt, options, path, appName) local desc = GetOptionsMemberValue("desc", opt, options, path, appName)
local usage = GetOptionsMemberValue("usage", opt, options, path, appName) local usage = GetOptionsMemberValue("usage", opt, options, path, appName)
@@ -542,98 +521,147 @@ local function OptionOnMouseOver(widget, event)
if descStyle and descStyle ~= "tooltip" then return end if descStyle and descStyle ~= "tooltip" then return end
GameTooltip:SetText(name, 1, .82, 0, 1) tooltip:SetText(name, 1, .82, 0, 1)
if opt.type == "multiselect" then if opt.type == "multiselect" then
GameTooltip:AddLine(user.text,0.5, 0.5, 0.8, 1) tooltip:AddLine(user.text, 0.5, 0.5, 0.8, 1)
end end
if type(desc) == "string" then if type(desc) == "string" then
GameTooltip:AddLine(desc, 1, 1, 1, 1) tooltip:AddLine(desc, 1, 1, 1, 1)
end end
if type(usage) == "string" then if type(usage) == "string" then
GameTooltip:AddLine("Usage: "..usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1) tooltip:AddLine("Usage: "..usage, NORMAL_FONT_COLOR.r, NORMAL_FONT_COLOR.g, NORMAL_FONT_COLOR.b, 1)
end end
GameTooltip:Show() tooltip:Show()
end end
local function OptionOnMouseLeave(widget, event) local function OptionOnMouseLeave(widget, event)
GameTooltip:Hide() AceConfigDialog.tooltip:Hide()
end end
local function GetFuncName(option) local function GetFuncName(option)
local type = option.type if option.type == "execute" then
if type == "execute" then
return "func" return "func"
else else
return "set" return "set"
end end
end end
local function confirmPopup(appName, rootframe, basepath, info, message, func, ...) do
if not StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] then local InCombatLockdown = InCombatLockdown
StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] = {} local frame = AceConfigDialog.popup
end if not frame or oldminor < 81 then
local t = StaticPopupDialogs["ACECONFIGDIALOG30_CONFIRM_DIALOG"] frame = CreateFrame("Frame", nil, UIParent)
for k in pairs(t) do AceConfigDialog.popup = frame
t[k] = nil frame:Hide()
end frame:SetPoint("CENTER", UIParent, "CENTER")
t.text = message frame:SetSize(320, 72)
t.button1 = ACCEPT frame:EnableMouse(true) -- Do not allow click-through on the frame
t.button2 = CANCEL frame:SetFrameStrata("TOOLTIP")
t.preferredIndex = STATICPOPUP_NUMDIALOGS frame:SetFrameLevel(100) -- Lots of room to draw under it
local dialog, oldstrata frame:SetScript("OnKeyDown", function(self, key)
t.OnAccept = function() if key == "ESCAPE" then
safecall(func, unpack(t)) if not InCombatLockdown() then
if dialog and oldstrata then self:SetPropagateKeyboardInput(false)
dialog:SetFrameStrata(oldstrata) end
end if self.cancel:IsShown() then
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl)) self.cancel:Click()
del(info) else -- Showing a validation error
end self:Hide()
t.OnCancel = function() end
if dialog and oldstrata then elseif not InCombatLockdown() then
dialog:SetFrameStrata(oldstrata) self:SetPropagateKeyboardInput(true)
end end
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl)) end)
del(info)
end
for i = 1, select("#", ...) do
t[i] = select(i, ...) or false
end
t.timeout = 0
t.whileDead = 1
t.hideOnEscape = 1
dialog = StaticPopup_Show("ACECONFIGDIALOG30_CONFIRM_DIALOG") local border = CreateFrame("Frame", nil, frame)
if dialog then border:SetAllPoints(frame)
oldstrata = dialog:GetFrameStrata() frame.realSetFrameStrata = frame.SetFrameStrata
dialog:SetFrameStrata("TOOLTIP") frame.realSetFrameLevel = frame.SetFrameLevel
frame.SetFrameStrata = function() end -- frame:SetFixedFrameStrata(true)
frame.SetFrameLevel = function() end -- frame:SetFixedFrameLevel(true)
local text = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlight")
text:SetSize(290, 0)
text:SetPoint("TOP", 0, -16)
frame.text = text
local function newButton(newText)
local button = CreateFrame("Button", nil, frame)
button:SetSize(128, 21)
button:SetNormalFontObject(GameFontNormal)
button:SetHighlightFontObject(GameFontHighlight)
button:SetNormalTexture("Interface\\Buttons\\UI-DialogBox-Button-Up")
button:GetNormalTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875)
button:SetPushedTexture("Interface\\Buttons\\UI-DialogBox-Button-Down")
button:GetPushedTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875)
button:SetHighlightTexture("Interface\\Buttons\\UI-DialogBox-Button-Highlight")
button:GetHighlightTexture():SetTexCoord(0.0, 1.0, 0.0, 0.71875)
button:SetText(newText)
return button
end
local accept = newButton(ACCEPT)
accept:SetPoint("BOTTOMRIGHT", frame, "BOTTOM", -6, 16)
frame.accept = accept
local cancel = newButton(CANCEL)
cancel:SetPoint("LEFT", accept, "RIGHT", 13, 0)
frame.cancel = cancel
end end
end end
local function confirmPopup(appName, rootframe, basepath, info, message, func, ...)
local frame = AceConfigDialog.popup
frame:Show()
frame.text:SetText(message)
-- From StaticPopup.lua
-- local height = 32 + text:GetHeight() + 2;
-- height = height + 6 + accept:GetHeight()
-- We add 32 + 2 + 6 + 21 (button height) == 61
local height = 61 + frame.text:GetHeight()
frame:SetHeight(height)
frame.accept:ClearAllPoints()
frame.accept:SetPoint("BOTTOMRIGHT", frame, "BOTTOM", -6, 16)
frame.cancel:Show()
local t = {...}
local tCount = select("#", ...)
frame.accept:SetScript("OnClick", function(self)
safecall(func, unpack(t, 1, tCount)) -- Manually set count as unpack() stops on nil (bug with #table)
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl))
frame:Hide()
self:SetScript("OnClick", nil)
frame.cancel:SetScript("OnClick", nil)
del(info)
end)
frame.cancel:SetScript("OnClick", function(self)
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl))
frame:Hide()
self:SetScript("OnClick", nil)
frame.accept:SetScript("OnClick", nil)
del(info)
end)
end
local function validationErrorPopup(message) local function validationErrorPopup(message)
if not StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] then local frame = AceConfigDialog.popup
StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] = {} frame:Show()
end frame.text:SetText(message)
local t = StaticPopupDialogs["ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG"] -- From StaticPopup.lua
t.text = message -- local height = 32 + text:GetHeight() + 2;
t.button1 = OKAY -- height = height + 6 + accept:GetHeight()
t.preferredIndex = STATICPOPUP_NUMDIALOGS -- We add 32 + 2 + 6 + 21 (button height) == 61
local dialog, oldstrata local height = 61 + frame.text:GetHeight()
t.OnAccept = function() frame:SetHeight(height)
if dialog and oldstrata then
dialog:SetFrameStrata(oldstrata)
end
end
t.timeout = 0
t.whileDead = 1
t.hideOnEscape = 1
dialog = StaticPopup_Show("ACECONFIGDIALOG30_VALIDATION_ERROR_DIALOG") frame.accept:ClearAllPoints()
if dialog then frame.accept:SetPoint("BOTTOM", frame, "BOTTOM", 0, 16)
oldstrata = dialog:GetFrameStrata() frame.cancel:Hide()
dialog:SetFrameStrata("TOOLTIP")
end frame.accept:SetScript("OnClick", function()
frame:Hide()
end)
end end
local function ActivateControl(widget, event, ...) local function ActivateControl(widget, event, ...)
@@ -656,7 +684,7 @@ local function ActivateControl(widget, event, ...)
if group[funcname] ~= nil then if group[funcname] ~= nil then
func = group[funcname] func = group[funcname]
end end
handler = group.handler or handler handler = group.handler
confirm = group.confirm confirm = group.confirm
validate = group.validate validate = group.validate
for i = 1, #path do for i = 1, #path do
@@ -720,7 +748,6 @@ local function ActivateControl(widget, event, ...)
end end
end end
local rootframe = user.rootframe
if not validated or type(validated) == "string" then if not validated or type(validated) == "string" then
if not validated then if not validated then
if usage then if usage then
@@ -735,8 +762,8 @@ local function ActivateControl(widget, event, ...)
end end
-- show validate message -- show validate message
if rootframe.SetStatusText then if user.rootframe.SetStatusText then
rootframe:SetStatusText(validated) user.rootframe:SetStatusText(validated)
else else
validationErrorPopup(validated) validationErrorPopup(validated)
end end
@@ -773,14 +800,14 @@ local function ActivateControl(widget, event, ...)
if type(confirm) == "boolean" then if type(confirm) == "boolean" then
if confirm then if confirm then
if not confirmText then if not confirmText then
local name, desc = option.name, option.desc local option_name, desc = option.name, option.desc
if type(name) == "function" then if type(option_name) == "function" then
name = name(info) option_name = option_name(info)
end end
if type(desc) == "function" then if type(desc) == "function" then
desc = desc(info) desc = desc(info)
end end
confirmText = name confirmText = option_name
if desc then if desc then
confirmText = confirmText.." - "..desc confirmText = confirmText.." - "..desc
end end
@@ -886,7 +913,7 @@ end
local function MultiControlOnClosed(widget, event, ...) local function MultiControlOnClosed(widget, event, ...)
local user = widget:GetUserDataTable() local user = widget:GetUserDataTable()
if user.valuechanged then if user.valuechanged and not widget:IsReleasing() then
local iscustom = user.rootframe:GetUserData("iscustom") local iscustom = user.rootframe:GetUserData("iscustom")
local basepath = user.rootframe:GetUserData("basepath") or emptyTbl local basepath = user.rootframe:GetUserData("basepath") or emptyTbl
if iscustom then if iscustom then
@@ -1122,8 +1149,6 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
--Control to feed --Control to feed
local control local control
local name = GetOptionsMemberValue("name", v, options, path, appName)
if v.type == "execute" then if v.type == "execute" then
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName) local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName)
@@ -1226,7 +1251,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
end end
tsort(sorting, sortTblAsStrings) tsort(sorting, sortTblAsStrings)
end end
for k, value in ipairs(sorting) do for _, value in ipairs(sorting) do
local text = values[value] local text = values[value]
local radio = gui:Create("CheckBox") local radio = gui:Create("CheckBox")
radio:SetLabel(text) radio:SetLabel(text)
@@ -1308,8 +1333,8 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
control:SetWidth(width_multiplier) control:SetWidth(width_multiplier)
end end
--check:SetTriState(v.tristate) --check:SetTriState(v.tristate)
for i = 1, #valuesort do for s = 1, #valuesort do
local key = valuesort[i] local key = valuesort[s]
local value = GetOptionsMemberValue("get",v, options, path, appName, key) local value = GetOptionsMemberValue("get",v, options, path, appName, key)
control:SetItemValue(key,value) control:SetItemValue(key,value)
end end
@@ -1321,8 +1346,8 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
control:PauseLayout() control:PauseLayout()
local width = GetOptionsMemberValue("width",v,options,path,appName) local width = GetOptionsMemberValue("width",v,options,path,appName)
for i = 1, #valuesort do for s = 1, #valuesort do
local value = valuesort[i] local value = valuesort[s]
local text = values[value] local text = values[value]
local check = gui:Create("CheckBox") local check = gui:Create("CheckBox")
check:SetLabel(text) check:SetLabel(text)
@@ -1389,7 +1414,7 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName) local imageCoords = GetOptionsMemberValue("imageCoords",v, options, path, appName)
local image, width, height = GetOptionsMemberValue("image",v, options, path, appName) local image, width, height = GetOptionsMemberValue("image",v, options, path, appName)
if type(image) == "string" then if type(image) == "string" or type(image) == "number" then
if not width then if not width then
width = GetOptionsMemberValue("imageWidth",v, options, path, appName) width = GetOptionsMemberValue("imageWidth",v, options, path, appName)
end end
@@ -1409,8 +1434,8 @@ local function FeedOptions(appName, options,container,rootframe,path,group,inlin
end end
control:SetImageSize(width, height) control:SetImageSize(width, height)
end end
local width = GetOptionsMemberValue("width",v,options,path,appName) local controlWidth = GetOptionsMemberValue("width",v,options,path,appName)
control.width = not width and "fill" control.width = not controlWidth and "fill"
end end
--Common Init --Common Init
@@ -1462,6 +1487,7 @@ local function TreeOnButtonEnter(widget, event, uniquevalue, button)
local option = user.option local option = user.option
local path = user.path local path = user.path
local appName = user.appName local appName = user.appName
local tooltip = AceConfigDialog.tooltip
local feedpath = new() local feedpath = new()
for i = 1, #path do for i = 1, #path do
@@ -1478,24 +1504,25 @@ local function TreeOnButtonEnter(widget, event, uniquevalue, button)
local name = GetOptionsMemberValue("name", group, options, feedpath, appName) local name = GetOptionsMemberValue("name", group, options, feedpath, appName)
local desc = GetOptionsMemberValue("desc", group, options, feedpath, appName) local desc = GetOptionsMemberValue("desc", group, options, feedpath, appName)
GameTooltip:SetOwner(button, "ANCHOR_NONE") tooltip:SetOwner(button, "ANCHOR_NONE")
tooltip:ClearAllPoints()
if widget.type == "TabGroup" then if widget.type == "TabGroup" then
GameTooltip:SetPoint("BOTTOM",button,"TOP") tooltip:SetPoint("BOTTOM",button,"TOP")
else else
GameTooltip:SetPoint("LEFT",button,"RIGHT") tooltip:SetPoint("LEFT",button,"RIGHT")
end end
GameTooltip:SetText(name, 1, .82, 0, 1) tooltip:SetText(name, 1, .82, 0, true)
if type(desc) == "string" then if type(desc) == "string" then
GameTooltip:AddLine(desc, 1, 1, 1, 1) tooltip:AddLine(desc, 1, 1, 1, true)
end end
GameTooltip:Show() tooltip:Show()
end end
local function TreeOnButtonLeave(widget, event, value, button) local function TreeOnButtonLeave(widget, event, value, button)
GameTooltip:Hide() AceConfigDialog.tooltip:Hide()
end end
@@ -1663,29 +1690,29 @@ function AceConfigDialog:FeedGroup(appName,options,container,rootframe,path, isR
elseif grouptype == "select" then elseif grouptype == "select" then
local select = gui:Create("DropdownGroup") local selectGroup = gui:Create("DropdownGroup")
select:SetTitle(name) selectGroup:SetTitle(name)
InjectInfo(select, options, group, path, rootframe, appName) InjectInfo(selectGroup, options, group, path, rootframe, appName)
select:SetCallback("OnGroupSelected", GroupSelected) selectGroup:SetCallback("OnGroupSelected", GroupSelected)
local status = AceConfigDialog:GetStatusTable(appName, path) local status = AceConfigDialog:GetStatusTable(appName, path)
if not status.groups then if not status.groups then
status.groups = {} status.groups = {}
end end
select:SetStatusTable(status.groups) selectGroup:SetStatusTable(status.groups)
local grouplist, orderlist = BuildSelect(group, options, path, appName) local grouplist, orderlist = BuildSelect(group, options, path, appName)
select:SetGroupList(grouplist, orderlist) selectGroup:SetGroupList(grouplist, orderlist)
select:SetUserData("grouplist", grouplist) selectGroup:SetUserData("grouplist", grouplist)
select:SetUserData("orderlist", orderlist) selectGroup:SetUserData("orderlist", orderlist)
local firstgroup = orderlist[1] local firstgroup = orderlist[1]
if firstgroup then if firstgroup then
select:SetGroup((GroupExists(appName, options, path,status.groups.selected) and status.groups.selected) or firstgroup) selectGroup:SetGroup((GroupExists(appName, options, path,status.groups.selected) and status.groups.selected) or firstgroup)
end end
select.width = "fill" selectGroup.width = "fill"
select.height = "fill" selectGroup.height = "fill"
container:AddChild(select) container:AddChild(selectGroup)
--assume tree group by default --assume tree group by default
--if parenttype is tree then this group is already a node on that tree --if parenttype is tree then this group is already a node on that tree
@@ -1913,13 +1940,13 @@ end
-- convert pre-39 BlizOptions structure to the new format -- convert pre-39 BlizOptions structure to the new format
if oldminor and oldminor < 39 and AceConfigDialog.BlizOptions then if oldminor and oldminor < 39 and AceConfigDialog.BlizOptions then
local old = AceConfigDialog.BlizOptions local old = AceConfigDialog.BlizOptions
local new = {} local newOpt = {}
for key, widget in pairs(old) do for key, widget in pairs(old) do
local appName = widget:GetUserData("appName") local appName = widget:GetUserData("appName")
if not new[appName] then new[appName] = {} end if not newOpt[appName] then newOpt[appName] = {} end
new[appName][key] = widget newOpt[appName][key] = widget
end end
AceConfigDialog.BlizOptions = new AceConfigDialog.BlizOptions = newOpt
else else
AceConfigDialog.BlizOptions = AceConfigDialog.BlizOptions or {} AceConfigDialog.BlizOptions = AceConfigDialog.BlizOptions or {}
end end
@@ -1952,6 +1979,7 @@ end
-- @param parent The parent to use in the interface options tree. -- @param parent The parent to use in the interface options tree.
-- @param ... The path in the options table to feed into the interface options panel. -- @param ... The path in the options table to feed into the interface options panel.
-- @return The reference to the frame registered into the Interface Options. -- @return The reference to the frame registered into the Interface Options.
-- @return The category ID to pass to Settings.OpenToCategory (or InterfaceOptionsFrame_OpenToCategory)
function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...) function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
local BlizOptions = AceConfigDialog.BlizOptions local BlizOptions = AceConfigDialog.BlizOptions
@@ -1967,7 +1995,6 @@ function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
if not BlizOptions[appName][key] then if not BlizOptions[appName][key] then
local group = gui:Create("BlizOptionsGroup") local group = gui:Create("BlizOptionsGroup")
BlizOptions[appName][key] = group BlizOptions[appName][key] = group
group:SetName(name or appName, parent)
group:SetTitle(name or appName) group:SetTitle(name or appName)
group:SetUserData("appName", appName) group:SetUserData("appName", appName)
@@ -1980,8 +2007,30 @@ function AceConfigDialog:AddToBlizOptions(appName, name, parent, ...)
end end
group:SetCallback("OnShow", FeedToBlizPanel) group:SetCallback("OnShow", FeedToBlizPanel)
group:SetCallback("OnHide", ClearBlizPanel) group:SetCallback("OnHide", ClearBlizPanel)
InterfaceOptions_AddCategory(group.frame) if Settings and Settings.RegisterCanvasLayoutCategory then
return group.frame local categoryName = name or appName
if parent then
local category = Settings.GetCategory(parent)
if not category then
error(("The parent category '%s' was not found"):format(parent), 2)
end
local subcategory = Settings.RegisterCanvasLayoutSubcategory(category, group.frame, categoryName)
-- force the generated ID to be used for subcategories, as these can have very simple names like "Profiles"
group:SetName(subcategory.ID, parent)
else
local category = Settings.RegisterCanvasLayoutCategory(group.frame, categoryName)
-- using appName here would be cleaner, but would not be 100% compatible
-- but for top-level categories it should be fine, as these are typically addon names
category.ID = categoryName
group:SetName(categoryName, parent)
Settings.RegisterAddOnCategory(category)
end
else
group:SetName(name or appName, parent)
InterfaceOptions_AddCategory(group.frame)
end
return group.frame, group.frame.name
else else
error(("%s has already been added to the Blizzard Options Window with the given path"):format(appName), 2) error(("%s has already been added to the Blizzard Options Window with the given path"):format(appName), 2)
end end
@@ -1,4 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd"> ..\FrameXML\UI.xsd">
<Script file="AceConfigDialog-3.0.lua"/> <Script file="AceConfigDialog-3.0.lua"/>
</Ui> </Ui>
@@ -8,10 +8,10 @@
-- :IterateOptionsTables() (and :GetOptionsTable() if only given one argument) return a function reference that the requesting config handling addon must call with valid "uiType", "uiName". -- :IterateOptionsTables() (and :GetOptionsTable() if only given one argument) return a function reference that the requesting config handling addon must call with valid "uiType", "uiName".
-- @class file -- @class file
-- @name AceConfigRegistry-3.0 -- @name AceConfigRegistry-3.0
-- @release $Id: AceConfigRegistry-3.0.lua 1207 2019-06-23 12:08:33Z nevcairiel $ -- @release $Id: AceConfigRegistry-3.0.lua 1296 2022-11-04 18:50:10Z nevcairiel $
local CallbackHandler = LibStub("CallbackHandler-1.0") local CallbackHandler = LibStub("CallbackHandler-1.0")
local MAJOR, MINOR = "AceConfigRegistry-3.0", 20 local MAJOR, MINOR = "AceConfigRegistry-3.0", 21
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR) local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR)
if not AceConfigRegistry then return end if not AceConfigRegistry then return end
@@ -83,6 +83,7 @@ local basekeys={
dialogHidden=optmethodbool, dialogHidden=optmethodbool,
dropdownHidden=optmethodbool, dropdownHidden=optmethodbool,
cmdHidden=optmethodbool, cmdHidden=optmethodbool,
tooltipHyperlink=optstringfunc,
icon=optstringnumberfunc, icon=optstringnumberfunc,
iconCoords=optmethodtable, iconCoords=optmethodtable,
handler=opttable, handler=opttable,
@@ -1,4 +1,4 @@
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ <Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
..\FrameXML\UI.xsd"> ..\FrameXML\UI.xsd">
<Script file="AceConfigRegistry-3.0.lua"/> <Script file="AceConfigRegistry-3.0.lua"/>
</Ui> </Ui>
+76 -86
View File
@@ -24,33 +24,28 @@
-- f:AddChild(btn) -- f:AddChild(btn)
-- @class file -- @class file
-- @name AceGUI-3.0 -- @name AceGUI-3.0
-- @release $Id$ -- @release $Id: AceGUI-3.0.lua 1288 2022-09-25 14:19:00Z funkehdude $
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 41 local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 41
local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR) local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR)
if not AceGUI then return end -- No upgrade needed if not AceGUI then return end -- No upgrade needed
-- Lua APIs -- Lua APIs
local tconcat, tinsert = table.concat, table.insert local tinsert, wipe = table.insert, table.wipe
local select, pairs, next, type = select, pairs, next, type local select, pairs, next, type = select, pairs, next, type
local error, assert, loadstring = error, assert, loadstring local error, assert = error, assert
local setmetatable, rawget, rawset = setmetatable, rawget, rawset local setmetatable, rawget = setmetatable, rawget
local math_max = math.max local math_max, math_min, math_ceil = math.max, math.min, math.ceil
-- WoW APIs -- WoW APIs
local UIParent = UIParent 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.WidgetRegistry = AceGUI.WidgetRegistry or {}
AceGUI.LayoutRegistry = AceGUI.LayoutRegistry or {} AceGUI.LayoutRegistry = AceGUI.LayoutRegistry or {}
AceGUI.WidgetBase = AceGUI.WidgetBase or {} AceGUI.WidgetBase = AceGUI.WidgetBase or {}
AceGUI.WidgetContainerBase = AceGUI.WidgetContainerBase or {} AceGUI.WidgetContainerBase = AceGUI.WidgetContainerBase or {}
AceGUI.WidgetVersions = AceGUI.WidgetVersions or {} AceGUI.WidgetVersions = AceGUI.WidgetVersions or {}
AceGUI.tooltip = AceGUI.tooltip or CreateFrame("GameTooltip", "AceGUITooltip", UIParent, "GameTooltipTemplate")
-- local upvalues -- local upvalues
local WidgetRegistry = AceGUI.WidgetRegistry local WidgetRegistry = AceGUI.WidgetRegistry
@@ -58,47 +53,22 @@ local LayoutRegistry = AceGUI.LayoutRegistry
local WidgetVersions = AceGUI.WidgetVersions local WidgetVersions = AceGUI.WidgetVersions
--[[ --[[
xpcall safecall implementation pcall safecall implementation
]] ]]
local xpcall = xpcall local pcall = pcall
local function errorhandler(err) local function errorhandler(err)
return geterrorhandler()(err) return geterrorhandler()(err)
end 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, ...) local function safecall(func, ...)
return Dispatchers[select("#", ...)](func, ...) if func then
local ret = {pcall(func, ...)}
if not ret[1] then
errorhandler(ret[2])
end
return unpack(ret)
end
end end
-- Recycling functions -- Recycling functions
@@ -122,38 +92,38 @@ do
AceGUI.objPools = AceGUI.objPools or {} AceGUI.objPools = AceGUI.objPools or {}
local objPools = AceGUI.objPools local objPools = AceGUI.objPools
--Returns a new instance, if none are available either returns a new table or calls the given contructor --Returns a new instance, if none are available either returns a new table or calls the given contructor
function newWidget(type) function newWidget(widgetType)
if not WidgetRegistry[type] then if not WidgetRegistry[widgetType] then
error("Attempt to instantiate unknown widget type", 2) error("Attempt to instantiate unknown widget type", 2)
end end
if not objPools[type] then if not objPools[widgetType] then
objPools[type] = {} objPools[widgetType] = {}
end end
local newObj = next(objPools[type]) local newObj = next(objPools[widgetType])
if not newObj then if not newObj then
newObj = WidgetRegistry[type]() newObj = WidgetRegistry[widgetType]()
newObj.AceGUIWidgetVersion = WidgetVersions[type] newObj.AceGUIWidgetVersion = WidgetVersions[widgetType]
else else
objPools[type][newObj] = nil objPools[widgetType][newObj] = nil
-- if the widget is older then the latest, don't even try to reuse it -- if the widget is older then the latest, don't even try to reuse it
-- just forget about it, and grab a new one. -- just forget about it, and grab a new one.
if not newObj.AceGUIWidgetVersion or newObj.AceGUIWidgetVersion < WidgetVersions[type] then if not newObj.AceGUIWidgetVersion or newObj.AceGUIWidgetVersion < WidgetVersions[widgetType] then
return newWidget(type) return newWidget(widgetType)
end end
end end
return newObj return newObj
end end
-- Releases an instance to the Pool -- Releases an instance to the Pool
function delWidget(obj,type) function delWidget(obj,widgetType)
if not objPools[type] then if not objPools[widgetType] then
objPools[type] = {} objPools[widgetType] = {}
end end
if objPools[type][obj] then if objPools[widgetType][obj] then
error("Attempt to Release Widget that is already released", 2) error("Attempt to Release Widget that is already released", 2)
end end
objPools[type][obj] = true objPools[widgetType][obj] = true
end end
end end
@@ -169,9 +139,9 @@ end
-- OnAcquire function on it, before returning. -- OnAcquire function on it, before returning.
-- @param type The type of the widget. -- @param type The type of the widget.
-- @return The newly created widget. -- @return The newly created widget.
function AceGUI:Create(type) function AceGUI:Create(widgetType)
if WidgetRegistry[type] then if WidgetRegistry[widgetType] then
local widget = newWidget(type) local widget = newWidget(widgetType)
if rawget(widget, "Acquire") then if rawget(widget, "Acquire") then
widget.OnAcquire = widget.Acquire widget.OnAcquire = widget.Acquire
@@ -189,7 +159,7 @@ function AceGUI:Create(type)
if widget.OnAcquire then if widget.OnAcquire then
widget:OnAcquire() widget:OnAcquire()
else else
error(("Widget type %s doesn't supply an OnAcquire Function"):format(type)) error(("Widget type %s doesn't supply an OnAcquire Function"):format(widgetType))
end end
-- Set the default Layout ("List") -- Set the default Layout ("List")
safecall(widget.SetLayout, widget, "List") safecall(widget.SetLayout, widget, "List")
@@ -240,6 +210,22 @@ function AceGUI:Release(widget)
delWidget(widget, widget.type) delWidget(widget, widget.type)
end end
--- Check if a widget is currently in the process of being released
-- This function check if this widget, or any of its parents (in which case it'll be released shortly as well)
-- are currently being released. This allows addon to handle any callbacks accordingly.
-- @param widget The widget to check
function AceGUI:IsReleasing(widget)
if widget.isQueuedForRelease then
return true
end
if widget.parent and widget.parent.AceGUIWidgetVersion then
return AceGUI:IsReleasing(widget.parent)
end
return false
end
----------- -----------
-- Focus -- -- Focus --
----------- -----------
@@ -366,6 +352,10 @@ do
AceGUI:Release(self) AceGUI:Release(self)
end end
WidgetBase.IsReleasing = function(self)
return AceGUI:IsReleasing(self)
end
WidgetBase.SetPoint = function(self, ...) WidgetBase.SetPoint = function(self, ...)
return self.frame:SetPoint(...) return self.frame:SetPoint(...)
end end
@@ -597,25 +587,25 @@ AceGUI.counts = AceGUI.counts or {}
-- This is used by widgets that require a named frame, e.g. when a Blizzard -- This is used by widgets that require a named frame, e.g. when a Blizzard
-- Template requires it. -- Template requires it.
-- @param type The widget type -- @param type The widget type
function AceGUI:GetNextWidgetNum(type) function AceGUI:GetNextWidgetNum(widgetType)
if not self.counts[type] then if not self.counts[widgetType] then
self.counts[type] = 0 self.counts[widgetType] = 0
end end
self.counts[type] = self.counts[type] + 1 self.counts[widgetType] = self.counts[widgetType] + 1
return self.counts[type] return self.counts[widgetType]
end end
--- Return the number of created widgets for this type. --- Return the number of created widgets for this type.
-- In contrast to GetNextWidgetNum, the number is not incremented. -- In contrast to GetNextWidgetNum, the number is not incremented.
-- @param type The widget type -- @param widgetType The widget type
function AceGUI:GetWidgetCount(type) function AceGUI:GetWidgetCount(widgetType)
return self.counts[type] or 0 return self.counts[widgetType] or 0
end end
--- Return the version of the currently registered widget type. --- Return the version of the currently registered widget type.
-- @param type The widget type -- @param widgetType The widget type
function AceGUI:GetWidgetVersion(type) function AceGUI:GetWidgetVersion(widgetType)
return WidgetVersions[type] return WidgetVersions[widgetType]
end end
------------- -------------
@@ -778,7 +768,6 @@ AceGUI:RegisterLayout("Flow",
usedwidth = 0 usedwidth = 0
rowstart = frame rowstart = frame
rowstartoffset = frameoffset
if child.DoLayout then if child.DoLayout then
child:DoLayout() child:DoLayout()
@@ -821,7 +810,8 @@ local GetCellAlign = function (dir, tableObj, colObj, cellObj, cell, child)
or colObj and (colObj["align" .. dir] or colObj.align) or colObj and (colObj["align" .. dir] or colObj.align)
or tableObj["align" .. dir] or tableObj.align or tableObj["align" .. dir] or tableObj.align
or "CENTERLEFT" or "CENTERLEFT"
local child, cell, val = child or 0, cell or 0, nil local val
child, cell = child or 0, cell or 0
if type(fn) == "string" then if type(fn) == "string" then
fn = fn:lower() fn = fn:lower()
@@ -835,7 +825,7 @@ local GetCellAlign = function (dir, tableObj, colObj, cellObj, cell, child)
val = fn val = fn
end end
return fn, max(0, min(val, cell)) return fn, math_max(0, math_min(val, cell))
end end
-- Get width or height for multiple cells combined -- Get width or height for multiple cells combined
@@ -844,7 +834,7 @@ local GetCellDimension = function (dir, laneDim, from, to, space)
for cell=from,to do for cell=from,to do
dim = dim + (laneDim[cell] or 0) dim = dim + (laneDim[cell] or 0)
end end
return dim + max(0, to - from) * (space or 0) return dim + math_max(0, to - from) * (space or 0)
end end
--[[ Options --[[ Options
@@ -890,7 +880,7 @@ AceGUI:RegisterLayout("Table",
repeat repeat
n = n + 1 n = n + 1
local col = (n - 1) % #cols + 1 local col = (n - 1) % #cols + 1
local row = ceil(n / #cols) local row = math_ceil(n / #cols)
local rowspan = rowspans[col] local rowspan = rowspans[col]
local cell = rowspan and rowspan.child or child local cell = rowspan and rowspan.child or child
local cellObj = cell:GetUserData("cell") local cellObj = cell:GetUserData("cell")
@@ -906,7 +896,7 @@ AceGUI:RegisterLayout("Table",
end end
-- Colspan -- Colspan
local colspan = max(0, min((cellObj and cellObj.colspan or 1) - 1, #cols - col)) local colspan = math_max(0, math_min((cellObj and cellObj.colspan or 1) - 1, #cols - col))
n = n + colspan n = n + colspan
-- Place the cell -- Place the cell
@@ -923,7 +913,7 @@ AceGUI:RegisterLayout("Table",
end end
end end
local rows = ceil(n / #cols) local rows = math_ceil(n / #cols)
-- Determine fixed size cols and collect weights -- Determine fixed size cols and collect weights
local extantH, totalWeight = totalH, 0 local extantH, totalWeight = totalH, 0
@@ -948,16 +938,16 @@ AceGUI:RegisterLayout("Table",
f:ClearAllPoints() f:ClearAllPoints()
local childH = f:GetWidth() or 0 local childH = f:GetWidth() or 0
laneH[col] = max(laneH[col], childH - GetCellDimension("H", laneH, colStart[child], col - 1, spaceH)) laneH[col] = math_max(laneH[col], childH - GetCellDimension("H", laneH, colStart[child], col - 1, spaceH))
end end
end end
laneH[col] = max(colObj.min or colObj[1] or 0, min(laneH[col], colObj.max or colObj[2] or laneH[col])) laneH[col] = math_max(colObj.min or colObj[1] or 0, math_min(laneH[col], colObj.max or colObj[2] or laneH[col]))
else else
-- Rel./Abs. width -- Rel./Abs. width
laneH[col] = colObj.width < 1 and colObj.width * totalH or colObj.width laneH[col] = colObj.width < 1 and colObj.width * totalH or colObj.width
end end
extantH = max(0, extantH - laneH[col]) extantH = math_max(0, extantH - laneH[col])
end end
end end
@@ -996,7 +986,7 @@ AceGUI:RegisterLayout("Table",
child:DoLayout() child:DoLayout()
end end
rowV = max(rowV, (f:GetHeight() or 0) - GetCellDimension("V", laneV, rowStart[child], row - 1, spaceV)) rowV = math_max(rowV, (f:GetHeight() or 0) - GetCellDimension("V", laneV, rowStart[child], row - 1, spaceV))
end end
end end
@@ -2,7 +2,7 @@
BlizOptionsGroup Container BlizOptionsGroup Container
Simple container widget for the integration of AceGUI into the Blizzard Interface Options Simple container widget for the integration of AceGUI into the Blizzard Interface Options
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "BlizOptionsGroup", 21 local Type, Version = "BlizOptionsGroup", 27
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -99,7 +99,7 @@ local methods = {
Constructor Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame") local frame = CreateFrame("Frame", string.format("%s%d", Type, AceGUI:GetNextWidgetNum(Type)), InterfaceOptionsFramePanelContainer)
frame:Hide() frame:Hide()
-- support functions for the Blizzard Interface Options -- support functions for the Blizzard Interface Options
@@ -108,6 +108,11 @@ local function Constructor()
frame.default = default frame.default = default
frame.refresh = refresh 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("OnHide", OnHide)
frame:SetScript("OnShow", OnShow) frame:SetScript("OnShow", OnShow)
@@ -2,7 +2,7 @@
DropdownGroup Container DropdownGroup Container
Container controlled by a dropdown on the top. Container controlled by a dropdown on the top.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "DropdownGroup", 21 local Type, Version = "DropdownGroup", 23
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -106,7 +106,7 @@ local PaneBackdrop = {
} }
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame") local frame = CreateFrame("Frame", string.format("%s%d", Type, AceGUI:GetNextWidgetNum(Type)))
frame:SetHeight(100) frame:SetHeight(100)
frame:SetWidth(100) frame:SetWidth(100)
frame:SetFrameStrata("FULLSCREEN_DIALOG") frame:SetFrameStrata("FULLSCREEN_DIALOG")
@@ -1,7 +1,7 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Frame Container Frame Container
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Frame", 25 local Type, Version = "Frame", 31
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -13,10 +13,6 @@ local wipe = table.wipe
local PlaySound = PlaySound local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent 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 Scripts
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -83,6 +79,7 @@ local methods = {
["OnAcquire"] = function(self) ["OnAcquire"] = function(self)
self.frame:SetParent(UIParent) self.frame:SetParent(UIParent)
self.frame:SetFrameStrata("FULLSCREEN_DIALOG") self.frame:SetFrameStrata("FULLSCREEN_DIALOG")
self.frame:SetFrameLevel(100) -- Lots of room to draw under it
self:SetTitle() self:SetTitle()
self:SetStatusText() self:SetStatusText()
self:ApplyStatus() self:ApplyStatus()
@@ -179,16 +176,21 @@ local PaneBackdrop = {
} }
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", string.format("%s%d", Type, AceGUI:GetNextWidgetNum(Type)), UIParent)
frame:Hide() frame:Hide()
frame:EnableMouse(true) frame:EnableMouse(true)
frame:SetMovable(true) frame:SetMovable(true)
frame:SetResizable(true) frame:SetResizable(true)
frame:SetFrameStrata("FULLSCREEN_DIALOG") frame:SetFrameStrata("FULLSCREEN_DIALOG")
frame:SetFrameLevel(100) -- Lots of room to draw under it
frame:SetBackdrop(FrameBackdrop) frame:SetBackdrop(FrameBackdrop)
frame:SetBackdropColor(0, 0, 0, 1) frame:SetBackdropColor(0, 0, 0, 1)
frame:SetMinResize(400, 200) if frame.SetResizeBounds then -- WoW 10.0
frame:SetResizeBounds(400, 200)
else
frame:SetMinResize(400, 200)
end
frame:SetToplevel(true) frame:SetToplevel(true)
frame:SetScript("OnShow", Frame_OnShow) frame:SetScript("OnShow", Frame_OnShow)
frame:SetScript("OnHide", Frame_OnClose) frame:SetScript("OnHide", Frame_OnClose)
@@ -269,7 +271,7 @@ local function Constructor()
line2:SetHeight(8) line2:SetHeight(8)
line2:SetPoint("BOTTOMRIGHT", -8, 8) line2:SetPoint("BOTTOMRIGHT", -8, 8)
line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
local x = 0.1 * 8/17 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) 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) local sizer_s = CreateFrame("Frame", nil, frame)
@@ -2,7 +2,7 @@
InlineGroup Container InlineGroup Container
Simple container widget that creates a visible "box" with an optional title. Simple container widget that creates a visible "box" with an optional title.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "InlineGroup", 21 local Type, Version = "InlineGroup", 23
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -66,7 +66,7 @@ local PaneBackdrop = {
} }
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", string.format("%s%d", Type, AceGUI:GetNextWidgetNum(Type)), UIParent)
frame:SetFrameStrata("FULLSCREEN_DIALOG") frame:SetFrameStrata("FULLSCREEN_DIALOG")
local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
@@ -2,7 +2,7 @@
ScrollFrame Container ScrollFrame Container
Plain container that scrolls its content and doesn't grow in height. Plain container that scrolls its content and doesn't grow in height.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "ScrollFrame", 26 local Type, Version = "ScrollFrame", 27
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -94,7 +94,7 @@ local methods = {
local status = self.status or self.localstatus local status = self.status or self.localstatus
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight() local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight()
local offset = status.offset or 0 local offset = status.offset or 0
-- Give us a margin of error of 2 pixels to stop some conditions that i would blame on floating point inaccuracies -- Give us a margin of error of 2 pixels to stop some conditions that i would blame on floating point inaccuracys
-- No-one is going to miss 2 pixels at the bottom of the frame, anyhow! -- No-one is going to miss 2 pixels at the bottom of the frame, anyhow!
if viewheight < height + 2 then if viewheight < height + 2 then
if self.scrollBarShown then if self.scrollBarShown then
@@ -164,8 +164,8 @@ local methods = {
Constructor Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
local num = AceGUI:GetNextWidgetNum(Type) local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", string.format("%s%d", Type, num), UIParent)
local scrollframe = CreateFrame("ScrollFrame", nil, frame) local scrollframe = CreateFrame("ScrollFrame", nil, frame)
scrollframe:SetPoint("TOPLEFT") scrollframe:SetPoint("TOPLEFT")
@@ -2,7 +2,7 @@
SimpleGroup Container SimpleGroup Container
Simple container widget that just groups widgets. Simple container widget that just groups widgets.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "SimpleGroup", 20 local Type, Version = "SimpleGroup", 21
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -46,7 +46,7 @@ local methods = {
Constructor Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", string.format("%s%d", Type, AceGUI:GetNextWidgetNum(Type)), UIParent)
frame:SetFrameStrata("FULLSCREEN_DIALOG") frame:SetFrameStrata("FULLSCREEN_DIALOG")
--Container Support --Container Support
@@ -2,22 +2,18 @@
TabGroup Container TabGroup Container
Container that uses tabs on top to switch between groups. Container that uses tabs on top to switch between groups.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "TabGroup", 31 local Type, Version = "TabGroup", 39
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs -- Lua APIs
local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, wipe local pairs, ipairs, assert, type, wipe = pairs, ipairs, assert, type, table.wipe
-- WoW APIs -- WoW APIs
local PlaySound = PlaySound local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent local CreateFrame, UIParent = CreateFrame, UIParent
local _G = _G 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 upvalue storage used by BuildTabs
local widths = {} local widths = {}
local rowwidths = {} local rowwidths = {}
@@ -26,6 +22,143 @@ local rowends = {}
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Support functions 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) local function UpdateTabLook(frame)
if frame.disabled then if frame.disabled then
PanelTemplates_SetDisabledTabState(frame) PanelTemplates_SetDisabledTabState(frame)
@@ -39,7 +172,7 @@ end
local function Tab_SetText(frame, text) local function Tab_SetText(frame, text)
frame:_SetText(text) frame:_SetText(text)
local width = frame.obj.frame.width or frame.obj.frame:GetWidth() or 0 local width = frame.obj.frame.width or frame.obj.frame:GetWidth() or 0
PanelTemplates_TabResize(frame, 0, nil, width) PanelTemplates_TabResize(frame, 0, nil, nil, width, frame:GetFontString():GetStringWidth())
end end
local function Tab_SetSelected(frame, selected) local function Tab_SetSelected(frame, selected)
@@ -103,11 +236,64 @@ local methods = {
["CreateTab"] = function(self, id) ["CreateTab"] = function(self, id)
local tabname = ("AceGUITabGroup%dTab%d"):format(self.num, id) local tabname = ("AceGUITabGroup%dTab%d"):format(self.num, id)
local tab = CreateFrame("Button", tabname, self.border, "OptionsFrameTabButtonTemplate") 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
tab.obj = self tab.obj = self
tab.id = id tab.id = id
tab.text = _G[tabname .. "Text"] tab.text = tab.Text -- compat
tab.text:ClearAllPoints() tab.text:ClearAllPoints()
tab.text:SetPoint("LEFT", 14, -3) tab.text:SetPoint("LEFT", 14, -3)
tab.text:SetPoint("RIGHT", -12, -3) tab.text:SetPoint("RIGHT", -12, -3)
@@ -255,7 +441,7 @@ local methods = {
end end
for i = starttab, endtab do for i = starttab, endtab do
PanelTemplates_TabResize(tabs[i], padding + 4, nil, width) PanelTemplates_TabResize(tabs[i], padding + 4, nil, nil, width, tabs[i]:GetFontString():GetStringWidth())
end end
starttab = endtab + 1 starttab = endtab + 1
end end
@@ -304,7 +490,7 @@ local PaneBackdrop = {
local function Constructor() local function Constructor()
local num = AceGUI:GetNextWidgetNum(Type) local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame",nil,UIParent) local frame = CreateFrame("Frame", string.format("%s%d", Type, num), UIParent)
frame:SetHeight(100) frame:SetHeight(100)
frame:SetWidth(100) frame:SetWidth(100)
frame:SetFrameStrata("FULLSCREEN_DIALOG") frame:SetFrameStrata("FULLSCREEN_DIALOG")
@@ -2,22 +2,18 @@
TreeGroup Container TreeGroup Container
Container that uses a tree control to switch between groups. Container that uses a tree control to switch between groups.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "TreeGroup", 43 local Type, Version = "TreeGroup", 50
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
-- Lua APIs -- Lua APIs
local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type
local math_min, math_max, floor = math.min, math.max, floor local math_min, math_max, floor = math.min, math.max, math.floor
local select, tremove, unpack, tconcat = select, table.remove, unpack, table.concat local select, tremove, unpack, tconcat = select, table.remove, unpack, table.concat
-- WoW APIs -- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent 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 -- Recycling functions
local new, del local new, del
do do
@@ -159,7 +155,7 @@ end
local function FirstFrameUpdate(frame) local function FirstFrameUpdate(frame)
local self = frame.obj local self = frame.obj
frame:SetScript("OnUpdate", nil) frame:SetScript("OnUpdate", nil)
self:RefreshTree() self:RefreshTree(nil, true)
end end
local function BuildUniqueValue(...) local function BuildUniqueValue(...)
@@ -206,11 +202,13 @@ local function Button_OnEnter(frame)
self:Fire("OnButtonEnter", frame.uniquevalue, frame) self:Fire("OnButtonEnter", frame.uniquevalue, frame)
if self.enabletooltips then if self.enabletooltips then
GameTooltip:SetOwner(frame, "ANCHOR_NONE") local tooltip = AceGUI.tooltip
GameTooltip:SetPoint("LEFT",frame,"RIGHT") tooltip:SetOwner(frame, "ANCHOR_NONE")
GameTooltip:SetText(frame.text:GetText() or "", 1, .82, 0, 1) tooltip:ClearAllPoints()
tooltip:SetPoint("LEFT",frame,"RIGHT")
tooltip:SetText(frame.text:GetText() or "", 1, .82, 0, true)
GameTooltip:Show() tooltip:Show()
end end
end end
@@ -219,7 +217,7 @@ local function Button_OnLeave(frame)
self:Fire("OnButtonLeave", frame.uniquevalue, frame) self:Fire("OnButtonLeave", frame.uniquevalue, frame)
if self.enabletooltips then if self.enabletooltips then
GameTooltip:Hide() AceGUI.tooltip:Hide()
end end
end end
@@ -227,7 +225,7 @@ local function OnScrollValueChanged(frame, value)
if frame.obj.noupdate then return end if frame.obj.noupdate then return end
local self = frame.obj local self = frame.obj
local status = self.status or self.localstatus local status = self.status or self.localstatus
status.scrollvalue = value status.scrollvalue = floor(value + 0.5)
self:RefreshTree() self:RefreshTree()
AceGUI:ClearFocus() AceGUI:ClearFocus()
end end
@@ -292,10 +290,13 @@ local methods = {
["OnAcquire"] = function(self) ["OnAcquire"] = function(self)
self:SetTreeWidth(DEFAULT_TREE_WIDTH, DEFAULT_TREE_SIZABLE) self:SetTreeWidth(DEFAULT_TREE_WIDTH, DEFAULT_TREE_SIZABLE)
self:EnableButtonTooltips(true) self:EnableButtonTooltips(true)
self.frame:SetScript("OnUpdate", FirstFrameUpdate)
end, end,
["OnRelease"] = function(self) ["OnRelease"] = function(self)
self.status = nil self.status = nil
self.tree = nil
self.frame:SetScript("OnUpdate", nil)
for k, v in pairs(self.localstatus) do for k, v in pairs(self.localstatus) do
if k == "groups" then if k == "groups" then
for k2 in pairs(v) do for k2 in pairs(v) do
@@ -383,13 +384,9 @@ local methods = {
end end
end, end,
["RefreshTree"] = function(self,scrollToSelection) ["RefreshTree"] = function(self,scrollToSelection,fromOnUpdate)
local buttons = self.buttons local buttons = self.buttons
local lines = self.lines local lines = self.lines
for i, v in ipairs(buttons) do
v:Hide()
end
while lines[1] do while lines[1] do
local t = tremove(lines) local t = tremove(lines)
for k in pairs(t) do for k in pairs(t) do
@@ -415,6 +412,11 @@ local methods = {
local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18)) local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18))
if maxlines <= 0 then return end 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 local first, last
scrollToSelection = status.scrollToSelection scrollToSelection = status.scrollToSelection
@@ -493,6 +495,10 @@ local methods = {
buttonnum = buttonnum + 1 buttonnum = buttonnum + 1
end 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, end,
["SetSelected"] = function(self, value) ["SetSelected"] = function(self, value)
@@ -557,7 +563,11 @@ local methods = {
if maxtreewidth > 100 and status.treewidth > maxtreewidth then if maxtreewidth > 100 and status.treewidth > maxtreewidth then
self:SetTreeWidth(maxtreewidth, status.treesizable) self:SetTreeWidth(maxtreewidth, status.treesizable)
end end
treeframe:SetMaxResize(maxtreewidth, 1600) if treeframe.SetResizeBounds then
treeframe:SetResizeBounds(100, 1, maxtreewidth, 1600)
else
treeframe:SetMaxResize(maxtreewidth, 1600)
end
end, end,
["OnHeightSet"] = function(self, height) ["OnHeightSet"] = function(self, height)
@@ -619,13 +629,13 @@ local PaneBackdrop = {
local DraggerBackdrop = { local DraggerBackdrop = {
bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", bgFile = "Interface\\Tooltips\\UI-Tooltip-Background",
edgeFile = nil, edgeFile = nil,
tile = true, tileSize = 16, edgeSize = 0, tile = true, tileSize = 16, edgeSize = 1,
insets = { left = 3, right = 3, top = 7, bottom = 7 } insets = { left = 3, right = 3, top = 7, bottom = 7 }
} }
local function Constructor() local function Constructor()
local num = AceGUI:GetNextWidgetNum(Type) local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", string.format("%s%d", Type, num), UIParent)
local treeframe = CreateFrame("Frame", nil, frame) local treeframe = CreateFrame("Frame", nil, frame)
treeframe:SetPoint("TOPLEFT") treeframe:SetPoint("TOPLEFT")
@@ -636,8 +646,12 @@ local function Constructor()
treeframe:SetBackdropColor(0.1, 0.1, 0.1, 0.5) treeframe:SetBackdropColor(0.1, 0.1, 0.1, 0.5)
treeframe:SetBackdropBorderColor(0.4, 0.4, 0.4) treeframe:SetBackdropBorderColor(0.4, 0.4, 0.4)
treeframe:SetResizable(true) treeframe:SetResizable(true)
treeframe:SetMinResize(100, 1) if treeframe.SetResizeBounds then -- WoW 10.0
treeframe:SetMaxResize(400, 1600) treeframe:SetResizeBounds(100, 1, 400, 1600)
else
treeframe:SetMinResize(100, 1)
treeframe:SetMaxResize(400, 1600)
end
treeframe:SetScript("OnUpdate", FirstFrameUpdate) treeframe:SetScript("OnUpdate", FirstFrameUpdate)
treeframe:SetScript("OnSizeChanged", Tree_OnSizeChanged) treeframe:SetScript("OnSizeChanged", Tree_OnSizeChanged)
treeframe:SetScript("OnMouseWheel", Tree_OnMouseWheel) treeframe:SetScript("OnMouseWheel", Tree_OnMouseWheel)
@@ -667,7 +681,7 @@ local function Constructor()
scrollbg:SetAllPoints(scrollbar) scrollbg:SetAllPoints(scrollbar)
scrollbg:SetTexture(0,0,0,0.4) scrollbg:SetTexture(0,0,0,0.4)
local border = CreateFrame("Frame",nil,frame) local border = CreateFrame("Frame", nil, frame)
border:SetPoint("TOPLEFT", treeframe, "TOPRIGHT") border:SetPoint("TOPLEFT", treeframe, "TOPRIGHT")
border:SetPoint("BOTTOMRIGHT") border:SetPoint("BOTTOMRIGHT")
border:SetBackdrop(PaneBackdrop) border:SetBackdrop(PaneBackdrop)
@@ -7,10 +7,6 @@ local pairs, assert, type = pairs, assert, type
local PlaySound = PlaySound local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent 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 -- -- Main Frame --
---------------- ----------------
@@ -21,7 +17,7 @@ local CreateFrame, UIParent = CreateFrame, UIParent
]] ]]
do do
local Type = "Window" local Type = "Window"
local Version = 5 local Version = 9
local function frameOnShow(this) local function frameOnShow(this)
this.obj:Fire("OnShow") this.obj:Fire("OnShow")
@@ -155,7 +151,7 @@ do
end end
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame",nil,UIParent) local frame = CreateFrame("Frame", string.format("%s%d", Type, AceGUI:GetNextWidgetNum(Type)), UIParent)
local self = {} local self = {}
self.type = "Window" self.type = "Window"
@@ -186,7 +182,11 @@ do
frame:SetScript("OnShow",frameOnShow) frame:SetScript("OnShow",frameOnShow)
frame:SetScript("OnHide",frameOnClose) frame:SetScript("OnHide",frameOnClose)
frame:SetMinResize(240,240) if frame.SetResizeBounds then -- WoW 10.0
frame:SetResizeBounds(240,240)
else
frame:SetMinResize(240,240)
end
frame:SetToplevel(true) frame:SetToplevel(true)
local titlebg = frame:CreateTexture(nil, "BACKGROUND") local titlebg = frame:CreateTexture(nil, "BACKGROUND")
@@ -300,7 +300,7 @@ do
line2:SetHeight(8) line2:SetHeight(8)
line2:SetPoint("BOTTOMRIGHT", -8, 8) line2:SetPoint("BOTTOMRIGHT", -8, 8)
line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border") line2:SetTexture("Interface\\Tooltips\\UI-Tooltip-Border")
local x = 0.1 * 8/17 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) 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) local sizer_s = CreateFrame("Frame",nil,frame)
@@ -2,7 +2,7 @@
Button Widget Button Widget
Graphical Button. Graphical Button.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Button", 23 local Type, Version = "Button", 25
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -74,7 +74,7 @@ Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type) local name = "AceGUI30Button" .. AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate2") local frame = CreateFrame("Button", name, UIParent, "UIPanelButtonTemplate")
frame:Hide() frame:Hide()
frame:EnableMouse(true) frame:EnableMouse(true)
@@ -1,7 +1,7 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Checkbox Widget Checkbox Widget
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "CheckBox", 26 local Type, Version = "CheckBox", 27
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -12,10 +12,6 @@ local select, pairs = select, pairs
local PlaySound = PlaySound local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent 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 Support functions
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -199,14 +195,14 @@ local methods = {
["SetDescription"] = function(self, desc) ["SetDescription"] = function(self, desc)
if desc then if desc then
if not self.desc then if not self.desc then
local desc = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") local f = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
desc:ClearAllPoints() f:ClearAllPoints()
desc:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21) f:SetPoint("TOPLEFT", self.checkbg, "TOPRIGHT", 5, -21)
desc:SetWidth(self.frame.width - 30) f:SetWidth(self.frame.width - 30)
desc:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0) f:SetPoint("RIGHT", self.frame, "RIGHT", -30, 0)
desc:SetJustifyH("LEFT") f:SetJustifyH("LEFT")
desc:SetJustifyV("TOP") f:SetJustifyV("TOP")
self.desc = desc self.desc = f
end end
self.desc:Show() self.desc:Show()
--self.text:SetFontObject(GameFontNormal) --self.text:SetFontObject(GameFontNormal)
@@ -242,7 +238,7 @@ local methods = {
Constructor Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local frame = CreateFrame("Button", nil, UIParent) local frame = CreateFrame("Button", string.format("%s%d", Type, AceGUI:GetNextWidgetNum(Type)), UIParent)
frame:Hide() frame:Hide()
frame:EnableMouse(true) frame:EnableMouse(true)
@@ -1,7 +1,7 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
ColorPicker Widget ColorPicker Widget
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "ColorPicker", 25 local Type, Version = "ColorPicker", 29
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -11,17 +11,24 @@ local pairs = pairs
-- WoW APIs -- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent local CreateFrame, UIParent = CreateFrame, UIParent
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded -- Unfortunately we have no way to realistically detect if a client uses inverted alpha
-- List them here for Mikk's FindGlobals script -- as no API will tell you. Wrath uses the old colorpicker, era uses the new one, both are inverted
-- GLOBALS: ColorPickerFrame, OpacitySliderFrame local INVERTED_ALPHA = true
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Support functions Support functions
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function ColorCallback(self, r, g, b, a, isAlpha) local function ColorCallback(self, r, g, b, a, isAlpha)
if INVERTED_ALPHA and a then
a = 1 - a
end
if not self.HasAlpha then if not self.HasAlpha then
a = 1 a = 1
end 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) self:SetColor(r, g, b, a)
if ColorPickerFrame:IsVisible() then if ColorPickerFrame:IsVisible() then
--colorpicker is still open --colorpicker is still open
@@ -54,30 +61,63 @@ local function ColorSwatch_OnClick(frame)
ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10) ColorPickerFrame:SetFrameLevel(frame:GetFrameLevel() + 10)
ColorPickerFrame:SetClampedToScreen(true) ColorPickerFrame:SetClampedToScreen(true)
ColorPickerFrame.func = function() if ColorPickerFrame.SetupColorPickerAndShow then -- 10.2.5 color picker overhaul
local r, g, b = ColorPickerFrame:GetColorRGB() local r2, g2, b2, a2 = self.r, self.g, self.b, (self.a or 1)
local a = 1 - OpacitySliderFrame:GetValue() if INVERTED_ALPHA then
ColorCallback(self, r, g, b, a) a2 = 1 - a2
end end
ColorPickerFrame.hasOpacity = self.HasAlpha local info = {
ColorPickerFrame.opacityFunc = function() swatchFunc = function()
local r, g, b = ColorPickerFrame:GetColorRGB() local r, g, b = ColorPickerFrame:GetColorRGB()
local a = 1 - OpacitySliderFrame:GetValue() local a = ColorPickerFrame:GetColorAlpha()
ColorCallback(self, r, g, b, a, true) ColorCallback(self, r, g, b, a)
end end,
local r, g, b, a = self.r, self.g, self.b, self.a hasOpacity = self.HasAlpha,
if self.HasAlpha then opacityFunc = function()
ColorPickerFrame.opacity = 1 - (a or 0) local r, g, b = ColorPickerFrame:GetColorRGB()
end local a = ColorPickerFrame:GetColorAlpha()
ColorPickerFrame:SetColorRGB(r, g, b) ColorCallback(self, r, g, b, a, true)
end,
opacity = a2,
ColorPickerFrame.cancelFunc = function() cancelFunc = function()
ColorCallback(self, r, g, b, a, true) ColorCallback(self, r2, g2, b2, a2, true)
end end,
ColorPickerFrame:Show() 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()
end
end end
AceGUI:ClearFocus() AceGUI:ClearFocus()
end end
@@ -129,7 +169,7 @@ local methods = {
Constructor Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local frame = CreateFrame("Button", nil, UIParent) local frame = CreateFrame("Button", string.format("%s%d", Type, AceGUI:GetNextWidgetNum(Type)), UIParent)
frame:Hide() frame:Hide()
frame:EnableMouse(true) frame:EnableMouse(true)
@@ -1,4 +1,4 @@
--[[ $Id$ ]]-- --[[ $Id: AceGUIWidget-DropDown-Items.lua 1272 2022-08-29 15:56:35Z nevcairiel $ ]]--
local AceGUI = LibStub("AceGUI-3.0") local AceGUI = LibStub("AceGUI-3.0")
@@ -41,7 +41,7 @@ local ItemBase = {
-- NOTE: The ItemBase version is added to each item's version number -- NOTE: The ItemBase version is added to each item's version number
-- to ensure proper updates on ItemBase changes. -- to ensure proper updates on ItemBase changes.
-- Use at least 1000er steps. -- Use at least 1000er steps.
version = 1000, version = 2000,
counter = 0, counter = 0,
} }
@@ -178,7 +178,7 @@ function ItemBase.Create(type)
highlight:Hide() highlight:Hide()
self.highlight = highlight self.highlight = highlight
local check = frame:CreateTexture("OVERLAY") local check = frame:CreateTexture(nil, "OVERLAY")
check:SetWidth(16) check:SetWidth(16)
check:SetHeight(16) check:SetHeight(16)
check:SetPoint("LEFT",frame,"LEFT",3,-1) check:SetPoint("LEFT",frame,"LEFT",3,-1)
@@ -186,7 +186,7 @@ function ItemBase.Create(type)
check:Hide() check:Hide()
self.check = check self.check = check
local sub = frame:CreateTexture("OVERLAY") local sub = frame:CreateTexture(nil, "OVERLAY")
sub:SetWidth(16) sub:SetWidth(16)
sub:SetHeight(16) sub:SetHeight(16)
sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1) sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1)
@@ -246,7 +246,7 @@ end
-- Special: Different text color and no highlight -- Special: Different text color and no highlight
do do
local widgetType = "Dropdown-Item-Header" local widgetType = "Dropdown-Item-Header"
local widgetVersion = 1 local widgetVersion = 2
local function OnEnter(this) local function OnEnter(this)
local self = this.obj local self = this.obj
@@ -295,7 +295,7 @@ end
-- A simple button -- A simple button
do do
local widgetType = "Dropdown-Item-Execute" local widgetType = "Dropdown-Item-Execute"
local widgetVersion = 1 local widgetVersion = 2
local function Frame_OnClick(this, button) local function Frame_OnClick(this, button)
local self = this.obj local self = this.obj
@@ -323,7 +323,7 @@ end
-- Does not close the pullout on click. -- Does not close the pullout on click.
do do
local widgetType = "Dropdown-Item-Toggle" local widgetType = "Dropdown-Item-Toggle"
local widgetVersion = 3 local widgetVersion = 5
local function UpdateToggle(self) local function UpdateToggle(self)
if self.value then if self.value then
@@ -383,7 +383,7 @@ end
-- Does not close the pullout on click -- Does not close the pullout on click
do do
local widgetType = "Dropdown-Item-Menu" local widgetType = "Dropdown-Item-Menu"
local widgetVersion = 2 local widgetVersion = 3
local function OnEnter(this) local function OnEnter(this)
local self = this.obj local self = this.obj
@@ -440,7 +440,7 @@ end
-- A single line to separate items -- A single line to separate items
do do
local widgetType = "Dropdown-Item-Separator" local widgetType = "Dropdown-Item-Separator"
local widgetVersion = 1 local widgetVersion = 3
-- exported, override -- exported, override
local function SetDisabled(self, disabled) local function SetDisabled(self, disabled)
@@ -455,7 +455,7 @@ do
local line = self.frame:CreateTexture(nil, "OVERLAY") local line = self.frame:CreateTexture(nil, "OVERLAY")
line:SetHeight(1) line:SetHeight(1)
line:SetTexture(.5, .5, .5) line:SetTexture(0.5, 0.5, 0.5)
line:SetPoint("LEFT", self.frame, "LEFT", 10, 0) line:SetPoint("LEFT", self.frame, "LEFT", 10, 0)
line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0) line:SetPoint("RIGHT", self.frame, "RIGHT", -10, 0)
@@ -1,4 +1,4 @@
--[[ $Id: AceGUIWidget-DropDown.lua 1209 2019-06-24 21:01:01Z nevcairiel $ ]]-- --[[ $Id: AceGUIWidget-DropDown.lua 1284 2022-09-25 09:15:30Z nevcairiel $ ]]--
local AceGUI = LibStub("AceGUI-3.0") local AceGUI = LibStub("AceGUI-3.0")
-- Lua APIs -- Lua APIs
@@ -11,10 +11,6 @@ local PlaySound = PlaySound
local UIParent, CreateFrame = UIParent, CreateFrame local UIParent, CreateFrame = UIParent, CreateFrame
local _G = _G 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 function fixlevels(parent,...)
local i = 1 local i = 1
local child = select(i, ...) local child = select(i, ...)
@@ -39,7 +35,7 @@ end
do do
local widgetType = "Dropdown-Pullout" local widgetType = "Dropdown-Pullout"
local widgetVersion = 3 local widgetVersion = 6
--[[ Static data ]]-- --[[ Static data ]]--
@@ -193,12 +189,7 @@ do
local height = 8 local height = 8
for i, item in pairs(items) do for i, item in pairs(items) do
if i == 1 then item:SetPoint("TOP", itemFrame, "TOP", 0, -2 + (i - 1) * -16)
item:SetPoint("TOP", itemFrame, "TOP", 0, -2)
else
item:SetPoint("TOP", items[i-1].frame, "BOTTOM", 0, 1)
end
item:Show() item:Show()
height = height + 16 height = height + 16
@@ -356,7 +347,7 @@ end
do do
local widgetType = "Dropdown" local widgetType = "Dropdown"
local widgetVersion = 34 local widgetVersion = 37
--[[ Static data ]]-- --[[ Static data ]]--
@@ -381,7 +372,6 @@ do
local function Dropdown_TogglePullout(this) local function Dropdown_TogglePullout(this)
local self = this.obj local self = this.obj
PlaySound("igMainMenuOptionCheckBoxOn") -- missleading name, but the Blizzard code uses this sound
if self.open then if self.open then
self.open = nil self.open = nil
self.pullout:Close() self.pullout:Close()
@@ -465,6 +455,7 @@ do
self:SetWidth(200) self:SetWidth(200)
self:SetLabel() self:SetLabel()
self:SetPulloutWidth(nil) self:SetPulloutWidth(nil)
self.list = {}
end end
-- exported, AceGUI callback -- exported, AceGUI callback
@@ -535,9 +526,7 @@ do
-- exported -- exported
local function SetValue(self, value) local function SetValue(self, value)
if self.list then self:SetText(self.list[value] or "")
self:SetText(self.list[value] or "")
end
self.value = value self.value = value
end end
@@ -601,7 +590,7 @@ do
end end
end end
local function SetList(self, list, order, itemType) local function SetList(self, list, order, itemType)
self.list = list self.list = list or {}
self.pullout:Clear() self.pullout:Clear()
self.hasClose = nil self.hasClose = nil
if not list then return end if not list then return end
@@ -629,10 +618,8 @@ do
-- exported -- exported
local function AddItem(self, value, text, itemType) local function AddItem(self, value, text, itemType)
if self.list then self.list[value] = text
self.list[value] = text AddListItem(self, value, text, itemType)
AddListItem(self, value, text, itemType)
end
end end
-- exported -- exported
@@ -657,7 +644,7 @@ do
local function Constructor() local function Constructor()
local count = AceGUI:GetNextWidgetNum(widgetType) local count = AceGUI:GetNextWidgetNum(widgetType)
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", widgetType .. count, UIParent)
local dropdown = CreateFrame("Frame", "AceGUI30DropDown"..count, frame, "UIDropDownMenuTemplate") local dropdown = CreateFrame("Frame", "AceGUI30DropDown"..count, frame, "UIDropDownMenuTemplate")
local self = {} local self = {}
@@ -1,7 +1,7 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
EditBox Widget EditBox Widget
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "EditBox", 28 local Type, Version = "EditBox", 30
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -10,14 +10,11 @@ local tostring, pairs = tostring, pairs
-- WoW APIs -- WoW APIs
local PlaySound = PlaySound local PlaySound = PlaySound
local GetMacroInfo = GetMacroInfo
local GetCursorInfo, ClearCursor, GetSpellInfo = GetCursorInfo, ClearCursor, GetSpellInfo local GetCursorInfo, ClearCursor, GetSpellInfo = GetCursorInfo, ClearCursor, GetSpellInfo
local CreateFrame, UIParent = CreateFrame, UIParent local CreateFrame, UIParent = CreateFrame, UIParent
local _G = _G 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 Support functions
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -210,10 +207,10 @@ Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local num = AceGUI:GetNextWidgetNum(Type) local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", string.format("%s%d", Type, num), UIParent)
frame:Hide() frame:Hide()
local editbox = CreateFrame("EditBox", "AceGUI-3.0EditBox"..num, frame, "WA_InputBoxTemplate") local editbox = CreateFrame("EditBox", "AceGUI-3.0EditBox"..num, frame, "InputBoxTemplate")
editbox:SetAutoFocus(false) editbox:SetAutoFocus(false)
editbox:SetFontObject(ChatFontNormal) editbox:SetFontObject(ChatFontNormal)
editbox:SetScript("OnEnter", Control_OnEnter) editbox:SetScript("OnEnter", Control_OnEnter)
@@ -1,7 +1,7 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Heading Widget Heading Widget
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Heading", 20 local Type, Version = "Heading", 21
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -39,7 +39,7 @@ local methods = {
Constructor Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", string.format("%s%d", Type, AceGUI:GetNextWidgetNum(Type)), UIParent)
frame:Hide() frame:Hide()
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontNormal") local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontNormal")
@@ -1,7 +1,7 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
Icon Widget Icon Widget
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Icon", 21 local Type, Version = "Icon", 22
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -96,7 +96,7 @@ local methods = {
Constructor Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local frame = CreateFrame("Button", nil, UIParent) local frame = CreateFrame("Button", string.format("%s%d", Type, AceGUI:GetNextWidgetNum(Type)), UIParent)
frame:Hide() frame:Hide()
frame:EnableMouse(true) frame:EnableMouse(true)
@@ -132,7 +132,7 @@ local function Constructor()
widget[method] = func widget[method] = func
end end
widget.SetText = widget.SetLabel widget.SetText = widget.SetLabel -- deprecated soon!
return AceGUI:RegisterAsWidget(widget) return AceGUI:RegisterAsWidget(widget)
end end
@@ -1,7 +1,7 @@
--[[----------------------------------------------------------------------------- --[[-----------------------------------------------------------------------------
InteractiveLabel Widget InteractiveLabel Widget
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "InteractiveLabel", 21 local Type, Version = "InteractiveLabel", 22
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -2,7 +2,7 @@
Keybinding Widget Keybinding Widget
Set Keybindings in the Config UI. Set Keybindings in the Config UI.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Keybinding", 25 local Type, Version = "Keybinding", 27
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -13,10 +13,6 @@ local pairs = pairs
local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown
local CreateFrame, UIParent = CreateFrame, UIParent 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 Scripts
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -185,10 +181,9 @@ local function keybindingMsgFixWidth(frame)
end end
local function Constructor() local function Constructor()
local name = "AceGUI30KeybindingButton" .. AceGUI:GetNextWidgetNum(Type) local num = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", string.format("%s%d", Type, num), UIParent)
local frame = CreateFrame("Frame", nil, UIParent) local button = CreateFrame("Button", "AceGUI30KeybindingButton" .. num, frame, "UIPanelButtonTemplate")
local button = CreateFrame("Button", name, frame, "UIPanelButtonTemplate2")
button:EnableMouse(true) button:EnableMouse(true)
button:EnableMouseWheel(false) button:EnableMouseWheel(false)
@@ -2,7 +2,7 @@
Label Widget Label Widget
Displays text and optionally an icon. Displays text and optionally an icon.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Label", 26 local Type, Version = "Label", 29
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -12,10 +12,6 @@ local max, select, pairs = math.max, select, pairs
-- WoW APIs -- WoW APIs
local CreateFrame, UIParent = CreateFrame, UIParent 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 Support functions
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -129,11 +125,16 @@ local methods = {
end, end,
["SetFont"] = function(self, font, height, flags) ["SetFont"] = function(self, font, height, flags)
self.label:SetFont(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)
end, end,
["SetFontObject"] = function(self, font) ["SetFontObject"] = function(self, font)
self:SetFont((font or GameFontHighlightSmall):GetFont()) self.label:SetFontObject(font or GameFontHighlightSmall)
UpdateImageAnchor(self)
end, end,
["SetImageSize"] = function(self, width, height) ["SetImageSize"] = function(self, width, height)
@@ -155,7 +156,7 @@ local methods = {
Constructor Constructor
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", string.format("%s%d", Type, AceGUI:GetNextWidgetNum(Type)), UIParent)
frame:Hide() frame:Hide()
local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall") local label = frame:CreateFontString(nil, "BACKGROUND", "GameFontHighlightSmall")
@@ -1,4 +1,4 @@
local Type, Version = "MultiLineEditBox", 33 local Type, Version = "MultiLineEditBox", 34
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -273,11 +273,11 @@ local backdrop = {
} }
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent)
frame:Hide()
local widgetNum = AceGUI:GetNextWidgetNum(Type) local widgetNum = AceGUI:GetNextWidgetNum(Type)
local frame = CreateFrame("Frame", string.format("%s%d", Type, widgetNum), UIParent)
frame:Hide()
local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall") local label = frame:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
label:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -4) label:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, -4)
label:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, -4) label:SetPoint("TOPRIGHT", frame, "TOPRIGHT", 0, -4)
@@ -2,7 +2,7 @@
Slider Widget Slider Widget
Graphical Slider, like, for Range values. Graphical Slider, like, for Range values.
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
local Type, Version = "Slider", 20 local Type, Version = "Slider", 24
local AceGUI = LibStub and LibStub("AceGUI-3.0", true) local AceGUI = LibStub and LibStub("AceGUI-3.0", true)
if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end if not AceGUI or (AceGUI:GetWidgetVersion(Type) or 0) >= Version then return end
@@ -14,10 +14,6 @@ local tonumber, pairs = tonumber, pairs
local PlaySound = PlaySound local PlaySound = PlaySound
local CreateFrame, UIParent = CreateFrame, UIParent 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 Support functions
-------------------------------------------------------------------------------]] -------------------------------------------------------------------------------]]
@@ -31,13 +27,13 @@ local function UpdateText(self)
end end
local function UpdateLabels(self) local function UpdateLabels(self)
local min, max = (self.min or 0), (self.max or 100) local min_value, max_value = (self.min or 0), (self.max or 100)
if self.ispercent then if self.ispercent then
self.lowtext:SetFormattedText("%s%%", (min * 100)) self.lowtext:SetFormattedText("%s%%", (min_value * 100))
self.hightext:SetFormattedText("%s%%", (max * 100)) self.hightext:SetFormattedText("%s%%", (max_value * 100))
else else
self.lowtext:SetText(min) self.lowtext:SetText(min_value)
self.hightext:SetText(max) self.hightext:SetText(max_value)
end end
end end
@@ -60,6 +56,10 @@ end
local function Slider_OnValueChanged(frame, newvalue) local function Slider_OnValueChanged(frame, newvalue)
local self = frame.obj local self = frame.obj
if not frame.setup then 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 if newvalue ~= self.value and not self.disabled then
self.value = newvalue self.value = newvalue
self:Fire("OnValueChanged", newvalue) self:Fire("OnValueChanged", newvalue)
@@ -171,13 +171,13 @@ local methods = {
self.label:SetText(text) self.label:SetText(text)
end, end,
["SetSliderValues"] = function(self, min, max, step) ["SetSliderValues"] = function(self, min_value, max_value, step)
local frame = self.slider local frame = self.slider
frame.setup = true frame.setup = true
self.min = min self.min = min_value
self.max = max self.max = max_value
self.step = step self.step = step
frame:SetMinMaxValues(min or 0,max or 100) frame:SetMinMaxValues(min_value or 0,max_value or 100)
UpdateLabels(self) UpdateLabels(self)
frame:SetValueStep(step or 1) frame:SetValueStep(step or 1)
if self.value then if self.value then
@@ -210,7 +210,7 @@ local ManualBackdrop = {
} }
local function Constructor() local function Constructor()
local frame = CreateFrame("Frame", nil, UIParent) local frame = CreateFrame("Frame", string.format("%s%d", Type, AceGUI:GetNextWidgetNum(Type)), UIParent)
frame:EnableMouse(true) frame:EnableMouse(true)
frame:SetScript("OnMouseDown", Frame_OnMouseDown) frame:SetScript("OnMouseDown", Frame_OnMouseDown)
@@ -27,7 +27,6 @@ local function ConstructIconPicker(frame)
local scroll = AceGUI:Create("ScrollFrame"); local scroll = AceGUI:Create("ScrollFrame");
scroll:SetLayout("flow"); scroll:SetLayout("flow");
--scroll.frame:SetClipsChildren(true);
group:AddChild(scroll); group:AddChild(scroll);
local function iconPickerFill(subname, doSort) local function iconPickerFill(subname, doSort)
@@ -100,8 +99,12 @@ local function ConstructIconPicker(frame)
end end
end end
local input = CreateFrame("Editbox", "WeakAurasIconFilterInput", group.frame, "WA_InputBoxTemplate"); local input = CreateFrame("EditBox", "WeakAurasFilterInput", group.frame)
input:SetScript("OnTextChanged", function(...) iconPickerFill(input:GetText(), false); end); WeakAuras.XMLTemplates["SearchBoxTemplate"](input)
input:SetScript("OnTextChanged", function(self)
WA_SearchBoxTemplate_OnTextChanged(self)
iconPickerFill(input:GetText(), false)
end);
input:SetScript("OnEnterPressed", function(...) iconPickerFill(input:GetText(), true); end); input:SetScript("OnEnterPressed", function(...) iconPickerFill(input:GetText(), true); end);
input:SetScript("OnEscapePressed", function(...) input:SetText(""); iconPickerFill(input:GetText(), true); end); input:SetScript("OnEscapePressed", function(...) input:SetText(""); iconPickerFill(input:GetText(), true); end);
input:SetWidth(200); input:SetWidth(200);
+5 -60
View File
@@ -57,66 +57,11 @@ local function ConstructModelPicker(frame)
group.frame:Hide(); group.frame:Hide();
group:SetLayout("flow"); group:SetLayout("flow");
local filterInput = CreateFrame("EditBox", "WeakAurasModelFilterInput", group.frame, "WA_InputBoxTemplate") local filterInput = CreateFrame("EditBox", "WeakAurasFilterInput", nil)
filterInput:SetAutoFocus(false) WeakAuras.XMLTemplates["SearchBoxTemplate"](filterInput)
filterInput:SetTextInsets(16, 20, 0, 0) filterInput:SetParent(group.frame)
filterInput:SetScript("OnTextChanged", function(self)
filterInput.Instructions = filterInput:CreateFontString(nil, "ARTWORK", "GameFontDisableSmall") WA_SearchBoxTemplate_OnTextChanged(self)
filterInput.Instructions:SetText(SEARCH)
filterInput.Instructions:SetPoint("TOPLEFT", filterInput, "TOPLEFT", 16, 0)
filterInput.Instructions:SetPoint("BOTTOMRIGHT", filterInput, "BOTTOMRIGHT", -20, 0)
filterInput.Instructions:SetTextColor(0.35, 0.35, 0.35)
filterInput.Instructions:SetJustifyH("LEFT")
filterInput.Instructions:SetJustifyV("MIDDLE")
filterInput.searchIcon = filterInput:CreateTexture(nil, "OVERLAY")
filterInput.searchIcon:SetTexture("Interface\\Common\\UI-Searchbox-Icon")
filterInput.searchIcon:SetVertexColor(0.6, 0.6, 0.6)
filterInput.searchIcon:SetSize(14, 14)
filterInput.searchIcon:SetPoint("LEFT", 0, -2)
filterInput.clearButton = CreateFrame("Button", nil, filterInput)
filterInput.clearButton:SetSize(14, 14)
filterInput.clearButton:SetPoint("RIGHT", -3, 0)
filterInput.clearButton.texture = filterInput.clearButton:CreateTexture()
filterInput.clearButton.texture:SetTexture("Interface\\FriendsFrame\\ClearBroadcastIcon")
filterInput.clearButton.texture:SetAlpha(0.5)
filterInput.clearButton.texture:SetSize(17, 17)
filterInput.clearButton.texture:SetPoint("CENTER", 0, 0)
filterInput.clearButton:SetScript("OnEnter", function(self) self.texture:SetAlpha(1.0) end)
filterInput.clearButton:SetScript("OnLeave", function(self) self.texture:SetAlpha(0.5) end)
filterInput.clearButton:SetScript("OnMouseDown", function(self) if self:IsEnabled() then self.texture:SetPoint("CENTER", 1, -1) end end)
filterInput.clearButton:SetScript("OnMouseUp", function(self) self.texture:SetPoint("CENTER") end)
filterInput.clearButton:SetScript("OnClick", function(self)
local editBox = self:GetParent()
editBox:SetText("")
editBox:ClearFocus()
end)
filterInput:SetScript("OnEditFocusLost", function(self)
if self:GetText() == "" then
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6)
self.clearButton:Hide()
end
end)
filterInput:SetScript("OnEditFocusGained", function(self)
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0)
self.clearButton:Show()
end)
filterInput:HookScript("OnTextChanged", function(self)
if not self:HasFocus() and self:GetText() == "" then
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6)
self.clearButton:Hide()
else
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0)
self.clearButton:Show()
end
if self:GetText() == "" then
self.Instructions:Show()
else
self.Instructions:Hide()
end
local filterText = filterInput:GetText() local filterText = filterInput:GetText()
RecurseSetFilter(group.modelTree.tree, filterText) RecurseSetFilter(group.modelTree.tree, filterText)
group.modelTree.filter = filterText ~= nil and filterText ~= "" group.modelTree.filter = filterText ~= nil and filterText ~= ""
+13 -65
View File
@@ -96,7 +96,8 @@ function OptionsPrivate.CreateFrame()
local db = OptionsPrivate.savedVars.db local db = OptionsPrivate.savedVars.db
local odb = OptionsPrivate.savedVars.odb local odb = OptionsPrivate.savedVars.odb
frame = CreateFrame("Frame", "WeakAurasOptions", UIParent, "WA_PortraitFrameTemplate") frame = CreateFrame("Frame", "WeakAurasOptions", UIParent)
WeakAuras.XMLTemplates["PortraitFrameTemplate"](frame)
function OptionsPrivate.SetTitle(title) function OptionsPrivate.SetTitle(title)
local text = "WeakAuras " .. WeakAuras.versionString local text = "WeakAuras " .. WeakAuras.versionString
@@ -312,7 +313,8 @@ function OptionsPrivate.CreateFrame()
end end
end end
local minimizebutton = CreateFrame("Button", nil, frame, "WA_MaximizeMinimizeButtonFrameTemplate") local minimizebutton = CreateFrame("Button", nil, frame)
WeakAuras.XMLTemplates["MaximizeMinimizeButtonFrameTemplate"](minimizebutton)
minimizebutton:SetPoint("RIGHT", frame.CloseButton, "LEFT", 0, 0) minimizebutton:SetPoint("RIGHT", frame.CloseButton, "LEFT", 0, 0)
minimizebutton:SetOnMaximizedCallback(function() minimizebutton:SetOnMaximizedCallback(function()
frame.minimized = false frame.minimized = false
@@ -386,7 +388,8 @@ function OptionsPrivate.CreateFrame()
tipPopupLabelK:SetJustifyH("LEFT") tipPopupLabelK:SetJustifyH("LEFT")
tipPopupLabelK:SetJustifyV("TOP") tipPopupLabelK:SetJustifyV("TOP")
local urlWidget = CreateFrame("EditBox", nil, tipPopup, "WA_InputBoxTemplate") local urlWidget = CreateFrame("EditBox", nil, tipPopup)
WeakAuras.XMLTemplates["InputBoxTemplate"](urlWidget)
urlWidget:SetFont(STANDARD_TEXT_FONT, 12) urlWidget:SetFont(STANDARD_TEXT_FONT, 12)
urlWidget:SetPoint("TOPLEFT", tipPopupLabelK, "BOTTOMLEFT", 6, 0) urlWidget:SetPoint("TOPLEFT", tipPopupLabelK, "BOTTOMLEFT", 6, 0)
urlWidget:SetPoint("TOPRIGHT", tipPopupLabelK, "BOTTOMRIGHT", 0, 0) urlWidget:SetPoint("TOPRIGHT", tipPopupLabelK, "BOTTOMRIGHT", 0, 0)
@@ -570,66 +573,10 @@ function OptionsPrivate.CreateFrame()
frame.moversizer, frame.mover = OptionsPrivate.MoverSizer(frame) frame.moversizer, frame.mover = OptionsPrivate.MoverSizer(frame)
-- filter line -- filter line
local filterInput = CreateFrame("EditBox", "WeakAurasFilterInput", frame, "WA_InputBoxTemplate") local filterInput = CreateFrame("EditBox", "WeakAurasFilterInput", frame)
filterInput:SetAutoFocus(false) WeakAuras.XMLTemplates["SearchBoxTemplate"](filterInput)
filterInput:SetTextInsets(16, 20, 0, 0) filterInput:SetScript("OnTextChanged", function(self)
WA_SearchBoxTemplate_OnTextChanged(self)
filterInput.Instructions = filterInput:CreateFontString(nil, "ARTWORK", "GameFontDisableSmall")
filterInput.Instructions:SetText(SEARCH)
filterInput.Instructions:SetPoint("TOPLEFT", filterInput, "TOPLEFT", 16, 0)
filterInput.Instructions:SetPoint("BOTTOMRIGHT", filterInput, "BOTTOMRIGHT", -20, 0)
filterInput.Instructions:SetTextColor(0.35, 0.35, 0.35)
filterInput.Instructions:SetJustifyH("LEFT")
filterInput.Instructions:SetJustifyV("MIDDLE")
filterInput.searchIcon = filterInput:CreateTexture(nil, "OVERLAY")
filterInput.searchIcon:SetTexture("Interface\\Common\\UI-Searchbox-Icon")
filterInput.searchIcon:SetVertexColor(0.6, 0.6, 0.6)
filterInput.searchIcon:SetSize(14, 14)
filterInput.searchIcon:SetPoint("LEFT", 0, -2)
filterInput.clearButton = CreateFrame("Button", nil, filterInput)
filterInput.clearButton:SetSize(14, 14)
filterInput.clearButton:SetPoint("RIGHT", -3, 0)
filterInput.clearButton.texture = filterInput.clearButton:CreateTexture()
filterInput.clearButton.texture:SetTexture("Interface\\FriendsFrame\\ClearBroadcastIcon")
filterInput.clearButton.texture:SetAlpha(0.5)
filterInput.clearButton.texture:SetSize(17, 17)
filterInput.clearButton.texture:SetPoint("CENTER", 0, 0)
filterInput.clearButton:SetScript("OnEnter", function(self) self.texture:SetAlpha(1.0) end)
filterInput.clearButton:SetScript("OnLeave", function(self) self.texture:SetAlpha(0.5) end)
filterInput.clearButton:SetScript("OnMouseDown", function(self) if self:IsEnabled() then self.texture:SetPoint("CENTER", 1, -1) end end)
filterInput.clearButton:SetScript("OnMouseUp", function(self) self.texture:SetPoint("CENTER") end)
filterInput.clearButton:SetScript("OnClick", function(self)
local editBox = self:GetParent()
editBox:SetText("")
editBox:ClearFocus()
end)
filterInput:SetScript("OnEditFocusLost", function(self)
if self:GetText() == "" then
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6)
self.clearButton:Hide()
end
end)
filterInput:SetScript("OnEditFocusGained", function(self)
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0)
self.clearButton:Show()
end)
filterInput:HookScript("OnTextChanged", function(self)
if not self:HasFocus() and self:GetText() == "" then
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6)
self.clearButton:Hide()
else
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0)
self.clearButton:Show()
end
if self:GetText() == "" then
self.Instructions:Show()
else
self.Instructions:Hide()
end
OptionsPrivate.SortDisplayButtons(filterInput:GetText()) OptionsPrivate.SortDisplayButtons(filterInput:GetText())
end) end)
filterInput:SetHeight(15) filterInput:SetHeight(15)
@@ -1032,7 +979,8 @@ function OptionsPrivate.CreateFrame()
sidegroup.frame:Show() sidegroup.frame:Show()
sidegroup:SetLayout("flow") sidegroup:SetLayout("flow")
local dynamicTextCodesFrame = CreateFrame("Frame", "WeakAurasTextReplacements", sidegroup.frame, "WA_PortraitFrameTemplate") local dynamicTextCodesFrame = CreateFrame("Frame", "WeakAurasTextReplacements", sidegroup.frame)
WeakAuras.XMLTemplates["PortraitFrameTemplate"](dynamicTextCodesFrame)
dynamicTextCodesFrame:HidePortrait() dynamicTextCodesFrame:HidePortrait()
dynamicTextCodesFrame:SetPoint("TOPLEFT", sidegroup.frame, "TOPRIGHT", 20, 0) dynamicTextCodesFrame:SetPoint("TOPLEFT", sidegroup.frame, "TOPRIGHT", 20, 0)
dynamicTextCodesFrame:SetPoint("BOTTOMLEFT", sidegroup.frame, "BOTTOMRIGHT", 20, 0) dynamicTextCodesFrame:SetPoint("BOTTOMLEFT", sidegroup.frame, "BOTTOMRIGHT", 20, 0)
@@ -1408,7 +1356,7 @@ function OptionsPrivate.CreateFrame()
containerScroll:SetLayout("flow") containerScroll:SetLayout("flow")
border:AddChild(containerScroll) border:AddChild(containerScroll)
local _, _, _, enabled = GetAddOnInfo("WeakAurasTemplates") local enabled = select(4, GetAddOnInfo("WeakAurasTemplates"))
if enabled then if enabled then
local simpleLabel = AceGUI:Create("Label") local simpleLabel = AceGUI:Create("Label")
simpleLabel:SetFont(STANDARD_TEXT_FONT, 24, "OUTLINE") simpleLabel:SetFont(STANDARD_TEXT_FONT, 24, "OUTLINE")
+10 -64
View File
@@ -420,7 +420,8 @@ local function ConstructTextEditor(frame)
local apiSearchFrame local apiSearchFrame
-- Make sidebar for snippets -- Make sidebar for snippets
local snippetsFrame = CreateFrame("Frame", "WeakAurasSnippets", group.frame, "WA_PortraitFrameTemplate") local snippetsFrame = CreateFrame("Frame", "WeakAurasSnippets", group.frame)
WeakAuras.XMLTemplates["PortraitFrameTemplate"](snippetsFrame)
snippetsFrame:HidePortrait() snippetsFrame:HidePortrait()
snippetsFrame:SetPoint("TOPLEFT", group.frame, "TOPRIGHT", 20, 0) snippetsFrame:SetPoint("TOPLEFT", group.frame, "TOPRIGHT", 20, 0)
snippetsFrame:SetPoint("BOTTOMLEFT", group.frame, "BOTTOMRIGHT", 20, 0) snippetsFrame:SetPoint("BOTTOMLEFT", group.frame, "BOTTOMRIGHT", 20, 0)
@@ -505,7 +506,8 @@ local function ConstructTextEditor(frame)
apiSearchButton:RegisterForClicks("LeftButtonUp") apiSearchButton:RegisterForClicks("LeftButtonUp")
-- Make sidebar for apiSearch -- Make sidebar for apiSearch
apiSearchFrame = CreateFrame("Frame", "WeakAurasAPISearchFrame", group.frame, "WA_PortraitFrameTemplate") apiSearchFrame = CreateFrame("Frame", "WeakAurasAPISearchFrame", group.frame)
WeakAuras.XMLTemplates["PortraitFrameTemplate"](apiSearchFrame)
apiSearchFrame:HidePortrait() apiSearchFrame:HidePortrait()
apiSearchFrame:SetWidth(350) apiSearchFrame:SetWidth(350)
@@ -514,54 +516,11 @@ local function ConstructTextEditor(frame)
local APISearchCTimer local APISearchCTimer
-- filter line -- filter line
local filterInput = CreateFrame("EditBox", "WeakAurasAPISearchFilterInput", apiSearchFrame, "WA_InputBoxTemplate") local filterInput = CreateFrame("EditBox", "WeakAurasAPISearchFilterInput", apiSearchFrame)
filterInput:SetAutoFocus(false) WeakAuras.XMLTemplates["SearchBoxTemplate"](filterInput)
filterInput:SetTextInsets(16, 20, 0, 0) filterInput:SetFrameLevel(5)
filterInput.Instructions = filterInput:CreateFontString(nil, "ARTWORK", "GameFontDisableSmall")
filterInput.Instructions:SetText(SEARCH)
filterInput.Instructions:SetPoint("TOPLEFT", filterInput, "TOPLEFT", 16, 0)
filterInput.Instructions:SetPoint("BOTTOMRIGHT", filterInput, "BOTTOMRIGHT", -20, 0)
filterInput.Instructions:SetTextColor(0.35, 0.35, 0.35)
filterInput.Instructions:SetJustifyH("LEFT")
filterInput.Instructions:SetJustifyV("MIDDLE")
filterInput.searchIcon = filterInput:CreateTexture(nil, "OVERLAY")
filterInput.searchIcon:SetTexture("Interface\\Common\\UI-Searchbox-Icon")
filterInput.searchIcon:SetVertexColor(0.6, 0.6, 0.6)
filterInput.searchIcon:SetSize(14, 14)
filterInput.searchIcon:SetPoint("LEFT", 0, -2)
filterInput.clearButton = CreateFrame("Button", nil, filterInput)
filterInput.clearButton:SetSize(14, 14)
filterInput.clearButton:SetPoint("RIGHT", -3, 0)
filterInput.clearButton.texture = filterInput.clearButton:CreateTexture()
filterInput.clearButton.texture:SetTexture("Interface\\FriendsFrame\\ClearBroadcastIcon")
filterInput.clearButton.texture:SetAlpha(0.5)
filterInput.clearButton.texture:SetSize(17, 17)
filterInput.clearButton.texture:SetPoint("CENTER", 0, 0)
filterInput.clearButton:SetScript("OnEnter", function(self) self.texture:SetAlpha(1.0) end)
filterInput.clearButton:SetScript("OnLeave", function(self) self.texture:SetAlpha(0.5) end)
filterInput.clearButton:SetScript("OnMouseDown", function(self) if self:IsEnabled() then self.texture:SetPoint("CENTER", 1, -1) end end)
filterInput.clearButton:SetScript("OnMouseUp", function(self) self.texture:SetPoint("CENTER") end)
filterInput.clearButton:SetScript("OnClick", function(self)
local editBox = self:GetParent()
editBox:SetText("")
editBox:ClearFocus()
end)
filterInput:SetScript("OnEditFocusLost", function(self)
if self:GetText() == "" then
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6)
self.clearButton:Hide()
end
end)
filterInput:SetScript("OnEditFocusGained", function(self)
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0)
self.clearButton:Show()
end)
filterInput:SetScript("OnTextChanged", function(self) filterInput:SetScript("OnTextChanged", function(self)
WA_SearchBoxTemplate_OnTextChanged(self)
if APISearchCTimer and WeakAuras.timer:TimeLeft(APISearchCTimer) then if APISearchCTimer and WeakAuras.timer:TimeLeft(APISearchCTimer) then
WeakAuras.timer:CancelTimer(APISearchCTimer) WeakAuras.timer:CancelTimer(APISearchCTimer)
end end
@@ -572,20 +531,6 @@ local function ConstructTextEditor(frame)
APISearchTextChangeDelay APISearchTextChangeDelay
) )
end) end)
filterInput:HookScript("OnTextChanged", function(self)
if not self:HasFocus() and self:GetText() == "" then
self.searchIcon:SetVertexColor(0.6, 0.6, 0.6)
self.clearButton:Hide()
else
self.searchIcon:SetVertexColor(1.0, 1.0, 1.0)
self.clearButton:Show()
end
if self:GetText() == "" then
self.Instructions:Show()
else
self.Instructions:Hide()
end
end)
filterInput:SetHeight(15) filterInput:SetHeight(15)
filterInput:SetPoint("TOPLEFT", apiSearchFrame, "TOPLEFT", 17, -30) filterInput:SetPoint("TOPLEFT", apiSearchFrame, "TOPLEFT", 17, -30)
filterInput:SetPoint("TOPRIGHT", apiSearchFrame, "TOPRIGHT", -10, -30) filterInput:SetPoint("TOPRIGHT", apiSearchFrame, "TOPRIGHT", -10, -30)
@@ -890,7 +835,8 @@ local function ConstructTextEditor(frame)
editorError:SetPoint("RIGHT", settings_frame, "LEFT") editorError:SetPoint("RIGHT", settings_frame, "LEFT")
group.editorError = editorError group.editorError = editorError
local editorLine = CreateFrame("EditBox", nil, group.frame, "WA_InputBoxTemplate") local editorLine = CreateFrame("EditBox", nil, group.frame)
WeakAuras.XMLTemplates["InputBoxTemplate"](editorLine)
-- Set script on enter pressed.. -- Set script on enter pressed..
editorLine:SetPoint("RIGHT", snippetsButton, "LEFT", -10, 0) editorLine:SetPoint("RIGHT", snippetsButton, "LEFT", -10, 0)
editorLine:SetFont(STANDARD_TEXT_FONT, 10) editorLine:SetFont(STANDARD_TEXT_FONT, 10)