Commit 32b03ae9 authored by Simpy's avatar Simpy 🐹

12.09

parents 5c54926f 0fa9fccb
......@@ -492,9 +492,6 @@ function E:PLAYER_ENTERING_WORLD(_, initLogin, isReload)
end
if initLogin or isReload then
self:RegisterEvent('UI_SCALE_CHANGED', 'PixelScaleChanged')
self:UIScale()
self:CheckIncompatible()
end
......@@ -597,6 +594,7 @@ function E:LoadAPI()
E:RegisterEvent('PLAYER_SPECIALIZATION_CHANGED', 'CheckRole')
E:RegisterEvent('UNIT_ENTERED_VEHICLE', 'EnterVehicleHideFrames')
E:RegisterEvent('UNIT_EXITED_VEHICLE', 'ExitVehicleShowFrames')
E:RegisterEvent('UI_SCALE_CHANGED', 'PixelScaleChanged')
do -- setup cropIcon texCoords
local opt = E.db.general.cropIcon
......
......@@ -1141,15 +1141,6 @@ do -- BFA Convert, deprecated..
end
end
--v11 Nameplates Reset
if not E.db.v11NamePlateReset and E.private.nameplates.enable then
local styleFilters = E:CopyTable({}, E.db.nameplates.filters)
E.db.nameplates = E:CopyTable({}, P.nameplates)
E.db.nameplates.filters = E:CopyTable({}, styleFilters)
NamePlates:CVarReset()
E.db.v11NamePlateReset = true
end
-- Wipe some old variables off profiles
if E.global.uiScaleInformed then E.global.uiScaleInformed = nil end
if E.global.nameplatesResetInformed then E.global.nameplatesResetInformed = nil end
......@@ -1796,6 +1787,7 @@ function E:Initialize()
if not E.db.unitframe.thinBorders then P.unitframe.colors.borderColor = { r = 0.1, g = 0.1, b = 0.1 } end
E:DBConversions()
E:UIScale()
E:BuildPrefixValues()
E:LoadAPI()
E:LoadCommands()
......
......@@ -297,7 +297,6 @@ local blacklistedKeys = {
D.GeneratedKeys = {
profile = {
movers = true,
v11NamePlateReset = true,
nameplates = { -- this is supposed to have an 's' because yeah, oh well
filters = true
},
......
## Interface: 90001
## Author: Elv, Simpy
## Version: 12.08
## Version: 12.09
## Title: |cff1784d1ElvUI|r
## Notes: User Interface replacement AddOn for World of Warcraft.
## SavedVariables: ElvDB, ElvPrivateDB
......
--[[
# Element: Party Indicator
Toggles the visibility of an indicator based on if the player was in a group before joining the instance.
## Widget
PartyIndicator - Player only widget.
]]
local _, ns = ...
local oUF = ns.oUF
local function Update(self, event)
local element = self.PartyIndicator
if(element.PreUpdate) then
element:PreUpdate()
end
local forced = not event or event == 'ElvUI_UpdateAllElements'
if forced or event == 'GROUP_ROSTER_UPDATE' then
if IsInGroup(LE_PARTY_CATEGORY_HOME) and IsInGroup(LE_PARTY_CATEGORY_INSTANCE) then
element:Show()
else
element:Hide()
end
end
if forced or event == 'UPDATE_CHAT_COLOR' then
local private = ChatTypeInfo.PARTY
if private and element.HomeIcon then
element.HomeIcon:SetVertexColor(private.r, private.g, private.b, 1)
end
local public = ChatTypeInfo.INSTANCE_CHAT
if public and element.InstanceIcon then
element.InstanceIcon:SetVertexColor(public.r, public.g, public.b, 1)
end
end
if(element.PostUpdate) then
return element:PostUpdate()
end
end
local function Path(self, ...)
--[[ Override: PartyIndicator.Override(self, event)
Used to completely override the internal update function.
* self - the parent object
* event - the event triggering the update (string)
--]]
return (self.PartyIndicator.Override or Update) (self, ...)
end
local function ForceUpdate(element)
return Path(element.__owner, 'ForceUpdate')
end
local function Enable(self)
local element = self.PartyIndicator
if element then
element.__owner = self
element.ForceUpdate = ForceUpdate
self:RegisterEvent('UPDATE_CHAT_COLOR', Path, true)
self:RegisterEvent('GROUP_ROSTER_UPDATE', Path, true)
if(element.HomeIcon and element.HomeIcon:IsObjectType('Texture') and not element.HomeIcon:GetTexture()) then
element.HomeIcon:SetTexture([[Interface\FriendsFrame\UI-Toast-FriendOnlineIcon]])
end
if(element.InstanceIcon and element.InstanceIcon:IsObjectType('Texture') and not element.InstanceIcon:GetTexture()) then
element.InstanceIcon:SetTexture([[Interface\FriendsFrame\UI-Toast-FriendOnlineIcon]])
end
return true
end
end
local function Disable(self)
local element = self.PartyIndicator
if(element) then
element:Hide()
self:UnregisterEvent('UPDATE_CHAT_COLOR', Path)
self:UnregisterEvent('GROUP_ROSTER_UPDATE', Path)
end
end
oUF:AddElement('PartyIndicator', Path, Enable, Disable)
......@@ -19,6 +19,7 @@
<Script file="elements\health.lua"/>
<Script file="elements\healthprediction.lua"/>
<Script file="elements\leaderindicator.lua"/>
<Script file="elements\partyindicator.lua"/>
<Script file="elements\phaseindicator.lua"/>
<Script file="elements\portrait.lua"/>
<Script file="elements\power.lua"/>
......
......@@ -147,6 +147,7 @@ local function updateArenaPreparation(self, event)
if(self.Debuffs) then self.Debuffs:Hide() end
if(self.Castbar) then self.Castbar:Hide() end
if(self.CombatIndicator) then self.CombatIndicator:Hide() end
if(self.PartyIndicator) then self.PartyIndicator:Hide() end
if(self.GroupRoleIndicator) then self.GroupRoleIndicator:Hide() end
if(self.Portrait) then self.Portrait:Hide() end
if(self.PvPIndicator) then self.PvPIndicator:Hide() end
......
......@@ -156,7 +156,7 @@ L["Honor Bar"] = "Ehreleiste"
L["Honor Remaining:"] = "Ehre verbleibend:"
L["Honor XP:"] = "Ehre XP:"
L["Horde: "] = true --No need to translate
L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the ESC key to clear the current actionbutton's keybinding."] = "Bewege deine Maus über einen Aktionsbutton oder dein Zauberbuch um ihn mit einem Hotkey zu belegen. Drücke Escape um die aktuelle Tastenbelegung des Buttons zu löschen."
L["Hover your mouse over any |cFF1784d1action|r, |cFF1784d1micro|r, |cFF1784d1macro|r, or |cFF1784d1spellbook|r button to bind it. This also works for items in your |cFF1784d1bag|r. Press the |cfd9b9b9bESC|r key to |cfd9b9b9bclear|r the current bindings."] = true
L["HP"] = "HP"
L["HPS"] = "HPS"
L["I Swear"] = "Ich schwöre"
......
......@@ -156,7 +156,7 @@ L["Honor Bar"] = true
L["Honor Remaining:"] = true
L["Honor XP:"] = true
L["Horde: "] = true
L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the ESC key to clear the current actionbutton's keybinding."] = true
L["Hover your mouse over any |cFF1784d1action|r, |cFF1784d1micro|r, |cFF1784d1macro|r, or |cFF1784d1spellbook|r button to bind it. This also works for items in your |cFF1784d1bag|r. Press the |cfd9b9b9bESC|r key to |cfd9b9b9bclear|r the current bindings."] = true
L["HP"] = true
L["HPS"] = true
L["I Swear"] = true
......
......@@ -156,7 +156,7 @@ L["Honor Bar"] = "Barra de Honor"
L["Honor Remaining:"] = "Honor restante:"
L["Honor XP:"] = true
L["Horde: "] = "Horda: "
L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the ESC key to clear the current actionbutton's keybinding."] = "Pase el mouse sobre cualquier botón de acción o botón del libro de hechizos para vincularlo. Presione la tecla ESC para borrar la combinación de teclas del botón de acción actual."
L["Hover your mouse over any |cFF1784d1action|r, |cFF1784d1micro|r, |cFF1784d1macro|r, or |cFF1784d1spellbook|r button to bind it. This also works for items in your |cFF1784d1bag|r. Press the |cfd9b9b9bESC|r key to |cfd9b9b9bclear|r the current bindings."] = true
L["HP"] = "Salud"
L["HPS"] = "VPS"
L["I Swear"] = "Lo Juro"
......
......@@ -156,7 +156,7 @@ L["Honor Bar"] = "Barre d'honneur"
L["Honor Remaining:"] = "Honneur restant :"
L["Honor XP:"] = "Niveau d'honneur :"
L["Horde: "] = true
L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the ESC key to clear the current actionbutton's keybinding."] = "Passez votre souris sur n'importe quel bouton d'action ou bouton du livre des sorts pour le lier. Appuyez sur la touche ESC pour effacer le lien du bouton d'action en cours."
L["Hover your mouse over any |cFF1784d1action|r, |cFF1784d1micro|r, |cFF1784d1macro|r, or |cFF1784d1spellbook|r button to bind it. This also works for items in your |cFF1784d1bag|r. Press the |cfd9b9b9bESC|r key to |cfd9b9b9bclear|r the current bindings."] = true
L["HP"] = "PV"
L["HPS"] = "HPS"
L["I Swear"] = "Je le jure"
......
......@@ -156,7 +156,7 @@ L["Honor Bar"] = true
L["Honor Remaining:"] = true
L["Honor XP:"] = true
L["Horde: "] = true
L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the ESC key to clear the current actionbutton's keybinding."] = true
L["Hover your mouse over any |cFF1784d1action|r, |cFF1784d1micro|r, |cFF1784d1macro|r, or |cFF1784d1spellbook|r button to bind it. This also works for items in your |cFF1784d1bag|r. Press the |cfd9b9b9bESC|r key to |cfd9b9b9bclear|r the current bindings."] = true
L["HP"] = true
L["HPS"] = true
L["I Swear"] = true
......
......@@ -156,7 +156,7 @@ L["Honor Bar"] = "명예바"
L["Honor Remaining:"] = "남은 명예"
L["Honor XP:"] = "명예 경험치"
L["Horde: "] = true
L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the ESC key to clear the current actionbutton's keybinding."] = true
L["Hover your mouse over any |cFF1784d1action|r, |cFF1784d1micro|r, |cFF1784d1macro|r, or |cFF1784d1spellbook|r button to bind it. This also works for items in your |cFF1784d1bag|r. Press the |cfd9b9b9bESC|r key to |cfd9b9b9bclear|r the current bindings."] = true
L["HP"] = "주문력"
L["HPS"] = "HPS"
L["I Swear"] = "알겠습니다."
......
......@@ -156,7 +156,7 @@ L["Honor Bar"] = "Barra de honra"
L["Honor Remaining:"] = "Honra restante"
L["Honor XP:"] = "EXP de Honra"
L["Horde: "] = "Horda: "
L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the ESC key to clear the current actionbutton's keybinding."] = "Passe seu cursor em cima de qualquer botão de ações ou livro de feitiços para atribuí-lo. Pressione ESC para limpar a atual tecla de atalho para tal barra de ações"
L["Hover your mouse over any |cFF1784d1action|r, |cFF1784d1micro|r, |cFF1784d1macro|r, or |cFF1784d1spellbook|r button to bind it. This also works for items in your |cFF1784d1bag|r. Press the |cfd9b9b9bESC|r key to |cfd9b9b9bclear|r the current bindings."] = true
L["HP"] = "PV"
L["HPS"] = "PVS"
L["I Swear"] = "Eu Juro"
......
......@@ -156,7 +156,7 @@ L["Honor Bar"] = "Полоса Чести"
L["Honor Remaining:"] = "Осталось Чести"
L["Honor XP:"] = "Честь: "
L["Horde: "] = "Орда: "
L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the ESC key to clear the current actionbutton's keybinding."] = "Наведите мышку на любую кнопку панели команд или книги заклинаний, чтобы создать назначение. Нажатие ESC убирает текущее назначение."
L["Hover your mouse over any |cFF1784d1action|r, |cFF1784d1micro|r, |cFF1784d1macro|r, or |cFF1784d1spellbook|r button to bind it. This also works for items in your |cFF1784d1bag|r. Press the |cfd9b9b9bESC|r key to |cfd9b9b9bclear|r the current bindings."] = true
L["HP"] = "+ Исцел."
L["HPS"] = "ИВС"
L["I Swear"] = "Я клянусь!"
......
......@@ -156,7 +156,7 @@ L["Honor Bar"] = "荣誉条"
L["Honor Remaining:"] = "荣誉值剩余:"
L["Honor XP:"] = "荣誉值:"
L["Horde: "] = true
L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the ESC key to clear the current actionbutton's keybinding."] = "鼠标指向任何动作条或者技能书快捷键来绑定它. 按Esc键来清除当前动作条按钮的按键绑定."
L["Hover your mouse over any |cFF1784d1action|r, |cFF1784d1micro|r, |cFF1784d1macro|r, or |cFF1784d1spellbook|r button to bind it. This also works for items in your |cFF1784d1bag|r. Press the |cfd9b9b9bESC|r key to |cfd9b9b9bclear|r the current bindings."] = true
L["HP"] = "生命值"
L["HPS"] = "治疗输出"
L["I Swear"] = "我承诺"
......
......@@ -156,7 +156,7 @@ L["Honor Bar"] = "榮譽條"
L["Honor Remaining:"] = "剩餘:"
L["Honor XP:"] = "榮譽:"
L["Horde: "] = "部落: "
L["Hover your mouse over any actionbutton or spellbook button to bind it. Press the ESC key to clear the current actionbutton's keybinding."] = "將你的滑鼠游標放在任意快捷鍵或是法術書上來完成綁定。按下 ESC 可以清除當前快捷鍵的綁定."
L["Hover your mouse over any |cFF1784d1action|r, |cFF1784d1micro|r, |cFF1784d1macro|r, or |cFF1784d1spellbook|r button to bind it. This also works for items in your |cFF1784d1bag|r. Press the |cfd9b9b9bESC|r key to |cfd9b9b9bclear|r the current bindings."] = true
L["HP"] = "生命值"
L["HPS"] = "治療輸出"
L["I Swear"] = "我承諾"
......
......@@ -213,16 +213,20 @@ function AB:HandleButton(bar, button, index, lastButton, lastColumnButton)
bar.backdrop:Point(horizontal, button, horizontal, anchorLeft and -db.backdropSpacing or db.backdropSpacing, 0)
end
if button:IsShown() then
if button.handleBackdrop then
local anchorPoint = anchorUp and 'TOP' or 'BOTTOM'
bar.backdrop:Point(anchorPoint, button, anchorPoint, 0, anchorUp and db.backdropSpacing or -db.backdropSpacing)
end
end
function AB:TrimIcon(icon, db, customCoords)
local left, right, top, bottom = unpack(customCoords or E.TexCoords)
function AB:TrimIcon(button)
if not button.icon then return end
local db = button.db
local left, right, top, bottom = unpack(db and db.customCoords or E.TexCoords)
if db and not db.keepSizeRatio then
local ratio = (db.buttonsize or db.buttonSize) / db.buttonHeight
local width, height = button:GetSize()
local ratio = width / height
if ratio > 1 then
local trimAmount = (1 - (1 / ratio)) / 2
top = top + trimAmount
......@@ -234,7 +238,7 @@ function AB:TrimIcon(icon, db, customCoords)
end
end
icon:SetTexCoord(left, right, top, bottom)
button.icon:SetTexCoord(left, right, top, bottom)
end
function AB:GetGrowth(point)
......@@ -299,8 +303,10 @@ function AB:PositionAndSizeBar(barName)
if i > numButtons then
button:Hide()
button.handleBackdrop = nil
else
button:Show()
button.handleBackdrop = true
lastShownButton = button
end
......@@ -311,14 +317,18 @@ function AB:PositionAndSizeBar(barName)
AB:HandleBackdropMultiplier(bar, backdropSpacing, buttonSpacing, db.widthMult, db.heightMult, anchorUp, anchorLeft, horizontal, lastShownButton, anchorRowButton)
AB:HandleBackdropMover(bar, backdropSpacing)
if db.enabled or not bar.initialized then
if not bar.initialized then
bar.initialized = true
if AB.barDefaults['bar'..bar.id].conditions:find('[form,noform]') then
bar:SetAttribute('newCondition', gsub(AB.barDefaults['bar'..bar.id].conditions, ' %[form,noform%] 0; ', ''))
bar:SetAttribute('hasTempBar', true)
else
bar:SetAttribute('hasTempBar', false)
end
end
if db.enabled or not bar.initialized then
local page = AB:GetPage(barName, AB.barDefaults[barName].page, AB.barDefaults[barName].conditions)
visibility = gsub(visibility, '[\n\r]','')
......@@ -327,12 +337,6 @@ function AB:PositionAndSizeBar(barName)
bar:SetAttribute('page', page)
bar:Show()
if not bar.initialized then
bar.initialized = true
AB:PositionAndSizeBar(barName)
return
end
E:EnableMover(bar.mover:GetName())
else
E:DisableMover(bar.mover:GetName())
......@@ -344,6 +348,11 @@ function AB:PositionAndSizeBar(barName)
if MasqueGroup and E.private.actionbar.masque.actionbars then
MasqueGroup:ReSkin()
-- masque retrims them all so we have to too
for btn in pairs(AB.handledbuttons) do
AB:TrimIcon(btn)
end
end
end
......@@ -414,8 +423,6 @@ function AB:CreateBar(id)
AB.handledBars['bar'..id] = bar
E:CreateMover(bar, 'ElvAB_'..id, L["Bar "]..id, nil, nil, nil,'ALL,ACTIONBARS',nil,'actionbar,playerBars,bar'..id)
AB:PositionAndSizeBar('bar'..id)
return bar
end
......@@ -498,13 +505,14 @@ function AB:ReassignBindings(event)
for _, bar in pairs(AB.handledBars) do
if bar then
ClearOverrideBindings(bar)
for i = 1, #bar.buttons do
local button = (bar.bindButtons..'%d'):format(i)
local real_button = (bar:GetName()..'Button%d'):format(i)
for k=1, select('#', GetBindingKey(button)) do
local key = select(k, GetBindingKey(button))
if key and key ~= '' then
SetOverrideBindingClick(bar, false, key, real_button)
for _, button in ipairs(bar.buttons) do
if button.keyBoundTarget then
for k=1, select('#', GetBindingKey(button.keyBoundTarget)) do
local key = select(k, GetBindingKey(button.keyBoundTarget))
if key and key ~= '' then
SetOverrideBindingClick(bar, false, key, button:GetName())
end
end
end
end
......@@ -548,24 +556,23 @@ function AB:UpdateButtonSettings()
for barName, bar in pairs(AB.handledBars) do
if bar then
AB:UpdateButtonConfig(bar, bar.bindButtons)
AB:PositionAndSizeBar(barName)
AB:UpdateButtonConfig(bar, bar.bindButtons) -- config them first
AB:PositionAndSizeBar(barName) -- db is set here, button style also runs here
end
end
AB:AdjustMaxStanceButtons()
AB:PositionAndSizeBarPet()
AB:PositionAndSizeBarShapeShift()
for button in pairs(AB.handledbuttons) do
if button then
AB:StyleButton(button, button.noBackdrop, button.useMasque, button.ignoreNormal)
AB:StyleFlyout(button)
else
AB.handledbuttons[button] = nil
end
end
AB:AdjustMaxStanceButtons()
AB:PositionAndSizeBarPet()
AB:PositionAndSizeBarShapeShift()
AB:UpdatePetBindings()
AB:UpdateStanceBindings() -- call after AdjustMaxStanceButtons
AB:UpdateFlyoutButtons()
......@@ -643,8 +650,8 @@ function AB:StyleButton(button, noBackdrop, useMasque, ignoreNormal)
end
end
if icon then
AB:TrimIcon(icon, button.db, button.customCoords)
if icon and not useMasque then
AB:TrimIcon(button)
icon:SetInside()
end
......@@ -705,7 +712,7 @@ function AB:FadeBlings(alpha)
for i = 1, AB.fadeParent:GetNumChildren() do
local bar = select(i, AB.fadeParent:GetChildren())
if bar.buttons then
for _, button in pairs(bar.buttons) do
for _, button in ipairs(bar.buttons) do
AB:FadeBlingTexture(button.cooldown, alpha)
end
end
......@@ -985,7 +992,7 @@ function AB:ToggleCountDownNumbers(bar, button, cd)
end
elseif bar then -- ref: E:UpdateCooldownOverride
if bar.buttons then
for _, btn in pairs(bar.buttons) do
for _, btn in ipairs(bar.buttons) do
if btn and btn.config and (btn.cooldown and btn.cooldown.timer) then
-- update the buttons config
btn.config.disableCountDownNumbers = not not E:ToggleBlizzardCooldownText(btn.cooldown, btn.cooldown.timer, true)
......@@ -1020,7 +1027,7 @@ function AB:UpdateButtonConfig(bar, buttonName)
bar.buttonConfig.useDrawSwipeOnCharges = AB.db.useDrawSwipeOnCharges
SetModifiedClick('PICKUPACTION', AB.db.movementModifier)
for i, button in pairs(bar.buttons) do
for i, button in ipairs(bar.buttons) do
AB:ToggleCountDownNumbers(bar, button)
bar.buttonConfig.keyBoundTarget = format(buttonName..'%d', i)
......@@ -1092,6 +1099,8 @@ end
function AB:FlyoutButton_OnEnter()
local anchor = flyoutButtonAnchor(self)
if anchor then AB:Bar_OnEnter(anchor) end
AB:BindUpdate(self, 'FLYOUT')
end
function AB:FlyoutButton_OnLeave()
......@@ -1120,6 +1129,7 @@ function AB:UpdateFlyoutButtons()
local btn, i = _G['SpellFlyoutButton1'], 1
while btn do
AB:SetupFlyoutButton(btn)
btn.isFlyout = true
i = i + 1
btn = _G['SpellFlyoutButton'..i]
......@@ -1330,6 +1340,12 @@ function AB:Initialize()
AB:RegisterEvent('PET_BATTLE_OPENING_DONE', 'RemoveBindings')
AB:RegisterEvent('SPELL_UPDATE_COOLDOWN', 'UpdateSpellBookTooltip')
if _G.KeyBindingFrame then
AB:SwapKeybindButton()
else
AB:RegisterEvent('ADDON_LOADED', 'SwapKeybindButton')
end
if C_PetBattles_IsInBattle() then
AB:RemoveBindings()
else
......
......@@ -3,18 +3,16 @@ local AB = E:GetModule('ActionBars')
local Skins = E:GetModule('Skins')
local _G = _G
local strfind, format = strfind, format
local select, tonumber, pairs, floor = select, tonumber, pairs, floor
local tonumber, format = tonumber, format
local select, pairs, floor = select, pairs, floor
local CreateFrame = CreateFrame
local HideUIPanel = HideUIPanel
local GameTooltip_Hide = GameTooltip_Hide
local GameTooltip_ShowCompareItem = GameTooltip_ShowCompareItem
local GetBindingKey = GetBindingKey
local GetCurrentBindingSet = GetCurrentBindingSet
local GetFlyoutID = GetFlyoutID
local GetMacroInfo = GetMacroInfo
local GetNumFlyouts, GetFlyoutInfo = GetNumFlyouts, GetFlyoutInfo
local GetSpellBookItemName = GetSpellBookItemName
local GetSpellInfo = GetSpellInfo
local InCombatLockdown = InCombatLockdown
local IsAddOnLoaded = IsAddOnLoaded
local IsAltKeyDown, IsControlKeyDown = IsAltKeyDown, IsControlKeyDown
......@@ -22,6 +20,7 @@ local IsShiftKeyDown, IsModifiedClick = IsShiftKeyDown, IsModifiedClick
local LoadBindings, SaveBindings = LoadBindings, SaveBindings
local SecureActionButton_OnClick = SecureActionButton_OnClick
local SetBinding = SetBinding
local GameTooltip = GameTooltip
local SpellBook_GetSpellBookSlot = SpellBook_GetSpellBookSlot
local MAX_ACCOUNT_MACROS = MAX_ACCOUNT_MACROS
local CHARACTER_SPECIFIC_KEYBINDING_TOOLTIP = CHARACTER_SPECIFIC_KEYBINDING_TOOLTIP
......@@ -31,9 +30,7 @@ local CHARACTER_SPECIFIC_KEYBINDINGS = CHARACTER_SPECIFIC_KEYBINDINGS
local bind = CreateFrame('Frame', 'ElvUI_KeyBinder', E.UIParent)
function AB:ActivateBindMode()
if InCombatLockdown() then
return
end
if InCombatLockdown() then return end
bind.active = true
E:StaticPopupSpecial_Show(ElvUIBindPopupWindow)
......@@ -59,6 +56,7 @@ end
function AB:BindHide()
bind:ClearAllPoints()
bind:Hide()
if not _G.GameTooltip:IsForbidden() then
_G.GameTooltip:Hide()
end
......@@ -73,7 +71,7 @@ function AB:BindListener(key)
end
end
E:Print(format(L["All keybindings cleared for |cff00ff00%s|r."], bind.button.name))
E:Print(format(L["All keybindings cleared for |cff00ff00%s|r."], bind.name))
self:BindUpdate(bind.button, bind.spellmacro)
if bind.spellmacro~='MACRO' and not _G.GameTooltip:IsForbidden() then
......@@ -86,10 +84,8 @@ function AB:BindListener(key)
--Check if this button can open a flyout menu
local isFlyout = (bind.button.FlyoutArrow and bind.button.FlyoutArrow:IsShown())
if key == 'LSHIFT' or key == 'RSHIFT'
or key == 'LCTRL' or key == 'RCTRL'
or key == 'LALT' or key == 'RALT'
or key == 'UNKNOWN' then return end
if key == 'LSHIFT' or key == 'RSHIFT' or key == 'LCTRL' or key == 'RCTRL'
or key == 'LALT' or key == 'RALT' or key == 'UNKNOWN' then return end
--Redirect LeftButton click to open flyout
if key == 'LeftButton' and isFlyout then
......@@ -99,194 +95,142 @@ function AB:BindListener(key)
if key == 'MiddleButton' then key = 'BUTTON3' end
if key:find('Button%d') then key = key:upper() end
local alt = IsAltKeyDown() and 'ALT-' or ''
local ctrl = IsControlKeyDown() and 'CTRL-' or ''
local shift = IsShiftKeyDown() and 'SHIFT-' or ''
local allowBinding = (not isFlyout or (isFlyout and key ~= 'LeftButton')) --Don't attempt to bind left mouse button for flyout buttons
local allowBinding = not isFlyout or (key ~= 'LeftButton') --Don't attempt to bind left mouse button for flyout buttons
if allowBinding and bind.button.bindstring then
local alt = IsAltKeyDown() and 'ALT-' or ''
local ctrl = IsControlKeyDown() and 'CTRL-' or ''
local shift = IsShiftKeyDown() and 'SHIFT-' or ''
if not bind.spellmacro or bind.spellmacro == 'PET' or bind.spellmacro == 'STANCE' or bind.spellmacro == 'FLYOUT' then
if allowBinding then
SetBinding(alt..ctrl..shift..key, bind.button.bindstring)
end
else
if allowBinding then
SetBinding(alt..ctrl..shift..key, bind.spellmacro..' '..bind.button.name)
end
end
if allowBinding then
E:Print(alt..ctrl..shift..key..L[" |cff00ff00bound to |r"]..bind.button.name..'.')
SetBinding(alt..ctrl..shift..key, bind.button.bindstring)
E:Print(alt..ctrl..shift..key..L[" |cff00ff00bound to |r"]..bind.name..'.')
end
self:BindUpdate(bind.button, bind.spellmacro)
if bind.spellmacro~='MACRO' and bind.spellmacro~='FLYOUT' and not _G.GameTooltip:IsForbidden() then
_G.GameTooltip:Hide()
end
end
function AB:BindUpdate(button, spellmacro)
if not bind.active or InCombatLockdown() then return; end
local GameTooltip = _G.GameTooltip</