From 8ac54ea8fbceaf4fd902849bcc12726722d8dcb3 Mon Sep 17 00:00:00 2001 From: Steven Jackson Date: Wed, 9 Jul 2014 07:44:18 -0500 Subject: [PATCH] Remaining font configs fixed --- Interface/AddOns/SVUI/packages/actionbar/SVBar.lua | 59 +++----- Interface/AddOns/SVUI/packages/unit/SVUnit.lua | 91 ++++++++++++ .../AddOns/SVUI/packages/unit/common/_load.xml | 2 - .../AddOns/SVUI/packages/unit/common/media.lua | 148 -------------------- Interface/AddOns/SVUI/system/classes/Database.lua | 9 +- Interface/AddOns/SVUI/system/presets.lua | 8 +- Interface/AddOns/SVUI_ConfigOMatic/modules/bar.lua | 32 ++++- 7 files changed, 155 insertions(+), 194 deletions(-) delete mode 100644 Interface/AddOns/SVUI/packages/unit/common/media.lua diff --git a/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua b/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua index a3413d1..1524896 100644 --- a/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua +++ b/Interface/AddOns/SVUI/packages/actionbar/SVBar.lua @@ -250,39 +250,26 @@ local Bar_OnLeave = function(self) end end; -local function FixKeybindText(button) +function MOD:FixKeybindText(button) local hotkey = _G[button:GetName()..'HotKey'] local hotkeyText = hotkey:GetText() if hotkeyText then - hotkeyText = gsub(hotkeyText, 'SHIFT%-', "S") - hotkeyText = gsub(hotkeyText, 'ALT%-', "A") - hotkeyText = gsub(hotkeyText, 'CTRL%-', "C") - hotkeyText = gsub(hotkeyText, 'BUTTON', "MB") - hotkeyText = gsub(hotkeyText, 'MOUSEWHEELUP', "MU") - hotkeyText = gsub(hotkeyText, 'MOUSEWHEELDOWN', "MD") - hotkeyText = gsub(hotkeyText, 'NUMPAD', "NP") - hotkeyText = gsub(hotkeyText, 'PAGEUP', "PgU") - hotkeyText = gsub(hotkeyText, 'PAGEDOWN', "PgD") - hotkeyText = gsub(hotkeyText, 'SPACE', "SP") - hotkeyText = gsub(hotkeyText, 'INSERT', "IN") - hotkeyText = gsub(hotkeyText, 'HOME', "HM") - hotkeyText = gsub(hotkeyText, 'DELETE', "DEL") - hotkeyText = gsub(hotkeyText, 'NMULTIPLY', "*") - hotkeyText = gsub(hotkeyText, 'NMINUS', "N-") - hotkeyText = gsub(hotkeyText, 'NPLUS', "N+") - -- hotkeyText = gsub(hotkeyText, 'SHIFT%-', L['KEY_SHIFT']) - -- hotkeyText = gsub(hotkeyText, 'ALT%-', L['KEY_ALT']) - -- hotkeyText = gsub(hotkeyText, 'CTRL%-', L['KEY_CTRL']) - -- hotkeyText = gsub(hotkeyText, 'BUTTON', L['KEY_MOUSEBUTTON']) - -- hotkeyText = gsub(hotkeyText, 'MOUSEWHEELUP', L['KEY_MOUSEWHEELUP']) - -- hotkeyText = gsub(hotkeyText, 'MOUSEWHEELDOWN', L['KEY_MOUSEWHEELDOWN']) - -- hotkeyText = gsub(hotkeyText, 'NUMPAD', L['KEY_NUMPAD']) - -- hotkeyText = gsub(hotkeyText, 'PAGEUP', L['KEY_PAGEUP']) - -- hotkeyText = gsub(hotkeyText, 'PAGEDOWN', L['KEY_PAGEDOWN']) - -- hotkeyText = gsub(hotkeyText, 'SPACE', L['KEY_SPACE']) - -- hotkeyText = gsub(hotkeyText, 'INSERT', L['KEY_INSERT']) - -- hotkeyText = gsub(hotkeyText, 'HOME', L['KEY_HOME']) - -- hotkeyText = gsub(hotkeyText, 'DELETE', L['KEY_DELETE']) + hotkeyText = hotkeyText:gsub('SHIFT%-', "S") + hotkeyText = hotkeyText:gsub('ALT%-', "A") + hotkeyText = hotkeyText:gsub('CTRL%-', "C") + hotkeyText = hotkeyText:gsub('BUTTON', "B") + hotkeyText = hotkeyText:gsub('MOUSEWHEELUP', "WU") + hotkeyText = hotkeyText:gsub('MOUSEWHEELDOWN', "WD") + hotkeyText = hotkeyText:gsub('NUMPAD', "N") + hotkeyText = hotkeyText:gsub('PAGEUP', "PgU") + hotkeyText = hotkeyText:gsub('PAGEDOWN', "PgD") + hotkeyText = hotkeyText:gsub('SPACE', "SP") + hotkeyText = hotkeyText:gsub('INSERT', "INS") + hotkeyText = hotkeyText:gsub('HOME', "HM") + hotkeyText = hotkeyText:gsub('DELETE', "DEL") + hotkeyText = hotkeyText:gsub('NMULTIPLY', "N*") + hotkeyText = hotkeyText:gsub('NMINUS', "N-") + hotkeyText = hotkeyText:gsub('NPLUS', "N+") hotkey:SetText(hotkeyText) end; hotkey:ClearAllPoints() @@ -327,7 +314,7 @@ local function SaveActionButton(parent) local button = parent:GetName() local cooldown = _G[button.."Cooldown"] cooldown.SizeOverride = MOD.db.cooldownSize - FixKeybindText(parent) + MOD:FixKeybindText(parent) if not MOD.Storage.Cache[parent] then SuperVillain:AddCD(cooldown) MOD.Storage.Cache[parent] = true @@ -432,7 +419,7 @@ local function ModifyActionButton(parent) count:ClearAllPoints() count:SetPoint("BOTTOMRIGHT",1,1) count:SetShadowOffset(1,-1) - count:SetFontTemplate(LSM:Fetch("font",MOD.db.font),MOD.db.fontSize,MOD.db.fontOutline) + count:SetFontTemplate(LSM:Fetch("font",MOD.db.countFont),MOD.db.countFontSize,MOD.db.countFontOutline) end; if icon then icon:SetTexCoord(.1,.9,.1,.9) @@ -443,7 +430,7 @@ local function ModifyActionButton(parent) if MOD.db.hotkeytext then hotkey:ClearAllPoints() hotkey:SetAllPoints() - hotkey:SetFont(CLEANFONT,10,"OUTLINE") + hotkey:SetFontTemplate(LSM:Fetch("font",MOD.db.font),MOD.db.fontSize,MOD.db.fontOutline) hotkey:SetJustifyH("RIGHT") hotkey:SetJustifyV("TOP") hotkey:SetShadowOffset(1,-1) @@ -452,7 +439,7 @@ local function ModifyActionButton(parent) parent.style:SetDrawLayer('BACKGROUND',-7) end; parent.FlyoutUpdateFunc = SetFlyoutButton; - FixKeybindText(parent) + MOD:FixKeybindText(parent) end; do @@ -541,7 +528,7 @@ function MOD:UpdateBarBindings(pet,stance) local binding = GetBindingKey(key) _G["SVUI_StanceBarButton"..i.."HotKey"]:Show() _G["SVUI_StanceBarButton"..i.."HotKey"]:SetText(binding) - FixKeybindText(_G["SVUI_StanceBarButton"..i]) + MOD:FixKeybindText(_G["SVUI_StanceBarButton"..i]) else _G["SVUI_StanceBarButton"..i.."HotKey"]:Hide() end @@ -556,7 +543,7 @@ function MOD:UpdateBarBindings(pet,stance) local binding = GetBindingKey(key) _G["PetActionButton"..i.."HotKey"]:Show() _G["PetActionButton"..i.."HotKey"]:SetText(binding) - FixKeybindText(_G["PetActionButton"..i]) + MOD:FixKeybindText(_G["PetActionButton"..i]) else _G["PetActionButton"..i.."HotKey"]:Hide() end; diff --git a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua index c05363c..ff95bd1 100644 --- a/Interface/AddOns/SVUI/packages/unit/SVUnit.lua +++ b/Interface/AddOns/SVUI/packages/unit/SVUnit.lua @@ -50,6 +50,15 @@ MODULE DATA ]]-- local LoadedBasicFrames, LoadedGroupFrames, LoadedExtraFrames; local BasicFrames, GroupFrames, ExtraFrames = {},{},{} +local CURRENT_BAR_TEXTURE = [[Interface\AddOns\SVUI\assets\artwork\Bars\DEFAULT]]; +local CURRENT_AURABAR_TEXTURE = [[Interface\AddOns\SVUI\assets\artwork\Bars\GLOWING]]; +local CURRENT_FONT = [[Interface\AddOns\SVUI\assets\fonts\Names.ttf]]; +local CURRENT_FONTSIZE = 10; +local CURRENT_FONTOUTLINE = "OUTLINE"; +local CURRENT_AURABAR_FONT = [[Interface\AddOns\SVUI\assets\fonts\Alert.ttf]]; +local CURRENT_AURABAR_FONTSIZE = 14 +local CURRENT_AURABAR_FONTOUTLINE = "NONE" +local INIT_UPDATE = false; --[[ ########################################################## LOCAL FUNCTIONS @@ -74,6 +83,18 @@ local KillBlizzardUnit = function(unit) if p then p:UnregisterAllEvents()end end end + +local function UpdateUnitMediaLocals() + CURRENT_BAR_TEXTURE = LSM:Fetch("statusbar", MOD.db.statusbar) + CURRENT_AURABAR_TEXTURE = LSM:Fetch("statusbar", MOD.db.auraBarStatusbar); + CURRENT_FONT = LSM:Fetch("font", MOD.db.font) + CURRENT_FONTSIZE = MOD.db.fontSize + CURRENT_FONTOUTLINE = MOD.db.fontOutline + CURRENT_AURABAR_FONT = LSM:Fetch("font", MOD.db.auraFont); + CURRENT_AURABAR_FONTSIZE = MOD.db.auraFontSize + CURRENT_AURABAR_FONTOUTLINE = MOD.db.auraFontOutline + INIT_UPDATE = true +end --[[ ########################################################## INNER CLASSES @@ -144,6 +165,75 @@ function oUF_SuperVillain:DisableBlizzard(unit) end end +function MOD:RefreshUnitColors() + local db = SuperVillain.db.media.unitframes + for i, setting in pairs(db) do + if setting and type(setting) == "table" then + if(setting[1]) then + oUF_SuperVillain.colors[i] = setting + else + local bt = {} + for x, color in pairs(setting) do + if(color)then + bt[x] = color + end + oUF_SuperVillain.colors[i] = bt + end + end + elseif setting then + oUF_SuperVillain.colors[i] = setting + end + end + local r, g, b = db.health[1], db.health[2], db.health[3] + oUF_SuperVillain.colors.smooth = {1, 0, 0, 1, 1, 0, r, g, b} +end + +function MOD:RefreshUnitMedia(frame, updateUpvalues) + if(not frame or not self.db or (self.db and self.db.enable ~= true)) then return end + if((not INIT_UPDATE) or updateUpvalues == true) then UpdateUnitMediaLocals() end + local db = self.db + local unitDB = frame.db + if(unitDB and unitDB.enable) then + local panel = frame.InfoPanel + if(panel) then + if(panel.Name and unitDB.name) then + panel.Name:SetFont(LSM:Fetch("font", unitDB.name.font), unitDB.name.fontSize, unitDB.name.fontOutline) + end + if(panel.Health) then + panel.Health:SetFont(CURRENT_FONT, CURRENT_FONTSIZE, CURRENT_FONTOUTLINE) + end + if(panel.Power) then + panel.Power:SetFont(CURRENT_FONT, CURRENT_FONTSIZE, CURRENT_FONTOUTLINE) + end + if(panel.Misc) then + panel.Misc:SetFont(CURRENT_FONT, CURRENT_FONTSIZE, CURRENT_FONTOUTLINE) + end + end + if(frame.Power and (unitDB.power and unitDB.power.enable)) then + frame.Power:SetStatusBarTexture(CURRENT_BAR_TEXTURE) + end + if(frame.AuraBars and (unitDB.aurabar and unitDB.aurabar.enable)) then + local ab = frame.AuraBars + ab.auraBarTexture = CURRENT_AURABAR_TEXTURE + ab.textFont = CURRENT_AURABAR_FONT + ab.textSize = CURRENT_AURABAR_FONTSIZE + ab.textOutline = CURRENT_AURABAR_FONTOUTLINE + end + if(frame.Buffs and (unitDB.buffs and unitDB.buffs.enable)) then + local buffs = frame.Buffs + buffs.textFont = CURRENT_AURABAR_FONT + buffs.textSize = CURRENT_AURABAR_FONTSIZE + buffs.textOutline = CURRENT_AURABAR_FONTOUTLINE + end + if(frame.Debuffs and (unitDB.debuffs and unitDB.debuffs.enable)) then + local debuffs = frame.Debuffs + debuffs.textFont = CURRENT_AURABAR_FONT + debuffs.textSize = CURRENT_AURABAR_FONTSIZE + debuffs.textOutline = CURRENT_AURABAR_FONTOUTLINE + end + end +end + function MOD:DetachSubFrames(...) for i = 1, select("#", ...) do local frame = select(i,...) @@ -269,6 +359,7 @@ end function MOD:RefreshAllUnitMedia() if(not self.db or (self.db and self.db.enable ~= true)) then return end + UpdateUnitMediaLocals() self:RefreshUnitColors() -- [[ FRAMES ]] -- for unit in pairs(BasicFrames)do diff --git a/Interface/AddOns/SVUI/packages/unit/common/_load.xml b/Interface/AddOns/SVUI/packages/unit/common/_load.xml index 554b3e0..3a9df74 100644 --- a/Interface/AddOns/SVUI/packages/unit/common/_load.xml +++ b/Interface/AddOns/SVUI/packages/unit/common/_load.xml @@ -1,8 +1,6 @@ -