Moved Hotkey and MacroText handling to the ButtonBar prototype and show the Hotkey on Pet and Stance Bar (default off)
This commit is contained in:
@@ -111,28 +111,6 @@ function ActionBar:SetGrid(state)
|
||||
end
|
||||
end
|
||||
|
||||
function ActionBar:SetHideMacroText(state)
|
||||
if state ~= nil then
|
||||
self.config.hidemacrotext = state
|
||||
end
|
||||
self:ForAll("Update")
|
||||
end
|
||||
|
||||
function ActionBar:GetHideMacroText()
|
||||
return self.config.hidemacrotext
|
||||
end
|
||||
|
||||
function ActionBar:SetHideHotkey(state)
|
||||
if state ~= nil then
|
||||
self.config.hidehotkey = state
|
||||
end
|
||||
self:ForAll("Update")
|
||||
end
|
||||
|
||||
function ActionBar:GetHideHotkey()
|
||||
return self.config.hidehotkey
|
||||
end
|
||||
|
||||
function ActionBar:UpdateSelfCast()
|
||||
self:ForAll("UpdateSelfCast")
|
||||
self:UpdateStates()
|
||||
|
||||
@@ -8,7 +8,6 @@ local abdefaults = {
|
||||
enabled = true,
|
||||
buttons = 12,
|
||||
hidemacrotext = false,
|
||||
hidehotkey = false,
|
||||
showgrid = false,
|
||||
autoassist = false,
|
||||
states = {
|
||||
|
||||
@@ -7,6 +7,7 @@ local ButtonBar_MT = {__index = ButtonBar}
|
||||
local defaults = Bartender4:Merge({
|
||||
padding = 2,
|
||||
rows = 1,
|
||||
hidehotkey = false,
|
||||
skin = {
|
||||
ID = "DreamLayout",
|
||||
Backdrop = true,
|
||||
@@ -95,6 +96,28 @@ function ButtonBar:SetZoom(zoom)
|
||||
self:UpdateButtonLayout()
|
||||
end
|
||||
|
||||
function ButtonBar:SetHideMacroText(state)
|
||||
if state ~= nil then
|
||||
self.config.hidemacrotext = state
|
||||
end
|
||||
self:ForAll("Update")
|
||||
end
|
||||
|
||||
function ButtonBar:GetHideMacroText()
|
||||
return self.config.hidemacrotext
|
||||
end
|
||||
|
||||
function ButtonBar:SetHideHotkey(state)
|
||||
if state ~= nil then
|
||||
self.config.hidehotkey = state
|
||||
end
|
||||
self:ForAll("Update")
|
||||
end
|
||||
|
||||
function ButtonBar:GetHideHotkey()
|
||||
return self.config.hidehotkey
|
||||
end
|
||||
|
||||
local math_floor = math.floor
|
||||
-- align the buttons and correct the size of the bar overlay frame
|
||||
ButtonBar.button_width = 36
|
||||
|
||||
@@ -17,8 +17,6 @@ do
|
||||
buttons = "Buttons",
|
||||
enabled = "Enabled",
|
||||
grid = "Grid",
|
||||
macrotext = "HideMacroText",
|
||||
hotkey = "HideHotkey",
|
||||
}
|
||||
|
||||
-- retrieves a valid bar object from the modules actionbars table
|
||||
@@ -87,27 +85,6 @@ function module:GetOptionsObject()
|
||||
set = optSetter,
|
||||
get = optGetter,
|
||||
},
|
||||
hidedesc = {
|
||||
order = 80,
|
||||
name = L["Button Look"],
|
||||
type = "header",
|
||||
},
|
||||
macrotext = {
|
||||
order = 81,
|
||||
type = "toggle",
|
||||
name = L["Hide Macro Text"],
|
||||
desc = L["Hide the Macro Text on the buttons of this bar."],
|
||||
set = optSetter,
|
||||
get = optGetter,
|
||||
},
|
||||
hotkey = {
|
||||
order = 82,
|
||||
type = "toggle",
|
||||
name = L["Hide Hotkey"],
|
||||
desc = L["Hide the Hotkey on the buttons of this bar."],
|
||||
set = optSetter,
|
||||
get = optGetter,
|
||||
},
|
||||
}
|
||||
obj:AddElementGroup("general", cat_general)
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ do
|
||||
rows = "Rows",
|
||||
padding = "Padding",
|
||||
zoom = "Zoom",
|
||||
macrotext = "HideMacroText",
|
||||
hotkey = "HideHotkey",
|
||||
}
|
||||
|
||||
-- retrieves a valid bar object from the barregistry table
|
||||
@@ -78,6 +80,27 @@ function ButtonBar:GetOptionObject()
|
||||
set = optSetter,
|
||||
get = optGetter,
|
||||
},
|
||||
hidedesc = {
|
||||
order = 80,
|
||||
name = L["Button Look"],
|
||||
type = "header",
|
||||
},
|
||||
macrotext = {
|
||||
order = 81,
|
||||
type = "toggle",
|
||||
name = L["Hide Macro Text"],
|
||||
desc = L["Hide the Macro Text on the buttons of this bar."],
|
||||
set = optSetter,
|
||||
get = optGetter,
|
||||
},
|
||||
hotkey = {
|
||||
order = 82,
|
||||
type = "toggle",
|
||||
name = L["Hide Hotkey"],
|
||||
desc = L["Hide the Hotkey on the buttons of this bar."],
|
||||
set = optSetter,
|
||||
get = optGetter,
|
||||
},
|
||||
}
|
||||
obj:AddElementGroup("general", otbl_general)
|
||||
return obj
|
||||
|
||||
@@ -12,6 +12,7 @@ local PetBar = setmetatable({}, {__index = ButtonBar})
|
||||
local defaults = { profile = Bartender4:Merge({
|
||||
enabled = true,
|
||||
scale = 1.0,
|
||||
hidehotkey = true,
|
||||
visibility = {
|
||||
nopet = true,
|
||||
},
|
||||
|
||||
@@ -42,6 +42,7 @@ function Bartender4.PetButton:Create(id, parent)
|
||||
button.icon = _G[name .. "Icon"]
|
||||
button.autocastable = _G[name .. "AutoCastable"]
|
||||
button.autocast = _G[name .. "Shine"]
|
||||
button.hotkey = _G[name .. "HotKey"]
|
||||
|
||||
button:SetNormalTexture("")
|
||||
local oldNT = button:GetNormalTexture()
|
||||
@@ -120,6 +121,19 @@ function PetButtonPrototype:Update()
|
||||
end
|
||||
end
|
||||
self:UpdateCooldown()
|
||||
self:UpdateHotkeys()
|
||||
end
|
||||
|
||||
function PetButtonPrototype:UpdateHotkeys()
|
||||
local key = self:GetHotkey() or ""
|
||||
local hotkey = self.hotkey
|
||||
|
||||
if key == "" or self.parent.config.hidehotkey then
|
||||
hotkey:Hide()
|
||||
else
|
||||
hotkey:SetText(key)
|
||||
hotkey:Show()
|
||||
end
|
||||
end
|
||||
|
||||
function PetButtonPrototype:ShowButton()
|
||||
|
||||
@@ -19,6 +19,7 @@ local KeyBound = LibStub("LibKeyBound-1.0")
|
||||
local defaults = { profile = Bartender4:Merge({
|
||||
enabled = true,
|
||||
scale = 1.5,
|
||||
hidehotkey = true,
|
||||
}, Bartender4.ButtonBar.defaults) }
|
||||
|
||||
function StanceBarMod:OnInitialize()
|
||||
@@ -99,6 +100,20 @@ function StanceButtonPrototype:Update()
|
||||
else
|
||||
self.icon:SetVertexColor(0.4, 0.4, 0.4)
|
||||
end
|
||||
|
||||
self:UpdateHotkeys()
|
||||
end
|
||||
|
||||
function StanceButtonPrototype:UpdateHotkeys()
|
||||
local key = self:GetHotkey() or ""
|
||||
local hotkey = self.hotkey
|
||||
|
||||
if key == "" or self.parent.config.hidehotkey then
|
||||
hotkey:Hide()
|
||||
else
|
||||
hotkey:SetText(key)
|
||||
hotkey:Show()
|
||||
end
|
||||
end
|
||||
|
||||
function StanceButtonPrototype:GetHotkey()
|
||||
@@ -167,9 +182,11 @@ end
|
||||
|
||||
function StanceBarMod:CreateStanceButton(id)
|
||||
local button = setmetatable(CreateFrame("CheckButton", "BT4StanceButton" .. id, self.bar, "ShapeshiftButtonTemplate"), StanceButton_MT)
|
||||
button.parent = self.bar
|
||||
button:SetID(id)
|
||||
button.icon = _G[button:GetName() .. "Icon"]
|
||||
button.cooldown = _G[button:GetName() .. "Cooldown"]
|
||||
button.hotkey = _G[button:GetName() .. "HotKey"]
|
||||
button.normalTexture = button:GetNormalTexture()
|
||||
button.normalTexture:SetTexture("")
|
||||
-- button.checkedTexture = button:GetCheckedTexture()
|
||||
|
||||
Reference in New Issue
Block a user