diff --git a/ActionBar.lua b/ActionBar.lua index 794aa32..8ccf902 100644 --- a/ActionBar.lua +++ b/ActionBar.lua @@ -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() diff --git a/ActionBars.lua b/ActionBars.lua index c6593ab..cc43b89 100644 --- a/ActionBars.lua +++ b/ActionBars.lua @@ -8,7 +8,6 @@ local abdefaults = { enabled = true, buttons = 12, hidemacrotext = false, - hidehotkey = false, showgrid = false, autoassist = false, states = { diff --git a/ButtonBar.lua b/ButtonBar.lua index 56d4739..9629356 100644 --- a/ButtonBar.lua +++ b/ButtonBar.lua @@ -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 diff --git a/Options/ActionBar.lua b/Options/ActionBar.lua index ee2d27e..7668ad4 100644 --- a/Options/ActionBar.lua +++ b/Options/ActionBar.lua @@ -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) diff --git a/Options/ButtonBar.lua b/Options/ButtonBar.lua index 076075f..3388bb9 100644 --- a/Options/ButtonBar.lua +++ b/Options/ButtonBar.lua @@ -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 diff --git a/PetBar.lua b/PetBar.lua index 265ec98..90e027e 100644 --- a/PetBar.lua +++ b/PetBar.lua @@ -12,6 +12,7 @@ local PetBar = setmetatable({}, {__index = ButtonBar}) local defaults = { profile = Bartender4:Merge({ enabled = true, scale = 1.0, + hidehotkey = true, visibility = { nopet = true, }, diff --git a/PetButton.lua b/PetButton.lua index 2fdbae1..cb798b8 100644 --- a/PetButton.lua +++ b/PetButton.lua @@ -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() diff --git a/StanceBar.lua b/StanceBar.lua index 4a456f5..971c11e 100644 --- a/StanceBar.lua +++ b/StanceBar.lua @@ -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()