Ace3 backport

This commit is contained in:
Pinya
2018-07-21 13:29:50 +03:00
parent 332d53e7f6
commit f0eac39bcd
43 changed files with 1071 additions and 846 deletions
@@ -6,6 +6,10 @@ local Media = LibStub("LibSharedMedia-3.0")
local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0")
local next, ipairs, pairs = next, ipairs, pairs
local upper = string.upper
local tinsert, tremove, sort = table.insert, table.remove, table.sort
do
local widgetType = "LSM30_Background"
local widgetVersion = 11
@@ -15,10 +19,10 @@ do
self:ClearAllPoints()
self:Hide()
self.check:Hide()
table.insert(contentFrameCache, self)
tinsert(contentFrameCache, self)
end
local function ContentOnClick(this, button)
local function ContentOnClick()
local self = this.obj
self:Fire("OnValueChanged", this.text:GetText())
if self.dropdown then
@@ -26,7 +30,7 @@ do
end
end
local function ContentOnEnter(this, button)
local function ContentOnEnter()
local self = this.obj
local text = this.text:GetText()
local background = self.list[text] ~= text and self.list[text] or Media:Fetch('background',text)
@@ -36,7 +40,7 @@ do
local function GetContentLine()
local frame
if next(contentFrameCache) then
frame = table.remove(contentFrameCache)
frame = tremove(contentFrameCache)
else
frame = CreateFrame("Button", nil, UIParent)
--frame:SetWidth(200)
@@ -140,7 +144,7 @@ do
end
local function textSort(a,b)
return string.upper(a) < string.upper(b)
return upper(a) < upper(b)
end
local sortedlist = {}
@@ -156,9 +160,9 @@ do
self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0)
for k, v in pairs(self.list) do
sortedlist[#sortedlist+1] = k
tinsert(sortedlist, k)
end
table.sort(sortedlist, textSort)
sort(sortedlist, textSort)
for i, k in ipairs(sortedlist) do
local f = GetContentLine()
f.text:SetText(k)
@@ -180,18 +184,18 @@ do
end
end
local function OnHide(this)
local function OnHide()
local self = this.obj
if self.dropdown then
self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown)
end
end
local function Drop_OnEnter(this)
local function Drop_OnEnter()
this.obj:Fire("OnEnter")
end
local function Drop_OnLeave(this)
local function Drop_OnLeave()
this.obj:Fire("OnLeave")
end
@@ -6,6 +6,10 @@ local Media = LibStub("LibSharedMedia-3.0")
local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0")
local next, ipairs, pairs = next, ipairs, pairs
local upper = string.upper
local tinsert, tremove, sort = table.insert, table.remove, table.sort
do
local widgetType = "LSM30_Border"
local widgetVersion = 11
@@ -15,7 +19,7 @@ do
self:ClearAllPoints()
self:Hide()
self.check:Hide()
table.insert(contentFrameCache, self)
tinsert(contentFrameCache, self)
end
local function ContentOnClick(this, button)
@@ -39,7 +43,7 @@ do
local function GetContentLine()
local frame
if next(contentFrameCache) then
frame = table.remove(contentFrameCache)
frame = tremove(contentFrameCache)
else
frame = CreateFrame("Button", nil, UIParent)
--frame:SetWidth(200)
@@ -135,7 +139,7 @@ do
end
local function textSort(a,b)
return string.upper(a) < string.upper(b)
return upper(a) < upper(b)
end
local sortedlist = {}
@@ -151,9 +155,9 @@ do
self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0)
for k, v in pairs(self.list) do
sortedlist[#sortedlist+1] = k
tinsert(sortedlist, k)
end
table.sort(sortedlist, textSort)
sort(sortedlist, textSort)
for i, k in ipairs(sortedlist) do
local f = GetContentLine()
f.text:SetText(k)
@@ -6,6 +6,10 @@ local Media = LibStub("LibSharedMedia-3.0")
local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0")
local next, ipairs, pairs = next, ipairs, pairs
local upper = string.upper
local tinsert, tremove, sort = table.insert, table.remove, table.sort
do
local widgetType = "LSM30_Font"
local widgetVersion = 11
@@ -15,10 +19,10 @@ do
self:ClearAllPoints()
self:Hide()
self.check:Hide()
table.insert(contentFrameCache, self)
tinsert(contentFrameCache, self)
end
local function ContentOnClick(this, button)
local function ContentOnClick()
local self = this.obj
self:Fire("OnValueChanged", this.text:GetText())
if self.dropdown then
@@ -29,7 +33,7 @@ do
local function GetContentLine()
local frame
if next(contentFrameCache) then
frame = table.remove(contentFrameCache)
frame = tremove(contentFrameCache)
else
frame = CreateFrame("Button", nil, UIParent)
--frame:SetWidth(200)
@@ -120,11 +124,11 @@ do
end
local function textSort(a,b)
return string.upper(a) < string.upper(b)
return upper(a) < upper(b)
end
local sortedlist = {}
local function ToggleDrop(this)
local function ToggleDrop()
local self = this.obj
if self.dropdown then
self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown)
@@ -136,9 +140,9 @@ do
self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0)
for k, v in pairs(self.list) do
sortedlist[#sortedlist+1] = k
tinsert(sortedlist, k)
end
table.sort(sortedlist, textSort)
sort(sortedlist, textSort)
for i, k in ipairs(sortedlist) do
local f = GetContentLine()
local _, size, outline= f.text:GetFont()
@@ -161,18 +165,18 @@ do
end
end
local function OnHide(this)
local function OnHide()
local self = this.obj
if self.dropdown then
self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown)
end
end
local function Drop_OnEnter(this)
local function Drop_OnEnter()
this.obj:Fire("OnEnter")
end
local function Drop_OnLeave(this)
local function Drop_OnLeave()
this.obj:Fire("OnLeave")
end
@@ -6,6 +6,10 @@ local Media = LibStub("LibSharedMedia-3.0")
local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0")
local next, ipairs, pairs = next, ipairs, pairs
local upper = string.upper
local tinsert, tremove, sort = table.insert, table.remove, table.sort
do
local widgetType = "LSM30_Sound"
local widgetVersion = 11
@@ -15,10 +19,10 @@ do
self:ClearAllPoints()
self:Hide()
self.check:Hide()
table.insert(contentFrameCache, self)
tinsert(contentFrameCache, self)
end
local function ContentOnClick(this, button)
local function ContentOnClick()
local self = this.obj
self:Fire("OnValueChanged", this.text:GetText())
if self.dropdown then
@@ -26,7 +30,7 @@ do
end
end
local function ContentSpeakerOnClick(this, button)
local function ContentSpeakerOnClick()
local self = this.frame.obj
local sound = this.frame.text:GetText()
PlaySoundFile(self.list[sound] ~= sound and self.list[sound] or Media:Fetch('sound',sound), "Master")
@@ -35,7 +39,7 @@ do
local function GetContentLine()
local frame
if next(contentFrameCache) then
frame = table.remove(contentFrameCache)
frame = tremove(contentFrameCache)
else
frame = CreateFrame("Button", nil, UIParent)
--frame:SetWidth(200)
@@ -145,11 +149,11 @@ do
end
local function textSort(a,b)
return string.upper(a) < string.upper(b)
return upper(a) < upper(b)
end
local sortedlist = {}
local function ToggleDrop(this)
local function ToggleDrop()
local self = this.obj
if self.dropdown then
self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown)
@@ -161,9 +165,9 @@ do
self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0)
for k, v in pairs(self.list) do
sortedlist[#sortedlist+1] = k
tinsert(sortedlist, k)
end
table.sort(sortedlist, textSort)
sort(sortedlist, textSort)
for i, k in ipairs(sortedlist) do
local f = GetContentLine()
f.text:SetText(k)
@@ -183,22 +187,22 @@ do
end
end
local function OnHide(this)
local function OnHide()
local self = this.obj
if self.dropdown then
self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown)
end
end
local function Drop_OnEnter(this)
local function Drop_OnEnter()
this.obj:Fire("OnEnter")
end
local function Drop_OnLeave(this)
local function Drop_OnLeave()
this.obj:Fire("OnLeave")
end
local function WidgetPlaySound(this)
local function WidgetPlaySound()
local self = this.obj
local sound = self.frame.text:GetText()
PlaySoundFile(self.list[sound] ~= sound and self.list[sound] or Media:Fetch('sound',sound), "Master")
@@ -6,6 +6,10 @@ local Media = LibStub("LibSharedMedia-3.0")
local AGSMW = LibStub("AceGUISharedMediaWidgets-1.0")
local next, ipairs, pairs = next, ipairs, pairs
local upper = string.upper
local tinsert, tremove, sort = table.insert, table.remove, table.sort
do
local widgetType = "LSM30_Statusbar"
local widgetVersion = 11
@@ -15,10 +19,10 @@ do
self:ClearAllPoints()
self:Hide()
self.check:Hide()
table.insert(contentFrameCache, self)
tinsert(contentFrameCache, self)
end
local function ContentOnClick(this, button)
local function ContentOnClick()
local self = this.obj
self:Fire("OnValueChanged", this.text:GetText())
if self.dropdown then
@@ -29,7 +33,7 @@ do
local function GetContentLine()
local frame
if next(contentFrameCache) then
frame = table.remove(contentFrameCache)
frame = tremove(contentFrameCache)
else
frame = CreateFrame("Button", nil, UIParent)
--frame:SetWidth(200)
@@ -129,11 +133,11 @@ do
end
local function textSort(a,b)
return string.upper(a) < string.upper(b)
return upper(a) < upper(b)
end
local sortedlist = {}
local function ToggleDrop(this)
local function ToggleDrop()
local self = this.obj
if self.dropdown then
self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown)
@@ -145,9 +149,9 @@ do
self.dropdown:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
self.dropdown:SetPoint("TOPRIGHT", self.frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 0, 0)
for k, v in pairs(self.list) do
sortedlist[#sortedlist+1] = k
tinsert(sortedlist, k)
end
table.sort(sortedlist, textSort)
sort(sortedlist, textSort)
for i, k in ipairs(sortedlist) do
local f = GetContentLine()
f.text:SetText(k)
@@ -172,18 +176,18 @@ do
end
end
local function OnHide(this)
local function OnHide()
local self = this.obj
if self.dropdown then
self.dropdown = AGSMW:ReturnDropDownFrame(self.dropdown)
end
end
local function Drop_OnEnter(this)
local function Drop_OnEnter()
this.obj:Fire("OnEnter")
end
local function Drop_OnLeave(this)
local function Drop_OnLeave()
this.obj:Fire("OnLeave")
end
@@ -16,6 +16,11 @@ local Media = LibStub("LibSharedMedia-3.0")
AGSMW = AGSMW or {}
local next, ipairs = next, ipairs
local tinsert, tremove = table.insert, table.remove
local GetScreenHeight = GetScreenHeight
AceGUIWidgetLSMlists = {
['font'] = Media:HashTable("font"),
['sound'] = Media:HashTable("sound"),
@@ -156,8 +161,8 @@ do
insets = { left = 11, right = 12, top = 12, bottom = 9 },
}
local function OnMouseWheel(self, dir)
self.slider:SetValue(self.slider:GetValue()+(15*dir*-1))
local function OnMouseWheel()
this.slider:SetValue(this.slider:GetValue()+(15*arg1*-1))
end
local function AddFrame(self, frame)
@@ -166,20 +171,19 @@ do
frame:SetFrameLevel(self:GetFrameLevel() + 100)
if next(self.contentRepo) then
frame:SetPoint("TOPLEFT", self.contentRepo[#self.contentRepo], "BOTTOMLEFT", 0, 0)
frame:SetPoint("TOPLEFT", self.contentRepo[getn(self.contentRepo)], "BOTTOMLEFT", 0, 0)
frame:SetPoint("RIGHT", self.contentframe, "RIGHT", 0, 0)
self.contentframe:SetHeight(self.contentframe:GetHeight() + frame:GetHeight())
self.contentRepo[#self.contentRepo+1] = frame
else
self.contentframe:SetHeight(frame:GetHeight())
frame:SetPoint("TOPLEFT", self.contentframe, "TOPLEFT", 0, 0)
frame:SetPoint("RIGHT", self.contentframe, "RIGHT", 0, 0)
self.contentRepo[1] = frame
end
tinsert(self.contentRepo, frame)
if self.contentframe:GetHeight() > UIParent:GetHeight()*2/5 - 20 then
if self.contentframe:GetHeight() > GetScreenHeight()*2/5 - 20 then
self.scrollframe:SetPoint("BOTTOMRIGHT", self, "BOTTOMRIGHT", -28, 12)
self:SetHeight(UIParent:GetHeight()*2/5)
self:SetHeight(GetScreenHeight()*2/5)
self.slider:Show()
self:SetScript("OnMouseWheel", OnMouseWheel)
self.scrollframe:UpdateScrollChildRect()
@@ -202,15 +206,15 @@ do
end
end
local function slider_OnValueChanged(self, value)
self.frame.scrollframe:SetVerticalScroll(value)
local function slider_OnValueChanged()
this.frame.scrollframe:SetVerticalScroll(arg1)
end
local DropDownCache = {}
function AGSMW:GetDropDownFrame()
local frame
if next(DropDownCache) then
frame = table.remove(DropDownCache)
frame = tremove(DropDownCache)
else
frame = CreateFrame("Frame", nil, UIParent)
frame:SetClampedToScreen(true)
@@ -255,7 +259,7 @@ do
slider:SetScript("OnValueChanged", slider_OnValueChanged)
frame.slider = slider
end
frame:SetHeight(UIParent:GetHeight()*2/5)
frame:SetHeight(GetScreenHeight()*2/5)
frame.slider:SetValue(0)
frame:Show()
return frame
@@ -267,7 +271,7 @@ do
frame:Hide()
frame:SetBackdrop(frameBackdrop)
frame.bgTex:SetTexture(nil)
table.insert(DropDownCache, frame)
tinsert(DropDownCache, frame)
return nil
end
end