flickerstreak@25
|
1 --[[
|
flickerstreak@25
|
2 ReAction Configuration UI module
|
flickerstreak@25
|
3
|
flickerstreak@33
|
4 Hooks into Blizzard Interface Options AddOns panel
|
flickerstreak@25
|
5 --]]
|
flickerstreak@25
|
6
|
flickerstreak@25
|
7 -- local imports
|
flickerstreak@25
|
8 local ReAction = ReAction
|
flickerstreak@25
|
9 local L = ReAction.L
|
flickerstreak@51
|
10 local _G = _G
|
flickerstreak@47
|
11 local AceConfigReg = LibStub("AceConfigRegistry-3.0")
|
flickerstreak@47
|
12 local AceConfigDialog = LibStub("AceConfigDialog-3.0")
|
flickerstreak@25
|
13
|
flickerstreak@51
|
14 -- some constants
|
flickerstreak@51
|
15 local pointTable = {
|
flickerstreak@51
|
16 CENTER = L["Center"],
|
flickerstreak@51
|
17 LEFT = L["Left"],
|
flickerstreak@51
|
18 RIGHT = L["Right"],
|
flickerstreak@51
|
19 TOP = L["Top"],
|
flickerstreak@51
|
20 BOTTOM = L["Bottom"],
|
flickerstreak@51
|
21 TOPLEFT = L["Top Left"],
|
flickerstreak@51
|
22 TOPRIGHT = L["Top Right"],
|
flickerstreak@51
|
23 BOTTOMLEFT = L["Bottom Left"],
|
flickerstreak@51
|
24 BOTTOMRIGHT = L["Bottom Right"],
|
flickerstreak@51
|
25 }
|
flickerstreak@51
|
26
|
flickerstreak@25
|
27 -- module declaration
|
flickerstreak@25
|
28 local moduleID = "ConfigUI"
|
flickerstreak@47
|
29 local module = ReAction:NewModule( moduleID,
|
flickerstreak@47
|
30 "AceEvent-3.0"
|
flickerstreak@47
|
31 )
|
flickerstreak@25
|
32
|
flickerstreak@25
|
33 -- module methods
|
flickerstreak@25
|
34 function module:OnInitialize()
|
flickerstreak@47
|
35 self.db = ReAction.db:RegisterNamespace( moduleID,
|
flickerstreak@47
|
36 {
|
flickerstreak@47
|
37 profile = {
|
flickerstreak@47
|
38 closeOnLaunch = true,
|
flickerstreak@47
|
39 editorCloseOnLaunch = true,
|
flickerstreak@47
|
40 }
|
flickerstreak@47
|
41 }
|
flickerstreak@47
|
42 )
|
flickerstreak@47
|
43
|
flickerstreak@30
|
44 ReAction.RegisterCallback(self,"OnOptionsRegistered")
|
flickerstreak@33
|
45 ReAction.RegisterCallback(self,"OnOptionsRefreshed")
|
flickerstreak@47
|
46 ReAction.RegisterCallback(self,"OnCreateBar")
|
flickerstreak@47
|
47 ReAction.RegisterCallback(self,"OnEraseBar")
|
flickerstreak@47
|
48 ReAction.RegisterCallback(self,"OnRenameBar")
|
flickerstreak@46
|
49 self:InitializeOptions()
|
flickerstreak@47
|
50 self:RegisterEvent("PLAYER_REGEN_DISABLED")
|
flickerstreak@25
|
51 end
|
flickerstreak@25
|
52
|
flickerstreak@59
|
53
|
flickerstreak@59
|
54 -- Creates a dispatcher to act as a handler and translate method calls from
|
flickerstreak@59
|
55 -- handler:method(info,value) to module:method(bar,value). If the opts table has
|
flickerstreak@59
|
56 -- a handler set, that will be used instead of module.
|
flickerstreak@59
|
57 -- Note: we replace the top level table if it's a group, giving it a new handler.
|
flickerstreak@59
|
58 local function CreateModuleBarDispatcher(module,bar,opts)
|
flickerstreak@59
|
59 local g = { }
|
flickerstreak@59
|
60 if opts.type == "group" then
|
flickerstreak@59
|
61 for k,v in pairs(opts) do
|
flickerstreak@59
|
62 g[k] = v
|
flickerstreak@59
|
63 end
|
flickerstreak@59
|
64 else
|
flickerstreak@59
|
65 g.type = "group"
|
flickerstreak@59
|
66 g.name = module:GetName()
|
flickerstreak@59
|
67 g.args = {
|
flickerstreak@59
|
68 arg1 = opts
|
flickerstreak@59
|
69 }
|
flickerstreak@59
|
70 end
|
flickerstreak@59
|
71 local handler = opts.handler or module
|
flickerstreak@59
|
72 g.handler = setmetatable( {}, {
|
flickerstreak@59
|
73 __index = function(self, idx)
|
flickerstreak@59
|
74 local f = rawget(self,idx)
|
flickerstreak@59
|
75 if not f then
|
flickerstreak@59
|
76 f = function(_, info, ...)
|
flickerstreak@59
|
77 return handler[idx](handler, bar, ...)
|
flickerstreak@59
|
78 end
|
flickerstreak@59
|
79 rawset(self,idx,f) -- cache for future use
|
flickerstreak@59
|
80 end
|
flickerstreak@59
|
81 return f
|
flickerstreak@59
|
82 end
|
flickerstreak@59
|
83 })
|
flickerstreak@59
|
84 return g
|
flickerstreak@59
|
85 end
|
flickerstreak@59
|
86
|
flickerstreak@59
|
87
|
flickerstreak@30
|
88 function module:OnOptionsRegistered(evt, context, module, opts)
|
flickerstreak@46
|
89 local c = self.configOptions.args[context]
|
flickerstreak@59
|
90 if context == "bar" then
|
flickerstreak@59
|
91 for name,bar in pairs(ReAction.bars) do
|
flickerstreak@59
|
92 local key = self.barOptMap[name]
|
flickerstreak@59
|
93 if key then
|
flickerstreak@59
|
94 self.editorOpts.args[key].plugins[module:GetName()] = { [module:GetName()] = CreateModuleBarDispatcher(module,bar,opts) }
|
flickerstreak@59
|
95 end
|
flickerstreak@59
|
96 end
|
flickerstreak@59
|
97 elseif c then
|
flickerstreak@30
|
98 for k, v in pairs(opts) do
|
flickerstreak@46
|
99 c.args[k] = v
|
flickerstreak@30
|
100 end
|
flickerstreak@30
|
101 end
|
flickerstreak@25
|
102 end
|
flickerstreak@25
|
103
|
flickerstreak@33
|
104 function module:OnOptionsRefreshed(evt)
|
flickerstreak@48
|
105 AceConfigReg:NotifyChange("ReAction")
|
flickerstreak@58
|
106 AceConfigReg:NotifyChange("ReAction-Editor")
|
flickerstreak@25
|
107 end
|
flickerstreak@25
|
108
|
flickerstreak@47
|
109 function module:OnCreateBar(evt, bar)
|
flickerstreak@47
|
110 local name = bar:GetName()
|
flickerstreak@47
|
111 -- AceConfig doesn't allow spaces, etc, in arg key names, and they must be
|
flickerstreak@47
|
112 -- unique strings. So generate a unique key (it can be whatever) for the bar
|
flickerstreak@59
|
113 local args = self.editorOpts.args
|
flickerstreak@47
|
114 local key
|
flickerstreak@47
|
115 local i = 1
|
flickerstreak@47
|
116 repeat
|
flickerstreak@47
|
117 key = ("bar%s"):format(i)
|
flickerstreak@47
|
118 i = i+1
|
flickerstreak@59
|
119 until args[key] == nil
|
flickerstreak@47
|
120 self.barOptMap[name] = key
|
flickerstreak@59
|
121 args[key] = {
|
flickerstreak@47
|
122 type = "group",
|
flickerstreak@47
|
123 name = name,
|
flickerstreak@47
|
124 childGroups = "tab",
|
flickerstreak@47
|
125 args = {
|
flickerstreak@47
|
126 general = {
|
flickerstreak@47
|
127 type = "group",
|
flickerstreak@47
|
128 name = L["General"],
|
flickerstreak@59
|
129 order = 1,
|
flickerstreak@47
|
130 args = {
|
flickerstreak@47
|
131 name = {
|
flickerstreak@47
|
132 type = "input",
|
flickerstreak@47
|
133 name = L["Rename Bar"],
|
flickerstreak@47
|
134 get = function() return bar:GetName() end,
|
flickerstreak@47
|
135 set = function(info, value) return ReAction:RenameBar(bar, value) end,
|
flickerstreak@47
|
136 order = 1,
|
flickerstreak@47
|
137 },
|
flickerstreak@47
|
138 delete = {
|
flickerstreak@47
|
139 type = "execute",
|
flickerstreak@47
|
140 name = L["Delete Bar"],
|
flickerstreak@47
|
141 desc = function() return bar:GetName() end,
|
flickerstreak@47
|
142 confirm = true,
|
flickerstreak@47
|
143 func = function() ReAction:EraseBar(bar) end,
|
flickerstreak@51
|
144 order = 2
|
flickerstreak@47
|
145 },
|
flickerstreak@51
|
146 anchor = {
|
flickerstreak@51
|
147 type = "group",
|
flickerstreak@51
|
148 name = L["Anchor"],
|
flickerstreak@51
|
149 inline = true,
|
flickerstreak@51
|
150 args = {
|
flickerstreak@51
|
151 frame = {
|
flickerstreak@51
|
152 type = "input",
|
flickerstreak@51
|
153 name = L["Frame"],
|
flickerstreak@51
|
154 desc = L["The frame that the bar is anchored to"],
|
flickerstreak@51
|
155 get = function() local _, f = bar:GetAnchor(); return f end,
|
flickerstreak@51
|
156 set = function(info, val) bar:SetAnchor(nil,val) end,
|
flickerstreak@51
|
157 validate = function(info, name)
|
flickerstreak@51
|
158 if name then
|
flickerstreak@51
|
159 local f = ReAction:GetBar(name)
|
flickerstreak@51
|
160 if f then
|
flickerstreak@51
|
161 return true
|
flickerstreak@51
|
162 else
|
flickerstreak@51
|
163 f = _G[name]
|
flickerstreak@51
|
164 if f and type(f) == "table" and f.IsObjectType and f:IsObjectType("Frame") then
|
flickerstreak@51
|
165 return true
|
flickerstreak@51
|
166 end
|
flickerstreak@51
|
167 end
|
flickerstreak@51
|
168 end
|
flickerstreak@51
|
169 return false
|
flickerstreak@51
|
170 end,
|
flickerstreak@51
|
171 width = "double",
|
flickerstreak@51
|
172 order = 1
|
flickerstreak@51
|
173 },
|
flickerstreak@51
|
174 point = {
|
flickerstreak@51
|
175 type = "select",
|
flickerstreak@51
|
176 name = L["Point"],
|
flickerstreak@51
|
177 desc = L["Anchor point on the bar frame"],
|
flickerstreak@51
|
178 style = "dropdown",
|
flickerstreak@51
|
179 get = function() return bar:GetAnchor() end,
|
flickerstreak@51
|
180 set = function(info, val) bar:SetAnchor(val) end,
|
flickerstreak@51
|
181 values = pointTable,
|
flickerstreak@51
|
182 order = 2,
|
flickerstreak@51
|
183 },
|
flickerstreak@51
|
184 relativePoint = {
|
flickerstreak@51
|
185 type = "select",
|
flickerstreak@51
|
186 name = L["Relative Point"],
|
flickerstreak@51
|
187 desc = L["Anchor point on the target frame"],
|
flickerstreak@51
|
188 style = "dropdown",
|
flickerstreak@51
|
189 get = function() local p,f,r = bar:GetAnchor(); return r end,
|
flickerstreak@51
|
190 set = function(info, val) bar:SetAnchor(nil,nil,val) end,
|
flickerstreak@51
|
191 values = pointTable,
|
flickerstreak@51
|
192 order = 3,
|
flickerstreak@51
|
193 },
|
flickerstreak@51
|
194 x = {
|
flickerstreak@51
|
195 type = "input",
|
flickerstreak@51
|
196 pattern = "\-?%d+",
|
flickerstreak@51
|
197 name = L["X offset"],
|
flickerstreak@52
|
198 get = function() local p,f,r,x = bar:GetAnchor(); return ("%d"):format(x) end,
|
flickerstreak@51
|
199 set = function(info,val) bar:SetAnchor(nil,nil,nil,val) end,
|
flickerstreak@51
|
200 order = 4
|
flickerstreak@51
|
201 },
|
flickerstreak@51
|
202 y = {
|
flickerstreak@51
|
203 type = "input",
|
flickerstreak@51
|
204 pattern = "\-?%d+",
|
flickerstreak@51
|
205 name = L["Y offset"],
|
flickerstreak@52
|
206 get = function() local p,f,r,x,y = bar:GetAnchor(); return ("%d"):format(y) end,
|
flickerstreak@51
|
207 set = function(info,val) bar:SetAnchor(nil,nil,nil,nil,val) end,
|
flickerstreak@51
|
208 order = 5
|
flickerstreak@51
|
209 },
|
flickerstreak@51
|
210 },
|
flickerstreak@51
|
211 order = 3
|
flickerstreak@51
|
212 },
|
flickerstreak@51
|
213 },
|
flickerstreak@47
|
214 },
|
flickerstreak@47
|
215 },
|
flickerstreak@59
|
216 plugins = { },
|
flickerstreak@59
|
217 }
|
flickerstreak@47
|
218
|
flickerstreak@59
|
219 -- Create a dispatcher for all the module options tables registered to ReAction under the 'bar' context
|
flickerstreak@59
|
220 for module, opts in pairs(ReAction:GetOptions("bar")) do
|
flickerstreak@59
|
221 args[key].plugins[module:GetName()] = { [module:GetName()] = CreateModuleBarDispatcher(module, bar, opts) }
|
flickerstreak@59
|
222 end
|
flickerstreak@47
|
223 end
|
flickerstreak@47
|
224
|
flickerstreak@47
|
225 function module:OnEraseBar(evt, name)
|
flickerstreak@47
|
226 local key = self.barOptMap[name]
|
flickerstreak@47
|
227 self.barOptMap[name] = nil
|
flickerstreak@47
|
228 if key then
|
flickerstreak@58
|
229 self.editorOpts.args[key] = nil
|
flickerstreak@58
|
230 self:RefreshBarEditor()
|
flickerstreak@25
|
231 end
|
flickerstreak@25
|
232 end
|
flickerstreak@44
|
233
|
flickerstreak@47
|
234 function module:OnRenameBar(evt, oldname, newname)
|
flickerstreak@47
|
235 local key = self.barOptMap[oldname]
|
flickerstreak@47
|
236 self.barOptMap[oldname], self.barOptMap[newname] = nil, key
|
flickerstreak@47
|
237 if key then
|
flickerstreak@58
|
238 self.editorOpts.args[key].name = newname
|
flickerstreak@58
|
239 self:RefreshBarEditor()
|
flickerstreak@47
|
240 end
|
flickerstreak@47
|
241 end
|
flickerstreak@47
|
242
|
flickerstreak@47
|
243 function module:PLAYER_REGEN_DISABLED()
|
flickerstreak@47
|
244 if self.editor then
|
flickerstreak@47
|
245 self.editor:Hide()
|
flickerstreak@47
|
246 end
|
flickerstreak@47
|
247 end
|
flickerstreak@47
|
248
|
flickerstreak@47
|
249 function module:UserError(msg)
|
flickerstreak@47
|
250 -- any user errors should be flashed to the UIErrorsFrame
|
flickerstreak@47
|
251 UIErrorsFrame:AddMessage(msg)
|
flickerstreak@47
|
252 end
|
flickerstreak@47
|
253
|
flickerstreak@47
|
254 function module:OpenConfig()
|
flickerstreak@47
|
255 InterfaceOptionsFrame_OpenToFrame("ReAction")
|
flickerstreak@47
|
256 end
|
flickerstreak@47
|
257
|
flickerstreak@58
|
258 function module:LaunchBarEditor(bar)
|
flickerstreak@47
|
259 if InCombatLockdown() then
|
flickerstreak@47
|
260 self:UserError(L["ReAction config mode disabled during combat."])
|
flickerstreak@47
|
261 else
|
flickerstreak@47
|
262 if not self.editor then
|
flickerstreak@47
|
263 -- use a local container to work around AceConfigDialog closing
|
flickerstreak@58
|
264 -- both the bar editor and the global options when interface options is closed
|
flickerstreak@47
|
265 local ed = LibStub("AceGUI-3.0"):Create("Frame")
|
flickerstreak@47
|
266 ed.frame:SetClampedToScreen(true)
|
flickerstreak@47
|
267 local old_OnUpdate = ed.frame:GetScript("OnUpdate")
|
flickerstreak@47
|
268 ed.frame:SetScript("OnUpdate", function(dt)
|
flickerstreak@47
|
269 if old_OnUpdate then
|
flickerstreak@47
|
270 old_OnUpdate(dt)
|
flickerstreak@47
|
271 end
|
flickerstreak@47
|
272 if ed.closePending then
|
flickerstreak@47
|
273 InterfaceOptionsFrame:Hide()
|
flickerstreak@47
|
274 ed.closePending = false
|
flickerstreak@47
|
275 end
|
flickerstreak@47
|
276 if ed.selfClosePending then
|
flickerstreak@47
|
277 ed:Hide()
|
flickerstreak@47
|
278 AceConfigReg:NotifyChange("ReAction")
|
flickerstreak@47
|
279 ed.selfClosePending = false
|
flickerstreak@47
|
280 end
|
flickerstreak@47
|
281 end )
|
flickerstreak@47
|
282 ed:SetCallback("OnClose",
|
flickerstreak@47
|
283 function()
|
flickerstreak@47
|
284 ReAction:SetConfigMode(false)
|
flickerstreak@47
|
285 end )
|
flickerstreak@47
|
286 self.editor = ed
|
flickerstreak@58
|
287 AceConfigDialog:SetDefaultSize("ReAction-Editor", 640, 420)
|
flickerstreak@47
|
288 end
|
flickerstreak@47
|
289
|
flickerstreak@58
|
290 AceConfigDialog:Open("ReAction-Editor", self.editor)
|
flickerstreak@47
|
291 ReAction:SetConfigMode(true)
|
flickerstreak@47
|
292 end
|
flickerstreak@47
|
293 end
|
flickerstreak@47
|
294
|
flickerstreak@58
|
295 function module:RefreshBarEditor()
|
flickerstreak@58
|
296 AceConfigReg:NotifyChange("ReAction-Editor")
|
flickerstreak@47
|
297 if self.editor and self.editor.frame:IsShown() then
|
flickerstreak@58
|
298 AceConfigDialog:Open("ReAction-Editor", self.editor)
|
flickerstreak@47
|
299 end
|
flickerstreak@47
|
300 end
|
flickerstreak@47
|
301
|
flickerstreak@47
|
302 function module:GetBarTypes()
|
flickerstreak@47
|
303 local opts = self.optBarTypes or { }
|
flickerstreak@48
|
304 self.optBarTypes = { }
|
flickerstreak@48
|
305 for k,v in pairs(opts) do
|
flickerstreak@48
|
306 opts[k] = nil
|
flickerstreak@48
|
307 end
|
flickerstreak@48
|
308 for k in pairs(ReAction.defaultBarConfig) do
|
flickerstreak@48
|
309 opts[k] = k
|
flickerstreak@48
|
310 end
|
flickerstreak@47
|
311 return opts
|
flickerstreak@47
|
312 end
|
flickerstreak@47
|
313
|
flickerstreak@47
|
314 function module:CreateBar()
|
flickerstreak@50
|
315 if self.tmpBarName and self.tmpBarName ~= "" then
|
flickerstreak@50
|
316 ReAction:CreateBar(self.tmpBarName, self.tmpBarType or ReAction.defaultBarConfigChoice, self.tmpBarRows, self.tmpBarCols, self.tmpBarSize, self.tmpBarSpacing)
|
flickerstreak@48
|
317 self.tmpBarName = nil
|
flickerstreak@48
|
318 end
|
flickerstreak@47
|
319 end
|
flickerstreak@47
|
320
|
flickerstreak@46
|
321 function module:InitializeOptions()
|
flickerstreak@47
|
322 -- general config options
|
flickerstreak@47
|
323 local opts = {
|
flickerstreak@46
|
324 type = "group",
|
flickerstreak@47
|
325 name = "ReAction",
|
flickerstreak@46
|
326 childGroups = "tab",
|
flickerstreak@46
|
327 args = {
|
flickerstreak@47
|
328 _desc = {
|
flickerstreak@47
|
329 type = "description",
|
flickerstreak@47
|
330 name = L["Customizable replacement for Blizzard's Action Bars"],
|
flickerstreak@47
|
331 order = 1,
|
flickerstreak@47
|
332 },
|
flickerstreak@58
|
333 _launchEditor = {
|
flickerstreak@47
|
334 type = "execute",
|
flickerstreak@47
|
335 handler = self,
|
flickerstreak@58
|
336 name = L["Edit Bars..."],
|
flickerstreak@58
|
337 desc = L["Show the ReAction Bar Editor dialogue"],
|
flickerstreak@47
|
338 func = function()
|
flickerstreak@58
|
339 self:LaunchBarEditor()
|
flickerstreak@47
|
340 -- you can't close a dialog in response to an options click, because the end of the
|
flickerstreak@47
|
341 -- handler for all the button events calls lib:Open()
|
flickerstreak@47
|
342 -- So, schedule a close on the next OnUpdate
|
flickerstreak@47
|
343 if self.db.profile.closeOnLaunch then
|
flickerstreak@47
|
344 self.editor.closePending = true
|
flickerstreak@47
|
345 end
|
flickerstreak@47
|
346 end,
|
flickerstreak@47
|
347 order = 2,
|
flickerstreak@47
|
348 },
|
flickerstreak@47
|
349 _closeThis = {
|
flickerstreak@47
|
350 type = "toggle",
|
flickerstreak@47
|
351 name = L["Close on Launch"],
|
flickerstreak@58
|
352 desc = L["Close the Interface Options window when launching the ReAction Bar Editor"],
|
flickerstreak@47
|
353 get = function() return self.db.profile.closeOnLaunch end,
|
flickerstreak@47
|
354 set = function(info, val) self.db.profile.closeOnLaunch = val end,
|
flickerstreak@47
|
355 order = 3,
|
flickerstreak@47
|
356 },
|
flickerstreak@46
|
357 global = {
|
flickerstreak@46
|
358 type = "group",
|
flickerstreak@46
|
359 name = L["Global Settings"],
|
flickerstreak@46
|
360 desc = L["Global configuration settings"],
|
flickerstreak@46
|
361 args = { },
|
flickerstreak@47
|
362 order = 3,
|
flickerstreak@46
|
363 },
|
flickerstreak@47
|
364 _profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(ReAction.db),
|
flickerstreak@46
|
365 module = {
|
flickerstreak@46
|
366 type = "group",
|
flickerstreak@46
|
367 childGroups = "select",
|
flickerstreak@46
|
368 name = L["Module Settings"],
|
flickerstreak@46
|
369 desc = L["Configuration settings for each module"],
|
flickerstreak@46
|
370 args = { },
|
flickerstreak@46
|
371 order = -1,
|
flickerstreak@46
|
372 },
|
flickerstreak@46
|
373 },
|
flickerstreak@46
|
374 plugins = { }
|
flickerstreak@46
|
375 }
|
flickerstreak@47
|
376 self.configOptions = opts
|
flickerstreak@47
|
377 opts.args._profile.order = -2
|
flickerstreak@47
|
378 AceConfigReg:RegisterOptionsTable("ReAction",opts)
|
flickerstreak@47
|
379 self.frame = AceConfigDialog:AddToBlizOptions("ReAction", "ReAction")
|
flickerstreak@47
|
380 self.frame.obj:SetCallback("default",
|
flickerstreak@47
|
381 function()
|
flickerstreak@47
|
382 ReAction.db:ResetProfile()
|
flickerstreak@47
|
383 module:OpenConfig()
|
flickerstreak@47
|
384 end )
|
flickerstreak@46
|
385
|
flickerstreak@47
|
386 -- import options from registered modules
|
flickerstreak@47
|
387 for c, tbl in pairs(opts.args) do
|
flickerstreak@46
|
388 for _, m in pairs(ReAction:GetOptions(c)) do
|
flickerstreak@46
|
389 for k, v in pairs(m) do
|
flickerstreak@46
|
390 tbl.args[k] = v
|
flickerstreak@46
|
391 end
|
flickerstreak@46
|
392 end
|
flickerstreak@46
|
393 end
|
flickerstreak@46
|
394
|
flickerstreak@46
|
395 ReAction:RegisterOptions("module",self, {
|
flickerstreak@46
|
396 configUI = {
|
flickerstreak@46
|
397 type = "group",
|
flickerstreak@46
|
398 name = "Config UI",
|
flickerstreak@46
|
399 desc = "description",
|
flickerstreak@46
|
400 args = {
|
flickerstreak@46
|
401 foo = {
|
flickerstreak@46
|
402 type = "toggle",
|
flickerstreak@46
|
403 handler = self,
|
flickerstreak@46
|
404 name = "foo",
|
flickerstreak@46
|
405 desc = "description",
|
flickerstreak@46
|
406 get = function() return true end,
|
flickerstreak@46
|
407 set = function() end,
|
flickerstreak@46
|
408 }
|
flickerstreak@46
|
409 }
|
flickerstreak@46
|
410 },
|
flickerstreak@46
|
411 })
|
flickerstreak@46
|
412
|
flickerstreak@58
|
413 -- bar editor options
|
flickerstreak@58
|
414 local editorOpts = {
|
flickerstreak@47
|
415 type = "group",
|
flickerstreak@58
|
416 name = ("ReAction - %s"):format(L["Bar Editor"]),
|
flickerstreak@47
|
417 handler = self,
|
flickerstreak@47
|
418 childGroups = "tree",
|
flickerstreak@47
|
419 args = {
|
flickerstreak@47
|
420 desc = {
|
flickerstreak@47
|
421 type = "description",
|
flickerstreak@47
|
422 name = L["Use the mouse to arrange and resize the bars on screen. Tooltips on bars indicate additional functionality."],
|
flickerstreak@47
|
423 order = 1
|
flickerstreak@47
|
424 },
|
flickerstreak@47
|
425 launchConfig = {
|
flickerstreak@47
|
426 type = "execute",
|
flickerstreak@47
|
427 name = L["Global Config"],
|
flickerstreak@47
|
428 desc = L["Opens ReAction global configuration settings panel"],
|
flickerstreak@47
|
429 func = function()
|
flickerstreak@47
|
430 self:OpenConfig()
|
flickerstreak@47
|
431 -- you can't close a dialog in response to an options click, because the end of the
|
flickerstreak@47
|
432 -- handler for all the button events calls lib:Open()
|
flickerstreak@48
|
433 -- So, schedule a close on the next OnUpdate
|
flickerstreak@47
|
434 if self.db.profile.editorCloseOnLaunch then
|
flickerstreak@47
|
435 self.editor.selfClosePending = true
|
flickerstreak@47
|
436 end
|
flickerstreak@47
|
437 end,
|
flickerstreak@47
|
438 order = 2
|
flickerstreak@47
|
439 },
|
flickerstreak@48
|
440 closeThis = {
|
flickerstreak@47
|
441 type = "toggle",
|
flickerstreak@47
|
442 name = L["Close on Launch"],
|
flickerstreak@58
|
443 desc = L["Close the Bar Editor when opening the ReAction global Interface Options"],
|
flickerstreak@47
|
444 get = function() return self.db.profile.editorCloseOnLaunch end,
|
flickerstreak@47
|
445 set = function(info, val) self.db.profile.editorCloseOnLaunch = val end,
|
flickerstreak@47
|
446 order = 3,
|
flickerstreak@47
|
447 },
|
flickerstreak@47
|
448 new = {
|
flickerstreak@47
|
449 type = "group",
|
flickerstreak@47
|
450 name = L["New Bar..."],
|
flickerstreak@47
|
451 order = 4,
|
flickerstreak@47
|
452 args = {
|
flickerstreak@47
|
453 desc = {
|
flickerstreak@47
|
454 type = "description",
|
flickerstreak@47
|
455 name = L["Choose a name, type, and initial grid for your new action bar:"],
|
flickerstreak@47
|
456 order = 1,
|
flickerstreak@47
|
457 },
|
flickerstreak@47
|
458 name = {
|
flickerstreak@47
|
459 type = "input",
|
flickerstreak@47
|
460 name = L["Bar Name"],
|
flickerstreak@47
|
461 desc = L["Enter a name for your new action bar"],
|
flickerstreak@47
|
462 get = function() return self.tmpBarName or "" end,
|
flickerstreak@47
|
463 set = function(info, val) self.tmpBarName = val end,
|
flickerstreak@47
|
464 order = 2,
|
flickerstreak@47
|
465 },
|
flickerstreak@47
|
466 type = {
|
flickerstreak@47
|
467 type = "select",
|
flickerstreak@47
|
468 name = L["Button Type"],
|
flickerstreak@48
|
469 get = function() return self.tmpBarType or ReAction.defaultBarConfigChoice or "" end,
|
flickerstreak@53
|
470 set = function(info, val)
|
flickerstreak@53
|
471 local c = ReAction.defaultBarConfig[val]
|
flickerstreak@53
|
472 self.tmpBarType = val
|
flickerstreak@53
|
473 self.tmpBarSize = c.defaultButtonSize or self.tmpBarSize
|
flickerstreak@53
|
474 self.tmpBarRows = c.defaultBarRows or self.tmpBarRows
|
flickerstreak@53
|
475 self.tmpBarCols = c.defaultBarCols or self.tmpBarCols
|
flickerstreak@53
|
476 self.tmpBarSpacing = c.defaultBarSpacing or self.tmpBarSpacing
|
flickerstreak@53
|
477 end,
|
flickerstreak@47
|
478 values = "GetBarTypes",
|
flickerstreak@47
|
479 order = 3,
|
flickerstreak@47
|
480 },
|
flickerstreak@47
|
481 grid = {
|
flickerstreak@47
|
482 type = "group",
|
flickerstreak@47
|
483 name = L["Button Grid"],
|
flickerstreak@47
|
484 inline = true,
|
flickerstreak@47
|
485 args = {
|
flickerstreak@47
|
486 hdr = {
|
flickerstreak@47
|
487 type = "header",
|
flickerstreak@47
|
488 name = L["Button Grid"],
|
flickerstreak@47
|
489 order = 1,
|
flickerstreak@47
|
490 },
|
flickerstreak@47
|
491 rows = {
|
flickerstreak@47
|
492 type = "range",
|
flickerstreak@47
|
493 name = L["Rows"],
|
flickerstreak@47
|
494 get = function() return self.tmpBarRows or 1 end,
|
flickerstreak@47
|
495 set = function(info, val) self.tmpBarRows = val end,
|
flickerstreak@47
|
496 width = "half",
|
flickerstreak@47
|
497 min = 1,
|
flickerstreak@47
|
498 max = 32,
|
flickerstreak@47
|
499 step = 1,
|
flickerstreak@47
|
500 order = 2,
|
flickerstreak@47
|
501 },
|
flickerstreak@47
|
502 cols = {
|
flickerstreak@47
|
503 type = "range",
|
flickerstreak@47
|
504 name = L["Columns"],
|
flickerstreak@47
|
505 get = function() return self.tmpBarCols or 12 end,
|
flickerstreak@47
|
506 set = function(info, val) self.tmpBarCols = val end,
|
flickerstreak@47
|
507 width = "half",
|
flickerstreak@47
|
508 min = 1,
|
flickerstreak@47
|
509 max = 32,
|
flickerstreak@47
|
510 step = 1,
|
flickerstreak@47
|
511 order = 3,
|
flickerstreak@47
|
512 },
|
flickerstreak@47
|
513 sz = {
|
flickerstreak@47
|
514 type = "range",
|
flickerstreak@47
|
515 name = L["Size"],
|
flickerstreak@47
|
516 get = function() return self.tmpBarSize or 36 end,
|
flickerstreak@47
|
517 set = function(info, val) self.tmpBarSize = val end,
|
flickerstreak@47
|
518 width = "half",
|
flickerstreak@47
|
519 min = 10,
|
flickerstreak@47
|
520 max = 72,
|
flickerstreak@47
|
521 step = 1,
|
flickerstreak@47
|
522 order = 4,
|
flickerstreak@47
|
523 },
|
flickerstreak@47
|
524 spacing = {
|
flickerstreak@47
|
525 type = "range",
|
flickerstreak@47
|
526 name = L["Spacing"],
|
flickerstreak@47
|
527 get = function() return self.tmpBarSpacing or 3 end,
|
flickerstreak@47
|
528 set = function(info, val) self.tmpBarSpacing = val end,
|
flickerstreak@47
|
529 width = "half",
|
flickerstreak@47
|
530 min = 0,
|
flickerstreak@47
|
531 max = 24,
|
flickerstreak@47
|
532 step = 1,
|
flickerstreak@47
|
533 order = 5,
|
flickerstreak@47
|
534 }
|
flickerstreak@47
|
535 },
|
flickerstreak@47
|
536 order = 4
|
flickerstreak@47
|
537 },
|
flickerstreak@47
|
538 spacer = {
|
flickerstreak@47
|
539 type = "header",
|
flickerstreak@47
|
540 name = "",
|
flickerstreak@47
|
541 width = "full",
|
flickerstreak@47
|
542 order = -2
|
flickerstreak@47
|
543 },
|
flickerstreak@47
|
544 go = {
|
flickerstreak@47
|
545 type = "execute",
|
flickerstreak@47
|
546 name = L["Create Bar"],
|
flickerstreak@47
|
547 func = "CreateBar",
|
flickerstreak@47
|
548 order = -1,
|
flickerstreak@47
|
549 }
|
flickerstreak@47
|
550 }
|
flickerstreak@47
|
551 }
|
flickerstreak@47
|
552 }
|
flickerstreak@47
|
553 }
|
flickerstreak@58
|
554 self.editorOpts = editorOpts
|
flickerstreak@47
|
555 self.barOptMap = { }
|
flickerstreak@58
|
556 AceConfigReg:RegisterOptionsTable("ReAction-Editor",editorOpts)
|
flickerstreak@44
|
557 end
|
flickerstreak@44
|
558
|