diff --git a/BagBar.lua b/BagBar.lua index 1dde46b..9df2488 100644 --- a/BagBar.lua +++ b/BagBar.lua @@ -27,8 +27,7 @@ local noopFunc = function() end function BagBarMod:OnEnable() if not self.bar then - self.bar = setmetatable(Bartender4.ButtonBar:Create("Bags", self.db.profile), {__index = BagBar}) - self.bar:FeedButtons() + self.bar = setmetatable(Bartender4.ButtonBar:Create("Bag", self.db.profile), {__index = BagBar}) -- TODO: real start position self.bar:SetPoint("CENTER") @@ -49,9 +48,11 @@ function BagBarMod:ApplyConfig() self.bar:ApplyConfig(self.db.profile) end +local button_count = 5 function BagBarMod:SetupOptions() if not self.options then self.optionobject = ButtonBar:GetOptionObject() + self.optionobject.table.general.args.rows.max = button_count local enabled = { type = "toggle", order = 1, @@ -63,6 +64,26 @@ function BagBarMod:SetupOptions() } self.optionobject:AddElement("general", "enabled", enabled) + local onebag = { + type = "toggle", + order = 80, + name = "One Bag", + desc = "Only show one Bag Button in the BagBar.", + get = function() return self.db.profile.onebag end, + set = function(info, state) self.db.profile.onebag = state; self.bar:FeedButtons(); self.bar:UpdateButtonLayout() end, + } + self.optionobject:AddElement("general", "onebag", onebag) + + local keyring = { + type = "toggle", + order = 80, + name = "Keyring", + desc = "Show the keyring button.", + get = function() return self.db.profile.keyring end, + set = function(info, state) self.db.profile.keyring = state; self.bar:FeedButtons(); self.bar:UpdateButtonLayout() end, + } + self.optionobject:AddElement("general", "keyring", keyring) + self.disabledoptions = { general = { type = "group", @@ -81,7 +102,7 @@ function BagBarMod:SetupOptions() desc = "Configure the Bag Bar", childGroups = "tab", } - Bartender4:RegisterBarOptions("Bags", self.options) + Bartender4:RegisterBarOptions("Bag", self.options) end self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions end @@ -94,6 +115,7 @@ end function BagBar:ApplyConfig(config) ButtonBar.ApplyConfig(self, config) + self:FeedButtons() self:UpdateButtonLayout() end @@ -105,11 +127,13 @@ end BagBar.button_width = 37 BagBar.button_height = 37 function BagBar:FeedButtons() + local count = 1 if self.buttons then while next(self.buttons) do local btn = table.remove(self.buttons) btn:Hide() - btn:SetParent(nil) + btn:SetParent(UIParent) + btn:ClearSetPoint("CENTER") if btn ~= KeyRingButton and btn.LBFButtonData then local group = self.LBFGroup group:RemoveButton(btn) @@ -121,6 +145,7 @@ function BagBar:FeedButtons() if self.config.keyring then table_insert(self.buttons, KeyRingButton) + count = count + 1 end if not self.config.onebag then @@ -128,6 +153,7 @@ function BagBar:FeedButtons() table_insert(self.buttons, CharacterBag2Slot) table_insert(self.buttons, CharacterBag1Slot) table_insert(self.buttons, CharacterBag0Slot) + count = count + 4 end table_insert(self.buttons, MainMenuBarBackpackButton) @@ -135,8 +161,8 @@ function BagBar:FeedButtons() for i,v in pairs(self.buttons) do v:SetParent(self) v:Show() - if v ~= KeyRingButton then - v:SetNormalTexture("") + if v ~= KeyRingButton then + v:SetNormalTexture("") if LBF then local group = self.LBFGroup @@ -152,5 +178,10 @@ function BagBar:FeedButtons() v.ClearSetPoint = clearSetPoint end + + button_count = count + if BagBarMod.optionobject then + BagBarMod.optionobject.table.general.args.rows.max = count + end end diff --git a/PetBar.lua b/PetBar.lua index ff09839..b6f4703 100644 --- a/PetBar.lua +++ b/PetBar.lua @@ -130,6 +130,8 @@ function PetBarMod:SetupOptions() if not self.options then self.optionobject = Bartender4.ButtonBar.prototype:GetOptionObject() + self.optionobject.table.general.args.rows.max = 10 + local enabled = { type = "toggle", order = 1, diff --git a/StanceBar.lua b/StanceBar.lua index f9c217f..41954d2 100644 --- a/StanceBar.lua +++ b/StanceBar.lua @@ -57,10 +57,11 @@ function StanceBarMod:OnDisable() self:ToggleOptions() end +local button_count = 10 function StanceBarMod:SetupOptions() if not self.options then self.optionobject = Bartender4.ButtonBar.prototype:GetOptionObject() - + self.optionobject.table.general.args.rows.max = button_count local enabled = { type = "toggle", order = 1, @@ -251,6 +252,11 @@ function StanceBar:UpdateStanceButtons() buttons[i]:Hide() end + button_count = num_stances + if StanceBarMod.optionobject then + StanceBarMod.optionobject.table.general.args.rows.max = num_stances + end + self.buttons = buttons self:UpdateButtonLayout() diff --git a/TODO.txt b/TODO.txt index ee688b7..e29c0a7 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,11 +1,8 @@ Bartender4 TODO List - Option to change self-cast modifier assignment (Blizzard kinda removed that <.<) -- Bag Bar -- XP/Reputation Bar - Alignment Menu - Options to control the removal of the Blizzard Artwork Bottom Bar - Bar Fadeout until mouseover (Do i really have to? That features is so ugly :P) - Add Skin Configuration Options (ButtonFacade) into the BT4 config -- Add options to hide certain elements of the buttons (keybinding, macro text, etc) - Localization \ No newline at end of file