Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KLE Skin (took it from ElvUI now and dont forget to add KLE to option…
…aldeps Duffed, ok? ..)
- Loading branch information
Duffed
committed
Mar 20, 2011
1 parent
2f54616
commit 3b8e8fb
Showing
2 changed files
with
118 additions
and
119 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |