Skip to content

Commit

Permalink
KLE Skin (took it from ElvUI now and dont forget to add KLE to option…
Browse files Browse the repository at this point in the history
…aldeps Duffed, ok? ..)
  • Loading branch information
Duffed committed Mar 20, 2011
1 parent 2f54616 commit 3b8e8fb
Show file tree
Hide file tree
Showing 2 changed files with 118 additions and 119 deletions.
2 changes: 1 addition & 1 deletion Tukui/Tukui.toc
Expand Up @@ -8,7 +8,7 @@
## Notes: UI of awesomeness!
## SavedVariables: TukuiData
## SavedVariablesPerCharacter: TukuiDataPerChar
## OptionalDeps: Tukui_ConfigUI, !ClassColors, Clique, Recount, Omen, a, b, nibHideBlackBar, Skada, TelUI_AddonSkins, TinyDPS, Quartz, CooldownToGo, spellstealer
## OptionalDeps: Tukui_ConfigUI, !ClassColors, Clique, Recount, Omen, a, b, nibHideBlackBar, Skada, TelUI_AddonSkins, TinyDPS, Quartz, CooldownToGo, spellstealer, KLE
## X-oUF: oUFTukui

Tukui.xml
235 changes: 117 additions & 118 deletions Tukui/modules/skins/addons/KLE.lua
@@ -1,131 +1,130 @@
-- KLE Skin, credits to Elv22
local T, C, L = unpack(select(2, ...)) -- Import Functions/Constants, Config, Locales


if not IsAddOnLoaded("KLE") or not C.Addon_Skins.KLE then return end

local KLE = KLE
local _G = getfenv(0)
local barSpacing = T.Scale(3, 1)
local borderWidth = T.Scale(2, 2)
local buttonZoom = {.09,.91,.09,.91}

--Hide a frame... FOREVER!
local function kill(frame)
if frame.dead then return end
frame:Hide()
frame:HookScript("OnShow",frame.Hide)
frame.dead = true
local function SkinKLEBar(bar)
-- The main bar
bar:SetTemplate("Default")
bar.bg:SetTexture(nil)
bar.border:Kill()
bar.statusbar:SetStatusBarTexture(C["media"].normTex)
bar.statusbar:ClearAllPoints()
bar.statusbar:SetPoint("TOPLEFT",borderWidth, -borderWidth)
bar.statusbar:SetPoint("BOTTOMRIGHT",-borderWidth, borderWidth)

-- Right Icon
bar.righticon:SetTemplate("Default")
bar.righticon.border:Kill()
bar.righticon.t:SetTexCoord(unpack(buttonZoom))
bar.righticon.t:ClearAllPoints()
bar.righticon.t:SetPoint("TOPLEFT", borderWidth, -borderWidth)
bar.righticon.t:SetPoint("BOTTOMRIGHT", -borderWidth, borderWidth)
bar.righticon.t:SetDrawLayer("ARTWORK")

-- Left Icon
bar.lefticon:SetTemplate("Default")
bar.lefticon.border:Kill()
bar.lefticon.t:SetTexCoord(unpack(buttonZoom))
bar.lefticon.t:ClearAllPoints()
bar.lefticon.t:SetPoint("TOPLEFT",borderWidth, -borderWidth)
bar.lefticon.t:SetPoint("BOTTOMRIGHT",-borderWidth, borderWidth)
bar.lefticon.t:SetDrawLayer("ARTWORK")
end

local dummy = dummy or function() end
--Kill KLE's skinning
KLE.NotifyBarTextureChanged = T.dummy
KLE.NotifyBorderChanged = T.dummy
KLE.NotifyBorderColorChanged = T.dummy
KLE.NotifyBorderEdgeSizeChanged = T.dummy
KLE.NotifyBackgroundTextureChanged = T.dummy
KLE.NotifyBackgroundInsetChanged = T.dummy
KLE.NotifyBackgroundColorChanged = T.dummy

AddonSkins_Mod:RegisterSkin("KLE",function(Skin, skin, Layout, layout, config)
--[[ Kill KLE's skinning ]]
KLE.NotifyBarTextureChanged = dummy
KLE.NotifyBorderChanged = dummy
KLE.NotifyBorderColorChanged = dummy
KLE.NotifyBorderEdgeSizeChanged = dummy
KLE.NotifyBackgroundTextureChanged = dummy
KLE.NotifyBackgroundInsetChanged = dummy
KLE.NotifyBackgroundColorChanged = dummy
--[[ Hook Window Creation ]]
KLE.CreateWindow_ = KLE.CreateWindow
KLE.CreateWindow = function(self, name, width, height)
local win = self:CreateWindow_(name, width, height)
skin:SkinBackgroundFrame(win)
return win
end
-- Skin the pane
skin:SkinFrame(KLE.Pane)
-- Hook Health frames (Skin & spacing)
KLE.LayoutHealthWatchers_ = KLE.LayoutHealthWatchers
KLE.LayoutHealthWatchers = function(self)
self.db.profile.Pane.BarSpacing = config.barSpacing
self:LayoutHealthWatchers_()
for i,hw in ipairs(self.HW) do
if hw:IsShown() then
skin:SkinFrame(hw)
kill(hw.border)
hw.healthbar:SetStatusBarTexture(config.normTexture)
end
end
end
KLE.Alerts.RefreshBars_ = KLE.Alerts.RefreshBars
KLE.Alerts.RefreshBars = function(self)
if self.refreshing then return end
self.refreshing = true
self.db.profile.BarSpacing = config.barSpacing
self.db.profile.IconXOffset = config.barSpacing
self:RefreshBars_()
local i = 1
-- This wastes so much CPU, Please KLE, give us a reference to the bar pool!
while _G["KLEAlertBar"..i] do
local bar = _G["KLEAlertBar"..i]
bar:SetScale(1)
bar:SetAlpha(1)
bar.SetAlpha = dummy
-- F U SCALE!
bar.SetScale = dummy
skin:SkinKLEBar(bar)
i = i + 1
--Hook Window Creation
KLE.CreateWindow_ = KLE.CreateWindow
KLE.CreateWindow = function(self, name, width, height)
local win = self:CreateWindow_(name, width, height)
win:CreateShadow("")
win:SetTemplate("Default")
return win
end

-- Skin the pane
KLE.Pane:SetTemplate("Default")
KLE.Pane:CreateShadow("")

-- Hook Health frames (Skin & spacing)
KLE.LayoutHealthWatchers_ = KLE.LayoutHealthWatchers
KLE.LayoutHealthWatchers = function(self)
self.db.profile.Pane.BarSpacing = barSpacing
self:LayoutHealthWatchers_()
for i,hw in ipairs(self.HW) do
if hw:IsShown() then
hw:SetTemplate("Default")
hw:CreateShadow("")
hw.border:Kill()
hw.healthbar:SetStatusBarTexture(C["media"].normTex)
end
self.refreshing = false
end
KLE.Alerts.Dropdown_ = KLE.Alerts.Dropdown
KLE.Alerts.Dropdown = function(self,...)
self:Dropdown_(...)
self:RefreshBars()
end
KLE.Alerts.CenterPopup_ = KLE.Alerts.CenterPopup
KLE.Alerts.CenterPopup = function(self,...)
self:CenterPopup_(...)
self:RefreshBars()
end
KLE.Alerts.Simple_ = KLE.Alerts.Simple
KLE.Alerts.Simple = function(self,...)
self:Simple_(...)
self:RefreshBars()
end
function Skin:SkinKLEBar(bar)
-- The main bar
self:SkinFrame(bar)
bar.bg:SetTexture(nil)
kill(bar.border)
bar.statusbar:SetStatusBarTexture(config.normTexture)
bar.statusbar:ClearAllPoints()
bar.statusbar:SetPoint("TOPLEFT",config.borderWidth, -config.borderWidth)
bar.statusbar:SetPoint("BOTTOMRIGHT",-config.borderWidth, config.borderWidth)
-- Right Icon
self:SkinFrame(bar.righticon)
kill(bar.righticon.border)
bar.righticon.t:SetTexCoord(unpack(config.buttonZoom))
bar.righticon.t:ClearAllPoints()
bar.righticon.t:SetPoint("TOPLEFT",config.borderWidth, -config.borderWidth)
bar.righticon.t:SetPoint("BOTTOMRIGHT",-config.borderWidth, config.borderWidth)
bar.righticon.t:SetDrawLayer("ARTWORK")
-- Left Icon
self:SkinFrame(bar.lefticon)
kill(bar.lefticon.border)
bar.lefticon.t:SetTexCoord(unpack(config.buttonZoom))
bar.lefticon.t:ClearAllPoints()
bar.lefticon.t:SetPoint("TOPLEFT",config.borderWidth, -config.borderWidth)
bar.lefticon.t:SetPoint("BOTTOMRIGHT",-config.borderWidth, config.borderWidth)
bar.lefticon.t:SetDrawLayer("ARTWORK")
end

KLE.Alerts.RefreshBars_ = KLE.Alerts.RefreshBars
KLE.Alerts.RefreshBars = function(self)
if self.refreshing then return end
self.refreshing = true
self.db.profile.BarSpacing = barSpacing
self.db.profile.IconXOffset = barSpacing
self:RefreshBars_()
local i = 1
while _G["KLEAlertBar"..i] do
local bar = _G["KLEAlertBar"..i]
bar:SetScale(1)
bar:SetAlpha(1)
bar.SetAlpha = T.dummy
bar.SetScale = T.dummy
SkinKLEBar(bar)
i = i + 1
end
-- Force some updates
KLE:LayoutHealthWatchers()
KLE.Alerts:RefreshBars()
kill(KLE.Pane.border)
if not KLEDB then KLEDB = {} end
if not KLEDB["profiles"] then KLEDB["profiles"] = {} end
if not KLEDB["profiles"][T.myname.." - "..GetRealmName()] then KLEDB["profiles"][T.myname.." - "..GetRealmName()] = {} end
if not KLEDB["profiles"][T.myname.." - "..GetRealmName()]["Globals"] then KLEDB["profiles"][T.myname.." - "..GetRealmName()]["Globals"] = {} end
KLEDB["profiles"][T.myname.." - "..GetRealmName()]["Globals"]["BackgroundTexture"] = "Tukui Blank"
KLEDB["profiles"][T.myname.." - "..GetRealmName()]["Globals"]["BarTexture"] = "Tukui Statusbar"
KLEDB["profiles"][T.myname.." - "..GetRealmName()]["Globals"]["Border"] = "None"
KLEDB["profiles"][T.myname.." - "..GetRealmName()]["Globals"]["Font"] = "Tukui Font"
KLEDB["profiles"][T.myname.." - "..GetRealmName()]["Globals"]["TimerFont"] = "Tukui Font"
end)
self.refreshing = false
end

KLE.Alerts.Dropdown_ = KLE.Alerts.Dropdown
KLE.Alerts.Dropdown = function(self,...)
self:Dropdown_(...)
self:RefreshBars()
end

KLE.Alerts.CenterPopup_ = KLE.Alerts.CenterPopup
KLE.Alerts.CenterPopup = function(self,...)
self:CenterPopup_(...)
self:RefreshBars()
end

KLE.Alerts.Simple_ = KLE.Alerts.Simple
KLE.Alerts.Simple = function(self,...)
self:Simple_(...)
self:RefreshBars()
end

-- Force some updates
KLE:LayoutHealthWatchers()
KLE.Alerts:RefreshBars()
KLE.Pane.border:Kill()

--Force some default profile options
if not KLEDB then KLEDB = {} end
if not KLEDB["profiles"] then KLEDB["profiles"] = {} end
if not KLEDB["profiles"][T.myname.." - "..GetRealmName()] then KLEDB["profiles"][T.myname.." - "..T.myrealm] = {} end
if not KLEDB["profiles"][T.myname.." - "..GetRealmName()]["Globals"] then KLEDB["profiles"][T.myname.." - "..T.myrealm]["Globals"] = {} end
KLEDB["profiles"][T.myname.." - "..T.myrealm]["Globals"]["BackgroundTexture"] = "Tukui Blank"
KLEDB["profiles"][T.myname.." - "..T.myrealm]["Globals"]["BarTexture"] = "Tukui Statusbar"
KLEDB["profiles"][T.myname.." - "..T.myrealm]["Globals"]["Border"] = "None"
KLEDB["profiles"][T.myname.." - "..T.myrealm]["Globals"]["Font"] = "Tukui Normal Font"
KLEDB["profiles"][T.myname.." - "..T.myrealm]["Globals"]["TimerFont"] = "Tukui Normal Font"

0 comments on commit 3b8e8fb

Please sign in to comment.