mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-26 05:50:50 +00:00
pagemaster: page modifiers via override bindings; hoverbind: warn on conflicts
The old pagemaster wipe block checked a setting that was migrated away and never ran, so saved MOD-key bindings beat the paged action. Override every key bound to ACTIONBUTTON1-12 for each enabled page modifier instead; the saved binding set stays untouched. Hoverbind now reports when a bind takes a key from another action, and when an override masks the new bind.
This commit is contained in:
+22
-11
@@ -828,17 +828,28 @@ pfUI:RegisterModule("actionbar", function ()
|
|||||||
do
|
do
|
||||||
local formpage, shift, ctrl, alt, default = 8, 6, 5, 3, 1
|
local formpage, shift, ctrl, alt, default = 8, 6, 5, 3, 1
|
||||||
|
|
||||||
-- set temporary pagemaster bindings keybinds
|
-- while a page modifier is held, MOD-key must run the main bar binding on
|
||||||
if C.bars.pagemaster == "1" then
|
-- that key so the switched page fires. Overrides do this without touching
|
||||||
local modifier = { "ALT", "SHIFT", "CTRL" }
|
-- the saved binding set.
|
||||||
local buttons = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-", "+", "=", "´" }
|
local pagemods = {}
|
||||||
local current = CURRENT_ACTIONBAR_PAGE
|
if C.bars.pagemasteralt == "1" then table.insert(pagemods, "ALT") end
|
||||||
bars.pagemaster = bars.pagemaster or CreateFrame("Frame", "pfPageMaster", UIParent)
|
if C.bars.pagemasterctrl == "1" then table.insert(pagemods, "CTRL") end
|
||||||
bars.pagemaster:RegisterEvent("PLAYER_ENTERING_WORLD")
|
if C.bars.pagemastershift == "1" then table.insert(pagemods, "SHIFT") end
|
||||||
bars.pagemaster:SetScript("OnEvent", function()
|
|
||||||
for _,mod in pairs(modifier) do
|
if table.getn(pagemods) > 0 then
|
||||||
for _,but in pairs(buttons) do
|
local pagemaster = CreateFrame("Frame", "pfPageMaster", UIParent)
|
||||||
SetBinding(mod.."-"..but)
|
pagemaster:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
|
pagemaster:RegisterEvent("UPDATE_BINDINGS")
|
||||||
|
pagemaster:SetScript("OnEvent", function()
|
||||||
|
ClearOverrideBindings(this)
|
||||||
|
for i = 1, 12 do
|
||||||
|
for _, key in ipairs({ GetBindingKey("ACTIONBUTTON"..i) }) do
|
||||||
|
-- skip keys that already carry a modifier, e.g. "SHIFT-Q"
|
||||||
|
if not key:find("^%u+%-.") then
|
||||||
|
for _, mod in ipairs(pagemods) do
|
||||||
|
SetOverrideBinding(this, false, mod.."-"..key, "ACTIONBUTTON"..i)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
+16
-2
@@ -105,6 +105,10 @@ pfUI:RegisterModule("hoverbind", function ()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function BindingName(command)
|
||||||
|
return _G["BINDING_NAME_" .. command] or command
|
||||||
|
end
|
||||||
|
|
||||||
function pfUI.hoverbind:GetPrefix()
|
function pfUI.hoverbind:GetPrefix()
|
||||||
return string.format("%s%s%s",
|
return string.format("%s%s%s",
|
||||||
(IsAltKeyDown() and modifiers.ALT or ""),
|
(IsAltKeyDown() and modifiers.ALT or ""),
|
||||||
@@ -165,9 +169,19 @@ pfUI:RegisterModule("hoverbind", function ()
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- Create new binding
|
-- Create new binding
|
||||||
local key = map and map[arg1] or arg1
|
local key = prefix .. (map and map[arg1] or arg1)
|
||||||
if (SetBinding(prefix..key, binding)) then
|
local previous = GetBindingAction(key)
|
||||||
|
if (SetBinding(key, binding)) then
|
||||||
SaveBindings(GetCurrentBindingSet())
|
SaveBindings(GetCurrentBindingSet())
|
||||||
|
|
||||||
|
if previous and previous ~= "" and previous ~= binding then
|
||||||
|
DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc" .. key .. "|r " .. T["was unbound from"] .. " " .. BindingName(previous))
|
||||||
|
end
|
||||||
|
|
||||||
|
local active = GetBindingAction(key, true)
|
||||||
|
if active ~= binding then
|
||||||
|
DEFAULT_CHAT_FRAME:AddMessage("|cff33ffcc" .. key .. "|r " .. T["is currently overridden by"] .. " " .. BindingName(active))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user