Commit f5be340b authored by Simpy's avatar Simpy 🐹

12.01

parents 966a7016 95bd5b04
......@@ -418,7 +418,7 @@ function E:UpdateBorderColors()
local r, g, b = unpack(E.media.bordercolor)
for frame in pairs(E.frames) do
if frame and frame.template and not frame:IsForbidden() then
if not (frame.ignoreUpdates or frame.ignoreBorderColors) and (frame.template == 'Default' or frame.template == 'Transparent') then
if not (frame.ignoreUpdates or frame.forcedBorderColors) and (frame.template == 'Default' or frame.template == 'Transparent') then
frame:SetBackdropBorderColor(r, g, b)
end
else
......@@ -429,7 +429,7 @@ function E:UpdateBorderColors()
local r2, g2, b2 = unpack(E.media.unitframeBorderColor)
for frame in pairs(E.unitFrameElements) do
if frame and frame.template and not frame:IsForbidden() then
if not (frame.ignoreUpdates or frame.ignoreBorderColors) and (frame.template == 'Default' or frame.template == 'Transparent') then
if not (frame.ignoreUpdates or frame.forcedBorderColors) and (frame.template == 'Default' or frame.template == 'Transparent') then
frame:SetBackdropBorderColor(r2, g2, b2)
end
else
......
......@@ -280,7 +280,7 @@ local blacklistedKeys = {
},
unitframe = {
aurafilters = true,
buffwatch = true,
aurawatch = true,
effectiveHealth = true,
effectivePower = true,
effectiveAura = true,
......@@ -318,7 +318,7 @@ D.GeneratedKeys = {
},
unitframe = {
aurafilters = true,
buffwatch = true
aurawatch = true
},
nameplate = {
filters = true
......@@ -365,8 +365,8 @@ local function GetProfileData(profileType)
profileData.unitframe = {}
profileData.unitframe.aurafilters = {}
profileData.unitframe.aurafilters = E:CopyTable(profileData.unitframe.aurafilters, ElvDB.global.unitframe.aurafilters)
profileData.unitframe.buffwatch = {}
profileData.unitframe.buffwatch = E:CopyTable(profileData.unitframe.buffwatch, ElvDB.global.unitframe.buffwatch)
profileData.unitframe.aurawatch = {}
profileData.unitframe.aurawatch = E:CopyTable(profileData.unitframe.aurawatch, ElvDB.global.unitframe.aurawatch)
profileData = E:RemoveTableDuplicates(profileData, G, D.GeneratedKeys.global)
profileKey = 'filters'
elseif profileType == 'styleFilters' then
......
......@@ -202,7 +202,9 @@ local function OnShow(self, r, g, b)
self.text:FontTemplate()
self.text:SetTextColor(r, g, b)
self:SetBackdropBorderColor(r, g, b)
self.forcedBorderColors = {r, g, b}
end
local function UpdateColors()
......@@ -252,7 +254,6 @@ local function UpdateMover(name, parent, textString, overlay, snapOffset, postdr
f.configString = configString
f.perferCorners = perferCorners
f.ignoreSizeChanged = ignoreSizeChanged
f.ignoreBorderColors = true
holder.mover = f
parent.mover = f
......
......@@ -980,6 +980,7 @@ function E:StaticPopup_Show(which, text_arg1, text_arg2, data)
local button1 = _G[dialog:GetName()..'Button1']
local button2 = _G[dialog:GetName()..'Button2']
local button3 = _G[dialog:GetName()..'Button3']
local button4 = _G[dialog:GetName()..'Button4']
do --If there is any recursion in this block, we may get errors (tempButtonLocs is static). If you have to recurse, we'll have to create a new table each time.
assert(#tempButtonLocs == 0); --If this fails, we're recursing. (See the table.wipe at the end of the block)
......@@ -987,6 +988,7 @@ function E:StaticPopup_Show(which, text_arg1, text_arg2, data)
tinsert(tempButtonLocs, button1)
tinsert(tempButtonLocs, button2)
tinsert(tempButtonLocs, button3)
tinsert(tempButtonLocs, button4)
for i=#tempButtonLocs, 1, -1 do
--Do this stuff before we move it. (This is why we go back-to-front)
......@@ -1183,12 +1185,6 @@ function E:Contruct_StaticPopups()
E.StaticPopupFrames[index]:SetScript('OnUpdate', E.StaticPopup_OnUpdate)
E.StaticPopupFrames[index]:SetScript('OnEvent', E.StaticPopup_OnEvent)
for i = 1, 3 do
_G['ElvUI_StaticPopup'..index..'Button'..i]:SetScript('OnClick', function(button)
E.StaticPopup_OnClick(button:GetParent(), button:GetID())
end)
end
_G['ElvUI_StaticPopup'..index..'EditBox']:SetScript('OnEnterPressed', E.StaticPopup_EditBoxOnEnterPressed)
_G['ElvUI_StaticPopup'..index..'EditBox']:SetScript('OnEscapePressed', E.StaticPopup_EditBoxOnEscapePressed)
_G['ElvUI_StaticPopup'..index..'EditBox']:SetScript('OnTextChanged', E.StaticPopup_EditBoxOnTextChanged)
......@@ -1200,8 +1196,14 @@ function E:Contruct_StaticPopups()
E.StaticPopupFrames[index].Border:StripTextures()
E.StaticPopupFrames[index]:SetTemplate('Transparent')
for i = 1, 3 do
Skins:HandleButton(_G['ElvUI_StaticPopup'..index..'Button'..i])
for i = 1, 4 do
local button = _G['ElvUI_StaticPopup'..index..'Button'..i]
button:SetFrameLevel(button:GetFrameLevel() + 1)
button:SetScript('OnClick', function(btn)
E.StaticPopup_OnClick(btn:GetParent(), btn:GetID())
end)
Skins:HandleButton(button)
end
_G['ElvUI_StaticPopup'..index..'CheckButton']:Size(24)
......
......@@ -12,6 +12,7 @@ local GetNumAddOns = GetNumAddOns
local GetRealZoneText = GetRealZoneText
local GetSpecialization = GetSpecialization
local GetSpecializationInfo = GetSpecializationInfo
local UNKNOWN = UNKNOWN
function E:AreOtherAddOnsEnabled()
local EP, addons, plugins = E.Libs.EP.plugins
......@@ -86,7 +87,7 @@ local EnglishSpecName = {
}
local function GetSpecName()
return EnglishSpecName[GetSpecializationInfo(GetSpecialization())]
return EnglishSpecName[GetSpecializationInfo(GetSpecialization())] or UNKNOWN
end
function E:CreateStatusContent(num, width, parent, anchorTo, content)
......@@ -320,7 +321,7 @@ function E:UpdateStatusFrame()
local Section3 = StatusFrame.Section3
Section3.Content.Line4.Text:SetFormattedText('Specialization: |cff4beb2c%s|r', GetSpecName())
Section3.Content.Line5.Text:SetFormattedText('Level: |cff4beb2c%s|r', E.mylevel)
Section3.Content.Line6.Text:SetFormattedText('Zone: |cff4beb2c%s|r', GetRealZoneText())
Section3.Content.Line6.Text:SetFormattedText('Zone: |cff4beb2c%s|r', GetRealZoneText() or UNKNOWN)
StatusFrame.TitleLogoFrame.LogoTop:SetVertexColor(unpack(E.media.rgbvaluecolor))
end
......
......@@ -8,7 +8,8 @@ local EnumerateFrames = EnumerateFrames
local hooksecurefunc = hooksecurefunc
local CreateFrame = CreateFrame
local backdropr, backdropg, backdropb, backdropa, borderr, borderg, borderb = 0, 0, 0, 1, 0, 0, 0
local backdropr, backdropg, backdropb, backdropa = 0, 0, 0, 1
local borderr, borderg, borderb, bordera = 0, 0, 0, 1
-- 8.2 restricted frame check
function E:SetPointsRestricted(frame)
......@@ -47,7 +48,7 @@ local function DisablePixelSnap(frame)
end
local function GetTemplate(template, isUnitFrameElement)
backdropa = 1
backdropa, bordera = 1, 1
if template == 'ClassColor' then
local color = E:ClassColor(E.myclass)
......@@ -170,10 +171,12 @@ local function SetTemplate(frame, template, glossTex, ignoreUpdates, forcePixelM
end
end
if not frame.ignoreBorderColors then
frame:SetBackdropBorderColor(borderr, borderg, borderb)
if frame.forcedBorderColors then
borderr, borderg, borderb, bordera = unpack(frame.forcedBorderColors)
end
frame:SetBackdropBorderColor(borderr, borderg, borderb, bordera)
if not frame.ignoreUpdates then
if frame.isUnitFrameElement then
E.unitFrameElements[frame] = true
......
## Interface: 90001
## Author: Elv, Simpy
## Version: 12.00
## Version: 12.01
## Title: |cff1784d1ElvUI|r
## Notes: User Interface replacement AddOn for World of Warcraft.
## SavedVariables: ElvDB, ElvPrivateDB
......
......@@ -135,9 +135,21 @@ function LO:ToggleChatTabPanels(rightOverride, leftOverride)
end
end
function LO:SetDataPanelStyle()
_G.LeftChatToggleButton:SetTemplate(E.db.datatexts.panels.LeftChatDataPanel.backdrop and (E.db.datatexts.panels.LeftChatDataPanel.panelTransparency and 'Transparent' or 'Default') or 'NoBackdrop', true)
_G.RightChatToggleButton:SetTemplate(E.db.datatexts.panels.RightChatDataPanel.backdrop and (E.db.datatexts.panels.RightChatDataPanel.panelTransparency and 'Transparent' or 'Default') or 'NoBackdrop', true)
do
local function DataPanelStyle(panel, db)
panel.forcedBorderColors = (db.border == false and {0,0,0,0}) or nil
panel:SetTemplate(db.backdrop and (db.panelTransparency and 'Transparent' or 'Default') or 'NoBackdrop', true)
if db.border ~= nil then
if panel.iborder then panel.iborder:SetShown(db.border) end
if panel.oborder then panel.oborder:SetShown(db.border) end
end
end
function LO:SetDataPanelStyle()
DataPanelStyle(_G.LeftChatToggleButton, E.db.datatexts.panels.LeftChatDataPanel)
DataPanelStyle(_G.RightChatToggleButton, E.db.datatexts.panels.RightChatDataPanel)
end
end
local barHeight = BAR_HEIGHT + 1
......
......@@ -165,10 +165,10 @@ local function Update(self, event, unit)
local cur, max = UnitHealth(unit), UnitHealthMax(unit)
element:SetMinMaxValues(0, max)
if not UnitIsConnected(unit) then
element:SetValue(max)
else
if(UnitIsConnected(unit)) then
element:SetValue(cur)
else
element:SetValue(max)
end
element.cur = cur
......
......@@ -37,8 +37,9 @@ The following options are listed by priority. The first check that returns true
.colorPower - Use `self.colors.power[token]` to color the bar based on the unit's power type. This method will
fall-back to `:GetAlternativeColor()` if it can't find a color matching the token. If this function
isn't defined, then it will attempt to color based upon the alternative power colors returned by
[UnitPowerType](http://wowprogramming.com/docs/api/UnitPowerType.html). Finally, if these aren't
defined, then it will attempt to color the bar based upon `self.colors.power[type]` (boolean)
[UnitPowerType](http://wowprogramming.com/docs/api/UnitPowerType.html). If these aren't
defined, then it will attempt to color the bar based upon `self.colors.power[type]`. In case of
failure it'll default to `self.colors.power.MANA` (boolean)
.colorClass - Use `self.colors.class[class]` to color the bar based on unit class. `class` is defined by the
second return of [UnitClass](http://wowprogramming.com/docs/api/UnitClass.html) (boolean)
.colorClassNPC - Use `self.colors.class[class]` to color the bar if the unit is a NPC (boolean)
......@@ -119,7 +120,7 @@ local function UpdateColor(self, event, unit)
if(self.unit ~= unit) then return end
local element = self.Power
local ptype, ptoken, altR, altG, altB = UnitPowerType(unit)
local pType, pToken, altR, altG, altB = UnitPowerType(unit)
local r, g, b, t, atlas
if(element.colorDisconnected and not UnitIsConnected(unit)) then
......@@ -130,16 +131,18 @@ local function UpdateColor(self, event, unit)
t = self.colors.threat[UnitThreatSituation('player', unit)]
elseif(element.colorPower) then
if(element.displayType ~= ALTERNATE_POWER_INDEX) then
t = self.colors.power[ptoken or ptype]
t = self.colors.power[pToken]
if(not t) then
if(element.GetAlternativeColor) then
r, g, b = element:GetAlternativeColor(unit, ptype, ptoken, altR, altG, altB)
r, g, b = element:GetAlternativeColor(unit, pType, pToken, altR, altG, altB)
elseif(altR) then
r, g, b = altR, altG, altB
if(r > 1 or g > 1 or b > 1) then
-- BUG: As of 7.0.3, altR, altG, altB may be in 0-1 or 0-255 range.
r, g, b = r / 255, g / 255, b / 255
end
else
t = self.colors.power[pType] or self.colors.power.MANA
end
end
else
......@@ -230,10 +233,10 @@ local function Update(self, event, unit)
element:SetMinMaxValues(min, max)
if not UnitIsConnected(unit) then
element:SetValue(max)
else
if(UnitIsConnected(unit)) then
element:SetValue(cur)
else
element:SetValue(max)
end
element.cur = cur
......
......@@ -64,13 +64,17 @@ local function Update(self, event, unit)
element:PreUpdate(unit)
end
local _, _, _, startTime, endTime, _, _, _, spellID = UnitCastingInfo(unit)
local mainPowerType = UnitPowerType(unit)
local hasAltManaBar = ALT_MANA_BAR_PAIR_DISPLAY_INFO[playerClass] and ALT_MANA_BAR_PAIR_DISPLAY_INFO[playerClass][mainPowerType]
local mainCost, altCost = 0, 0
local mainType = UnitPowerType(unit)
local mainMax = UnitPowerMax(unit, mainType)
local isPlayer = UnitIsUnit('player', unit)
local altManaInfo = isPlayer and ALT_MANA_BAR_PAIR_DISPLAY_INFO[playerClass]
local hasAltManaBar = altManaInfo and altManaInfo[mainType]
local _, _, _, startTime, endTime, _, _, _, spellID = UnitCastingInfo(unit)
if(event == 'UNIT_SPELLCAST_START' and startTime ~= endTime) then
local costTable = GetSpellPowerCost(spellID)
local requiresAura = isPlayer and #costTable > 1
for _, costInfo in next, costTable do
-- costInfo content:
-- - name: string (powerToken)
......@@ -81,12 +85,15 @@ local function Update(self, event, unit)
-- - minCost: number
-- - hasRequiredAura: boolean
-- - requiredAuraID: number
if(costInfo.type == mainPowerType) then
mainCost = costInfo.cost
local cost, ctype, cperc = costInfo.cost, costInfo.type, costInfo.costPercent
local checkSpec = not requiresAura or costInfo.hasRequiredAura
if checkSpec and ctype == mainType then
mainCost = ((isPlayer or cost < mainMax) and cost) or (mainMax * cperc) / 100
break
elseif(costInfo.type == ADDITIONAL_POWER_BAR_INDEX) then
altCost = costInfo.cost
elseif hasAltManaBar and checkSpec and ctype == ADDITIONAL_POWER_BAR_INDEX then
altCost = cost
break
end
......@@ -94,7 +101,7 @@ local function Update(self, event, unit)
end
if(element.mainBar) then
element.mainBar:SetMinMaxValues(0, UnitPowerMax(unit, mainPowerType))
element.mainBar:SetMinMaxValues(0, mainMax)
element.mainBar:SetValue(mainCost)
element.mainBar:Show()
end
......
......@@ -174,8 +174,8 @@ local function Visibility(self, event, unit)
stateChanged = true
end
if element.PostUpdateVisibility then
element.PostUpdateVisibility(self, event, unit, not useClassbar, stateChanged)
if element.PostVisibility then
element.PostVisibility(self, event, unit, not useClassbar, stateChanged)
end
if not useClassbar then
......
......@@ -314,7 +314,7 @@ local tagStrings = {
return Hex(altR, altG, altB)
end
else
return Hex(_COLORS.power[pType])
return Hex(_COLORS.power[pType] or _COLORS.power.MANA)
end
end
......
## Interface: 90000
## Interface: 90001
## Title: oUF
## Author: Haste, lightspark, p3lim, Rainrider
## Version: @project-version@
......
......@@ -93,7 +93,7 @@ L["Continue"] = "下一步"
L["Coords"] = "坐標"
L["copperabbrev"] = "|cffeda55f銅|r"
L["Count"] = "計數"
L["Current Difficulties:"] = true
L["Current Difficulties:"] = "當前難度:"
L["Current Level:"] = "目前等級"
L["CVars Set"] = "參數設定"
L["CVars"] = "參數"
......@@ -110,13 +110,13 @@ L["Disband Group"] = "解散隊伍"
L["Discard"] = "取消"
L["Discord"] = true
L["DND"] = "忙碌"
L["Do you enjoy the new ElvUI?"] = "你享受新版的ElvUI嗎?"
L["Do you enjoy the new ElvUI?"] = "你享受新版的 ElvUI 嗎?"
L["Do you swear not to post in technical support about something not working without first disabling the addon/module combination first?"] = "你發誓在你沒停用其他插件或是模組前不會到技術支援發文詢問某些功能失效嗎?"
L["Don't forget to backup your WTF folder, all your profiles and settings are in there."] = true
L["Don't forget to backup your WTF folder, all your profiles and settings are in there."] = "別忘記備份你的 WTF 資料夾, 這裡存有你的全部設定及配置文件."
L["Download"] = "下載"
L["DPS"] = "傷害輸出"
L["Earned:"] = "賺取:"
L["ElvUI has a dual spec feature which allows you to load different profiles based on your current spec on the fly. You can enable it in the profiles tab."] = true
L["ElvUI has a dual spec feature which allows you to load different profiles based on your current spec on the fly. You can enable it in the profiles tab."] = "ElvUI 支持針對不同專精加載不同配置檔的功能, 你可以在[設定檔]中啟用."
L["ElvUI Installation"] = "安裝 ElvUI"
L["ElvUI is five or more revisions out of date. You can download the newest version from www.tukui.org. Get premium membership and have ElvUI automatically updated with the Tukui Client!"] = "ElvUI 已過期超過5個版本. 你可以在 www.tukui.org 下載到最新的版本. 購買會員可以使用 Tukui 客戶端自動下載最新的 ElvUI."
L["ElvUI is out of date. You can download the newest version from www.tukui.org. Get premium membership and have ElvUI automatically updated with the Tukui Client!"] = "ElvUI 已過期. 你可以在 www.tukui.org 下載到最新的版本. 購買會員可以使用 Tukui 客戶端自動下載最新的 ElvUI."
......@@ -169,7 +169,7 @@ L["Importance: |cFF33FF33Low|r"] = "重要性: |cFF33FF33低|r"
L["Importance: |cffD3CF00Medium|r"] = "重要性: |cffD3CF00中|r"
L["Importance: |cffFF3333High|r"] = "重要性: |cffFF3333高|r"
L["In Progress"] = "進行中"
L["INCOMPATIBLE_ADDON"] = true
L["INCOMPATIBLE_ADDON"] = "%s 無法與 %s 兼容.\n請選擇要保持啟用的模組/插件."
L["Installation Complete"] = "安裝完畢"
L["Interrupted %s's \124cff71d5ff\124Hspell:%d:0\124h[%s]\124h\124r!"] = "已打斷 %s 的 \124cff71d5ff\124Hspell:%d:0\124h[%s]\124h\124r!"
L["Invalid Target"] = "無效的目標"
......@@ -221,7 +221,7 @@ L["Mov. Speed:"] = _G.STAT_MOVEMENT_SPEED
L["MT Frames"] = "主坦克框架"
L["Naval Mission(s) Report:"] = "海軍任務報告"
L["Nazjatar Follower XP"] = "納沙塔爾盟友經驗"
L["Need help? Join our Discord: https://discord.gg/xFWcfgE"] = true
L["Need help? Join our Discord: https://discord.gg/xFWcfgE"] = "需要幫助? 加入我們的 Discord 伺服器(英文): https://discord.gg/xFWcfgE"
L["No bindings set."] = "未設定快捷綁定."
L["No gray items to delete."] = "沒有可刪除的灰色物品."
L["No Guild"] = "沒有公會"
......@@ -269,8 +269,8 @@ L["Remaining:"] = "剩餘:"
L["Remove Bar %d Action Page"] = "移除第 %d 快捷列"
L["Reputation Bar"] = "聲望條"
L["Request was denied by user."] = "請求被對方拒絕."
L["Reset Session Data: Hold Ctrl + Right Click"] = true
L["Reset Character Data: Hold Shift + Right Click"] = true
L["Reset Session Data: Hold Ctrl + Right Click"] = "重置會話數據: 按住 Ctrl + 右鍵點擊"
L["Reset Character Data: Hold Shift + Right Click"] = "重置角色數據: 按住 Shift + 右鍵點擊"
L["Reset Position"] = "重設位置"
L["Rested:"] = "休息:"
L["Right Chat"] = "右側對話框"
......@@ -355,16 +355,16 @@ L["yells"] = "大喊"
L["Yes, Keep Changes!"] = "是的, 保留變更!"
L["You are now finished with the installation process. If you are in need of technical support please visit us at http://www.tukui.org."] = "已完成安裝程序. 小提示: 若想開啟微型選單, 請在小地圖按滑鼠中鍵. 如果沒有中鍵按鈕, 請按住Shift鍵, 並在小地圖按滑鼠右鍵. 如需技術支援請至http://www.tukui.org"
L["You are using CPU Profiling. This causes decreased performance. Do you want to disable it or continue?"] = "你正在使用 CPU 使用記錄. 這將導致性能低下. 你想要關閉它還是繼續?"
L["You can access the copy chat and chat menu functions by left/right clicking on the icon in the top right corner of the chat panel."] = true
L["You can access the microbar by using middle mouse button on the minimap. You can also enable the MicroBar in the actionbar settings."] = true
L["You can always change fonts and colors of any element of ElvUI from the in-game configuration."] = "你可以在遊戲內的設定選項內更改ElvUI的字體、顏色等設定."
L["You can enter the keybind mode by typing /kb"] = true
L["You can access the copy chat and chat menu functions by left/right clicking on the icon in the top right corner of the chat panel."] = "你可以點擊聊天面板的右上角圖示來拷貝聊天, 及訪問聊天菜單."
L["You can access the microbar by using middle mouse button on the minimap. You can also enable the MicroBar in the actionbar settings."] = "你可以在小地圖上右鍵點擊來開啟微型菜單條. 你也可以在動作條設定中啟用微型系統條功能."
L["You can always change fonts and colors of any element of ElvUI from the in-game configuration."] = "你可以在遊戲內的設定選項內更改 ElvUI 的字體、顏色等設定."
L["You can enter the keybind mode by typing /kb"] = "你可以通過鍵入 /kb 來啟用按鍵綁定模式."
L["You can now choose what layout you wish to use based on your combat role."] = "你現在可以根據你的戰鬥角色選擇合適的佈局."
L["You can quickly change your displayed DataTexts by mousing over them while holding ALT."] = true
L["You can see someones average item level inside the tooltip by holding shift and mousing over them."] = true
L["You don't have enough money to repair."] = "沒有足夠的資金來修理."
L["You don't have permission to mark targets."] = "你沒有標記目標的權限."
L["You have imported settings which may require a UI reload to take effect. Reload now?"] = "你導入的設定可能需要重新載入UI才能生效. 現在重新載入嗎?"
L["You have imported settings which may require a UI reload to take effect. Reload now?"] = "你導入的設定可能需要重新載入 UI 才能生效. 現在重新載入嗎?"
L["You must be at a vendor."] = "你必須與商人對話."
L["You must purchase a bank slot first!"] = "你必需先購買一個銀行背包欄位!"
L["Your items have been repaired for: "] = "裝備已修理, 共支出:"
......
......@@ -9,8 +9,7 @@ E.Media = {
Textures = {}
}
local format = format
local ipairs, type = ipairs, type
local format, ipairs, type, pcall = format, ipairs, type, pcall
local westAndRU = LSM.LOCALE_BIT_ruRU + LSM.LOCALE_BIT_western
do
......@@ -203,3 +202,36 @@ AddMedia('logo','FoxWarrior')
AddMedia('logo','DeathlyHallows')
AddMedia('logo','GoldShield')
AddMedia('logo','Gem')
do -- LSM Font Preloader ~Simpy
local preloader = CreateFrame('Frame')
preloader:SetPoint('TOP', UIParent, 'BOTTOM', 0, -500)
preloader:SetSize(100, 100)
local cacheFont = function(key, data)
local loadFont = preloader:CreateFontString()
loadFont:SetAllPoints()
if pcall(loadFont.SetFont, loadFont, data, 14) then
pcall(loadFont.SetText, loadFont, 'cache')
end
end
-- Preload ElvUI Invisible
cacheFont('Invisible', E.Media.Fonts.Invisible)
-- Lets load all the fonts in LSM to prevent fonts not being ready
local sharedFonts = LSM:HashTable('font')
for key, data in next, sharedFonts do
cacheFont(key, data)
end
-- Now lets hook it so we can preload any other AddOns add to LSM
hooksecurefunc(LSM, 'Register', function(_, mediatype, key, data)
if not mediatype or type(mediatype) ~= 'string' then return end
if mediatype:lower() == 'font' then
cacheFont(key, data)
end
end)
end
......@@ -2,7 +2,7 @@ local E, L, V, P, G = unpack(select(2, ...)); --Import: Engine, Locales, Private
local AB = E:GetModule('ActionBars')
local _G = _G
local ceil, unpack = ceil, unpack
local unpack = unpack
local ipairs, pairs, select = ipairs, pairs, select
local format, gsub, strsplit, strfind = format, gsub, strsplit, strfind
......@@ -129,17 +129,32 @@ AB.customExitButton = {
tooltip = _G.LEAVE_VEHICLE,
}
do
local function barSize(size, btnSpacing, sideSpacing, mult, num)
local allButtons = size * (num * mult)
local allSpacing = (btnSpacing * (num - 1)) + sideSpacing
return allButtons + allSpacing
function AB:HandleBackdropMultiplier(bar, backdropSpacing, buttonSpacing, widthMult, heightMult, anchorUp, anchorLeft, horizontalGrowth, lastShownButton, anchorRowButton)
if not bar.backdrop:IsShown() then return end
local useWidthMult = widthMult > 1
local useHeightMult = heightMult > 1
if useWidthMult or useHeightMult then
local oldWidth, oldHeight = bar.backdrop:GetSize()
if useHeightMult then
local offset = ((oldHeight + buttonSpacing) * (heightMult - 1)) - backdropSpacing
local anchorPoint = anchorUp and 'TOP' or 'BOTTOM'
bar.backdrop:Point(anchorPoint, lastShownButton, anchorPoint, 0, anchorUp and offset or -offset)
end
if useWidthMult then
local offset = ((oldWidth + buttonSpacing) * (widthMult - 1)) - backdropSpacing
bar.backdrop:Point(horizontalGrowth, anchorRowButton, horizontalGrowth, anchorLeft and -offset or offset, 0)
end
end
end
function AB:SetBarSize(bar, size, btnSpacing, sideSpacing, widthMult, heightMult, buttonsPerRow, numColumns)
local width = barSize(size, btnSpacing, sideSpacing, widthMult, buttonsPerRow)
local height = barSize(size, btnSpacing, sideSpacing, heightMult, numColumns)
bar:Size(width, height)
function AB:HandleBackdropMover(bar, backdropSpacing)
local width, height = bar.backdrop:GetSize()
if not bar.backdrop:IsShown() then
local spacing = backdropSpacing * 2
bar:SetSize(width - spacing, height - spacing)
else
bar:SetSize(width, height)
end
end
......@@ -152,23 +167,18 @@ function AB:PositionAndSizeBar(barName)
local numButtons = db.buttons
local size = db.buttonsize
local point = db.point
local numColumns = ceil(numButtons / buttonsPerRow)
local visibility = db.visibility
local bar = AB.handledBars[barName]
bar.db = db
bar.db.position = nil --Depreciated
bar.backdrop:SetShown(db.backdrop)
if visibility and visibility:match('[\n\r]') then
visibility = visibility:gsub('[\n\r]','')
end
if numColumns < 1 then numColumns = 1 end
if numButtons < buttonsPerRow then buttonsPerRow = numButtons end
local sideSpacing = db.backdrop and (E.Border + backdropSpacing) or E.Spacing
AB:SetBarSize(bar, size, buttonSpacing, sideSpacing * 2, db.backdrop and db.widthMult or 1, db.backdrop and db.heightMult or 1, buttonsPerRow, numColumns)
bar.mouseover = db.mouseover
if bar.mouseover then
......@@ -189,18 +199,34 @@ function AB:PositionAndSizeBar(barName)
local verticalGrowth = (point == 'TOPLEFT' or point == 'TOPRIGHT') and 'DOWN' or 'UP'
local horizontalGrowth = (point == 'BOTTOMLEFT' or point == 'TOPLEFT') and 'RIGHT' or 'LEFT'
local anchorUp, anchorLeft = verticalGrowth == 'UP', horizontalGrowth == 'LEFT'
bar.backdrop:SetShown(db.backdrop)
bar.backdrop:ClearAllPoints()
-- mover magic ~Simpy
bar:ClearAllPoints()
if not bar.backdrop:IsShown() then
bar:SetPoint('BOTTOMLEFT', bar.mover)
elseif anchorUp then
bar:SetPoint('BOTTOMLEFT', bar.mover, 'BOTTOMLEFT', anchorLeft and E.Border or -E.Border, -E.Border)
else
bar:SetPoint('TOPLEFT', bar.mover, 'TOPLEFT', anchorLeft and E.Border or -E.Border, E.Border)
end
local button, lastButton, lastColumnButton
local button, lastButton, lastColumnButton, anchorRowButton, lastShownButton
for i