update Ace3 skin

This commit is contained in:
Crum
2018-11-15 14:42:45 -06:00
parent 5e1da9cfa3
commit dbdb8066e0
2 changed files with 183 additions and 190 deletions
+174 -181
View File
@@ -4,88 +4,27 @@ local S = E:GetModule("Skins");
--Cache global variables
--Lua functions
local _G = _G
local unpack = unpack
local pairs = pairs
local select, unpack = select, unpack
local getn = table.getn
--WoW API / Variables
local CreateFrame = CreateFrame
local RegisterAsWidget, RegisterAsContainer
local function SetModifiedBackdrop()
if this.backdrop then this = this.backdrop end
this:SetBackdropBorderColor(unpack(E["media"].rgbvaluecolor))
end
local function SetOriginalBackdrop()
if this.backdrop then this = this.backdrop end
this:SetBackdropBorderColor(unpack(E["media"].bordercolor))
end
local function SkinScrollBar(frame, thumbTrim)
if _G[frame:GetName().."BG"] then _G[frame:GetName().."BG"]:SetTexture(nil) end
if _G[frame:GetName().."Track"] then _G[frame:GetName().."Track"]:SetTexture(nil) end
if _G[frame:GetName().."Top"] then
_G[frame:GetName().."Top"]:SetTexture(nil)
_G[frame:GetName().."Bottom"]:SetTexture(nil)
_G[frame:GetName().."Middle"]:SetTexture(nil)
end
if _G[frame:GetName().."ScrollUpButton"] and _G[frame:GetName().."ScrollDownButton"] then
E:StripTextures(_G[frame:GetName().."ScrollUpButton"])
if not _G[frame:GetName().."ScrollUpButton"].icon then
S:HandleNextPrevButton(_G[frame:GetName().."ScrollUpButton"])
S:SquareButton_SetIcon(_G[frame:GetName().."ScrollUpButton"], "UP")
E:Size(_G[frame:GetName().."ScrollUpButton"], _G[frame:GetName().."ScrollUpButton"]:GetWidth() + 7, _G[frame:GetName().."ScrollUpButton"]:GetHeight() + 7)
end
E:StripTextures(_G[frame:GetName().."ScrollDownButton"])
if not _G[frame:GetName().."ScrollDownButton"].icon then
S:HandleNextPrevButton(_G[frame:GetName().."ScrollDownButton"])
S:SquareButton_SetIcon(_G[frame:GetName().."ScrollDownButton"], "DOWN")
E:Size(_G[frame:GetName().."ScrollDownButton"], _G[frame:GetName().."ScrollDownButton"]:GetWidth() + 7, _G[frame:GetName().."ScrollDownButton"]:GetHeight() + 7)
end
if not frame.trackbg then
frame.trackbg = CreateFrame("Frame", nil, frame)
E:Point(frame.trackbg, "TOPLEFT", _G[frame:GetName().."ScrollUpButton"], "BOTTOMLEFT", 0, -1)
E:Point(frame.trackbg, "BOTTOMRIGHT", _G[frame:GetName().."ScrollDownButton"], "TOPRIGHT", 0, 1)
E:SetTemplate(frame.trackbg, "Transparent")
end
if frame:GetThumbTexture() then
if not thumbTrim then thumbTrim = 3 end
frame:GetThumbTexture():SetTexture(nil)
E:Height(frame:GetThumbTexture(), 24)
if not frame.thumbbg then
frame.thumbbg = CreateFrame("Frame", nil, frame)
E:Point(frame.thumbbg, "TOPLEFT", frame:GetThumbTexture(), "TOPLEFT", 2, -thumbTrim)
E:Point(frame.thumbbg, "BOTTOMRIGHT", frame:GetThumbTexture(), "BOTTOMRIGHT", -2, thumbTrim)
E:SetTemplate(frame.thumbbg, "Default", true, true)
frame.thumbbg:SetBackdropColor(0.3, 0.3, 0.3)
if frame.trackbg then
frame.thumbbg:SetFrameLevel(frame.trackbg:GetFrameLevel() + 1)
end
end
end
end
end
local function SkinButton(f, strip, noTemplate)
local name = f:GetName()
if(name) then
if name then
local left = _G[name.."Left"]
local middle = _G[name.."Middle"]
local right = _G[name.."Right"]
if(left) then E:Kill(left) end
if(middle) then E:Kill(middle) end
if(right) then E:Kill(right) end
if left then E:Kill(left) end
if middle then E:Kill(middle) end
if right then E:Kill(right) end
end
if(f.Left) then E:Kill(f.Left) end
if(f.Middle) then E:Kill(f.Middle) end
if(f.Right) then E:Kill(f.Right) end
if f.Left then E:Kill(f.Left) end
if f.Middle then E:Kill(f.Middle) end
if f.Right then E:Kill(f.Right) end
if f.SetNormalTexture then f:SetNormalTexture("") end
if f.SetHighlightTexture then f:SetHighlightTexture("") end
@@ -98,8 +37,27 @@ local function SkinButton(f, strip, noTemplate)
E:SetTemplate(f, "Default", true)
end
HookScript(f, "OnEnter", SetModifiedBackdrop)
HookScript(f, "OnLeave", SetOriginalBackdrop)
HookScript(f, "OnEnter", S.SetModifiedBackdrop)
HookScript(f, "OnLeave", S.SetOriginalBackdrop)
end
local function SkinDropdownPullout(self)
if self.obj.pullout.frame.template and self.obj.pullout.slider.template then return end
if not self.obj.pullout.frame.template then
E:SetTemplate(self.obj.pullout.frame, "Default", true)
end
if not self.obj.pullout.slider.template then
E:SetTemplate(self.obj.pullout.slider, "Default")
E:Point(self.obj.pullout.slider, "TOPRIGHT", self.obj.pullout.frame, "TOPRIGHT", -10, -10)
E:Point(self.obj.pullout.slider, "BOTTOMRIGHT", self.obj.pullout.frame, "BOTTOMRIGHT", -10, 10)
if self.obj.pullout.slider:GetThumbTexture() then
self.obj.pullout.slider:SetThumbTexture(E.media.normTex)
self.obj.pullout.slider:GetThumbTexture():SetVertexColor(unpack(E.media.rgbvaluecolor))
E:Size(self.obj.pullout.slider:GetThumbTexture(), 10, 14)
end
end
end
function S:SkinAce3()
@@ -114,100 +72,112 @@ function S:SkinAce3()
local TYPE = widget.type
if TYPE == "MultiLineEditBox" then
local frame = widget.frame
local scrollBG = widget.scrollBG or select(2, frame:GetChildren())
if not widget.scrollBG.template then
E:SetTemplate(widget.scrollBG, "Default")
if not scrollBG.template then
E:SetTemplate(scrollBG, "Default")
end
SkinButton(widget.button)
SkinScrollBar(widget.scrollBar)
S:HandleScrollBar(widget.scrollBar)
E:Point(widget.scrollBar, "RIGHT", frame, "RIGHT", 0 -4)
E:Point(widget.scrollBG, "TOPRIGHT", widget.scrollBar, "TOPLEFT", -2, 19)
E:Point(widget.scrollBG, "BOTTOMLEFT", widget.button, "TOPLEFT")
E:Point(widget.scrollFrame, "BOTTOMRIGHT", widget.scrollBG, "BOTTOMRIGHT", -4, 8)
E:Point(scrollBG, "TOPRIGHT", widget.scrollBar, "TOPLEFT", -2, 19)
E:Point(scrollBG, "BOTTOMLEFT", widget.button, "TOPLEFT")
E:Point(widget.scrollFrame, "BOTTOMRIGHT", scrollBG, "BOTTOMRIGHT", -4, 8)
elseif TYPE == "CheckBox" then
E:Kill(widget.checkbg)
E:Kill(widget.highlight)
local check = widget.check
local checkbg = widget.checkbg
local highlight = widget.highlight
if not widget.skinnedCheckBG then
widget.skinnedCheckBG = CreateFrame("Frame", nil, widget.frame)
E:SetTemplate(widget.skinnedCheckBG, "Default")
E:Point(widget.skinnedCheckBG, "TOPLEFT", widget.checkbg, "TOPLEFT", 4, -4)
E:Point(widget.skinnedCheckBG, "BOTTOMRIGHT", widget.checkbg, "BOTTOMRIGHT", -4, 4)
end
E:CreateBackdrop(checkbg, "Default")
E:SetInside(checkbg.backdrop, checkbg, 4, 4)
checkbg.backdrop:SetFrameLevel(checkbg.backdrop:GetFrameLevel() + 1)
checkbg:SetTexture("")
checkbg.SetTexture = E.noop
widget.check:SetParent(widget.skinnedCheckBG)
check:SetTexture(E.media.normTex)
check.SetTexture = E.noop
check:SetVertexColor(unpack(E.media.rgbvaluecolor))
E:SetInside(check, checkbg.backdrop)
check:SetParent(checkbg.backdrop)
highlight:SetTexture("")
highlight.SetTexture = E.noop
elseif TYPE == "Dropdown" then
local frame = widget.dropdown
local button = widget.button
local button_cover = widget.button_cover
local text = widget.text
E:StripTextures(frame)
button:ClearAllPoints()
E:Point(button, "RIGHT", frame, "RIGHT", -20, 0)
E:StripTextures(frame)
S:HandleNextPrevButton(button, true)
if not frame.backdrop then
E:CreateBackdrop(frame, "Default")
E:Point(frame.backdrop, "TOPLEFT", 20, -2)
E:Point(frame.backdrop, "BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2)
end
button:SetParent(frame.backdrop)
text:SetParent(frame.backdrop)
HookScript(button, "OnClick", function()
local dropdown = this.obj.pullout
if dropdown.frame then
E:SetTemplate(dropdown.frame, "Default", true)
if dropdown.slider then
E:SetTemplate(dropdown.slider, "Default")
E:Point(dropdown.slider, "TOPRIGHT", dropdown.frame, "TOPRIGHT", -10, -10)
E:Point(dropdown.slider, "BOTTOMRIGHT", dropdown.frame, "BOTTOMRIGHT", -10, 10)
if dropdown.slider:GetThumbTexture() then
dropdown.slider:SetThumbTexture(E["media"].blankTex)
dropdown.slider:GetThumbTexture():SetVertexColor(0.3, 0.3, 0.3)
E:Size(dropdown.slider:GetThumbTexture(), 10, 12)
E:Point(frame.backdrop, "TOPLEFT", 15, -2)
E:Point(frame.backdrop, "BOTTOMRIGHT", -21, 0)
widget.label:ClearAllPoints()
E:Point(widget.label, "BOTTOMLEFT", frame.backdrop, "TOPLEFT", 2, 0)
E:Size(button, 20, 20)
button:ClearAllPoints()
E:Point(button, "RIGHT", frame.backdrop, "RIGHT", -2, 0)
button:SetParent(frame.backdrop)
text:SetParent(frame.backdrop)
HookScript(button, "OnClick", SkinDropdownPullout)
if button_cover then
HookScript(button_cover, "OnClick", SkinDropdownPullout)
end
end
end
end)
elseif TYPE == "LSM30_Font" or TYPE == "LSM30_Sound" or TYPE == "LSM30_Border" or TYPE == "LSM30_Background" or TYPE == "LSM30_Statusbar" then
local frame = widget.frame
local button = frame.dropButton
local text = frame.text
E:StripTextures(frame)
S:HandleNextPrevButton(button, true)
frame.text:ClearAllPoints()
E:Point(frame.text, "RIGHT", button, "LEFT", -2, 0)
button:ClearAllPoints()
E:Point(button, "RIGHT", frame, "RIGHT", -10, -6)
if not frame.backdrop then
E:CreateBackdrop(frame, "Default")
if TYPE == "LSM30_Font" then
E:Point(frame.backdrop, "TOPLEFT", 20, -17)
elseif TYPE == "LSM30_Sound" then
E:Point(frame.backdrop, "TOPLEFT", 20, -17)
end
frame.label:ClearAllPoints()
E:Point(frame.label, "BOTTOMLEFT", frame.backdrop, "TOPLEFT", 2, 0)
text:ClearAllPoints()
E:Point(text, "RIGHT", button, "LEFT", -2, 0)
E:Size(button, 20, 20)
button:ClearAllPoints()
E:Point(button, "RIGHT", frame.backdrop, "RIGHT", -2, 0)
E:Point(frame.backdrop, "TOPLEFT", 0, -21)
E:Point(frame.backdrop, "BOTTOMRIGHT", -4, -1)
if TYPE == "LSM30_Sound" then
widget.soundbutton:SetParent(frame.backdrop)
widget.soundbutton:ClearAllPoints()
E:Point(widget.soundbutton, "LEFT", frame.backdrop, "LEFT", 2, 0)
elseif TYPE == "LSM30_Statusbar" then
E:Point(frame.backdrop, "TOPLEFT", 20, -17)
widget.bar:SetParent(frame.backdrop)
E:SetInside(widget.bar)
elseif TYPE == "LSM30_Border" or TYPE == "LSM30_Background" then
E:Point(frame.backdrop, "TOPLEFT", 42, -16)
widget.bar:ClearAllPoints()
E:Point(widget.bar, "TOPLEFT", frame.backdrop, "TOPLEFT", 2, -2)
E:Point(widget.bar, "BOTTOMRIGHT", button, "BOTTOMLEFT", -1, 0)
--elseif TYPE == "LSM30_Border" or TYPE == "LSM30_Background" then -- Leave this here please. - Azilroka
end
E:Point(frame.backdrop, "BOTTOMRIGHT", button, "BOTTOMRIGHT", 2, -2)
end
button:SetParent(frame.backdrop)
text:SetParent(frame.backdrop)
HookScript(button, "OnClick", function()
local dropdown = this.obj.dropdown
HookScript(button, "OnClick", function(self)
local dropdown = self.obj.dropdown
if dropdown then
E:SetTemplate(dropdown, "Default", true)
if dropdown.slider then
@@ -216,14 +186,14 @@ function S:SkinAce3()
E:Point(dropdown.slider, "BOTTOMRIGHT", dropdown, "BOTTOMRIGHT", -10, 10)
if dropdown.slider:GetThumbTexture() then
dropdown.slider:SetThumbTexture(E["media"].blankTex)
dropdown.slider:GetThumbTexture():SetVertexColor(0.3, 0.3, 0.3)
E:Size(dropdown.slider:GetThumbTexture(), 10, 12)
dropdown.slider:SetThumbTexture(E.media.normTex)
dropdown.slider:GetThumbTexture():SetVertexColor(unpack(E.media.rgbvaluecolor))
E:Size(dropdown.slider:GetThumbTexture(), 10, 14)
end
end
if TYPE == "LSM30_Sound" then
local frame = this.obj.frame
local frame = self.obj.frame
local width = frame:GetWidth()
E:Point(dropdown, "TOPLEFT", frame, "BOTTOMLEFT")
E:Point(dropdown, "TOPRIGHT", frame, "BOTTOMRIGHT", width < 160 and (160 - width) or 30, 0)
@@ -233,35 +203,45 @@ function S:SkinAce3()
elseif TYPE == "EditBox" then
local frame = widget.editbox
local button = widget.button
E:Kill(_G[frame:GetName().."Left"])
E:Kill(_G[frame:GetName().."Middle"])
E:Kill(_G[frame:GetName().."Right"])
E:Height(frame, 17)
E:CreateBackdrop(frame, "Default")
E:Point(frame.backdrop, "TOPLEFT", -2, 0)
E:Point(frame.backdrop, "BOTTOMRIGHT", 2, 0)
E:Point(frame.backdrop, "TOPLEFT", 2, -2)
E:Point(frame.backdrop, "BOTTOMRIGHT", -2, 0)
frame.backdrop:SetParent(widget.frame)
frame:SetParent(frame.backdrop)
frame:SetTextInsets(4, 43, 3, 3)
frame.SetTextInsets = E.noop
SkinButton(button)
elseif TYPE == "Button" then
local frame = widget.frame
SkinButton(frame, nil, true)
E:StripTextures(frame)
E:CreateBackdrop(frame, "Default", true)
E:SetInside(frame.backdrop)
widget.text:SetParent(frame.backdrop)
elseif TYPE == "Button-ElvUI" then
E:Point(button, "RIGHT", frame.backdrop, "RIGHT", -2, 0)
hooksecurefunc(frame, "SetPoint", function(self, a, b, c, d, e)
if d == 7 then
self:SetPoint(a, b, c, 0, e)
end
end)
elseif TYPE == "Button" or TYPE == "Button-ElvUI" then
local frame = widget.frame
SkinButton(frame, nil, true)
E:StripTextures(frame)
E:CreateBackdrop(frame, "Default", true)
E:SetInside(frame.backdrop)
widget.text:SetParent(frame.backdrop)
elseif TYPE == "Keybinding" then
local button = widget.button
local msgframe = widget.msgframe
local msg = widget.msgframe.msg
SkinButton(button)
E:StripTextures(msgframe)
E:CreateBackdrop(msgframe, "Default", true)
E:SetInside(msgframe.backdrop)
@@ -282,9 +262,10 @@ function S:SkinAce3()
E:StripTextures(frame)
E:SetTemplate(frame, "Default")
E:Height(frame, HEIGHT)
frame:SetThumbTexture(E["media"].blankTex)
frame:GetThumbTexture():SetVertexColor(0.3, 0.3, 0.3)
E:Size(frame:GetThumbTexture(), HEIGHT-2, HEIGHT+2)
frame:SetThumbTexture(E.media.normTex)
frame:GetThumbTexture():SetVertexColor(unpack(E.media.rgbvaluecolor))
E:Size(frame:GetThumbTexture(), HEIGHT - 2, HEIGHT - 2)
E:SetTemplate(editbox, "Default")
E:Height(editbox, 15)
@@ -292,12 +273,37 @@ function S:SkinAce3()
E:Point(lowtext, "TOPLEFT", frame, "BOTTOMLEFT", 2, -2)
E:Point(hightext, "TOPRIGHT", frame, "BOTTOMRIGHT", -2, -2)
--[[elseif TYPE == "ColorPicker" then
elseif (TYPE == "ColorPicker" or TYPE == "ColorPicker-ElvUI") then
local frame = widget.frame
local colorSwatch = widget.colorSwatch
]]
if not frame.backdrop then
E:CreateBackdrop(frame, "Default")
end
E:Size(frame.backdrop, 16, 16)
frame.backdrop:ClearAllPoints()
E:Point(frame.backdrop, "LEFT", frame, "LEFT", 4, 0)
frame.backdrop:SetBackdropColor(0, 0, 0, 0)
frame.backdrop.SetBackdropColor = E.noop
colorSwatch:SetTexture(E.media.blankTex)
colorSwatch:ClearAllPoints()
colorSwatch:SetParent(frame.backdrop)
E:SetInside(colorSwatch, frame.backdrop)
if frame.texture then
frame.texture:SetTexture(0, 0, 0, 0)
end
if frame.checkers then
frame.checkers:ClearAllPoints()
frame.checkers:SetDrawLayer("ARTWORK")
frame.checkers:SetParent(frame.backdrop)
E:SetInside(frame.checkers, frame.backdrop)
end
end
return oldRegisterAsWidget(self, widget)
end
AceGUI.RegisterAsWidget = RegisterAsWidget
@@ -309,32 +315,22 @@ function S:SkinAce3()
end
local TYPE = widget.type
if TYPE == "ScrollFrame" then
local frame = widget.scrollbar
SkinScrollBar(frame)
S:HandleScrollBar(widget.scrollbar)
elseif TYPE == "InlineGroup" or TYPE == "TreeGroup" or TYPE == "TabGroup" or TYPE == "Frame" or TYPE == "DropdownGroup" or TYPE == "Window" then
local frame = widget.content:GetParent()
if TYPE == "Frame" then
E:StripTextures(frame)
if(not E.GUIFrame) then
if not E.GUIFrame then
E.GUIFrame = frame
end
for _, child in ipairs({frame:GetChildren()}) do
if child:GetObjectType() == "Button" and child:GetText() then
SkinButton(child)
else
E:StripTextures(child)
end
end
--[[for i=1, frame:GetNumChildren() do
for i = 1, frame:GetNumChildren() do
local child = select(i, frame:GetChildren())
if child:GetObjectType() == "Button" and child:GetText() then
SkinButton(child)
else
E:StripTextures(child)
end
end]]
end
elseif TYPE == "Window" then
E:StripTextures(frame)
S:HandleCloseButton(frame.obj.closebutton)
@@ -345,19 +341,6 @@ function S:SkinAce3()
E:SetTemplate(widget.treeframe, "Transparent")
E:Point(frame, "TOPLEFT", widget.treeframe, "TOPRIGHT", 1, 0)
local oldCreateButton = widget.CreateButton
widget.CreateButton = function(self)
local button = oldCreateButton(self)
E:StripTextures(button.toggle)
button.toggle.SetNormalTexture = E.noop
button.toggle.SetPushedTexture = E.noop
button.toggleText = button.toggle:CreateFontString(nil, "OVERLAY")
E:FontTemplate(button.toggleText, nil, 19)
E:Point(button.toggleText, "CENTER", 0, 0)
button.toggleText:SetText("+")
return button
end
local oldRefreshTree = widget.RefreshTree
widget.RefreshTree = function(self, scrollToSelection)
oldRefreshTree(self, scrollToSelection)
@@ -366,13 +349,22 @@ function S:SkinAce3()
local groupstatus = status.groups
local lines = self.lines
local buttons = self.buttons
local offset = status.scrollvalue
for i, line in pairs(lines) do
local button = buttons[i]
if groupstatus[line.uniquevalue] and button then
button.toggleText:SetText("-")
elseif button then
button.toggleText:SetText("+")
for i = offset + 1, getn(lines) do
local button = buttons[i - offset]
if button then
button.toggle:SetNormalTexture([[Interface\AddOns\ElvUI\media\textures\PlusMinusButton]])
button.toggle:SetPushedTexture([[Interface\AddOns\ElvUI\media\textures\PlusMinusButton]])
button.toggle:SetHighlightTexture("")
if groupstatus[lines[i].uniquevalue] then
button.toggle:GetNormalTexture():SetTexCoord(0.540, 0.965, 0.085, 0.920)
button.toggle:GetPushedTexture():SetTexCoord(0.540, 0.965, 0.085, 0.920)
else
button.toggle:GetNormalTexture():SetTexCoord(0.040, 0.465, 0.085, 0.920)
button.toggle:GetPushedTexture():SetTexCoord(0.040, 0.465, 0.085, 0.920)
end
end
end
end
@@ -387,13 +379,14 @@ function S:SkinAce3()
E:SetTemplate(tab.backdrop, "Transparent")
tab.backdrop:SetFrameLevel(tab:GetFrameLevel() - 1)
E:Point(tab.backdrop, "TOPLEFT", 10, -3)
E:Point(tab.backdrop, "BOTTOMRIGHT", -10, 0)]]
E:Point(tab.backdrop, "BOTTOMRIGHT", -10, 0)--]]
return tab
end
end
if widget.scrollbar then
SkinScrollBar(widget.scrollbar)
S:HandleScrollBar(widget.scrollbar)
end
elseif TYPE == "SimpleGroup" then
local frame = widget.content:GetParent()
@@ -722,7 +722,7 @@ do
self.text = text
text.obj = self
text:ClearAllPoints()
text:SetPoint("RIGHT", right, "RIGHT" ,-43, 2)
text:SetPoint("RIGHT", right, "RIGHT" ,-46, 2)
text:SetPoint("LEFT", left, "LEFT", 25, 2)
local label = frame:CreateFontString(nil,"OVERLAY","GameFontNormalSmall")