first draft of new visibility system, works so far, but lacks options
This commit is contained in:
@@ -73,11 +73,6 @@ function ActionBar:SkinChanged(...)
|
||||
self:ForAll("Update")
|
||||
end
|
||||
|
||||
function ActionBar:SetShow(...)
|
||||
ButtonBar.SetShow(self, ...)
|
||||
self:UpdateStates()
|
||||
end
|
||||
|
||||
|
||||
--[[===================================================================================
|
||||
ActionBar Config Interface
|
||||
|
||||
+3
-18
@@ -54,7 +54,6 @@ local searchFunc = function(h, n) return (h.match == n or h.match2 == n or h.id
|
||||
local stancemap
|
||||
function ActionBar:UpdateStates()
|
||||
if not self.buttons then return end
|
||||
self:InitVisibilityDriver()
|
||||
self.statebutton = {}
|
||||
if not stancemap and DefaultStanceMap[playerclass] then
|
||||
stancemap = DefaultStanceMap[playerclass]
|
||||
@@ -79,11 +78,7 @@ function ActionBar:UpdateStates()
|
||||
for _,v in pairs(modifiers) do
|
||||
local page = self:GetStateOption(v)
|
||||
if page and page ~= 0 then
|
||||
if page == -1 then
|
||||
self:RegisterVisibilityCondition(fmt("[modifier:%s]hide", v))
|
||||
else
|
||||
table_insert(statedriver, fmt("[modifier:%s]%s", v, page))
|
||||
end
|
||||
table_insert(statedriver, fmt("[modifier:%s]%s", v, page))
|
||||
end
|
||||
end
|
||||
|
||||
@@ -103,18 +98,10 @@ function ActionBar:UpdateStates()
|
||||
if playerclass == "DRUID" and v.id == "cat" then
|
||||
local prowl = self:GetStanceState("prowl")
|
||||
if prowl then
|
||||
if prowl == -1 then
|
||||
self:RegisterVisibilityCondition(fmt("[bonusbar:%s,stealth:1]hide", v.index))
|
||||
else
|
||||
table_insert(statedriver, fmt("[bonusbar:%s,stealth:1]%s", v.index, prowl))
|
||||
end
|
||||
table_insert(statedriver, fmt("[bonusbar:%s,stealth:1]%s", v.index, prowl))
|
||||
end
|
||||
end
|
||||
if state == -1 then
|
||||
self:RegisterVisibilityCondition(fmt("[bonusbar:%s]hide", v.index))
|
||||
else
|
||||
table_insert(statedriver, fmt("[bonusbar:%s]%s", v.index, state))
|
||||
end
|
||||
table_insert(statedriver, fmt("[bonusbar:%s]%s", v.index, state))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -130,8 +117,6 @@ function ActionBar:UpdateStates()
|
||||
|
||||
--local newState = self:GetAttribute("state-page")
|
||||
--self:SetAttribute("state", newState)
|
||||
|
||||
self:ApplyVisibilityDriver()
|
||||
end
|
||||
|
||||
function ActionBar:GetStanceState(stance)
|
||||
|
||||
@@ -37,6 +37,9 @@ local abdefaults = {
|
||||
ROGUE = { stealth = 7 }
|
||||
},
|
||||
},
|
||||
visibility = {
|
||||
possess = false,
|
||||
},
|
||||
},
|
||||
[7] = {
|
||||
enabled = false,
|
||||
|
||||
@@ -16,6 +16,9 @@ local defaults = { profile = Bartender4:Merge({
|
||||
enabled = true,
|
||||
keyring = false,
|
||||
onebag = false,
|
||||
visibility = {
|
||||
possess = false,
|
||||
},
|
||||
}, Bartender4.ButtonBar.defaults) }
|
||||
|
||||
function BagBarMod:OnInitialize()
|
||||
|
||||
@@ -18,7 +18,9 @@ local defaults = {
|
||||
fadeout = false,
|
||||
fadeoutalpha = 0.1,
|
||||
fadeoutdelay = 0.2,
|
||||
show = "alwaysshow",
|
||||
visibility = {
|
||||
possess = true,
|
||||
},
|
||||
}
|
||||
|
||||
local barOnEnter, barOnLeave, barOnDragStart, barOnDragStop, barOnClick, barOnUpdateFunc
|
||||
@@ -138,7 +140,6 @@ function Bar:ApplyConfig(config)
|
||||
end
|
||||
if self.disabled then return end
|
||||
self:InitVisibilityDriver()
|
||||
self:SetShow()
|
||||
self:Lock()
|
||||
self:LoadPosition()
|
||||
self:SetConfigScale()
|
||||
@@ -201,28 +202,6 @@ function Bar:SetSize(width, height)
|
||||
self:SetHeight(height or width)
|
||||
end
|
||||
|
||||
function Bar:GetShow()
|
||||
return self.config.show
|
||||
end
|
||||
|
||||
function Bar:SetShow(show)
|
||||
if show ~= nil then
|
||||
self.config.show = show
|
||||
end
|
||||
if not self.unlocked then
|
||||
self:InitVisibilityDriver()
|
||||
self:ApplyVisibilityDriver()
|
||||
else
|
||||
self:Show()
|
||||
self:InitVisibilityDriver()
|
||||
if self.config.show == "alwayshide" then
|
||||
self.overlay:SetBackdropColor(1, 0, 0, 0.5)
|
||||
else
|
||||
self.overlay:SetBackdropColor(0, 1, 0, 0.5)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Bar:GetConfigAlpha()
|
||||
return self.config.alpha
|
||||
end
|
||||
@@ -301,29 +280,37 @@ function Bar:ControlFadeOut()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local directVisCond = {
|
||||
pet = true,
|
||||
nopet = true,
|
||||
combat = true,
|
||||
nocomat = true,
|
||||
mounted = true,
|
||||
}
|
||||
function Bar:InitVisibilityDriver()
|
||||
self.hidedriver = {}
|
||||
UnregisterStateDriver(self, 'visibility')
|
||||
if self.config.show == "alwaysshow" or self.config.show == true then
|
||||
--
|
||||
elseif self.config.show == "alwayshide" or self.config.show == false then
|
||||
self:RegisterVisibilityCondition("hide")
|
||||
elseif self.config.show == "combatshow" then
|
||||
self:RegisterVisibilityCondition("[nocombat]hide")
|
||||
elseif self.config.show == "combathide" then
|
||||
self:RegisterVisibilityCondition("[combat]hide")
|
||||
end
|
||||
end
|
||||
|
||||
function Bar:RegisterVisibilityCondition(condition)
|
||||
table_insert(self.hidedriver, condition)
|
||||
for key, value in pairs(self.config.visibility) do
|
||||
if value then
|
||||
if key == "always" then
|
||||
table_insert(self.hidedriver, "hide")
|
||||
elseif key == "possess" then
|
||||
table_insert(self.hidedriver, "[bonusbar:5]hide")
|
||||
elseif directVisCond[key] then
|
||||
table_insert(self.hidedriver, ("[%s]hide"):format(key))
|
||||
else
|
||||
Bartender4:Print("Invalid visibility state: "..key)
|
||||
end
|
||||
end
|
||||
end
|
||||
table_insert(self.hidedriver, "show")
|
||||
end
|
||||
|
||||
function Bar:ApplyVisibilityDriver()
|
||||
if self.unlocked then return end
|
||||
-- default state is shown
|
||||
RegisterStateDriver(self, "visibility", table_concat(self.hidedriver, ";") .. ";show")
|
||||
RegisterStateDriver(self, "visibility", table_concat(self.hidedriver, ";"))
|
||||
end
|
||||
|
||||
function Bar:DisableVisibilityDriver()
|
||||
|
||||
@@ -15,6 +15,9 @@ local table_insert = table.insert
|
||||
local defaults = { profile = Bartender4:Merge({
|
||||
enabled = true,
|
||||
vertical = false,
|
||||
visibility = {
|
||||
possess = false,
|
||||
},
|
||||
}, Bartender4.Bar.defaults) }
|
||||
|
||||
function MicroMenuMod:OnInitialize()
|
||||
|
||||
@@ -50,7 +50,6 @@ end
|
||||
local hasStances
|
||||
|
||||
local validStanceTable = {
|
||||
[-1] = "Hide",
|
||||
[0] = "Don't Page",
|
||||
("Page %2d"):format(1),
|
||||
("Page %2d"):format(2),
|
||||
|
||||
@@ -16,7 +16,6 @@ do
|
||||
optionMap = {
|
||||
alpha = "ConfigAlpha",
|
||||
scale = "ConfigScale",
|
||||
show = "Show",
|
||||
fadeout = "FadeOut",
|
||||
fadeoutalpha = "FadeOutAlpha",
|
||||
fadeoutdelay = "FadeOutDelay",
|
||||
@@ -51,8 +50,6 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
local showOptions = { alwaysshow = L["Always Show"], alwayshide = L["Always Hide"], combatshow = L["Show in Combat"], combathide = L["Hide in Combat"] }
|
||||
|
||||
local options
|
||||
function Bar:GetOptionObject()
|
||||
local otbl = {
|
||||
@@ -62,15 +59,6 @@ function Bar:GetOptionObject()
|
||||
name = L["General Settings"],
|
||||
order = 1,
|
||||
args = {
|
||||
show = {
|
||||
order = 5,
|
||||
type = "select",
|
||||
name = L["Show/Hide"],
|
||||
desc = L["Configure when to Show/Hide the bar."],
|
||||
get = optGetter,
|
||||
set = optSetter,
|
||||
values = showOptions,
|
||||
},
|
||||
styleheader = {
|
||||
order = 10,
|
||||
type = "header",
|
||||
|
||||
+3
-5
@@ -13,6 +13,9 @@ local PetBar = setmetatable({}, {__index = ButtonBar})
|
||||
local defaults = { profile = Bartender4:Merge({
|
||||
enabled = true,
|
||||
scale = 1.0,
|
||||
visibility = {
|
||||
nopet = true,
|
||||
},
|
||||
}, Bartender4.ButtonBar.defaults) }
|
||||
|
||||
function PetBarMod:OnInitialize()
|
||||
@@ -108,11 +111,6 @@ end
|
||||
function PetBar:ApplyConfig(config)
|
||||
ButtonBar.ApplyConfig(self, config)
|
||||
self:UpdateButtonLayout()
|
||||
self:InitVisibilityDriver()
|
||||
self:RegisterVisibilityCondition("[bonusbar:5]hide")
|
||||
self:RegisterVisibilityCondition("[pet]show")
|
||||
self:RegisterVisibilityCondition("hide")
|
||||
self:ApplyVisibilityDriver()
|
||||
self:ForAll("Update")
|
||||
self:ForAll("ApplyStyle", self.config.style)
|
||||
end
|
||||
|
||||
@@ -3,5 +3,4 @@ Bartender4 TODO List
|
||||
- Option to change self-cast modifier assignment (Blizzard kinda removed that <.<)
|
||||
- Alignment Menu
|
||||
- Options to control the removal of the Blizzard Artwork Bottom Bar
|
||||
- Add Skin Configuration Options (ButtonFacade) into the BT4 config
|
||||
- Localization
|
||||
- Improved Show/Hide functionality
|
||||
Reference in New Issue
Block a user