- add keyring and onebag option to bagbar

- fix some random stuff in the options tables
This commit is contained in:
Hendrik Leppkes
2008-05-31 19:48:47 +00:00
parent ee13a40b9d
commit d9e1bb2bb6
4 changed files with 46 additions and 10 deletions
+37 -6
View File
@@ -27,8 +27,7 @@ local noopFunc = function() end
function BagBarMod:OnEnable() function BagBarMod:OnEnable()
if not self.bar then if not self.bar then
self.bar = setmetatable(Bartender4.ButtonBar:Create("Bags", self.db.profile), {__index = BagBar}) self.bar = setmetatable(Bartender4.ButtonBar:Create("Bag", self.db.profile), {__index = BagBar})
self.bar:FeedButtons()
-- TODO: real start position -- TODO: real start position
self.bar:SetPoint("CENTER") self.bar:SetPoint("CENTER")
@@ -49,9 +48,11 @@ function BagBarMod:ApplyConfig()
self.bar:ApplyConfig(self.db.profile) self.bar:ApplyConfig(self.db.profile)
end end
local button_count = 5
function BagBarMod:SetupOptions() function BagBarMod:SetupOptions()
if not self.options then if not self.options then
self.optionobject = ButtonBar:GetOptionObject() self.optionobject = ButtonBar:GetOptionObject()
self.optionobject.table.general.args.rows.max = button_count
local enabled = { local enabled = {
type = "toggle", type = "toggle",
order = 1, order = 1,
@@ -63,6 +64,26 @@ function BagBarMod:SetupOptions()
} }
self.optionobject:AddElement("general", "enabled", enabled) 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 = { self.disabledoptions = {
general = { general = {
type = "group", type = "group",
@@ -81,7 +102,7 @@ function BagBarMod:SetupOptions()
desc = "Configure the Bag Bar", desc = "Configure the Bag Bar",
childGroups = "tab", childGroups = "tab",
} }
Bartender4:RegisterBarOptions("Bags", self.options) Bartender4:RegisterBarOptions("Bag", self.options)
end end
self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions self.options.args = self:IsEnabled() and self.optionobject.table or self.disabledoptions
end end
@@ -94,6 +115,7 @@ end
function BagBar:ApplyConfig(config) function BagBar:ApplyConfig(config)
ButtonBar.ApplyConfig(self, config) ButtonBar.ApplyConfig(self, config)
self:FeedButtons()
self:UpdateButtonLayout() self:UpdateButtonLayout()
end end
@@ -105,11 +127,13 @@ end
BagBar.button_width = 37 BagBar.button_width = 37
BagBar.button_height = 37 BagBar.button_height = 37
function BagBar:FeedButtons() function BagBar:FeedButtons()
local count = 1
if self.buttons then if self.buttons then
while next(self.buttons) do while next(self.buttons) do
local btn = table.remove(self.buttons) local btn = table.remove(self.buttons)
btn:Hide() btn:Hide()
btn:SetParent(nil) btn:SetParent(UIParent)
btn:ClearSetPoint("CENTER")
if btn ~= KeyRingButton and btn.LBFButtonData then if btn ~= KeyRingButton and btn.LBFButtonData then
local group = self.LBFGroup local group = self.LBFGroup
group:RemoveButton(btn) group:RemoveButton(btn)
@@ -121,6 +145,7 @@ function BagBar:FeedButtons()
if self.config.keyring then if self.config.keyring then
table_insert(self.buttons, KeyRingButton) table_insert(self.buttons, KeyRingButton)
count = count + 1
end end
if not self.config.onebag then if not self.config.onebag then
@@ -128,6 +153,7 @@ function BagBar:FeedButtons()
table_insert(self.buttons, CharacterBag2Slot) table_insert(self.buttons, CharacterBag2Slot)
table_insert(self.buttons, CharacterBag1Slot) table_insert(self.buttons, CharacterBag1Slot)
table_insert(self.buttons, CharacterBag0Slot) table_insert(self.buttons, CharacterBag0Slot)
count = count + 4
end end
table_insert(self.buttons, MainMenuBarBackpackButton) table_insert(self.buttons, MainMenuBarBackpackButton)
@@ -135,8 +161,8 @@ function BagBar:FeedButtons()
for i,v in pairs(self.buttons) do for i,v in pairs(self.buttons) do
v:SetParent(self) v:SetParent(self)
v:Show() v:Show()
if v ~= KeyRingButton then if v ~= KeyRingButton then
v:SetNormalTexture("") v:SetNormalTexture("")
if LBF then if LBF then
local group = self.LBFGroup local group = self.LBFGroup
@@ -152,5 +178,10 @@ function BagBar:FeedButtons()
v.ClearSetPoint = clearSetPoint v.ClearSetPoint = clearSetPoint
end end
button_count = count
if BagBarMod.optionobject then
BagBarMod.optionobject.table.general.args.rows.max = count
end
end end
+2
View File
@@ -130,6 +130,8 @@ function PetBarMod:SetupOptions()
if not self.options then if not self.options then
self.optionobject = Bartender4.ButtonBar.prototype:GetOptionObject() self.optionobject = Bartender4.ButtonBar.prototype:GetOptionObject()
self.optionobject.table.general.args.rows.max = 10
local enabled = { local enabled = {
type = "toggle", type = "toggle",
order = 1, order = 1,
+7 -1
View File
@@ -57,10 +57,11 @@ function StanceBarMod:OnDisable()
self:ToggleOptions() self:ToggleOptions()
end end
local button_count = 10
function StanceBarMod:SetupOptions() function StanceBarMod:SetupOptions()
if not self.options then if not self.options then
self.optionobject = Bartender4.ButtonBar.prototype:GetOptionObject() self.optionobject = Bartender4.ButtonBar.prototype:GetOptionObject()
self.optionobject.table.general.args.rows.max = button_count
local enabled = { local enabled = {
type = "toggle", type = "toggle",
order = 1, order = 1,
@@ -251,6 +252,11 @@ function StanceBar:UpdateStanceButtons()
buttons[i]:Hide() buttons[i]:Hide()
end end
button_count = num_stances
if StanceBarMod.optionobject then
StanceBarMod.optionobject.table.general.args.rows.max = num_stances
end
self.buttons = buttons self.buttons = buttons
self:UpdateButtonLayout() self:UpdateButtonLayout()
-3
View File
@@ -1,11 +1,8 @@
Bartender4 TODO List Bartender4 TODO List
- Option to change self-cast modifier assignment (Blizzard kinda removed that <.<) - Option to change self-cast modifier assignment (Blizzard kinda removed that <.<)
- Bag Bar
- XP/Reputation Bar
- Alignment Menu - Alignment Menu
- Options to control the removal of the Blizzard Artwork Bottom Bar - 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) - 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 Skin Configuration Options (ButtonFacade) into the BT4 config
- Add options to hide certain elements of the buttons (keybinding, macro text, etc)
- Localization - Localization