/trunk/sStats
## Interface: 30200 |
## Interface: 30300 |
## Title: sStats |
## Author: Seerah |
## Version: 1.0 beta 3 |
## Version: 1.0 beta 4 |
## Notes: memory, latency, fps, and durability display |
## SavedVariables: sStatsDB |
## SavedVariablesPerCharacter: sStatsPCDB |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local tostring = tostring |
-- WoW APIs |
local GetCursorInfo, ClearCursor, GetSpellName = GetCursorInfo, ClearCursor, GetSpellName |
local CreateFrame, UIParent = CreateFrame, UIParent |
local _G = _G |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: AceGUIEditBoxInsertLink, ChatFontNormal, OKAY |
local Type = "EditBox" |
local Version = 13 |
if not AceGUIEditBoxInsertLink then |
-- upgradeable hook |
hooksecurefunc("ChatEdit_InsertLink", function(...) return _G.AceGUIEditBoxInsertLink(...) end) |
end |
function _G.AceGUIEditBoxInsertLink(text) |
for i = 1, AceGUI:GetNextWidgetNum(Type)-1 do |
local editbox = _G["AceGUI-3.0EditBox"..i] |
if editbox and editbox:IsVisible() and editbox:HasFocus() then |
editbox:Insert(text) |
return true |
end |
end |
end |
-------------------------- |
-- Edit box -- |
-------------------------- |
]] |
do |
local Type = "EditBox" |
local Version = 11 |
local function OnAcquire(self) |
self:SetHeight(26) |
self:SetWidth(200) |
self.frame:ClearAllPoints() |
self.frame:Hide() |
self:SetDisabled(false) |
self:SetText() |
end |
local function Control_OnEnter(this) |
local function EditBox_OnTextChanged(this) |
local self = this.obj |
local value = this:GetText() |
if value ~= self.lasttext then |
if tostring(value) ~= tostring(self.lasttext) then |
self:Fire("OnTextChanged",value) |
self.lasttext = value |
ShowButton(self) |
local AceGUI = LibStub("AceGUI-3.0") |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
-------------------------- |
-- Heading -- |
-------------------------- |
local AceGUI = LibStub("AceGUI-3.0") |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
------------- |
-- Widgets -- |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local pairs, assert, type = pairs, assert, type |
local min, max, floor = math.min, math.max, math.floor |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
------------- |
-- Widgets -- |
------------- |
-------------------------- |
do |
local Type = "ScrollFrame" |
local Version = 4 |
local Version = 9 |
local function OnAcquire(self) |
self.frame:ClearAllPoints() |
self.frame:Hide() |
self.status = nil |
-- do SetScroll after niling status, but before clearing localstatus |
-- so the scroll value isnt populated back into status, but not kept in localstatus either |
self:SetScroll(0) |
for k in pairs(self.localstatus) do |
self.localstatus[k] = nil |
end |
self.scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",0,0) |
self.scrollbar:Hide() |
self.scrollBarShown = nil |
self.content.height, self.content.width = nil, nil |
end |
local function SetScroll(self, value) |
local status = self.status or self.localstatus |
local viewheight = self.scrollframe:GetHeight() |
local height = self.content:GetHeight() |
local offset |
local frame, child = self.scrollframe, self.content |
local viewheight = frame:GetHeight() |
local height = child:GetHeight() |
local offset |
if viewheight > height then |
offset = 0 |
else |
offset = floor((height - viewheight) / 1000.0 * value) |
end |
child:ClearAllPoints() |
child:SetPoint("TOPLEFT",frame,"TOPLEFT",0,offset) |
child:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,offset) |
self.content:ClearAllPoints() |
self.content:SetPoint("TOPLEFT", self.scrollframe, "TOPLEFT", 0, offset) |
self.content:SetPoint("TOPRIGHT", self.scrollframe, "TOPRIGHT", 0, offset) |
status.offset = offset |
status.scrollvalue = value |
end |
local function MoveScroll(self, value) |
local status = self.status or self.localstatus |
local frame, child = self.scrollframe, self.content |
local height, viewheight = frame:GetHeight(), child:GetHeight() |
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight() |
if height > viewheight then |
self.scrollbar:Hide() |
else |
if value < 0 then |
delta = -1 |
end |
self.scrollbar:SetValue(math.min(math.max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000)) |
self.scrollbar:SetValue(min(max(status.scrollvalue + delta*(1000/(diff/45)),0), 1000)) |
end |
end |
local function FixScroll(self) |
if self.updateLock then return end |
self.updateLock = true |
local status = self.status or self.localstatus |
local frame, child = self.scrollframe, self.content |
local height, viewheight = frame:GetHeight(), child:GetHeight() |
local offset = status.offset |
if not offset then |
offset = 0 |
end |
local height, viewheight = self.scrollframe:GetHeight(), self.content:GetHeight() |
local offset = status.offset or 0 |
local curvalue = self.scrollbar:GetValue() |
if viewheight < height then |
self.scrollbar:Hide() |
self.scrollbar:SetValue(0) |
--self.scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",0,0) |
if self.scrollBarShown then |
self.scrollBarShown = nil |
self.scrollbar:Hide() |
self.scrollbar:SetValue(0) |
self.scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",0,0) |
self:DoLayout() |
end |
else |
self.scrollbar:Show() |
--self.scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",-16,0) |
if not self.scrollBarShown then |
self.scrollBarShown = true |
self.scrollbar:Show() |
self.scrollframe:SetPoint("BOTTOMRIGHT", self.frame,"BOTTOMRIGHT",-20,0) |
self:DoLayout() |
end |
local value = (offset / (viewheight - height) * 1000) |
if value > 1000 then value = 1000 end |
self.scrollbar:SetValue(value) |
self:SetScroll(value) |
if value < 1000 then |
child:ClearAllPoints() |
child:SetPoint("TOPLEFT",frame,"TOPLEFT",0,offset) |
child:SetPoint("TOPRIGHT",frame,"TOPRIGHT",0,offset) |
self.content:ClearAllPoints() |
self.content:SetPoint("TOPLEFT", self.scrollframe, "TOPLEFT", 0, offset) |
self.content:SetPoint("TOPRIGHT", self.scrollframe, "TOPRIGHT", 0, offset) |
status.offset = offset |
end |
end |
self.updateLock = nil |
end |
local function OnMouseWheel(this,value) |
local function OnMouseWheel(this, value) |
this.obj:MoveScroll(value) |
end |
this:SetScript("OnUpdate", nil) |
this.obj:FixScroll() |
end |
local function OnSizeChanged(this) |
--this:SetScript("OnUpdate", FixScrollOnUpdate) |
this.obj:FixScroll() |
this:SetScript("OnUpdate", FixScrollOnUpdate) |
end |
local function LayoutFinished(self,width,height) |
local function LayoutFinished(self, width, height) |
self.content:SetHeight(height or 0 + 20) |
self:FixScroll() |
self.scrollframe:SetScript("OnUpdate", FixScrollOnUpdate) |
end |
-- called to set an external table to store status in |
end |
end |
local createdcount = 0 |
local function OnWidthSet(self, width) |
local content = self.content |
content.width = width |
end |
local function Constructor() |
local frame = CreateFrame("Frame",nil,UIParent) |
local frame = CreateFrame("Frame", nil, UIParent) |
local self = {} |
self.type = Type |
self.OnWidthSet = OnWidthSet |
self.OnHeightSet = OnHeightSet |
self.localstatus = {} |
self.localstatus = {} |
self.frame = frame |
frame.obj = self |
--Container Support |
local scrollframe = CreateFrame("ScrollFrame",nil,frame) |
local content = CreateFrame("Frame",nil,scrollframe) |
createdcount = createdcount + 1 |
local scrollbar = CreateFrame("Slider",("AceConfigDialogScrollFrame%dScrollBar"):format(createdcount),scrollframe,"UIPanelScrollBarTemplate") |
local scrollbg = scrollbar:CreateTexture(nil,"BACKGROUND") |
scrollbg:SetAllPoints(scrollbar) |
scrollbg:SetTexture(0,0,0,0.4) |
self.scrollframe = scrollframe |
self.content = content |
self.scrollbar = scrollbar |
scrollbar.obj = self |
local scrollframe = CreateFrame("ScrollFrame", nil, frame) |
scrollframe.obj = self |
content.obj = self |
scrollframe:SetScrollChild(content) |
scrollframe:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) |
scrollframe:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",-20,0) |
scrollframe:SetPoint("TOPLEFT", frame, "TOPLEFT", 0, 0) |
scrollframe:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", 0, 0) |
scrollframe:EnableMouseWheel(true) |
scrollframe:SetScript("OnMouseWheel", OnMouseWheel) |
scrollframe:SetScript("OnSizeChanged", OnSizeChanged) |
self.scrollframe = scrollframe |
content:SetPoint("TOPLEFT",scrollframe,"TOPLEFT",0,0) |
content:SetPoint("TOPRIGHT",scrollframe,"TOPRIGHT",0,0) |
local content = CreateFrame("Frame", nil, scrollframe) |
content.obj = self |
content:SetPoint("TOPLEFT", scrollframe, "TOPLEFT", 0, 0) |
content:SetPoint("TOPRIGHT", scrollframe, "TOPRIGHT", 0, 0) |
content:SetHeight(400) |
self.content = content |
scrollframe:SetScrollChild(content) |
scrollbar:SetPoint("TOPLEFT",scrollframe,"TOPRIGHT",4,-16) |
scrollbar:SetPoint("BOTTOMLEFT",scrollframe,"BOTTOMRIGHT",4,16) |
local num = AceGUI:GetNextWidgetNum(Type) |
local name = ("AceConfigDialogScrollFrame%dScrollBar"):format(num) |
local scrollbar = CreateFrame("Slider", name, scrollframe, "UIPanelScrollBarTemplate") |
scrollbar.obj = self |
scrollbar:SetPoint("TOPLEFT", scrollframe, "TOPRIGHT", 4, -16) |
scrollbar:SetPoint("BOTTOMLEFT", scrollframe, "BOTTOMRIGHT", 4, 16) |
scrollbar:SetScript("OnValueChanged", OnScrollValueChanged) |
scrollbar:SetMinMaxValues(0,1000) |
scrollbar:SetMinMaxValues(0, 1000) |
scrollbar:SetValueStep(1) |
scrollbar:SetValue(0) |
scrollbar:SetWidth(16) |
scrollbar:Hide() |
self.scrollbar = scrollbar |
local scrollbg = scrollbar:CreateTexture(nil, "BACKGROUND") |
scrollbg:SetAllPoints(scrollbar) |
scrollbg:SetTexture(0, 0, 0, 0.4) |
self.localstatus.scrollvalue = 0 |
self:FixScroll() |
--self:FixScroll() |
AceGUI:RegisterAsContainer(self) |
--AceGUI:RegisterAsWidget(self) |
return self |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local assert, pairs, type = assert, pairs, type |
-- WoW APIs |
local CreateFrame = CreateFrame |
--[[ |
Selection Group controls all have an interface to select a group for thier contents |
None of them will auto size to thier contents, and should usually be used with a scrollframe |
]] |
do |
local Type = "DropdownGroup" |
local Version = 11 |
local Version = 13 |
local function OnAcquire(self) |
self.dropdown:SetText("") |
self:SetDropdownWidth(200) |
self:SetTitle("") |
end |
local function OnRelease(self) |
local function SetTitle(self,title) |
self.titletext:SetText(title) |
self.dropdown.frame:ClearAllPoints() |
if title and title ~= "" then |
self.dropdown.frame:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", -2, 0) |
else |
self.dropdown.frame:SetPoint("TOPLEFT", self.frame, "TOPLEFT", -1, 0) |
end |
end |
self.frame = frame |
frame.obj = self |
frame:SetHeight(100) |
frame:SetWidth(100) |
frame:SetFrameStrata("FULLSCREEN_DIALOG") |
local titletext = frame:CreateFontString(nil,"OVERLAY","GameFontNormal") |
titletext:SetPoint("TOPLEFT",frame,"TOPLEFT",4,0) |
titletext:SetPoint("TOPRIGHT",frame,"TOPRIGHT",-4,0) |
local titletext = frame:CreateFontString(nil, "OVERLAY", "GameFontNormal") |
titletext:SetPoint("TOPLEFT", frame, "TOPLEFT", 4, -5) |
titletext:SetPoint("TOPRIGHT", frame, "TOPRIGHT", -4, -5) |
titletext:SetJustifyH("LEFT") |
titletext:SetHeight(18) |
self.titletext = titletext |
local dropdown = AceGUI:Create("Dropdown") |
self.dropdown = dropdown |
dropdown.frame:SetParent(frame) |
dropdown.frame:SetFrameLevel(dropdown.frame:GetFrameLevel() + 2) |
dropdown.parentgroup = self |
dropdown:SetCallback("OnValueChanged",SelectedGroup) |
dropdown.frame:SetPoint("TOPLEFT",titletext,"BOTTOMLEFT",-3,3) |
dropdown.frame:SetPoint("TOPLEFT",frame,"TOPLEFT", -1, 0) |
dropdown.frame:Show() |
dropdown:SetLabel("") |
local border = CreateFrame("Frame",nil,frame) |
self.border = border |
border:SetPoint("TOPLEFT",frame,"TOPLEFT",3,-40) |
border:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-3,3) |
border:SetPoint("TOPLEFT",frame,"TOPLEFT",0,-26) |
border:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",0,3) |
border:SetBackdrop(PaneBackdrop) |
border:SetBackdropColor(0.1,0.1,0.1,0.5) |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 808 2009-05-07 14:45:15Z ammo $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown-Items.lua 877 2009-11-02 15:56:50Z nevcairiel $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local select, assert = select, assert |
-- WoW APIs |
local CreateFrame = CreateFrame |
local function fixlevels(parent,...) |
local i = 1 |
local child = select(i, ...) |
local AceGUI = LibStub("AceGUI-3.0") |
-- WoW APIs |
local _G = _G |
local CreateFrame, UIParent = CreateFrame, UIParent |
-------------------------- |
-- Button -- |
-------------------------- |
do |
local Type = "Button" |
local Version = 11 |
local Version = 12 |
local function OnAcquire(self) |
-- restore default values |
self:SetDisabled(false) |
end |
local function Button_OnClick(this) |
this.obj:Fire("OnClick") |
local function Button_OnClick(this, ...) |
this.obj:Fire("OnClick", ...) |
AceGUI:ClearFocus() |
end |
end |
AceGUI:RegisterWidgetType(Type,Constructor,Version) |
end |
local AceGUI = LibStub("AceGUI-3.0") |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: ShowUIPanel, HideUIPanel, ColorPickerFrame, OpacitySliderFrame |
-------------------------- |
-- ColorPicker -- |
-------------------------- |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local next, pairs, ipairs, assert, type = next, pairs, ipairs, assert, type |
local math_min, math_max, floor = math.min, math.max, floor |
local select, tremove, unpack = select, table.remove, unpack |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: GameTooltip, FONT_COLOR_CODE_CLOSE |
-- Recycling functions |
local new, del |
do |
do |
local Type = "TreeGroup" |
local Version = 20 |
local Version = 23 |
local DEFAULT_TREE_WIDTH = 175 |
local DEFAULT_TREE_SIZABLE = true |
local frame = self.frame |
local text = treeline.text or "" |
local icon = treeline.icon |
local iconCoords = treeline.iconCoords |
local level = treeline.level |
local value = treeline.value |
local uniquevalue = treeline.uniquevalue |
button.icon:SetTexture(nil) |
end |
if iconCoords then |
button.icon:SetTexCoord(unpack(iconCoords)) |
else |
button.icon:SetTexCoord(0, 1, 0, 1) |
end |
if canExpand then |
if not isExpanded then |
toggle:SetNormalTexture("Interface\\Buttons\\UI-PlusButton-UP") |
line.value = v.value |
line.text = v.text |
line.icon = v.icon |
line.iconCoords = v.iconCoords |
line.disabled = v.disabled |
line.tree = tree |
line.level = level |
local numlines = #lines |
local maxlines = (math.floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18)) |
local maxlines = (floor(((self.treeframe:GetHeight()or 0) - 20 ) / 18)) |
local first, last |
--Selects a tree node by UniqueValue |
local function SelectByValue(self, uniquevalue) |
self:Select(uniquevalue,string.split("\001", uniquevalue)) |
self:Select(uniquevalue, ("\001"):split(uniquevalue)) |
end |
local content = self.content |
local treeframe = self.treeframe |
local status = self.status or self.localstatus |
status.fullwidth = width |
local contentwidth = width - status.treewidth - 20 |
if contentwidth < 0 then |
content:SetWidth(contentwidth) |
content.width = contentwidth |
local maxtreewidth = math.min(400, width - 50) |
local maxtreewidth = math_min(400, width - 50) |
if maxtreewidth > 100 and status.treewidth > maxtreewidth then |
self:SetTreeWidth(maxtreewidth, status.treesizable) |
local scrollbar = self.scrollbar |
local min, max = scrollbar:GetMinMaxValues() |
local value = scrollbar:GetValue() |
local newvalue = math.min(max,math.max(min,value - delta)) |
local newvalue = math_min(max,math_max(min,value - delta)) |
if value ~= newvalue then |
scrollbar:SetValue(newvalue) |
end |
local status = self.status or self.localstatus |
status.treewidth = treewidth |
status.treesizable = resizable |
-- recalculate the content width |
if status.fullwidth then |
self:OnWidthSet(status.fullwidth) |
end |
end |
local function draggerLeave(this) |
treeframe:SetHeight(0) |
treeframe:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) |
treeframe:SetPoint("BOTTOMLEFT",frame,"BOTTOMLEFT",0,0) |
treeframe.obj:Fire("OnTreeResize",treeframe:GetWidth()) |
local status = self.status or self.localstatus |
status.treewidth = treeframe:GetWidth() |
treeframe.obj:Fire("OnTreeResize",treeframe:GetWidth()) |
-- recalculate the content width |
treeframe.obj:OnWidthSet(status.fullwidth) |
-- update the layout of the content |
treeframe.obj:DoLayout() |
end |
local function LayoutFinished(self, width, height) |
self.SelectByValue = SelectByValue |
self.SelectByPath = SelectByPath |
self.OnWidthSet = OnWidthSet |
self.OnHeightSet = OnHeightSet |
self.OnHeightSet = OnHeightSet |
self.EnableButtonTooltips = EnableButtonTooltips |
self.Filter = Filter |
--self.Filter = Filter |
self.LayoutFinished = LayoutFinished |
self.frame = frame |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local select, max = select, math.max |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: GameFontHighlightSmall |
-------------------------- |
-- Label -- |
-------------------------- |
do |
local Type = "InteractiveLabel" |
local Version = 5 |
local Version = 6 |
local function OnAcquire(self) |
self:SetHeight(18) |
height = image:GetHeight() + label:GetHeight() |
else |
--image on the left |
image:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) |
label:SetPoint("TOPLEFT",image,"TOPRIGHT",0,0) |
local imageheight = image:GetHeight() |
local labelheight = label:GetHeight() |
--center image with label |
if imageheight > labelheight then |
image:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) |
label:SetPoint("LEFT",image,"RIGHT",0,0) |
else |
label:SetPoint("TOPLEFT",frame,"TOPLEFT",imagewidth,0) |
image:SetPoint("RIGHT",label,"LEFT",0,0) |
end |
label:SetWidth(width - imagewidth) |
height = math.max(image:GetHeight(), label:GetHeight()) |
height = max(imageheight, labelheight) |
end |
else |
--no image shown |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local max, select = math.max, select |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: GameFontHighlightSmall |
-------------------------- |
-- Label -- |
-------------------------- |
do |
local Type = "Label" |
local Version = 10 |
local Version = 11 |
local function OnAcquire(self) |
self:SetHeight(18) |
else |
--image on the left |
image:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) |
label:SetPoint("TOPLEFT",image,"TOPRIGHT",0,0) |
label:SetPoint("TOPLEFT",image,"TOPRIGHT",4,0) |
label:SetWidth(width - imagewidth) |
height = math.max(image:GetHeight(), label:GetHeight()) |
height = max(image:GetHeight(), label:GetHeight()) |
end |
else |
--no image shown |
--Multiline Editbox Widget, Originally by bam |
--]] |
local assert, error, ipairs, next, pairs, select, tonumber, tostring, type, unpack, pcall, xpcall = |
assert, error, ipairs, next, pairs, select, tonumber, tostring, type, unpack, pcall, xpcall |
local getmetatable, setmetatable, rawequal, rawget, rawset, getfenv, setfenv, loadstring, debugstack = |
getmetatable, setmetatable, rawequal, rawget, rawset, getfenv, setfenv, loadstring, debugstack |
local math, string, table = math, string, table |
local find, format, gmatch, gsub, tolower, match, toupper, join, split, trim = |
string.find, string.format, string.gmatch, string.gsub, string.lower, string.match, string.upper, string.join, string.split, string.trim |
local concat, insert, maxn, remove, sort = table.concat, table.insert, table.maxn, table.remove, table.sort |
local max, min, abs, ceil, floor = math.max, math.min, math.abs, math.ceil, math.floor |
local AceGUI = LibStub("AceGUI-3.0") |
local LibStub = assert(LibStub) |
-- Lua APIs |
local format, pairs, tostring = string.format, pairs, tostring |
local ChatFontNormal = ChatFontNormal |
local ClearCursor = ClearCursor |
local CreateFrame = CreateFrame |
local GetCursorInfo = GetCursorInfo |
local GetSpellName = GetSpellName |
local UIParent = UIParent |
local UISpecialFrames = UISpecialFrames |
-- WoW APIs |
local GetCursorInfo, ClearCursor, GetSpellName = GetCursorInfo, ClearCursor, GetSpellName |
local CreateFrame, UIParent = CreateFrame, UIParent |
-- No global variables after this! |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: ChatFontNormal, ACCEPT |
local _G = getfenv() |
local AceGUI = LibStub("AceGUI-3.0") |
local Version = 10 |
local Version = 11 |
--------------------- |
-- Common Elements -- |
--------------------- |
self.editbox:ClearFocus() |
self.editbox:SetTextColor(0.5, 0.5, 0.5) |
self.label:SetTextColor(0.5,0.5,0.5) |
self.button:Disable() |
else |
self.editbox:EnableMouse(true) |
self.scrollframe:EnableMouse(true) |
self.editbox:SetTextColor(1, 1, 1) |
self.label:SetTextColor(1,.82,0) |
self.button:Enable() |
end |
end |
if value ~= self.lasttext then |
self:Fire("OnTextChanged", value) |
self.lasttext = value |
self.button:Enable() |
if not self.disabled then |
self.button:Enable() |
end |
end |
end) |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local min, max, floor = math.min, math.max, math.floor |
local tonumber = tonumber |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: GameFontHighlightSmall |
-------------------------- |
-- Slider -- |
-------------------------- |
do |
local Type = "Slider" |
local Version = 7 |
local Version = 9 |
local function OnAcquire(self) |
self:SetWidth(200) |
local function UpdateText(self) |
local value = self.value or 0 |
if self.ispercent then |
self.editbox:SetText(("%s%%"):format(math.floor(value*1000+0.5)/10)) |
self.editbox:SetText(("%s%%"):format(floor(value*1000+0.5)/10)) |
else |
self.editbox:SetText(math.floor(value*100+0.5)/100) |
self.editbox:SetText(floor(value*100+0.5)/100) |
end |
end |
if not self.disabled then |
local value = self.value |
if v > 0 then |
value = math.min(value + (self.step or 1),self.max) |
value = min(value + (self.step or 1),self.max) |
else |
value = math.max(value - (self.step or 1), self.min) |
value = max(value - (self.step or 1), self.min) |
end |
self.slider:SetValue(value) |
end |
frame:SetMinMaxValues(min or 0,max or 100) |
UpdateLabels(self) |
frame:SetValueStep(step or 1) |
if self.value then |
frame:SetValue(self.value) |
end |
frame.setup = nil |
end |
end |
end |
local function EditBox_OnEnter(this) |
this:SetBackdropBorderColor(0.5,0.5,0.5,1) |
end |
local function EditBox_OnLeave(this) |
this:SetBackdropBorderColor(0.3,0.3,0.3,0.8) |
end |
local function SetIsPercent(self, value) |
self.ispercent = value |
UpdateLabels(self) |
insets = { left = 3, right = 3, top = 6, bottom = 6 } |
} |
local ManualBackdrop = { |
bgFile = "Interface\\ChatFrame\\ChatFrameBackground", |
edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", |
tile = true, edgeSize = 1, tileSize = 5, |
} |
local function Constructor() |
local frame = CreateFrame("Frame",nil,UIParent) |
local self = {} |
editbox:EnableMouse(true) |
editbox:SetScript("OnEscapePressed",EditBox_OnEscapePressed) |
editbox:SetScript("OnEnterPressed",EditBox_OnEnterPressed) |
editbox:SetScript("OnEnter",EditBox_OnEnter) |
editbox:SetScript("OnLeave",EditBox_OnLeave) |
editbox:SetBackdrop(ManualBackdrop) |
editbox:SetBackdropColor(0,0,0,0.5) |
editbox:SetBackdropBorderColor(0.3,0.3,0.30,0.80) |
self.editbox = editbox |
editbox.obj = self |
local bg = editbox:CreateTexture(nil,"BACKGROUND") |
editbox.bg = bg |
bg:SetTexture("Interface\\ChatFrame\\ChatFrameBackground") |
bg:SetVertexColor(0,0,0,0.25) |
bg:SetAllPoints(editbox) |
slider:SetThumbTexture("Interface\\Buttons\\UI-SliderBar-Button-Horizontal") |
frame:SetWidth(200) |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local pairs, ipairs, assert, type = pairs, ipairs, assert, type |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
local _G = _G |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: PanelTemplates_TabResize, PanelTemplates_SetDisabledTabState, PanelTemplates_SelectTab, PanelTemplates_DeselectTab |
------------- |
-- Widgets -- |
------------- |
do |
local Type = "TabGroup" |
local Version = 20 |
local Version = 24 |
local PaneBackdrop = { |
bgFile = "Interface\\ChatFrame\\ChatFrameBackground", |
for _, tab in pairs(self.tabs) do |
tab:Hide() |
end |
self:SetTitle() |
end |
local function Tab_SetText(self, text) |
local function SetTitle(self, text) |
self.titletext:SetText(text or "") |
if text and text ~= "" then |
self.alignoffset = 25 |
else |
self.alignoffset = 18 |
end |
self:BuildTabs() |
end |
-- called to set an external table to store status in |
local rowwidths = {} |
local rowends = {} |
local function BuildTabs(self) |
local hastitle = (self.titletext:GetText() and self.titletext:GetText() ~= "") |
local status = self.status or self.localstatus |
local tablist = self.tablist |
local tabs = self.tabs |
local tab = tabs[tabno] |
tab:ClearAllPoints() |
if first then |
tab:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 0, -7-(row-1)*20 ) |
tab:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 0, -(hastitle and 14 or 7)-(row-1)*20 ) |
first = false |
else |
tab:SetPoint("LEFT", tabs[tabno-1], "RIGHT", -10, 0) |
starttab = endtab + 1 |
end |
self.borderoffset = 10+((numrows)*20) |
self.border:SetPoint("TOPLEFT",self.frame,"TOPLEFT",3,-self.borderoffset) |
self.borderoffset = (hastitle and 17 or 10)+((numrows)*20) |
self.border:SetPoint("TOPLEFT",self.frame,"TOPLEFT",1,-self.borderoffset) |
end |
local function BuildTabsOnUpdate(this) |
frame:SetWidth(100) |
frame:SetFrameStrata("FULLSCREEN_DIALOG") |
self.alignoffset = 18 |
local titletext = frame:CreateFontString(nil,"OVERLAY","GameFontNormal") |
titletext:SetPoint("TOPLEFT",frame,"TOPLEFT",14,0) |
titletext:SetPoint("TOPRIGHT",frame,"TOPRIGHT",-14,0) |
titletext:SetJustifyH("LEFT") |
titletext:SetHeight(18) |
titletext:SetText("") |
self.titletext = titletext |
local border = CreateFrame("Frame",nil,frame) |
self.border = border |
self.borderoffset = 27 |
border:SetPoint("TOPLEFT",frame,"TOPLEFT",3,-27) |
border:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-3,3) |
border:SetPoint("TOPLEFT",frame,"TOPLEFT",1,-27) |
border:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-1,3) |
border:SetBackdrop(PaneBackdrop) |
border:SetBackdropColor(0.1,0.1,0.1,0.5) |
local content = CreateFrame("Frame",nil,border) |
self.content = content |
content.obj = self |
content:SetPoint("TOPLEFT",border,"TOPLEFT",10,-10) |
content:SetPoint("BOTTOMRIGHT",border,"BOTTOMRIGHT",-10,10) |
content:SetPoint("TOPLEFT",border,"TOPLEFT",10,-7) |
content:SetPoint("BOTTOMRIGHT",border,"BOTTOMRIGHT",-10,7) |
AceGUI:RegisterAsContainer(self) |
return self |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
-- WoW APIs |
local IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown = IsShiftKeyDown, IsControlKeyDown, IsAltKeyDown |
local CreateFrame, UIParent = CreateFrame, UIParent |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: NOT_BOUND |
-------------------------- |
-- Keybinding -- |
-------------------------- |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local select = select |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: SetDesaturation, GameFontHighlight |
-------------------------- |
-- Check Box -- |
-------------------------- |
]] |
do |
local Type = "CheckBox" |
local Version = 7 |
local Version = 13 |
local function OnAcquire(self) |
self:SetValue(false) |
self.tristate = nil |
self:SetHeight(24) |
self:SetWidth(200) |
self:SetImage() |
end |
local function OnRelease(self) |
self.checked = nil |
self:SetType() |
self:SetDisabled(false) |
self:SetDescription(nil) |
end |
local function CheckBox_OnEnter(this) |
self.checked = value |
if value then |
SetDesaturation(self.check, false) |
check:SetWidth(24) |
check:SetHeight(24) |
self.check:Show() |
else |
--Nil is the unknown tristate value |
if self.tristate and value == nil then |
SetDesaturation(self.check, true) |
check:SetWidth(24) |
check:SetHeight(24) |
self.check:Show() |
else |
SetDesaturation(self.check, false) |
check:SetWidth(24) |
check:SetHeight(24) |
self.check:Hide() |
end |
end |
local highlight = self.highlight |
if type == "radio" then |
checkbg:SetHeight(16) |
checkbg:SetWidth(16) |
checkbg:SetTexture("Interface\\Buttons\\UI-RadioButton") |
checkbg:SetTexCoord(0,0.25,0,1) |
check:SetHeight(16) |
check:SetWidth(16) |
check:SetTexture("Interface\\Buttons\\UI-RadioButton") |
check:SetTexCoord(0.5,0.75,0,1) |
check:SetTexCoord(0.25,0.5,0,1) |
check:SetBlendMode("ADD") |
highlight:SetTexture("Interface\\Buttons\\UI-RadioButton") |
highlight:SetTexCoord(0.5,0.75,0,1) |
else |
checkbg:SetHeight(24) |
checkbg:SetWidth(24) |
checkbg:SetTexture("Interface\\Buttons\\UI-CheckBox-Up") |
checkbg:SetTexCoord(0,1,0,1) |
check:SetHeight(24) |
check:SetWidth(24) |
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") |
check:SetTexCoord(0,1,0,1) |
check:SetBlendMode("BLEND") |
self.text:SetText(label) |
end |
local function SetDescription(self, desc) |
if desc then |
if not self.desc then |
local desc = self.frame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall") |
desc:ClearAllPoints() |
desc:SetPoint("TOPLEFT", self.check, "TOPRIGHT", 5, -21) |
desc:SetWidth(self.frame.width - 30) |
desc:SetJustifyH("LEFT") |
desc:SetJustifyV("TOP") |
self.desc = desc |
end |
self.desc:Show() |
--self.text:SetFontObject(GameFontNormal) |
self.desc:SetText(desc) |
self:SetHeight(28 + self.desc:GetHeight()) |
else |
if self.desc then |
self.desc:SetText("") |
self.desc:Hide() |
end |
self.text:SetFontObject(GameFontHighlight) |
self:SetHeight(24) |
end |
end |
local function SetImage(self, path, ...) |
local image = self.image |
image:SetTexture(path) |
if image:GetTexture() then |
local n = select('#', ...) |
if n == 4 or n == 8 then |
image:SetTexCoord(...) |
else |
image:SetTexCoord(0, 1, 0, 1) |
end |
end |
self:AlignImage() |
end |
local function AlignImage(self) |
local img = self.image:GetTexture() |
self.text:ClearAllPoints() |
if not img then |
self.text:SetPoint("LEFT", self.check, "RIGHT", 0, 0) |
self.text:SetPoint("RIGHT", self.frame, "RIGHT", 0, 0) |
else |
self.text:SetPoint("LEFT", self.image,"RIGHT", 1, 0) |
self.text:SetPoint("RIGHT", self.frame,"RIGHT", 0, 0) |
end |
end |
local function OnWidthSet(self, width) |
if self.desc and self.desc:GetText() ~= "" then |
self.desc:SetWidth(width - 30) |
self:SetHeight(28 + self.desc:GetHeight()) |
end |
end |
local function Constructor() |
local frame = CreateFrame("Button",nil,UIParent) |
local self = {} |
self.ToggleChecked = ToggleChecked |
self.SetLabel = SetLabel |
self.SetTriState = SetTriState |
self.SetDescription = SetDescription |
self.OnWidthSet = OnWidthSet |
self.SetImage = SetImage |
self.AlignImage = AlignImage |
self.frame = frame |
frame.obj = self |
self.checkbg = checkbg |
checkbg:SetWidth(24) |
checkbg:SetHeight(24) |
checkbg:SetPoint("LEFT",frame,"LEFT",0,0) |
checkbg:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) |
checkbg:SetTexture("Interface\\Buttons\\UI-CheckBox-Up") |
local check = frame:CreateTexture(nil,"OVERLAY") |
self.check = check |
check:SetPoint("CENTER",checkbg,"CENTER",0,0) |
check:SetTexture("Interface\\Buttons\\UI-CheckBox-Check") |
local highlight = frame:CreateTexture(nil, "BACKGROUND") |
local highlight = frame:CreateTexture(nil, "OVERLAY") |
self.highlight = highlight |
highlight:SetTexture("Interface\\Buttons\\UI-CheckBox-Highlight") |
highlight:SetBlendMode("ADD") |
highlight:SetAllPoints(checkbg) |
highlight:Hide() |
local image = frame:CreateTexture(nil, "OVERLAY") |
self.image = image |
image:SetHeight(16) |
image:SetWidth(16) |
image:SetPoint("LEFT", check, "RIGHT", 1, 0) |
text:SetJustifyH("LEFT") |
frame:SetHeight(24) |
frame:SetWidth(200) |
text:SetHeight(18) |
text:SetPoint("LEFT",check,"RIGHT",0,0) |
text:SetPoint("RIGHT",frame,"RIGHT",0,0) |
AceGUI:RegisterAsWidget(self) |
return self |
end |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local select = select |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
-------------------------- |
-- Label -- |
-------------------------- |
do |
local Type = "Icon" |
local Version = 10 |
local Version = 11 |
local function OnAcquire(self) |
self:SetHeight(110) |
local n = select('#', ...) |
if n == 4 or n == 8 then |
image:SetTexCoord(...) |
else |
image:SetTexCoord(0, 1, 0, 1) |
end |
else |
self.imageshown = nil |
Group Designed to be added to the bliz interface options panel |
]] |
-- WoW APIs |
local CreateFrame = CreateFrame |
do |
local Type = "BlizOptionsGroup" |
local Version = 6 |
local Version = 10 |
local function OnAcquire(self) |
local content = self.content |
content:ClearAllPoints() |
if not title or title == "" then |
content:SetPoint("TOPLEFT",self.frame,"TOPLEFT",15,-10) |
content:SetPoint("TOPLEFT",self.frame,"TOPLEFT",10,-10) |
self.label:SetText("") |
else |
content:SetPoint("TOPLEFT",self.frame,"TOPLEFT",15,-40) |
content:SetPoint("TOPLEFT",self.frame,"TOPLEFT",10,-40) |
self.label:SetText(title) |
end |
content:SetPoint("BOTTOMRIGHT",self.frame,"BOTTOMRIGHT",-10,10) |
local label = frame:CreateFontString(nil,"OVERLAY","GameFontNormalLarge") |
self.label = label |
label:SetPoint("TOPLEFT", frame, "TOPLEFT", 15, -15) |
label:SetPoint("TOPLEFT", frame, "TOPLEFT", 10, -15) |
label:SetPoint("BOTTOMRIGHT", frame, "TOPRIGHT", 10, -45) |
label:SetJustifyH("LEFT") |
label:SetJustifyV("TOP") |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local pairs, assert, type = pairs, assert, type |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: CLOSE |
---------------- |
-- Main Frame -- |
---------------- |
local AceGUI = LibStub("AceGUI-3.0") |
-- WoW APIs |
local CreateFrame, UIParent = CreateFrame, UIParent |
------------- |
-- Widgets -- |
do |
local Type = "InlineGroup" |
local Version = 5 |
local Version = 6 |
local function OnAcquire(self) |
self:SetWidth(300) |
local border = CreateFrame("Frame",nil,frame) |
self.border = border |
border:SetPoint("TOPLEFT",frame,"TOPLEFT",3,-17) |
border:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-3,3) |
border:SetPoint("TOPLEFT",frame,"TOPLEFT",0,-17) |
border:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-1,3) |
border:SetBackdrop(PaneBackdrop) |
border:SetBackdropColor(0.1,0.1,0.1,0.5) |
--[[ $Id: AceGUIWidget-DropDown.lua 815 2009-07-08 20:58:17Z nevcairiel $ ]]-- |
--[[ $Id: AceGUIWidget-DropDown.lua 877 2009-11-02 15:56:50Z nevcairiel $ ]]-- |
local AceGUI = LibStub("AceGUI-3.0") |
-- Lua APIs |
local min, max, floor = math.min, math.max, math.floor |
local select, pairs, ipairs = select, pairs, ipairs |
local tsort = table.sort |
local AceGUI = LibStub("AceGUI-3.0") |
-- WoW APIs |
local UIParent, CreateFrame = UIParent, CreateFrame |
local _G = _G |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: CLOSE |
local function fixlevels(parent,...) |
local i = 1 |
local child = select(i, ...) |
do |
local widgetType = "Dropdown-Pullout" |
local widgetVersion = 2 |
local widgetVersion = 3 |
--[[ Static data ]]-- |
local backdrop = { |
bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background", |
bgFile = "Interface\\ChatFrame\\ChatFrameBackground", |
edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border", |
edgeSize = 32, |
tileSize = 32, |
do |
local widgetType = "Dropdown" |
local widgetVersion = 20 |
local widgetVersion = 21 |
--[[ Static data ]]-- |
end |
-- exported |
local function GetValue(self) |
return self.value |
end |
-- exported |
local function SetItemValue(self, item, value) |
if not self.multiselect then return end |
for i, widget in self.pullout:IterateItems() do |
for v in pairs(list) do |
sortlist[#sortlist + 1] = v |
end |
table.sort(sortlist) |
tsort(sortlist) |
for i, value in pairs(sortlist) do |
AddListItem(self, value, list[value]) |
self.SetText = SetText |
self.SetValue = SetValue |
self.GetValue = GetValue |
self.SetList = SetList |
self.SetLabel = SetLabel |
self.SetDisabled = SetDisabled |
<Script file="widgets\AceGUIWidget-DropDown-Items.lua"/> |
<Script file="widgets\AceGUIWidget-EditBox.lua"/> |
<Script file="widgets\AceGUIWidget-Frame.lua"/> |
<Script file="widgets\AceGUIWidget-Window.lua"/> |
<Script file="widgets\AceGUIWidget-Heading.lua"/> |
<Script file="widgets\AceGUIWidget-InlineGroup.lua"/> |
<Script file="widgets\AceGUIWidget-Keybinding.lua"/> |
-- f:AddChild(btn) |
-- @class file |
-- @name AceGUI-3.0 |
-- @release $Id: AceGUI-3.0.lua 815 2009-07-08 20:58:17Z nevcairiel $ |
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 25 |
-- @release $Id: AceGUI-3.0.lua 896 2009-12-06 16:29:49Z nevcairiel $ |
local ACEGUI_MAJOR, ACEGUI_MINOR = "AceGUI-3.0", 30 |
local AceGUI, oldminor = LibStub:NewLibrary(ACEGUI_MAJOR, ACEGUI_MINOR) |
if not AceGUI then return end -- No upgrade needed |
-- Lua APIs |
local tconcat, tremove, tinsert = table.concat, table.remove, table.insert |
local select, pairs, next, type = select, pairs, next, type |
local error, assert, loadstring = error, assert, loadstring |
local setmetatable, rawget, rawset = setmetatable, rawget, rawset |
local math_max = math.max |
-- WoW APIs |
local UIParent = UIParent |
-- Global vars/functions that we don't upvalue since they might get hooked, or upgraded |
-- List them here for Mikk's FindGlobals script |
-- GLOBALS: geterrorhandler, LibStub |
--local con = LibStub("AceConsole-3.0",true) |
AceGUI.WidgetRegistry = AceGUI.WidgetRegistry or {} |
local LayoutRegistry = AceGUI.LayoutRegistry |
local WidgetVersions = AceGUI.WidgetVersions |
local pcall = pcall |
local select = select |
local pairs = pairs |
local ipairs = ipairs |
local type = type |
local assert = assert |
local tinsert = tinsert |
local tremove = tremove |
local CreateFrame = CreateFrame |
local UIParent = UIParent |
--[[ |
xpcall safecall implementation |
]] |
local ARGS = {} |
for i = 1, argCount do ARGS[i] = "arg"..i end |
code = code:gsub("ARGS", table.concat(ARGS, ", ")) |
code = code:gsub("ARGS", tconcat(ARGS, ", ")) |
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler) |
end |
end |
-- Recycling functions |
local new, del |
local newWidget, delWidget |
do |
-- Version Upgrade in Minor 29 |
-- Internal Storage of the objects changed, from an array table |
-- to a hash table, and additionally we introduced versioning on |
-- the widgets which would discard all widgets from a pre-29 version |
-- anyway, so we just clear the storage now, and don't try to |
-- convert the storage tables to the new format. |
-- This should generally not cause *many* widgets to end up in trash, |
-- since once dialogs are opened, all addons should be loaded already |
-- and AceGUI should be on the latest version available on the users |
-- setup. |
-- -- nevcairiel - Nov 2nd, 2009 |
if oldminor and oldminor < 29 and AceGUI.objPools then |
AceGUI.objPools = nil |
end |
AceGUI.objPools = AceGUI.objPools or {} |
local objPools = AceGUI.objPools |
--Returns a new instance, if none are available either returns a new table or calls the given contructor |
function new(type,constructor,...) |
if not type then |
type = "table" |
function newWidget(type) |
if not WidgetRegistry[type] then |
error("Attempt to instantiate unknown widget type", 2) |
end |
if not objPools[type] then |
objPools[type] = {} |
end |
local newObj = tremove(objPools[type]) |
local newObj = next(objPools[type]) |
if not newObj then |
newObj = constructor and constructor(...) or {} |
newObj = WidgetRegistry[type]() |
newObj.AceGUIWidgetVersion = WidgetVersions[type] |
else |
objPools[type][newObj] = nil |
-- if the widget is older then the latest, don't even try to reuse it |
-- just forget about it, and grab a new one. |
if not newObj.AceGUIWidgetVersion or newObj.AceGUIWidgetVersion < WidgetVersions[type] then |
return newWidget(type) |
end |
end |
return newObj |
end |
-- Releases an instance to the Pool |
function del(obj,type) |
if not type then |
type = "table" |
end |
function delWidget(obj,type) |
if not objPools[type] then |
objPools[type] = {} |
end |
for i,v in ipairs(objPools[type]) do |
if v == obj then |
error("Attempt to Release Widget that is already released") |
return |
end |
if objPools[type][obj] then |
error("Attempt to Release Widget that is already released", 2) |
end |
tinsert(objPools[type],obj) |
objPools[type][obj] = true |
end |
end |
-- @param type The type of the widget. |
-- @return The newly created widget. |
function AceGUI:Create(type) |
local reg = WidgetRegistry |
if reg[type] then |
local widget = new(type,reg[type]) |
if WidgetRegistry[type] then |
local widget = newWidget(type) |
if rawget(widget,'Acquire') then |
widget.OnAcquire = widget.Acquire |
widget.content.width = nil |
widget.content.height = nil |
end |
del(widget,widget.type) |
delWidget(widget, widget.type) |
end |
----------- |
:OnHeightSet(height) - Called when the height of the widget is changed |
Widgets should not use the OnSizeChanged events of thier frame or content members, use these methods instead |
AceGUI already sets a handler to the event |
:OnLayoutFinished(width, height) - called after a layout has finished, the width and height will be the width and height of the |
:LayoutFinished(width, height) - called after a layout has finished, the width and height will be the width and height of the |
area used for controls. These can be nil if the layout used the existing size to layout the controls. |
]] |
local height = 0 |
local width = content.width or content:GetWidth() or 0 |
for i, child in ipairs(children) do |
for i = 1, #children do |
local child = children[i] |
local frame = child.frame |
frame:ClearAllPoints() |
frame:Show() |
local frameoffset |
local lastframeoffset |
local oversize |
for i, child in ipairs(children) do |
for i = 1, #children do |
local child = children[i] |
oversize = nil |
local frame = child.frame |
local frameheight = frame.height or frame:GetHeight() or 0 |
local framewidth = frame.width or frame:GetWidth() or 0 |
lastframeoffset = frameoffset |
-- HACK: Why did we set a frameoffset of (frameheight / 2) ? |
-- That was moving all widgets half the widgets size down, is that intended? |
-- Actually, it seems to be neccessary for many cases, we'll leave it in for now. |
-- If widgets seem to anchor weirdly with this, provide a valid alignoffset for them. |
-- TODO: Investigate moar! |
frameoffset = child.alignoffset or (frameheight / 2) |
if child.width == "relative" then |
-- if there isn't available width for the control start a new row |
-- if a control is "fill" it will be on a row of its own full width |
if usedwidth == 0 or ((framewidth) + usedwidth > width) or child.width == "fill" then |
if isfullheight then |
-- a previous row has already filled the entire height, there's nothing we can usefully do anymore |
-- (maybe error/warn about this?) |
break |
end |
--anchor the previous row, we will now know its height and offset |
rowstart:SetPoint("TOPLEFT",content,"TOPLEFT",0,-(height+(rowoffset-rowstartoffset)+3)) |
height = height + rowheight + 3 |
--math.max(rowheight-rowoffset+frameoffset, frameheight-frameoffset+rowoffset) |
--offset is always the larger of the two offsets |
rowoffset = math.max(rowoffset, frameoffset) |
rowoffset = math_max(rowoffset, frameoffset) |
rowheight = math.max(rowheight,rowoffset+(frameheight/2)) |
rowheight = math_max(rowheight,rowoffset+(frameheight/2)) |
--print("type:", child.type, "offset:",frameoffset-lastframeoffset) |
frame:SetPoint("TOPLEFT",children[i-1].frame,"TOPRIGHT",0,frameoffset-lastframeoffset) |
usedwidth = framewidth + usedwidth |
end |
if child.height == "fill" then |
frame:SetPoint("BOTTOM",content,"BOTTOM") |
isfullheight = true |
break |
end |
end |
--- AceConfigRegistry-3.0 handles central registration of options tables in use by addons and modules. |
-- Options tables can be registered as raw tables, or as function refs that return a table.\\ |
-- These functions receive two arguments: "uiType" and "uiName". \\ |
-- Valid "uiTypes": "cmd", "dropdown", "dialog". This is verified by the library at call time. \\ |
-- The "uiName" field is expected to contain the full name of the calling addon, including version, e.g. "FooBar-1.0". This is verified by the library at call time.\\ |
-- :IterateOptionsTables() and :GetOptionsTable() always return a function reference that the requesting config handling addon must call with the above arguments. |
--- AceConfigRegistry-3.0 handles central registration of options tables in use by addons and modules.\\ |
-- Options tables can be registered as raw tables, OR as function refs that return a table.\\ |
-- Such functions receive three arguments: "uiType", "uiName", "appName". \\ |
-- * Valid **uiTypes**: "cmd", "dropdown", "dialog". This is verified by the library at call time. \\ |
-- * The **uiName** field is expected to contain the full name of the calling addon, including version, e.g. "FooBar-1.0". This is verified by the library at call time.\\ |
-- * The **appName** field is the options table name as given at registration time \\ |
-- |
-- :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 |
-- @name AceConfigRegistry-3.0 |
-- @release $Id: AceConfigRegistry-3.0.lua 785 2009-04-05 14:57:29Z nevcairiel $ |
local MAJOR, MINOR = "AceConfigRegistry-3.0", 9 |
-- @release $Id: AceConfigRegistry-3.0.lua 890 2009-12-06 12:50:05Z nevcairiel $ |
local MAJOR, MINOR = "AceConfigRegistry-3.0", 11 |
local AceConfigRegistry = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConfigRegistry then return end |
AceConfigRegistry.callbacks = CallbackHandler:New(AceConfigRegistry) |
end |
-- Lua APIs |
local tinsert, tconcat = table.insert, table.concat |
local strfind, strmatch = string.find, string.match |
local type, tostring, select, pairs = type, tostring, select, pairs |
local error, assert = error, assert |
----------------------------------------------------------------------- |
-- Validating options table consistency: |
for i=select("#",...),1,-1 do |
tinsert(t, (select(i, ...))) |
end |
error(MAJOR..":ValidateOptionsTable(): "..table.concat(t,".")..msg, errlvl+2) |
error(MAJOR..":ValidateOptionsTable(): "..tconcat(t,".")..msg, errlvl+2) |
end |
type=isstring, |
name=isstringfunc, |
desc=optstringfunc, |
descStyle=optstring, |
order=optmethodnumber, |
validate=optmethodfalse, |
confirm=optmethodbool, |
}, |
toggle={ |
tristate=optbool, |
image=optstringfunc, |
imageCoords=optmethodtable, |
}, |
tristate={ |
}, |
end |
end |
-- ------------------------------------------------------------------- |
-- :ValidateOptionsTable(options,name,errlvl) |
-- - options - the table |
-- - name - (string) name of table, used in error reports |
-- - errlvl - (optional number) error level offset, default 0 |
-- |
-- Validates basic structure and integrity of an options table |
--- Validates basic structure and integrity of an options table \\ |
-- Does NOT verify that get/set etc actually exist, since they can be defined at any depth |
-- @param options The table to be validated |
-- @param name The name of the table to be validated (shown in any error message) |
-- @param errlvl (optional number) error level offset, default 0 (=errors point to the function calling :ValidateOptionsTable) |
function AceConfigRegistry:ValidateOptionsTable(options,name,errlvl) |
errlvl=(errlvl or 0)+1 |
name = name or "Optionstable" |
validate(options,errlvl,name) |
end |
--- Fires a ConfigTableChange callback for those listening in on it, allowing config GUIs to refresh. |
--- Fires a "ConfigTableChange" callback for those listening in on it, allowing config GUIs to refresh. |
-- You should call this function if your options table changed from any outside event, like a game event |
-- or a timer. |
-- @param appName The application name as given to `:RegisterOptionsTable()` |
--- Register an options table with the config registry. |
-- @param appName The application name as given to `:RegisterOptionsTable()` |
-- @param options The options table or a function reference that generates it on demand. |
-- @param options The options table, OR a function reference that generates it on demand. \\ |
-- See the top of the page for info on arguments passed to such functions. |
function AceConfigRegistry:RegisterOptionsTable(appName, options) |
if type(options)=="table" then |
if options.type~="group" then -- quick sanity checker |
AceConfigRegistry.tables[appName] = function(uiType, uiName, errlvl) |
errlvl=(errlvl or 0)+1 |
validateGetterArgs(uiType, uiName, errlvl) |
local tab = assert(options(uiType, uiName)) |
local tab = assert(options(uiType, uiName, appName)) |
if not AceConfigRegistry.validated[uiType][appName] then |
AceConfigRegistry:ValidateOptionsTable(tab, appName, errlvl) -- upgradable |
AceConfigRegistry.validated[uiType][appName] = true |
end |
--------------------------------------------------------------------- |
-- :GetOptionsTable(appName) |
-- - appName - which addon to retreive the options table of |
-- Optional: |
-- - uiType - "cmd", "dropdown", "dialog" |
-- - uiName - e.g. "MyLib-1.0" |
-- |
--- Query the registry for a specific options table. |
-- can call with (uiType,uiName) to get the table.\\ |
-- If uiType&uiName are given, the table is returned. |
-- @param appName The application name as given to `:RegisterOptionsTable()` |
-- @param uiType The type of UI to get the table for. |
-- @param uiName The name of the library/addon querying the table. |
-- @param uiType The type of UI to get the table for, one of "cmd", "dropdown", "dialog" |
-- @param uiName The name of the library/addon querying for the table, e.g. "MyLib-1.0" |
function AceConfigRegistry:GetOptionsTable(appName, uiType, uiName) |
local f = AceConfigRegistry.tables[appName] |
if not f then |
-- as well as associate it with a slash command. |
-- @class file |
-- @name AceConfig-3.0 |
-- @release $Id: AceConfig-3.0.lua 802 2009-04-11 12:12:37Z nevcairiel $ |
-- @release $Id: AceConfig-3.0.lua 877 2009-11-02 15:56:50Z nevcairiel $ |
--[[ |
AceConfig-3.0 |
if not AceConfig then return end |
local cfgreg = LibStub("AceConfigRegistry-3.0") |
local cfgcmd = LibStub("AceConfigCmd-3.0") |
local cfgdlg = LibStub("AceConfigDialog-3.0") |
--TODO: local cfgdrp = LibStub("AceConfigDropdown-3.0") |
-- Lua APIs |
local pcall, error, type, pairs = pcall, error, type, pairs |
-- ------------------------------------------------------------------- |
-- :RegisterOptionsTable(appName, options, slashcmd, persist) |
--- AceConfigDialog-3.0 generates AceGUI-3.0 based windows based on option tables. |
-- @class file |
-- @name AceConfigDialog-3.0 |
-- @release $Id: AceConfigDialog-3.0.lua 796 2009-04-07 15:48:54Z nevcairiel $ |
-- @release $Id: AceConfigDialog-3.0.lua 895 2009-12-06 16:28:55Z nevcairiel $ |
local LibStub = LibStub |
local MAJOR, MINOR = "AceConfigDialog-3.0", 34 |
local AceConfigDialog = LibStub:NewLibrary(MAJOR, MINOR) |
local MAJOR, MINOR = "AceConfigDialog-3.0", 41 |
local AceConfigDialog, oldminor = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConfigDialog then return end |
local gui = LibStub("AceGUI-3.0") |
local reg = LibStub("AceConfigRegistry-3.0") |
local select = select |
local pairs = pairs |
local type = type |
local assert = assert |
local tinsert = tinsert |
local tremove = tremove |
local error = error |
local table = table |
local unpack = unpack |
local string = string |
local next = next |
local math = math |
local _ |
-- Lua APIs |
local tconcat, tinsert, tsort, tremove = table.concat, table.insert, table.sort, table.remove |
local strmatch, format = string.match, string.format |
local assert, loadstring, error = assert, loadstring, error |
local pairs, next, select, type, unpack = pairs, next, select, type, unpack |
local rawset, tostring = rawset, tostring |
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 = {} |
--[[ |
xpcall safecall implementation |
]] |
local ARGS = {} |
for i = 1, argCount do ARGS[i] = "arg"..i end |
code = code:gsub("ARGS", table.concat(ARGS, ", ")) |
code = code:gsub("ARGS", tconcat(ARGS, ", ")) |
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(xpcall, errorhandler) |
end |
--Is Never a function or method |
local allIsLiteral = { |
type = true, |
descStyle = true, |
imageWidth = true, |
imageHeight = true, |
} |
if handler and handler[member] then |
a,b,c,d = handler[member](handler, info, ...) |
else |
error(string.format("Method %s doesn't exist in handler for type %s", member, membername)) |
error(format("Method %s doesn't exist in handler for type %s", member, membername)) |
end |
end |
del(info) |
end |
end |
table.sort(keySort, compareOptions) |
tsort(keySort, compareOptions) |
del(tempOrders) |
del(tempNames) |
local name = GetOptionsMemberValue("name", opt, options, path, appName) |
local desc = GetOptionsMemberValue("desc", opt, options, path, appName) |
local usage = GetOptionsMemberValue("usage", opt, options, path, appName) |
local descStyle = opt.descStyle |
if descStyle and descStyle ~= "tooltip" then return end |
GameTooltip:SetText(name, 1, .82, 0, 1) |
if opt.type == 'multiselect' then |
if dialog and oldstrata then |
dialog:SetFrameStrata(oldstrata) |
end |
AceConfigDialog:Open(appName, rootframe, basepath and unpack(basepath)) |
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl)) |
del(info) |
end |
t.OnCancel = function() |
if dialog and oldstrata then |
dialog:SetFrameStrata(oldstrata) |
end |
AceConfigDialog:Open(appName, rootframe, basepath and unpack(basepath)) |
AceConfigDialog:Open(appName, rootframe, unpack(basepath or emptyTbl)) |
del(info) |
end |
for i = 1, select('#', ...) do |
success, validated = safecall(handler[validate], handler, info, ...) |
if not success then validated = false end |
else |
error(string.format("Method %s doesn't exist in handler for type execute", validate)) |
error(format("Method %s doesn't exist in handler for type execute", validate)) |
end |
elseif type(validate) == "function" then |
success, validated = safecall(validate, info, ...) |
--validate function returned a message to display |
if rootframe.SetStatusText then |
rootframe:SetStatusText(validated) |
else |
-- TODO: do something else. |
end |
PlaySound("igPlayerInviteDecline") |
del(info) |
rootframe:SetStatusText(name..": Invalid Value") |
end |
end |
else |
-- TODO: do something else |
end |
PlaySound("igPlayerInviteDecline") |
del(info) |
confirm = false |
end |
else |
error(string.format("Method %s doesn't exist in handler for type confirm", confirm)) |
error(format("Method %s doesn't exist in handler for type confirm", confirm)) |
end |
elseif type(confirm) == "function" then |
success, confirm = safecall(confirm, info, ...) |
if handler and handler[func] then |
confirmPopup(user.appName, rootframe, basepath, info, confirmText, handler[func], handler, info, ...) |
else |
error(string.format("Method %s doesn't exist in handler for type func", func)) |
error(format("Method %s doesn't exist in handler for type func", func)) |
end |
elseif type(func) == "function" then |
confirmPopup(user.appName, rootframe, basepath, info, confirmText, func, info, ...) |
if handler and handler[func] then |
safecall(handler[func],handler, info, ...) |
else |
error(string.format("Method %s doesn't exist in handler for type func", func)) |
error(format("Method %s doesn't exist in handler for type func", func)) |
end |
elseif type(func) == "function" then |
safecall(func,info, ...) |
local iscustom = user.rootframe:GetUserData('iscustom') |
local basepath = user.rootframe:GetUserData('basepath') |
local basepath = user.rootframe:GetUserData('basepath') or emptyTbl |
--full refresh of the frame, some controls dont cause this on all events |
if option.type == "color" then |
if event == "OnValueConfirmed" then |
if iscustom then |
AceConfigDialog:Open(user.appName, user.rootframe, basepath and unpack(basepath)) |
AceConfigDialog:Open(user.appName, user.rootframe, unpack(basepath)) |
else |
AceConfigDialog:Open(user.appName, basepath and unpack(basepath)) |
AceConfigDialog:Open(user.appName, unpack(basepath)) |
end |
end |
elseif option.type == "range" then |
if event == "OnMouseUp" then |
if iscustom then |
AceConfigDialog:Open(user.appName, user.rootframe, basepath and unpack(basepath)) |
AceConfigDialog:Open(user.appName, user.rootframe, unpack(basepath)) |
else |
AceConfigDialog:Open(user.appName, basepath and unpack(basepath)) |
AceConfigDialog:Open(user.appName, unpack(basepath)) |
end |
end |
--multiselects don't cause a refresh on 'OnValueChanged' only 'OnClosed' |
user.valuechanged = true |
else |
if iscustom then |
AceConfigDialog:Open(user.appName, user.rootframe, basepath and unpack(basepath)) |
AceConfigDialog:Open(user.appName, user.rootframe, unpack(basepath)) |
else |
AceConfigDialog:Open(user.appName, basepath and unpack(basepath)) |
AceConfigDialog:Open(user.appName, unpack(basepath)) |
end |
end |
local option = widget:GetUserData('option') |
local min, max, step = option.min or 0, option.max or 100, option.step |
if step then |
value = math.floor((value - min) / step + 0.5) * step + min |
value = math_floor((value - min) / step + 0.5) * step + min |
else |
value = math.max(math.min(value,max),min) |
value = math_max(math_min(value,max),min) |
end |
ActivateControl(widget,event,value) |
end |
ActivateControl(widget, event, widget:GetUserData('value'), ...) |
local user = widget:GetUserDataTable() |
local iscustom = user.rootframe:GetUserData('iscustom') |
local basepath = user.rootframe:GetUserData('basepath') |
local basepath = user.rootframe:GetUserData('basepath') or emptyTbl |
if iscustom then |
AceConfigDialog:Open(user.appName, user.rootframe, basepath and unpack(basepath)) |
AceConfigDialog:Open(user.appName, user.rootframe, unpack(basepath)) |
else |
AceConfigDialog:Open(user.appName, basepath and unpack(basepath)) |
AceConfigDialog:Open(user.appName, unpack(basepath)) |
end |
end |
local user = widget:GetUserDataTable() |
if user.valuechanged then |
local iscustom = user.rootframe:GetUserData('iscustom') |
local basepath = user.rootframe:GetUserData('basepath') |
local basepath = user.rootframe:GetUserData('basepath') or emptyTbl |
if iscustom then |
AceConfigDialog:Open(user.appName, user.rootframe, basepath and unpack(basepath)) |
AceConfigDialog:Open(user.appName, user.rootframe, unpack(basepath)) |
else |
AceConfigDialog:Open(user.appName, basepath and unpack(basepath)) |
AceConfigDialog:Open(user.appName, unpack(basepath)) |
end |
end |
end |
local value = GetOptionsMemberValue("get",v, options, path, appName) |
control:SetValue(value) |
control:SetCallback("OnValueChanged",ActivateControl) |
if v.descStyle == "inline" then |
local desc = GetOptionsMemberValue("desc", v, options, path, appName) |
control:SetDescription(desc) |
end |
local image = GetOptionsMemberValue("image", v, options, path, appName) |
local imageCoords = GetOptionsMemberValue("imageCoords", v, options, path, appName) |
if type(image) == 'string' then |
if type(imageCoords) == 'table' then |
control:SetImage(image, unpack(imageCoords)) |
else |
control:SetImage(image) |
end |
end |
elseif v.type == "range" then |
control = gui:Create("Slider") |
control:SetLabel(name) |
tinsert(valuesort, value) |
end |
end |
table.sort(valuesort) |
tsort(valuesort) |
if controlType then |
control = gui:Create(controlType) |
if not control then |
feedpath[i] = path[i] |
end |
BuildPath(feedpath, string.split("\001", uniquevalue)) |
BuildPath(feedpath, ("\001"):split(uniquevalue)) |
local group = options |
for i = 1, #feedpath do |
if not group then return end |
GameTooltip:SetOwner(button, "ANCHOR_NONE") |
if widget.type == "TabGroup" then |
GameTooltip:SetPoint("BOTTOM",button,"TOP") |
GameTooltip:SetPoint("BOTTOM",button,"TOP") |
else |
GameTooltip:SetPoint("LEFT",button,"RIGHT") |
GameTooltip:SetPoint("LEFT",button,"RIGHT") |
end |
GameTooltip:SetText(name, 1, .82, 0, 1) |
feedpath[i] = path[i] |
end |
BuildPath(feedpath, string.split("\001", uniquevalue)) |
BuildPath(feedpath, ("\001"):split(uniquevalue)) |
local group = options |
for i = 1, #feedpath do |
feedpath[i] = path[i] |
end |
BuildPath(feedpath, string.split("\001", uniquevalue)) |
BuildPath(feedpath, ("\001"):split(uniquevalue)) |
local group = options |
for i = 1, #feedpath do |
group = GetSubOption(group, feedpath[i]) |
--Add a scrollframe if we are not going to add a group control, this is the inverse of the conditions for that later on |
if (not (hasChildGroups and not inline)) or (grouptype ~= "tab" and grouptype ~= "select" and (parenttype == "tree" and not isRoot)) then |
if container.type ~= "InlineGroup" then |
if container.type ~= "InlineGroup" and container.type ~= "SimpleGroup" then |
scroll = gui:Create("ScrollFrame") |
scroll:SetLayout("flow") |
scroll.width = "fill" |
end |
if hasChildGroups and not inline then |
local name = GetOptionsMemberValue("name", group, options, path, appName) |
if grouptype == "tab" then |
local tab = gui:Create("TabGroup") |
elseif grouptype == "select" then |
local select = gui:Create("DropdownGroup") |
select:SetTitle(name) |
InjectInfo(select, options, group, path, rootframe, appName) |
select:SetCallback("OnGroupSelected", GroupSelected) |
local status = AceConfigDialog:GetStatusTable(appName, path) |
end |
if firstgroup then |
select:SetGroup( (GroupExists(appName, options, path,status.groups.selected) and status.groups.selected) or firstgroup) |
select:SetGroup((GroupExists(appName, options, path,status.groups.selected) and status.groups.selected) or firstgroup) |
end |
select.width = "fill" |
AceConfigDialog.OpenFrames[appName]:Hide() |
end |
if AceConfigDialog.BlizOptions and AceConfigDialog.BlizOptions[appName] then |
local widget = AceConfigDialog.BlizOptions[appName] |
if not widget:IsVisible() then |
widget:ReleaseChildren() |
for key, widget in pairs(AceConfigDialog.BlizOptions[appName]) do |
if not widget:IsVisible() then |
widget:ReleaseChildren() |
end |
end |
end |
this.closing[appName] = nil |
for appName in pairs(this.apps) do |
if AceConfigDialog.OpenFrames[appName] then |
local user = AceConfigDialog.OpenFrames[appName]:GetUserDataTable() |
AceConfigDialog:Open(appName, user.basepath and unpack(user.basepath)) |
AceConfigDialog:Open(appName, unpack(user.basepath or emptyTbl)) |
end |
if AceConfigDialog.BlizOptions and AceConfigDialog.BlizOptions[appName] then |
local widget = AceConfigDialog.BlizOptions[appName] |
local user = widget:GetUserDataTable() |
if widget:IsVisible() then |
AceConfigDialog:Open(widget:GetUserData('appName'), widget, user.basepath and unpack(user.basepath)) |
for key, widget in pairs(AceConfigDialog.BlizOptions[appName]) do |
local user = widget:GetUserDataTable() |
if widget:IsVisible() then |
AceConfigDialog:Open(widget:GetUserData('appName'), widget, unpack(user.basepath or emptyTbl)) |
end |
end |
end |
this.apps[appName] = nil |
if f.SetStatusTable then |
f:SetStatusTable(status) |
end |
if f.SetTitle then |
f:SetTitle(name or "") |
end |
else |
if not self.OpenFrames[appName] then |
f = gui:Create("Frame") |
del(path) |
end |
AceConfigDialog.BlizOptions = AceConfigDialog.BlizOptions or {} |
-- convert pre-39 BlizOptions structure to the new format |
if oldminor and oldminor < 39 and AceConfigDialog.BlizOptions then |
local old = AceConfigDialog.BlizOptions |
local new = {} |
for key, widget in pairs(old) do |
local appName = widget:GetUserData('appName') |
if not new[appName] then new[appName] = {} end |
new[appName][key] = widget |
end |
AceConfigDialog.BlizOptions = new |
else |
AceConfigDialog.BlizOptions = AceConfigDialog.BlizOptions or {} |
end |
local function FeedToBlizPanel(widget, event) |
local path = widget:GetUserData('path') |
AceConfigDialog:Open(widget:GetUserData('appName'), widget, path and unpack(path)) |
AceConfigDialog:Open(widget:GetUserData('appName'), widget, unpack(path or emptyTbl)) |
end |
local function ClearBlizPanel(widget, event) |
key = key..'\001'..select(n, ...) |
end |
if not BlizOptions[key] then |
if not BlizOptions[appName] then |
BlizOptions[appName] = {} |
end |
if not BlizOptions[appName][key] then |
local group = gui:Create("BlizOptionsGroup") |
BlizOptions[key] = group |
BlizOptions[appName][key] = group |
group:SetName(name or appName, parent) |
group:SetTitle(name or appName) |
--- AceConfigCmd-3.0 handles access to an options table through the "command line" interface via the ChatFrames. |
-- @class file |
-- @name AceConfigCmd-3.0 |
-- @release $Id: AceConfigCmd-3.0.lua 801 2009-04-09 20:34:28Z nevcairiel $ |
-- @release $Id: AceConfigCmd-3.0.lua 897 2009-12-06 17:02:27Z mikk $ |
--[[ |
AceConfigCmd-3.0 |
]] |
-- TODO: handle disabled / hidden |
-- TODO: implement handlers for all types |
-- TODO: plugin args |
local MAJOR, MINOR = "AceConfigCmd-3.0", 9 |
local MAJOR, MINOR = "AceConfigCmd-3.0", 11 |
local AceConfigCmd = LibStub:NewLibrary(MAJOR, MINOR) |
if not AceConfigCmd then return end |
local AceConsole -- LoD |
local AceConsoleName = "AceConsole-3.0" |
-- Lua APIs |
local strsub, strsplit, strlower, strmatch, strtrim = string.sub, string.split, string.lower, string.match, string.trim |
local format, tonumber, tostring = string.format, tonumber, tostring |
local tsort, tinsert = table.sort, table.insert |
local select, pairs, next, type = select, pairs, next, type |
local error, assert = error, assert |
-- WoW APIs |
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 |
__index = function(self,k) return k end |
}) |
end |
end |
local function checkhidden(info, inputpos, tab) |
if tab.cmdHidden~=nil then |
return tab.cmdHidden |
end |
local hidden = tab.hidden |
if type(hidden) == "function" or type(hidden) == "string" then |
info.hidden = hidden |
hidden = callmethod(info, inputpos, tab, 'hidden') |
info.hidden = nil |
end |
return hidden |
end |
local function showhelp(info, inputpos, tab, noHead) |
if not noHead then |
print("|cff33ff99"..info.appName.."|r: Arguments to |cffffff78/"..info[0].."|r "..strsub(info.input,1,inputpos-1)..":") |
for k,v in iterateargs(tab) do |
if not refTbl[k] then -- a plugin overriding something in .args |
table.insert(sortTbl, k) |
tinsert(sortTbl, k) |
refTbl[k] = v |
end |
end |
table.sort(sortTbl, function(one, two) |
tsort(sortTbl, function(one, two) |
local o1 = refTbl[one].order or 100 |
local o2 = refTbl[two].order or 100 |
if type(o1) == "function" or type(o1) == "string" then |
return o1<o2 |
end) |
for _,k in ipairs(sortTbl) do |
for i = 1, #sortTbl do |
local k = sortTbl[i] |
local v = refTbl[k] |
if not pickfirstset(v.cmdHidden, v.hidden, false) then |
if not checkhidden(info, inputpos, v) then |
-- recursively show all inline groups |
local name, desc = v.name, v.desc |
if type(name) == "function" then |
if tab.plugins and type(tab.plugins)~="table" then err(info,inputpos) end |
-- grab next arg from input |
local _,nextpos,arg = string.find(info.input, " *([^ ]+) *", inputpos) |
local _,nextpos,arg = (info.input):find(" *([^ ]+) *", inputpos) |
if not arg then |
showhelp(info, inputpos, tab) |
return |
--parse for =on =off =default in the process |
--table will be key = true for options that should toggle, key = [on|off|default] for options to be set |
local sels = {} |
for v in string.gmatch(str, "[^ ]+") do |
for v in str:gmatch("[^ ]+") do |
--parse option=on etc |
local opt, val = string.match(v,'(.+)=(.+)') |
local opt, val = v:match('(.+)=(.+)') |
--get option if toggling |
if not opt then |
opt = v |
local min, max, floor = math.min, math.max, math.floor |
local fixlevels = AceGUISharedMediaWidgets.fixlevels |
local OnItemValueChanged = AceGUISharedMediaWidgets.OnItemValueChanged |
do |
local widgetType = "LSM30_Border_Item_Select" |
local widgetVersion = 1 |
local function Frame_OnEnter(this) |
local self = this.obj |
self.border:Show() |
end |
self:Fire("OnEnter") |
if self.specialOnEnter then |
self.specialOnEnter(self) |
end |
self.border:Hide() |
self.highlight:Hide() |
self:Fire("OnLeave") |
if self.specialOnLeave then |
self.specialOnLeave(self) |
end |
end |
self.text:SetText(text or "") |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown-Item-Toggle") |
self.type = widgetType |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
end |
do |
do |
local widgetType = "LSM30_Border" |
local widgetVersion = 2 |
local widgetVersion = 3 |
local function Frame_OnEnter(this) |
local self = this.obj |
local text = self.text:GetText() |
if text ~= nil and text ~= '' then |
if text ~= nil and text ~= '' then |
self.borderframe:Show() |
end |
end |
local function Frame_OnLeave(this) |
local self = this.obj |
self.borderframe:Hide() |
end |
local function AddListItem(self, value, text) |
local item = AceGUI:Create("LSM30_Border_Item_Select") |
item:SetText(text) |
item:SetCallback("OnValueChanged", OnItemValueChanged) |
self.pullout:AddItem(item) |
end |
local sortlist = {} |
local function SetList(self, list) |
self.list = list or Media:HashTable("border") |
self.pullout:Clear() |
if self.multiselect then |
AddCloseButton() |
end |
end |
local sortlist = {} |
local function ParseListItems(self) |
for v in pairs(self.list) do |
sortlist[#sortlist + 1] = v |
end |
AddListItem(self, value, value) |
sortlist[i] = nil |
end |
if self.multiselect then |
AddCloseButton() |
end |
end |
local function SetText(self, text) |
if text and text ~= '' then |
local backdropTable = self.borderframe:GetBackdrop() |
end |
self.text:SetText(text or "") |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown") |
self.type = widgetType |
self.SetList = SetList |
self.SetText = SetText |
self.SetValue = AceGUISharedMediaWidgets.SetValue |
local left = _G[self.dropdown:GetName() .. "Left"] |
local middle = _G[self.dropdown:GetName() .. "Middle"] |
local right = _G[self.dropdown:GetName() .. "Right"] |
local borderframe = CreateFrame('Frame') |
borderframe:SetFrameStrata("TOOLTIP") |
borderframe:SetWidth(64) |
insets = { left = 4, right = 4, top = 4, bottom = 4 }}) |
self.borderframe = borderframe |
borderframe:Hide() |
self.dropdown:EnableMouse(true) |
self.dropdown:SetScript("OnEnter", Frame_OnEnter) |
self.dropdown:SetScript("OnLeave", Frame_OnLeave) |
local clickscript = self.button:GetScript("OnClick") |
self.button:SetScript("OnClick", function(...) |
self.pullout:Clear() |
ParseListItems(self) |
clickscript(...) |
end) |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
local min, max, floor = math.min, math.max, math.floor |
local fixlevels = AceGUISharedMediaWidgets.fixlevels |
local OnItemValueChanged = AceGUISharedMediaWidgets.OnItemValueChanged |
do |
local widgetType = "LSM30_Background_Item_Select" |
local widgetVersion = 1 |
local function Frame_OnEnter(this) |
local self = this.obj |
self.texture:Show() |
end |
self:Fire("OnEnter") |
if self.specialOnEnter then |
self.specialOnEnter(self) |
end |
self.texture:Hide() |
self.highlight:Hide() |
self:Fire("OnLeave") |
if self.specialOnLeave then |
self.specialOnLeave(self) |
end |
end |
self.text:SetText(text or "") |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown-Item-Toggle") |
self.type = widgetType |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
end |
do |
do |
local widgetType = "LSM30_Background" |
local widgetVersion = 2 |
local widgetVersion = 3 |
local function Frame_OnEnter(this) |
local self = this.obj |
local text = self.text:GetText() |
if text ~= nil and text ~= '' then |
if text ~= nil and text ~= '' then |
self.textureframe:Show() |
end |
end |
local function Frame_OnLeave(this) |
local self = this.obj |
self.textureframe:Hide() |
end |
local function SetText(self, text) |
if text and text ~= '' then |
self.texture:SetTexture(Media:Fetch('background',text)) |
end |
self.text:SetText(text or "") |
end |
local function AddListItem(self, value, text) |
local item = AceGUI:Create("LSM30_Background_Item_Select") |
item:SetText(text) |
item:SetCallback("OnValueChanged", OnItemValueChanged) |
self.pullout:AddItem(item) |
end |
local sortlist = {} |
local function SetList(self, list) |
self.list = list or Media:HashTable("background") |
self.pullout:Clear() |
if self.multiselect then |
AddCloseButton() |
end |
end |
local sortlist = {} |
local function ParseListItems(self) |
for v in pairs(self.list) do |
sortlist[#sortlist + 1] = v |
end |
AddListItem(self, value, value) |
sortlist[i] = nil |
end |
if self.multiselect then |
AddCloseButton() |
end |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown") |
self.type = widgetType |
self.SetText = SetText |
self.SetList = SetList |
self.SetValue = AceGUISharedMediaWidgets.SetValue |
local left = _G[self.dropdown:GetName() .. "Left"] |
local middle = _G[self.dropdown:GetName() .. "Middle"] |
local right = _G[self.dropdown:GetName() .. "Right"] |
local textureframe = CreateFrame('Frame') |
textureframe:SetFrameStrata("TOOLTIP") |
textureframe:SetWidth(128) |
texture:SetAllPoints(textureframe) |
textureframe:Hide() |
self.texture = texture |
self.dropdown:EnableMouse(true) |
self.dropdown:SetScript("OnEnter", Frame_OnEnter) |
self.dropdown:SetScript("OnLeave", Frame_OnLeave) |
local clickscript = self.button:GetScript("OnClick") |
self.button:SetScript("OnClick", function(...) |
self.pullout:Clear() |
ParseListItems(self) |
clickscript(...) |
end) |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
local min, max, floor = math.min, math.max, math.floor |
local fixlevels = AceGUISharedMediaWidgets.fixlevels |
local OnItemValueChanged = AceGUISharedMediaWidgets.OnItemValueChanged |
do |
local widgetType = "LSM30_Font_Item_Select" |
local widgetVersion = 1 |
end |
self.text:SetText(text or "") |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown-Item-Toggle") |
self.type = widgetType |
self.SetText = SetText |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
end |
do |
local widgetType = "LSM30_Font" |
local widgetVersion = 2 |
local function SetText(self, text) |
local widgetVersion = 3 |
local function SetText(self, text) |
if text and text ~= '' then |
local _, size, outline= self.text:GetFont() |
self.text:SetFont(Media:Fetch('font',text),size,outline) |
end |
self.text:SetText(text or "") |
end |
local function AddListItem(self, value, text) |
local item = AceGUI:Create("LSM30_Font_Item_Select") |
item:SetText(text) |
item:SetCallback("OnValueChanged", OnItemValueChanged) |
self.pullout:AddItem(item) |
end |
local sortlist = {} |
local function SetList(self, list) |
self.list = list or Media:HashTable("font") |
self.pullout:Clear() |
if self.multiselect then |
AddCloseButton() |
end |
end |
local sortlist = {} |
local function ParseListItems(self) |
for v in pairs(self.list) do |
sortlist[#sortlist + 1] = v |
end |
AddListItem(self, value, value) |
sortlist[i] = nil |
end |
if self.multiselect then |
AddCloseButton() |
end |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown") |
self.type = widgetType |
self.SetText = SetText |
self.SetValue = AceGUISharedMediaWidgets.SetValue |
self.SetList = SetList |
local clickscript = self.button:GetScript("OnClick") |
self.button:SetScript("OnClick", function(...) |
self.pullout:Clear() |
ParseListItems(self) |
clickscript(...) |
end) |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
end |
end |
local min, max, floor = math.min, math.max, math.floor |
local fixlevels = AceGUISharedMediaWidgets.fixlevels |
local OnItemValueChanged = AceGUISharedMediaWidgets.OnItemValueChanged |
do |
local widgetType = "LSM30_Sound_Item_Select" |
local widgetVersion = 1 |
local function Frame_OnEnter(this) |
local self = this.obj |
self.highlight:Show() |
end |
self:Fire("OnEnter") |
if self.specialOnEnter then |
self.specialOnEnter(self) |
end |
local function Frame_OnLeave(this) |
local self = this.obj |
self.highlight:Hide() |
self:Fire("OnLeave") |
if self.specialOnLeave then |
self.specialOnLeave(self) |
end |
local function SetPullout(self, pullout) |
self.pullout = pullout |
self.frame:SetParent(nil) |
self.frame:SetParent(pullout.itemFrame) |
self.parent = pullout.itemFrame |
local function Hide(self) |
self.frame:Hide() |
end |
local function SetDisabled(self, disabled) |
self.disabled = disabled |
if disabled then |
self.text:SetTextColor(1, 1, 1) |
end |
end |
local function SetOnLeave(self, func) |
self.specialOnLeave = func |
end |
self.check:Hide() |
end |
end |
local function Frame_OnClick(this, button) |
local self = this.obj |
self.value = not self.value |
UpdateToggle(self) |
self:Fire("OnValueChanged", self.value) |
end |
local function Speaker_OnClick(this, button) |
local self = this.obj |
PlaySoundFile(Media:Fetch('sound',self.sound)) |
end |
local function SetValue(self, value) |
self.value = value |
UpdateToggle(self) |
end |
local function Constructor() |
local count = AceGUI:GetNextWidgetNum(type) |
local frame = CreateFrame("Frame", "LSM30_Sound_DropDownItem"..count) |
self.frame = frame |
frame.obj = self |
self.type = type |
self.useHighlight = true |
frame:SetHeight(17) |
frame:SetFrameStrata("FULLSCREEN_DIALOG") |
local button = CreateFrame("Button", nil, frame) |
button:SetPoint("BOTTOMRIGHT",frame,"BOTTOMRIGHT",-22,0) |
button:SetPoint("TOPLEFT",frame,"TOPLEFT",0,0) |
self.button = button |
button.obj = self |
local speakerbutton = CreateFrame("Button", nil, frame) |
speakerbutton:SetWidth(16) |
speakerbutton:SetHeight(16) |
speakerbutton:SetPoint("RIGHT",frame,"RIGHT",-6,0) |
self.speakerbutton = speakerbutton |
speakerbutton.obj = self |
local speaker = frame:CreateTexture(nil, "BACKGROUND") |
speaker:SetTexture("Interface\\Common\\VoiceChat-Speaker") |
speaker:SetAllPoints(speakerbutton) |
self.speaker = speaker |
local speakeron = speakerbutton:CreateTexture(nil, "HIGHLIGHT") |
speakeron:SetTexture("Interface\\Common\\VoiceChat-On") |
speakeron:SetAllPoints(speakerbutton) |
self.speakeron = speakeron |
local text = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall") |
text:SetTextColor(1,1,1) |
text:SetJustifyH("LEFT") |
highlight:SetPoint("LEFT",frame,"LEFT",5,0) |
highlight:Hide() |
self.highlight = highlight |
local check = frame:CreateTexture("OVERLAY") |
local check = frame:CreateTexture("OVERLAY") |
check:SetWidth(16) |
check:SetHeight(16) |
check:SetPoint("LEFT",frame,"LEFT",3,-1) |
sub:SetPoint("RIGHT",frame,"RIGHT",-3,-1) |
sub:SetTexture("Interface\\ChatFrame\\ChatFrameExpandArrow") |
sub:Hide() |
self.sub = sub |
self.sub = sub |
button:SetScript("OnEnter", Frame_OnEnter) |
button:SetScript("OnLeave", Frame_OnLeave) |
self.OnAcquire = OnAcquire |
self.OnRelease = OnRelease |
self.SetPullout = SetPullout |
self.GetText = GetText |
self.SetText = SetText |
self.SetDisabled = SetDisabled |
self.SetPoint = SetPoint |
self.Show = Show |
self.Hide = Hide |
self.SetOnLeave = SetOnLeave |
self.SetOnEnter = SetOnEnter |
self.button:SetScript("OnClick", Frame_OnClick) |
self.speakerbutton:SetScript("OnClick", Speaker_OnClick) |
self.SetValue = SetValue |
AceGUI:RegisterAsWidget(self) |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
end |
do |
do |
local widgetType = "LSM30_Sound" |
local widgetVersion = 2 |
local widgetVersion = 3 |
local function AddListItem(self, value, text) |
local item = AceGUI:Create("LSM30_Sound_Item_Select") |
item:SetText(text) |
item:SetCallback("OnValueChanged", OnItemValueChanged) |
self.pullout:AddItem(item) |
end |
local sortlist = {} |
local function SetList(self, list) |
self.list = list or Media:HashTable("sound") |
self.pullout:Clear() |
if self.multiselect then |
AddCloseButton() |
end |
end |
local sortlist = {} |
local function ParseListItems(self) |
for v in pairs(self.list) do |
sortlist[#sortlist + 1] = v |
end |
AddListItem(self, value, value) |
sortlist[i] = nil |
end |
if self.multiselect then |
AddCloseButton() |
end |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown") |
self.type = widgetType |
self.SetList = SetList |
self.SetValue = AceGUISharedMediaWidgets.SetValue |
local clickscript = self.button:GetScript("OnClick") |
self.button:SetScript("OnClick", function(...) |
self.pullout:Clear() |
ParseListItems(self) |
clickscript(...) |
end) |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
local min, max, floor = math.min, math.max, math.floor |
local fixlevels = AceGUISharedMediaWidgets.fixlevels |
local OnItemValueChanged = AceGUISharedMediaWidgets.OnItemValueChanged |
do |
local widgetType = "LSM30_Statusbar_Item_Select" |
local widgetVersion = 1 |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
end |
do |
do |
local widgetType = "LSM30_Statusbar" |
local widgetVersion = 2 |
local widgetVersion = 3 |
local function SetText(self, text) |
if text and text ~= '' then |
self.texture:SetTexture(Media:Fetch('statusbar',text)) |
end |
self.text:SetText(text or "") |
end |
local function AddListItem(self, value, text) |
local item = AceGUI:Create("LSM30_Statusbar_Item_Select") |
item:SetText(text) |
item:SetCallback("OnValueChanged", OnItemValueChanged) |
self.pullout:AddItem(item) |
end |
local sortlist = {} |
local function SetList(self, list) |
self.list = list or Media:HashTable("statusbar") |
self.pullout:Clear() |
if self.multiselect then |
AddCloseButton() |
end |
end |
local sortlist = {} |
local function ParseListItems(self) |
for v in pairs(self.list) do |
sortlist[#sortlist + 1] = v |
end |
AddListItem(self, value, value) |
sortlist[i] = nil |
end |
if self.multiselect then |
AddCloseButton() |
end |
end |
local function Constructor() |
local self = AceGUI:Create("Dropdown") |
self.type = widgetType |
self.SetText = SetText |
self.SetList = SetList |
self.SetValue = AceGUISharedMediaWidgets.SetValue |
local left = _G[self.dropdown:GetName() .. "Left"] |
local middle = _G[self.dropdown:GetName() .. "Middle"] |
local right = _G[self.dropdown:GetName() .. "Right"] |
local texture = self.dropdown:CreateTexture(nil, "ARTWORK") |
texture:SetPoint("BOTTOMRIGHT", right, "BOTTOMRIGHT" ,-39, 26) |
texture:SetPoint("TOPLEFT", left, "TOPLEFT", 24, -24) |
self.texture = texture |
local clickscript = self.button:GetScript("OnClick") |
self.button:SetScript("OnClick", function(...) |
self.pullout:Clear() |
ParseListItems(self) |
clickscript(...) |
end) |
return self |
end |
AceGUI:RegisterWidgetType(widgetType, Constructor, widgetVersion) |
--[[ $Id: CallbackHandler-1.0.lua 504 2008-02-07 11:04:06Z nevcairiel $ ]] |
local MAJOR, MINOR = "CallbackHandler-1.0", 3 |
--[[ $Id: CallbackHandler-1.0.lua 895 2009-12-06 16:28:55Z nevcairiel $ ]] |
local MAJOR, MINOR = "CallbackHandler-1.0", 5 |
local CallbackHandler = LibStub:NewLibrary(MAJOR, MINOR) |
if not CallbackHandler then return end -- No upgrade needed |
local meta = {__index = function(tbl, key) tbl[key] = {} return tbl[key] end} |
local type = type |
local pcall = pcall |
local pairs = pairs |
local assert = assert |
local concat = table.concat |
local loadstring = loadstring |
local next = next |
local select = select |
local type = type |
-- Lua APIs |
local tconcat = table.concat |
local assert, error, loadstring = assert, error, loadstring |
local setmetatable, rawset, rawget = setmetatable, rawset, rawget |
local next, select, pairs, type, tostring = next, select, pairs, type, tostring |
-- 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 |
local xpcall = xpcall |
local function errorhandler(err) |
local ARGS, OLD_ARGS = {}, {} |
for i = 1, argCount do ARGS[i], OLD_ARGS[i] = "arg"..i, "old_arg"..i end |
code = code:gsub("OLD_ARGS", concat(OLD_ARGS, ", ")):gsub("ARGS", concat(ARGS, ", ")) |
code = code:gsub("OLD_ARGS", tconcat(OLD_ARGS, ", ")):gsub("ARGS", tconcat(ARGS, ", ")) |
return assert(loadstring(code, "safecall Dispatcher["..argCount.."]"))(next, xpcall, errorhandler) |
end |