- now using LibKeyBound-1.0
- added more options to configure the show/hide state of the bar, now supports showing/hiding bars based on in-combat
This commit is contained in:
+1
-1
@@ -191,7 +191,7 @@ end
|
|||||||
-- Creates a new bar object based on the id and the specified config
|
-- Creates a new bar object based on the id and the specified config
|
||||||
function BT4ActionBars:Create(id, config)
|
function BT4ActionBars:Create(id, config)
|
||||||
local id = tostring(id)
|
local id = tostring(id)
|
||||||
local bar = setmetatable(Bartender4.ButtonBar:Create(id, "SecureStateHeaderTemplate", config), ActionBar_MT)
|
local bar = setmetatable(Bartender4.ButtonBar:Create(id, config), ActionBar_MT)
|
||||||
bar.module = self
|
bar.module = self
|
||||||
|
|
||||||
self:CreateBarOption(id)
|
self:CreateBarOption(id)
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ local Bar_MT = {__index = Bar}
|
|||||||
local defaults = {
|
local defaults = {
|
||||||
scale = 1,
|
scale = 1,
|
||||||
alpha = 1,
|
alpha = 1,
|
||||||
show = true
|
show = "alwaysshow",
|
||||||
}
|
}
|
||||||
|
|
||||||
local barOnEnter, barOnLeave, barOnDragStart, barOnDragStop, barOnClick
|
local barOnEnter, barOnLeave, barOnDragStart, barOnDragStop, barOnClick
|
||||||
@@ -53,11 +53,11 @@ Bartender4.Bar = {}
|
|||||||
Bartender4.Bar.defaults = defaults
|
Bartender4.Bar.defaults = defaults
|
||||||
Bartender4.Bar.prototype = Bar
|
Bartender4.Bar.prototype = Bar
|
||||||
Bartender4.Bar.barregistry = barregistry
|
Bartender4.Bar.barregistry = barregistry
|
||||||
function Bartender4.Bar:Create(id, template, config)
|
function Bartender4.Bar:Create(id, config)
|
||||||
id = tostring(id)
|
id = tostring(id)
|
||||||
assert(not barregistry[id], "duplicated entry in barregistry.")
|
assert(not barregistry[id], "duplicated entry in barregistry.")
|
||||||
|
|
||||||
local bar = setmetatable(CreateFrame("Frame", ("BT4Bar%s"):format(id), UIParent, template), Bar_MT)
|
local bar = setmetatable(CreateFrame("Frame", ("BT4Bar%s"):format(id), UIParent, "SecureStateHeaderTemplate"), Bar_MT)
|
||||||
barregistry[id] = bar
|
barregistry[id] = bar
|
||||||
bar.id = id
|
bar.id = id
|
||||||
bar:SetMovable(true)
|
bar:SetMovable(true)
|
||||||
@@ -157,6 +157,8 @@ do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local showOptions = { alwaysshow = "Always Show", alwayshide = "Always Hide", combatshow = "Show in Combat", combathide = "Hide in Combat" }
|
||||||
|
|
||||||
local options
|
local options
|
||||||
function Bar:GetOptionObject()
|
function Bar:GetOptionObject()
|
||||||
local otbl = {
|
local otbl = {
|
||||||
@@ -168,11 +170,12 @@ function Bar:GetOptionObject()
|
|||||||
args = {
|
args = {
|
||||||
show = {
|
show = {
|
||||||
order = 5,
|
order = 5,
|
||||||
type = "toggle",
|
type = "select",
|
||||||
name = "Show",
|
name = "Show/Hide",
|
||||||
desc = "Show/Hide the bar.",
|
desc = "Configure when to Show/Hide the bar.",
|
||||||
get = optGetter,
|
get = optGetter,
|
||||||
set = optSetter,
|
set = optSetter,
|
||||||
|
values = showOptions,
|
||||||
},
|
},
|
||||||
styleheader = {
|
styleheader = {
|
||||||
order = 10,
|
order = 10,
|
||||||
@@ -235,9 +238,10 @@ end
|
|||||||
function Bar:Unlock()
|
function Bar:Unlock()
|
||||||
if self.disabled or self.unlocked then return end
|
if self.disabled or self.unlocked then return end
|
||||||
self.unlocked = true
|
self.unlocked = true
|
||||||
|
UnregisterStateDriver(self, "visibility")
|
||||||
self:Show()
|
self:Show()
|
||||||
self.overlay:Show()
|
self.overlay:Show()
|
||||||
if not self.config.show then
|
if self.config.show == "alwayshide" then
|
||||||
self.overlay:SetBackdropColor(1, 0, 0, 0.5)
|
self.overlay:SetBackdropColor(1, 0, 0, 0.5)
|
||||||
else
|
else
|
||||||
self.overlay:SetBackdropColor(0, 1, 0, 0.5)
|
self.overlay:SetBackdropColor(0, 1, 0, 0.5)
|
||||||
@@ -249,9 +253,7 @@ function Bar:Lock()
|
|||||||
self.unlocked = nil
|
self.unlocked = nil
|
||||||
barOnDragStop(self.overlay)
|
barOnDragStop(self.overlay)
|
||||||
|
|
||||||
if not self.config.show then
|
self:ConfigureShowStates()
|
||||||
self:Hide()
|
|
||||||
end
|
|
||||||
|
|
||||||
self.overlay:Hide()
|
self.overlay:Hide()
|
||||||
end
|
end
|
||||||
@@ -289,10 +291,10 @@ function Bar:SetShow(show)
|
|||||||
self.config.show = show
|
self.config.show = show
|
||||||
end
|
end
|
||||||
if not self.unlocked then
|
if not self.unlocked then
|
||||||
self[self.config.show and "Show" or "Hide"](self)
|
self:ConfigureShowStates()
|
||||||
else
|
else
|
||||||
self:Show()
|
self:Show()
|
||||||
if not self.config.show then
|
if self.config.show == "alwayshide" then
|
||||||
self.overlay:SetBackdropColor(1, 0, 0, 0.5)
|
self.overlay:SetBackdropColor(1, 0, 0, 0.5)
|
||||||
else
|
else
|
||||||
self.overlay:SetBackdropColor(0, 1, 0, 0.5)
|
self.overlay:SetBackdropColor(0, 1, 0, 0.5)
|
||||||
@@ -300,6 +302,20 @@ function Bar:SetShow(show)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Bar:ConfigureShowStates()
|
||||||
|
UnregisterStateDriver(self, 'visibility')
|
||||||
|
local conditions
|
||||||
|
if self.config.show == "alwaysshow" or self.config.show == true then
|
||||||
|
self:Show()
|
||||||
|
elseif self.config.show == "alwayshide" or self.config.show == false then
|
||||||
|
self:Hide()
|
||||||
|
elseif self.config.show == "combatshow" then
|
||||||
|
RegisterStateDriver(self, 'visibility', '[combat]show;hide')
|
||||||
|
elseif self.config.show == "combathide" then
|
||||||
|
RegisterStateDriver(self, 'visibility', '[combat]hide;show')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function Bar:GetConfigAlpha()
|
function Bar:GetConfigAlpha()
|
||||||
return self.config.alpha
|
return self.config.alpha
|
||||||
end
|
end
|
||||||
|
|||||||
+2
-3
@@ -3,13 +3,12 @@
|
|||||||
## Title: Bartender4
|
## Title: Bartender4
|
||||||
## Author: Nevcairiel
|
## Author: Nevcairiel
|
||||||
## SavedVariables: Bartender4DB
|
## SavedVariables: Bartender4DB
|
||||||
## OptionalDeps: Ace3, ButtonFacade
|
## OptionalDeps: Ace3, ButtonFacade, LibKeyBound-1.0
|
||||||
## X-Embeds: Ace3
|
## X-Embeds: Ace3, LibKeyBound-1.0
|
||||||
## X-Category: Action Bars
|
## X-Category: Action Bars
|
||||||
## Version: 4.0
|
## Version: 4.0
|
||||||
|
|
||||||
embeds.xml
|
embeds.xml
|
||||||
keyBound\keyBound.xml
|
|
||||||
|
|
||||||
locale\locale.xml
|
locale\locale.xml
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ local IsUsableAction = IsUsableAction
|
|||||||
local IsActionInRange = IsActionInRange
|
local IsActionInRange = IsActionInRange
|
||||||
|
|
||||||
local LBF = LibStub("LibButtonFacade", true)
|
local LBF = LibStub("LibButtonFacade", true)
|
||||||
|
local KeyBound = LibStub("LibKeyBound-1.0")
|
||||||
|
|
||||||
Bartender4.Button = {}
|
Bartender4.Button = {}
|
||||||
Bartender4.Button.prototype = Button
|
Bartender4.Button.prototype = Button
|
||||||
|
|||||||
+2
-2
@@ -23,8 +23,8 @@ Bartender4.ButtonBar.defaults = defaults
|
|||||||
|
|
||||||
local LBF = LibStub("LibButtonFacade", true)
|
local LBF = LibStub("LibButtonFacade", true)
|
||||||
|
|
||||||
function Bartender4.ButtonBar:Create(id, template, config)
|
function Bartender4.ButtonBar:Create(id, config)
|
||||||
local bar = setmetatable(Bartender4.Bar:Create(id, template, config), ButtonBar_MT)
|
local bar = setmetatable(Bartender4.Bar:Create(id, config), ButtonBar_MT)
|
||||||
|
|
||||||
if LBF then
|
if LBF then
|
||||||
bar.LBFGroup = LBF:Group("Bartender4", tostring(id))
|
bar.LBFGroup = LBF:Group("Bartender4", tostring(id))
|
||||||
|
|||||||
+1
-1
@@ -26,7 +26,7 @@ local noopFunc = function() end
|
|||||||
|
|
||||||
function MicroMenuMod:OnEnable()
|
function MicroMenuMod:OnEnable()
|
||||||
if not self.bar then
|
if not self.bar then
|
||||||
self.bar = setmetatable(Bartender4.Bar:Create("MicroMenu", nil, self.db.profile), {__index = MicroMenuBar})
|
self.bar = setmetatable(Bartender4.Bar:Create("MicroMenu", self.db.profile), {__index = MicroMenuBar})
|
||||||
local buttons = {}
|
local buttons = {}
|
||||||
table_insert(buttons, CharacterMicroButton)
|
table_insert(buttons, CharacterMicroButton)
|
||||||
table_insert(buttons, SpellbookMicroButton)
|
table_insert(buttons, SpellbookMicroButton)
|
||||||
|
|||||||
+2
-1
@@ -13,6 +13,7 @@ local PetButtonPrototype = CreateFrame("CheckButton")
|
|||||||
local PetButton_MT = {__index = PetButtonPrototype}
|
local PetButton_MT = {__index = PetButtonPrototype}
|
||||||
|
|
||||||
local LBF = LibStub("LibButtonFacade", true)
|
local LBF = LibStub("LibButtonFacade", true)
|
||||||
|
local KeyBound = LibStub("LibKeyBound-1.0")
|
||||||
|
|
||||||
local defaults = { profile = Bartender4:Merge({
|
local defaults = { profile = Bartender4:Merge({
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@@ -26,7 +27,7 @@ end
|
|||||||
|
|
||||||
function PetBarMod:OnEnable()
|
function PetBarMod:OnEnable()
|
||||||
if not self.bar then
|
if not self.bar then
|
||||||
self.bar = setmetatable(Bartender4.ButtonBar:Create("Pet", nil, self.db.profile), {__index = PetBar})
|
self.bar = setmetatable(Bartender4.ButtonBar:Create("Pet", self.db.profile), {__index = PetBar})
|
||||||
|
|
||||||
local buttons = {}
|
local buttons = {}
|
||||||
for i=1,10 do
|
for i=1,10 do
|
||||||
|
|||||||
+2
-1
@@ -15,6 +15,7 @@ local StanceButton_MT = {__index = StanceButtonPrototype}
|
|||||||
local format = string.format
|
local format = string.format
|
||||||
|
|
||||||
local LBF = LibStub("LibButtonFacade", true)
|
local LBF = LibStub("LibButtonFacade", true)
|
||||||
|
local KeyBound = LibStub("LibKeyBound-1.0")
|
||||||
|
|
||||||
local defaults = { profile = Bartender4:Merge({
|
local defaults = { profile = Bartender4:Merge({
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@@ -28,7 +29,7 @@ end
|
|||||||
|
|
||||||
function StanceBarMod:OnEnable()
|
function StanceBarMod:OnEnable()
|
||||||
if not self.bar then
|
if not self.bar then
|
||||||
self.bar = setmetatable(Bartender4.ButtonBar:Create("Stance", nil, self.db.profile), {__index = StanceBar})
|
self.bar = setmetatable(Bartender4.ButtonBar:Create("Stance", self.db.profile), {__index = StanceBar})
|
||||||
|
|
||||||
self.bar:ClearSetPoint("CENTER")
|
self.bar:ClearSetPoint("CENTER")
|
||||||
self.bar:SetScript("OnEvent", StanceBar.OnEvent)
|
self.bar:SetScript("OnEvent", StanceBar.OnEvent)
|
||||||
|
|||||||
@@ -10,4 +10,5 @@
|
|||||||
<Include file="libs\AceLocale-3.0\AceLocale-3.0.xml"/>
|
<Include file="libs\AceLocale-3.0\AceLocale-3.0.xml"/>
|
||||||
<Include file="libs\AceGUI-3.0\AceGUI-3.0.xml"/>
|
<Include file="libs\AceGUI-3.0\AceGUI-3.0.xml"/>
|
||||||
<Include file="libs\AceConfig-3.0\AceConfig-3.0.xml"/>
|
<Include file="libs\AceConfig-3.0\AceConfig-3.0.xml"/>
|
||||||
|
<Include file="libs\LibKeyBound-1.0\lib.xml"/>
|
||||||
</Ui>
|
</Ui>
|
||||||
|
|||||||
Reference in New Issue
Block a user