Skip to content
This repository has been archived by the owner on Jan 21, 2024. It is now read-only.

Commit

Permalink
Make sure bar types are showing available to create, even if redundant
Browse files Browse the repository at this point in the history
  • Loading branch information
brittyazel committed Nov 9, 2018
1 parent 53ad451 commit 5973e47
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Bar-Modules/Neuron-Bag.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function NeuronBagBar:OnInitialize()
----------------------------------------------------------------


NEURON:RegisterBarClass("bag", "BagBar", L["Bag Bar"], "Bag Button", DB.bagbar, NeuronBagBar, DB.bagbtn, "CheckButton", "NeuronAnchorButtonTemplate", { __index = BAGBTN }, #bagElements, true)
NEURON:RegisterBarClass("bag", "BagBar", L["Bag Bar"], "Bag Button", DB.bagbar, NeuronBagBar, DB.bagbtn, "CheckButton", "NeuronAnchorButtonTemplate", { __index = BAGBTN }, #bagElements)


NEURON:RegisterGUIOptions("bag", { AUTOHIDE = true, SHOWGRID = false, SPELLGLOW = false, SNAPTO = true, MULTISPEC = false, HIDDEN = true, LOCKBAR = false, TOOLTIPS = true, }, false, false)
Expand Down
2 changes: 1 addition & 1 deletion Bar-Modules/Neuron-Exit.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function NeuronExitBar:OnInitialize()
EXITBTN.SetSkinned = NeuronExitBar.SetSkinned
----------------------------------------------------------------

NEURON:RegisterBarClass("exitbar", "VehicleExitBar", L["Vehicle Exit Bar"], "Vehicle Exit Button", DB.exitbar, NeuronExitBar, DB.exitbtn, "CheckButton", "NeuronActionButtonTemplate", { __index = EXITBTN }, 1, false)
NEURON:RegisterBarClass("exitbar", "VehicleExitBar", L["Vehicle Exit Bar"], "Vehicle Exit Button", DB.exitbar, NeuronExitBar, DB.exitbtn, "CheckButton", "NeuronActionButtonTemplate", { __index = EXITBTN }, 1)

NEURON:RegisterGUIOptions("exitbar", { AUTOHIDE = true,
SHOWGRID = false,
Expand Down
2 changes: 1 addition & 1 deletion Bar-Modules/Neuron-Extra.lua
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function NeuronExtraBar:OnInitialize()
EXTRABTN.SetType = NeuronExtraBar.SetType
----------------------------------------------------------------

NEURON:RegisterBarClass("extrabar", "ExtraActionBar", L["Extra Action Bar"], "Extra Action Button", DB.extrabar, NeuronExtraBar, DB.extrabtn, "CheckButton", "NeuronActionButtonTemplate", { __index = EXTRABTN }, 1, false)
NEURON:RegisterBarClass("extrabar", "ExtraActionBar", L["Extra Action Bar"], "Extra Action Button", DB.extrabar, NeuronExtraBar, DB.extrabtn, "CheckButton", "NeuronActionButtonTemplate", { __index = EXTRABTN }, 1)

NEURON:RegisterGUIOptions("extrabar", { AUTOHIDE = true,
SHOWGRID = false,
Expand Down
2 changes: 1 addition & 1 deletion Bar-Modules/Neuron-Menu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ function NeuronMenuBar:OnInitialize()
MENUBTN.SetSkinned = NeuronMenuBar.SetSkinned
----------------------------------------------------------------

NEURON:RegisterBarClass("menu", "MenuBar", L["Menu Bar"], "Menu Button", DB.menubar, NeuronMenuBar, DB.menubtn, "CheckButton", "NeuronAnchorButtonTemplate", { __index = MENUBTN }, #menuElements, false)
NEURON:RegisterBarClass("menu", "MenuBar", L["Menu Bar"], "Menu Button", DB.menubar, NeuronMenuBar, DB.menubtn, "CheckButton", "NeuronAnchorButtonTemplate", { __index = MENUBTN }, #menuElements)
NEURON:RegisterGUIOptions("menu", { AUTOHIDE = true, SHOWGRID = false, SPELLGLOW = false, SNAPTO = true, MULTISPEC = false, HIDDEN = true, LOCKBAR = false, TOOLTIPS = true }, false, false)

if DB.blizzbar == false then
Expand Down
2 changes: 1 addition & 1 deletion Bar-Modules/Neuron-Pet.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function NeuronPetBar:OnInitialize()
PETBTN.SetSkinned = NeuronPetBar.SetSkinned
----------------------------------------------------------------

NEURON:RegisterBarClass("pet", "PetBar", L["Pet Bar"], "Pet Button", DB.petbar, NeuronPetBar, DB.petbtn, "CheckButton", "NeuronActionButtonTemplate", { __index = PETBTN }, NEURON.maxPetID, false)
NEURON:RegisterBarClass("pet", "PetBar", L["Pet Bar"], "Pet Button", DB.petbar, NeuronPetBar, DB.petbtn, "CheckButton", "NeuronActionButtonTemplate", { __index = PETBTN }, NEURON.maxPetID)

NEURON:RegisterGUIOptions("pet", {
AUTOHIDE = true,
Expand Down
2 changes: 1 addition & 1 deletion Bar-Modules/Neuron-Status.lua
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function NeuronStatusBar:OnInitialize()
STATUS.SetSkinned = NeuronStatusBar.SetSkinned
-------------------------------------------------

NEURON:RegisterBarClass("status", "StatusBarGroup", L["Status Bar"], "Status Bar", DB.statusbar, NeuronStatusBar, DB.statusbtn, "Button", "NeuronStatusBarTemplate", { __index = STATUS }, 1000, true)
NEURON:RegisterBarClass("status", "StatusBarGroup", L["Status Bar"], "Status Bar", DB.statusbar, NeuronStatusBar, DB.statusbtn, "Button", "NeuronStatusBarTemplate", { __index = STATUS }, 1000)

NEURON:RegisterGUIOptions("status", { AUTOHIDE = true,
SNAPTO = true,
Expand Down
2 changes: 1 addition & 1 deletion Bar-Modules/Neuron-ZoneAbility.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function NeuronZoneAbilityBar:OnInitialize()
----------------------------------------------------------------


NEURON:RegisterBarClass("zoneabilitybar", "ZoneActionBar", L["Zone Action Bar"], "Zone Action Button", DB.zoneabilitybar, NeuronZoneAbilityBar, DB.zoneabilitybtn, "CheckButton", "NeuronActionButtonTemplate", { __index = ZONEABILITYBTN }, 1, false)
NEURON:RegisterBarClass("zoneabilitybar", "ZoneActionBar", L["Zone Action Bar"], "Zone Action Button", DB.zoneabilitybar, NeuronZoneAbilityBar, DB.zoneabilitybtn, "CheckButton", "NeuronActionButtonTemplate", { __index = ZONEABILITYBTN }, 1)

NEURON:RegisterGUIOptions("zoneabilitybar", { AUTOHIDE = true,
SHOWGRID = false,
Expand Down
2 changes: 1 addition & 1 deletion Neuron-Bars.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function NeuronBar:OnInitialize()

DB = NEURON.db.profile

NEURON:RegisterBarClass("bar", "ActionBar", L["Action Bar"], "Action Button", DB.bars, BTNIndex, DB.buttons, "CheckButton", "NeuronActionButtonTemplate", { __index = BUTTON }, 1000, true)
NEURON:RegisterBarClass("bar", "ActionBar", L["Action Bar"], "Action Button", DB.bars, BTNIndex, DB.buttons, "CheckButton", "NeuronActionButtonTemplate", { __index = BUTTON }, 1000)

NEURON:RegisterGUIOptions("bar", {
AUTOHIDE = true,
Expand Down
18 changes: 2 additions & 16 deletions Neuron-GUI.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1196,29 +1196,15 @@ function NeuronGUI:CreateButton_OnLoad(button)
end


--- Checks to see if a one only bar type has been deleted. If so it will allow the bar
-- to be created
-- @param bar: type of bar being checked
-- @return allow : (boolean)
function NeuronGUI:MissingBarCheck(bar)
local allow = true
if ((bar == "extrabar" and DB.extrabar[1]) or (bar == "zoneabilitybar" and DB.zoneabilitybar[1]))then
allow = false
end
return allow
end


function NeuronGUI:BarEditor_CreateNewBar(button)
if (button.type == "create") then

local data = {} --{ [L["Select Bar Type"]] = "none" }

for class,info in pairs(NEURON.RegisteredBarData) do

if (info.barCreateMore or NeuronGUI:MissingBarCheck(class)) then
data[info.barLabel] = class
end
data[info.barLabel] = class

end

NeuronGUI:BarListScrollFrameUpdate(nil, data, true)
Expand Down
20 changes: 9 additions & 11 deletions Neuron.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1256,17 +1256,16 @@ function NEURON:PrintBarTypes()
local data, index, high = {}, 1, 0

for k,v in pairs(NEURON.RegisteredBarData) do
if (v.barCreateMore) then

local barType;
index = tonumber(v.createMsg:match("%d+"))
barType = v.createMsg:gsub("%d+","")
local barType;
index = tonumber(v.createMsg:match("%d+"))
barType = v.createMsg:gsub("%d+","")

if (index and barType) then
data[index] = {k, barType}
if (index > high) then high = index end
end

if (index and barType) then
data[index] = {k, barType}
if (index > high) then high = index end
end
end
end

for i=1,high do if (not data[i]) then data[i] = 0 end end
Expand All @@ -1285,14 +1284,13 @@ function NEURON:PrintBarTypes()
end

---This function is called each and every time a Bar-Module loads. It adds the module to the list of currently avaible bars. If we add new bars in the future, this is the place to start
function NEURON:RegisterBarClass(class, barType, barLabel, objType, barDB, objTable, objDB, objFrameType, objTemplate, objMetaTable, objMax, barCreateMore)
function NEURON:RegisterBarClass(class, barType, barLabel, objType, barDB, objTable, objDB, objFrameType, objTemplate, objMetaTable, objMax)

NEURON.ModuleIndex = NEURON.ModuleIndex + 1

NEURON.RegisteredBarData[class] = {
barType = barType,
barLabel = barLabel,
barCreateMore = barCreateMore,
barDB = barDB,
objTable = objTable, --this is all the buttons associated with a given bar
objDB = objDB,
Expand Down

0 comments on commit 5973e47

Please sign in to comment.