forked from brittyazel/Neuron
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNeuron-Startup.lua
More file actions
223 lines (185 loc) · 5.95 KB
/
Neuron-Startup.lua
File metadata and controls
223 lines (185 loc) · 5.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
--Neuron, a World of Warcraft® user interface addon.
--This file is part of Neuron.
--
--Neuron is free software: you can redistribute it and/or modify
--it under the terms of the GNU General Public License as published by
--the Free Software Foundation, either version 3 of the License, or
--(at your option) any later version.
--
--Neuron is distributed in the hope that it will be useful,
--but WITHOUT ANY WARRANTY; without even the implied warranty of
--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
--GNU General Public License for more details.
--
--You should have received a copy of the GNU General Public License
--along with this add-on. If not, see <https://www.gnu.org/licenses/>.
--
--Copyright for portions of Neuron are held by Connor Chenoweth,
--a.k.a Maul, 2014 as part of his original project, Ion. All other
--copyrights for Neuron are held by Britt Yazel, 2017-2020.
local DB
local L = LibStub("AceLocale-3.0"):GetLocale("Neuron")
function Neuron:Startup()
DB = Neuron.db.profile
Neuron:RegisterBars()
Neuron:RegisterGUI()
Neuron:CreateBarsAndButtons()
end
function Neuron:RegisterBars()
--Neuron Action Bar
Neuron:RegisterBarClass("ActionBar", "ActionBar", L["Action Bar"], "Action Button", DB.ActionBar, Neuron.ACTIONBUTTON, 250, true)
--Neuron Bag Bar
Neuron:RegisterBarClass("BagBar", "BagBar", L["Bag Bar"], "Bag Button", DB.BagBar, Neuron.BAGBTN, Neuron.NUM_BAG_BUTTONS, false) --Neuron.NUM_BAG_BUTTONS == 5 for retail and 6 for classic due to the keyring
--Neuron Status Bar
Neuron:RegisterBarClass("StatusBar", "StatusBar", L["Status Bar"], "Status Bar", DB.StatusBar, Neuron.STATUSBTN, 20, false)
--Neuron Menu Bar
Neuron:RegisterBarClass("MenuBar", "MenuBar", L["Menu Bar"], "Menu Button", DB.MenuBar, Neuron.MENUBTN, 11, false)
--Neuron Pet Bar
Neuron:RegisterBarClass("PetBar", "PetBar", L["Pet Bar"], "Pet Button", DB.PetBar, Neuron.PETBTN, 10, true)
if not Neuron.isWoWClassic then
--Neuron Zone Ability Bar
Neuron:RegisterBarClass("ZoneAbilityBar", "ZoneAbilityBar", L["Zone Action Bar"], "Zone Action Button", DB.ZoneAbilityBar, Neuron.ZONEABILITYBTN, 5, true)
--Neuron Extra Bar
Neuron:RegisterBarClass("ExtraBar", "ExtraBar", L["Extra Action Bar"], "Extra Action Button", DB.ExtraBar, Neuron.EXTRABTN,1, true)
--Neuron Exit Bar
Neuron:RegisterBarClass("ExitBar", "ExitBar", L["Vehicle Exit Bar"], "Vehicle Exit Button", DB.ExitBar, Neuron.EXITBTN,1, false)
end
end
function Neuron:RegisterGUI()
--Neuron Action Bar
Neuron:RegisterGUIOptions("ActionBar", {
AUTOHIDE = true,
SHOWGRID = true,
SPELLGLOW = true,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
MULTISPEC = true,
HIDDEN = true,
LOCKBAR = true,
TOOLTIPS = true,
BINDTEXT = true,
MACROTEXT = true,
COUNTTEXT = true,
RANGEIND = true,
CDTEXT = true,
CDALPHA = true, },
true, 115)
--Neuron Bag Bar
Neuron:RegisterGUIOptions("BagBar", {
AUTOHIDE = true,
SHOWGRID = false,
SPELLGLOW = false,
SNAPTO = true,
MULTISPEC = false,
HIDDEN = true,
LOCKBAR = false,
TOOLTIPS = true, },
false, false)
--Neuron Status Bar
Neuron:RegisterGUIOptions("StatusBar", {
AUTOHIDE = true,
SNAPTO = true,
HIDDEN = true,
TOOLTIPS = true },
false, false)
--Neuron Menu Bar
Neuron:RegisterGUIOptions("MenuBar", {
AUTOHIDE = true,
SHOWGRID = false,
SPELLGLOW = false,
SNAPTO = true,
MULTISPEC = false,
HIDDEN = true,
LOCKBAR = false,
TOOLTIPS = true },
false, false)
--Neuron Pet Bar
Neuron:RegisterGUIOptions("PetBar", {
AUTOHIDE = true,
SHOWGRID = false,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
HIDDEN = true,
LOCKBAR = true,
TOOLTIPS = true,
BINDTEXT = true,
RANGEIND = true,
CDTEXT = true,
CDALPHA = true },
false, 65)
if not Neuron.isWoWClassic then
--Neuron Zone Ability Bar
Neuron:RegisterGUIOptions("ZoneAbilityBar", {
AUTOHIDE = true,
SHOWGRID = false,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
HIDDEN = true,
LOCKBAR = false,
TOOLTIPS = true,
BINDTEXT = true,
COUNTTEXT = true,
CDTEXT = true,
CDALPHA = true,
BORDERSTYLE = true,},
false, 65)
--Neuron Extra Bar
Neuron:RegisterGUIOptions("ExtraBar", {
AUTOHIDE = true,
SHOWGRID = false,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
HIDDEN = true,
LOCKBAR = false,
TOOLTIPS = true,
BINDTEXT = true,
COUNTTEXT = true,
CDTEXT = true,
CDALPHA = true,
BORDERSTYLE = true,},
false, 65)
--Neuron Exit Bar
Neuron:RegisterGUIOptions("ExitBar", {
AUTOHIDE = true,
SHOWGRID = false,
SNAPTO = true,
UPCLICKS = true,
DOWNCLICKS = true,
HIDDEN = true,
LOCKBAR = false, },
false, 65)
end
end
function Neuron:CreateBarsAndButtons()
if DB.firstRun then
for barClass, barDefaults in pairs(Neuron.DefaultBarOptions) do
if Neuron.registeredBarData[barClass] then --only build default bars for registered bars types (Classic doesn't use all the bar types that Retail does)
for i, defaults in ipairs(barDefaults) do --create the bar objects
local newBar = Neuron.BAR.new(barClass, i) --this calls the bar constructor
--create the default button objects for a given bar with the default values
newBar:SetDefaults(defaults)
for buttonID=1,#defaults.buttons do
newBar.objTemplate.new(newBar, buttonID, defaults.buttons[buttonID]) --newBar.objTemplate is something like ACTIONBUTTON or EXTRABTN, we just need to code it agnostic
end
end
end
end
DB.firstRun = false
else
for barClass, barClassData in pairs (Neuron.registeredBarData) do
for id,data in pairs(barClassData.barDB) do
if data ~= nil then
local newBar = Neuron.BAR.new(barClass, id) --this calls the bar constructor
--create all the saved button objects for a given bar
for buttonID=1,#newBar.DB.buttons do
newBar.objTemplate.new(newBar, buttonID) --newBar.objTemplate is something like ACTIONBUTTON or EXTRABTN, we just need to code it agnostic
end
end
end
end
end
end