annotate modules/ReAction_ConfigUI/ReAction_ConfigUI.lua @ 81:57f8151ea0f0

- Fixed some snafus with creating bars - Added support for opening the bar editor to a particular path - Creating bars/states now selects the new bar/state in the config editor - moved Bar:SetStateAttribute() back to working optionally on buttons rather than buttonFrame container
author Flick <flickerstreak@gmail.com>
date Wed, 25 Jun 2008 21:07:18 +0000
parents 42ec2938d65a
children 1ad208c25618
rev   line source
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@80 14 ReAction:UpdateRevision("$Revision$")
flickerstreak@77 15
flickerstreak@51 16 -- some constants
flickerstreak@60 17 local configName = "ReAction"
flickerstreak@51 18
flickerstreak@25 19 -- module declaration
flickerstreak@25 20 local moduleID = "ConfigUI"
flickerstreak@47 21 local module = ReAction:NewModule( moduleID,
flickerstreak@47 22 "AceEvent-3.0"
flickerstreak@47 23 )
flickerstreak@25 24
flickerstreak@25 25 -- module methods
flickerstreak@25 26 function module:OnInitialize()
flickerstreak@47 27 self.db = ReAction.db:RegisterNamespace( moduleID,
flickerstreak@47 28 {
flickerstreak@47 29 profile = {
flickerstreak@47 30 closeOnLaunch = true,
flickerstreak@47 31 editorCloseOnLaunch = true,
flickerstreak@47 32 }
flickerstreak@47 33 }
flickerstreak@47 34 )
flickerstreak@47 35
flickerstreak@60 36 self:RegisterEvent("PLAYER_REGEN_DISABLED")
flickerstreak@60 37 ReAction.RegisterCallback(self,"OnOptionsRegistered","OnOptionsRefreshed")
flickerstreak@33 38 ReAction.RegisterCallback(self,"OnOptionsRefreshed")
flickerstreak@46 39 self:InitializeOptions()
flickerstreak@25 40 end
flickerstreak@25 41
flickerstreak@33 42 function module:OnOptionsRefreshed(evt)
flickerstreak@60 43 AceConfigReg:NotifyChange(configName)
flickerstreak@60 44 if self.editor then self.editor:Refresh() end
flickerstreak@47 45 end
flickerstreak@47 46
flickerstreak@47 47 function module:PLAYER_REGEN_DISABLED()
flickerstreak@47 48 if self.editor then
flickerstreak@47 49 self.editor:Hide()
flickerstreak@47 50 end
flickerstreak@47 51 end
flickerstreak@47 52
flickerstreak@47 53 function module:OpenConfig()
flickerstreak@60 54 InterfaceOptionsFrame_OpenToFrame(configName)
flickerstreak@47 55 end
flickerstreak@47 56
flickerstreak@46 57 function module:InitializeOptions()
flickerstreak@60 58 ReAction:RegisterOptions(self, {
flickerstreak@58 59 _launchEditor = {
flickerstreak@47 60 type = "execute",
flickerstreak@47 61 handler = self,
flickerstreak@58 62 name = L["Edit Bars..."],
flickerstreak@58 63 desc = L["Show the ReAction Bar Editor dialogue"],
flickerstreak@47 64 func = function()
flickerstreak@58 65 self:LaunchBarEditor()
flickerstreak@47 66 -- you can't close a dialog in response to an options click, because the end of the
flickerstreak@47 67 -- handler for all the button events calls lib:Open()
flickerstreak@47 68 -- So, schedule a close on the next OnUpdate
flickerstreak@47 69 if self.db.profile.closeOnLaunch then
flickerstreak@47 70 self.editor.closePending = true
flickerstreak@47 71 end
flickerstreak@47 72 end,
flickerstreak@47 73 order = 2,
flickerstreak@47 74 },
flickerstreak@47 75 _closeThis = {
flickerstreak@47 76 type = "toggle",
flickerstreak@47 77 name = L["Close on Launch"],
flickerstreak@58 78 desc = L["Close the Interface Options window when launching the ReAction Bar Editor"],
flickerstreak@47 79 get = function() return self.db.profile.closeOnLaunch end,
flickerstreak@47 80 set = function(info, val) self.db.profile.closeOnLaunch = val end,
flickerstreak@47 81 order = 3,
flickerstreak@47 82 },
flickerstreak@60 83 }, true) -- global
flickerstreak@60 84
flickerstreak@60 85 AceConfigReg:RegisterOptionsTable(configName,ReAction.options)
flickerstreak@60 86 self.frame = AceConfigDialog:AddToBlizOptions(configName, configName)
flickerstreak@47 87 self.frame.obj:SetCallback("default",
flickerstreak@47 88 function()
flickerstreak@47 89 ReAction.db:ResetProfile()
flickerstreak@63 90 ReAction:RefreshOptions()
flickerstreak@47 91 end )
flickerstreak@60 92 end
flickerstreak@46 93
flickerstreak@60 94
flickerstreak@60 95
flickerstreak@60 96
flickerstreak@60 97 -- Bar Editor --
flickerstreak@60 98 local function NewEditor()
flickerstreak@60 99 -- private variables
flickerstreak@60 100 local editorName = "ReAction-Editor"
flickerstreak@63 101 local barOptMap = setmetatable({},{__mode="v"})
flickerstreak@60 102 local tmp = { }
flickerstreak@60 103 local pointTable = {
flickerstreak@60 104 CENTER = L["Center"],
flickerstreak@60 105 LEFT = L["Left"],
flickerstreak@60 106 RIGHT = L["Right"],
flickerstreak@60 107 TOP = L["Top"],
flickerstreak@60 108 BOTTOM = L["Bottom"],
flickerstreak@60 109 TOPLEFT = L["Top Left"],
flickerstreak@60 110 TOPRIGHT = L["Top Right"],
flickerstreak@60 111 BOTTOMLEFT = L["Bottom Left"],
flickerstreak@60 112 BOTTOMRIGHT = L["Bottom Right"],
flickerstreak@60 113 }
flickerstreak@60 114
flickerstreak@60 115
flickerstreak@60 116 -- use a local GUI container to work around AceConfigDialog closing
flickerstreak@60 117 -- both the bar editor and the global options when interface options is closed
flickerstreak@60 118 local editor = LibStub("AceGUI-3.0"):Create("Frame")
flickerstreak@60 119 local frame = editor.frame
flickerstreak@60 120 frame:SetClampedToScreen(true)
flickerstreak@60 121 local old_OnUpdate = frame:GetScript("OnUpdate")
flickerstreak@60 122 frame:SetScript("OnUpdate", function(dt)
flickerstreak@60 123 if old_OnUpdate then
flickerstreak@60 124 old_OnUpdate(dt)
flickerstreak@46 125 end
flickerstreak@60 126 if editor.closePending then
flickerstreak@60 127 InterfaceOptionsFrame:Hide()
flickerstreak@60 128 editor.closePending = false
flickerstreak@60 129 end
flickerstreak@60 130 if editor.selfClosePending then
flickerstreak@63 131 editor:Hide()
flickerstreak@60 132 AceConfigReg:NotifyChange(configName)
flickerstreak@60 133 editor.selfClosePending = false
flickerstreak@60 134 end
flickerstreak@60 135 end )
flickerstreak@60 136 editor:SetCallback("OnClose",
flickerstreak@60 137 function()
flickerstreak@60 138 ReAction:SetConfigMode(false)
flickerstreak@60 139 end )
flickerstreak@61 140 AceConfigDialog:SetDefaultSize(editorName, 700, 540)
flickerstreak@60 141
flickerstreak@46 142
flickerstreak@76 143 local name = ("ReAction - %s"):format(L["Bar Editor"])
flickerstreak@76 144 editor:SetTitle(name)
flickerstreak@60 145 local options = {
flickerstreak@47 146 type = "group",
flickerstreak@76 147 name = name,
flickerstreak@60 148 handler = editor,
flickerstreak@47 149 childGroups = "tree",
flickerstreak@47 150 args = {
flickerstreak@47 151 desc = {
flickerstreak@47 152 type = "description",
flickerstreak@47 153 name = L["Use the mouse to arrange and resize the bars on screen. Tooltips on bars indicate additional functionality."],
flickerstreak@47 154 order = 1
flickerstreak@47 155 },
flickerstreak@47 156 launchConfig = {
flickerstreak@47 157 type = "execute",
flickerstreak@47 158 name = L["Global Config"],
flickerstreak@47 159 desc = L["Opens ReAction global configuration settings panel"],
flickerstreak@47 160 func = function()
flickerstreak@60 161 module:OpenConfig()
flickerstreak@47 162 -- you can't close a dialog in response to an options click, because the end of the
flickerstreak@47 163 -- handler for all the button events calls lib:Open()
flickerstreak@48 164 -- So, schedule a close on the next OnUpdate
flickerstreak@60 165 if module.db.profile.editorCloseOnLaunch then
flickerstreak@60 166 editor.selfClosePending = true
flickerstreak@47 167 end
flickerstreak@47 168 end,
flickerstreak@47 169 order = 2
flickerstreak@47 170 },
flickerstreak@48 171 closeThis = {
flickerstreak@47 172 type = "toggle",
flickerstreak@47 173 name = L["Close on Launch"],
flickerstreak@58 174 desc = L["Close the Bar Editor when opening the ReAction global Interface Options"],
flickerstreak@60 175 get = function() return module.db.profile.editorCloseOnLaunch end,
flickerstreak@60 176 set = function(info, val) module.db.profile.editorCloseOnLaunch = val end,
flickerstreak@47 177 order = 3,
flickerstreak@47 178 },
flickerstreak@47 179 new = {
flickerstreak@47 180 type = "group",
flickerstreak@47 181 name = L["New Bar..."],
flickerstreak@47 182 order = 4,
flickerstreak@47 183 args = {
flickerstreak@47 184 desc = {
flickerstreak@47 185 type = "description",
flickerstreak@47 186 name = L["Choose a name, type, and initial grid for your new action bar:"],
flickerstreak@47 187 order = 1,
flickerstreak@47 188 },
flickerstreak@47 189 name = {
flickerstreak@47 190 type = "input",
flickerstreak@47 191 name = L["Bar Name"],
flickerstreak@47 192 desc = L["Enter a name for your new action bar"],
flickerstreak@60 193 get = function() return tmp.barName or "" end,
flickerstreak@60 194 set = function(info, val) tmp.barName = val end,
flickerstreak@47 195 order = 2,
flickerstreak@47 196 },
flickerstreak@47 197 type = {
flickerstreak@47 198 type = "select",
flickerstreak@47 199 name = L["Button Type"],
flickerstreak@63 200 get = function() return tmp.barType or ReAction:GetDefaultBarType() or "" end,
flickerstreak@53 201 set = function(info, val)
flickerstreak@63 202 local c = ReAction:GetBarTypeConfig(val)
flickerstreak@60 203 tmp.barType = val
flickerstreak@60 204 tmp.barSize = c.defaultButtonSize or tmp.barSize
flickerstreak@60 205 tmp.barRows = c.defaultBarRows or tmp.barRows
flickerstreak@60 206 tmp.barCols = c.defaultBarCols or tmp.barCols
flickerstreak@60 207 tmp.barSpacing = c.defaultBarSpacing or tmp.barSpacing
flickerstreak@53 208 end,
flickerstreak@47 209 values = "GetBarTypes",
flickerstreak@47 210 order = 3,
flickerstreak@47 211 },
flickerstreak@47 212 grid = {
flickerstreak@47 213 type = "group",
flickerstreak@47 214 name = L["Button Grid"],
flickerstreak@47 215 inline = true,
flickerstreak@47 216 args = {
flickerstreak@47 217 hdr = {
flickerstreak@47 218 type = "header",
flickerstreak@47 219 name = L["Button Grid"],
flickerstreak@47 220 order = 1,
flickerstreak@47 221 },
flickerstreak@47 222 rows = {
flickerstreak@47 223 type = "range",
flickerstreak@47 224 name = L["Rows"],
flickerstreak@60 225 get = function() return tmp.barRows or 1 end,
flickerstreak@60 226 set = function(info, val) tmp.barRows = val end,
flickerstreak@47 227 width = "half",
flickerstreak@47 228 min = 1,
flickerstreak@47 229 max = 32,
flickerstreak@47 230 step = 1,
flickerstreak@47 231 order = 2,
flickerstreak@47 232 },
flickerstreak@47 233 cols = {
flickerstreak@47 234 type = "range",
flickerstreak@47 235 name = L["Columns"],
flickerstreak@60 236 get = function() return tmp.barCols or 12 end,
flickerstreak@60 237 set = function(info, val) tmp.barCols = val end,
flickerstreak@47 238 width = "half",
flickerstreak@47 239 min = 1,
flickerstreak@47 240 max = 32,
flickerstreak@47 241 step = 1,
flickerstreak@47 242 order = 3,
flickerstreak@47 243 },
flickerstreak@47 244 sz = {
flickerstreak@47 245 type = "range",
flickerstreak@47 246 name = L["Size"],
flickerstreak@60 247 get = function() return tmp.barSize or 36 end,
flickerstreak@60 248 set = function(info, val) tmp.barSize = val end,
flickerstreak@47 249 width = "half",
flickerstreak@47 250 min = 10,
flickerstreak@47 251 max = 72,
flickerstreak@47 252 step = 1,
flickerstreak@47 253 order = 4,
flickerstreak@47 254 },
flickerstreak@47 255 spacing = {
flickerstreak@47 256 type = "range",
flickerstreak@47 257 name = L["Spacing"],
flickerstreak@60 258 get = function() return tmp.barSpacing or 3 end,
flickerstreak@60 259 set = function(info, val) tmp.barSpacing = val end,
flickerstreak@47 260 width = "half",
flickerstreak@47 261 min = 0,
flickerstreak@47 262 max = 24,
flickerstreak@47 263 step = 1,
flickerstreak@47 264 order = 5,
flickerstreak@47 265 }
flickerstreak@47 266 },
flickerstreak@47 267 order = 4
flickerstreak@47 268 },
flickerstreak@47 269 spacer = {
flickerstreak@47 270 type = "header",
flickerstreak@47 271 name = "",
flickerstreak@47 272 width = "full",
flickerstreak@47 273 order = -2
flickerstreak@47 274 },
flickerstreak@47 275 go = {
flickerstreak@47 276 type = "execute",
flickerstreak@47 277 name = L["Create Bar"],
flickerstreak@47 278 func = "CreateBar",
flickerstreak@47 279 order = -1,
flickerstreak@47 280 }
flickerstreak@47 281 }
flickerstreak@47 282 }
flickerstreak@47 283 }
flickerstreak@47 284 }
flickerstreak@60 285 AceConfigReg:RegisterOptionsTable(editorName, options)
flickerstreak@60 286
flickerstreak@81 287 function editor:Open(bar, ...)
flickerstreak@76 288 if bar then
flickerstreak@81 289 AceConfigDialog:SelectGroup(editorName, barOptMap[bar:GetName()], ...)
flickerstreak@76 290 end
flickerstreak@60 291 AceConfigDialog:Open(editorName,self)
flickerstreak@60 292 end
flickerstreak@60 293
flickerstreak@60 294 function editor:Refresh()
flickerstreak@60 295 AceConfigReg:NotifyChange(editorName)
flickerstreak@60 296 if frame:IsShown() then
flickerstreak@60 297 self:Open() -- do I need this?
flickerstreak@60 298 end
flickerstreak@60 299 end
flickerstreak@60 300
flickerstreak@60 301 function editor:CreateBarTree(bar)
flickerstreak@60 302 local name = bar:GetName()
flickerstreak@60 303 -- AceConfig doesn't allow spaces, etc, in arg key names, and they must be
flickerstreak@60 304 -- unique strings. So generate a unique key (it can be whatever) for the bar
flickerstreak@60 305 local args = options.args
flickerstreak@60 306 local key
flickerstreak@60 307 local i = 1
flickerstreak@60 308 repeat
flickerstreak@60 309 key = ("bar%s"):format(i)
flickerstreak@60 310 i = i+1
flickerstreak@60 311 until args[key] == nil
flickerstreak@60 312 barOptMap[name] = key
flickerstreak@60 313 args[key] = {
flickerstreak@60 314 type = "group",
flickerstreak@60 315 name = name,
flickerstreak@60 316 childGroups = "tab",
flickerstreak@60 317 args = {
flickerstreak@60 318 general = {
flickerstreak@60 319 type = "group",
flickerstreak@60 320 name = L["General"],
flickerstreak@60 321 order = 1,
flickerstreak@60 322 args = {
flickerstreak@60 323 name = {
flickerstreak@60 324 type = "input",
flickerstreak@60 325 name = L["Rename Bar"],
flickerstreak@60 326 get = function() return bar:GetName() end,
flickerstreak@60 327 set = function(info, value) return ReAction:RenameBar(bar, value) end,
flickerstreak@60 328 order = 1,
flickerstreak@60 329 },
flickerstreak@60 330 delete = {
flickerstreak@60 331 type = "execute",
flickerstreak@60 332 name = L["Delete Bar"],
flickerstreak@60 333 desc = function() return bar:GetName() end,
flickerstreak@60 334 confirm = true,
flickerstreak@60 335 func = function() ReAction:EraseBar(bar) end,
flickerstreak@60 336 order = 2
flickerstreak@60 337 },
flickerstreak@60 338 anchor = {
flickerstreak@60 339 type = "group",
flickerstreak@60 340 name = L["Anchor"],
flickerstreak@60 341 inline = true,
flickerstreak@60 342 args = {
flickerstreak@60 343 frame = {
flickerstreak@60 344 type = "input",
flickerstreak@60 345 name = L["Frame"],
flickerstreak@60 346 desc = L["The frame that the bar is anchored to"],
flickerstreak@60 347 get = function() local _, f = bar:GetAnchor(); return f end,
flickerstreak@60 348 set = function(info, val) bar:SetAnchor(nil,val) end,
flickerstreak@60 349 validate = function(info, name)
flickerstreak@60 350 if name then
flickerstreak@60 351 local f = ReAction:GetBar(name)
flickerstreak@60 352 if f then
flickerstreak@60 353 return true
flickerstreak@60 354 else
flickerstreak@60 355 f = _G[name]
flickerstreak@60 356 if f and type(f) == "table" and f.IsObjectType and f:IsObjectType("Frame") then
flickerstreak@60 357 return true
flickerstreak@60 358 end
flickerstreak@60 359 end
flickerstreak@60 360 end
flickerstreak@60 361 return false
flickerstreak@60 362 end,
flickerstreak@60 363 width = "double",
flickerstreak@60 364 order = 1
flickerstreak@60 365 },
flickerstreak@60 366 point = {
flickerstreak@60 367 type = "select",
flickerstreak@60 368 name = L["Point"],
flickerstreak@60 369 desc = L["Anchor point on the bar frame"],
flickerstreak@60 370 style = "dropdown",
flickerstreak@60 371 get = function() return bar:GetAnchor() end,
flickerstreak@60 372 set = function(info, val) bar:SetAnchor(val) end,
flickerstreak@60 373 values = pointTable,
flickerstreak@60 374 order = 2,
flickerstreak@60 375 },
flickerstreak@60 376 relativePoint = {
flickerstreak@60 377 type = "select",
flickerstreak@60 378 name = L["Relative Point"],
flickerstreak@60 379 desc = L["Anchor point on the target frame"],
flickerstreak@60 380 style = "dropdown",
flickerstreak@60 381 get = function() local p,f,r = bar:GetAnchor(); return r end,
flickerstreak@60 382 set = function(info, val) bar:SetAnchor(nil,nil,val) end,
flickerstreak@60 383 values = pointTable,
flickerstreak@60 384 order = 3,
flickerstreak@60 385 },
flickerstreak@60 386 x = {
flickerstreak@60 387 type = "input",
flickerstreak@60 388 pattern = "\-?%d+",
flickerstreak@60 389 name = L["X offset"],
flickerstreak@60 390 get = function() local p,f,r,x = bar:GetAnchor(); return ("%d"):format(x) end,
flickerstreak@60 391 set = function(info,val) bar:SetAnchor(nil,nil,nil,val) end,
flickerstreak@60 392 order = 4
flickerstreak@60 393 },
flickerstreak@60 394 y = {
flickerstreak@60 395 type = "input",
flickerstreak@60 396 pattern = "\-?%d+",
flickerstreak@60 397 name = L["Y offset"],
flickerstreak@60 398 get = function() local p,f,r,x,y = bar:GetAnchor(); return ("%d"):format(y) end,
flickerstreak@60 399 set = function(info,val) bar:SetAnchor(nil,nil,nil,nil,val) end,
flickerstreak@60 400 order = 5
flickerstreak@60 401 },
flickerstreak@60 402 },
flickerstreak@60 403 order = 3
flickerstreak@60 404 },
flickerstreak@60 405 },
flickerstreak@60 406 },
flickerstreak@60 407 }
flickerstreak@60 408 }
flickerstreak@60 409 self:RefreshBarTree(bar)
flickerstreak@60 410 end
flickerstreak@60 411
flickerstreak@60 412 function editor:RefreshBarTree(bar)
flickerstreak@63 413 local key = barOptMap[bar:GetName()]
flickerstreak@63 414 if key and options.args[key] then
flickerstreak@63 415 options.args[key].plugins = ReAction:GenerateBarOptionsTable(bar)
flickerstreak@63 416 AceConfigReg:NotifyChange(editorName)
flickerstreak@60 417 end
flickerstreak@60 418 end
flickerstreak@60 419
flickerstreak@60 420 function editor:OnCreateBar(evt, bar)
flickerstreak@60 421 self:CreateBarTree(bar)
flickerstreak@60 422 end
flickerstreak@60 423
flickerstreak@63 424 function editor:OnDestroyBar(evt, bar, name)
flickerstreak@63 425 local key = barOptMap[name]
flickerstreak@63 426 if key then
flickerstreak@63 427 options.args[key] = nil
flickerstreak@63 428 end
flickerstreak@63 429 self:Refresh()
flickerstreak@63 430 end
flickerstreak@63 431
flickerstreak@60 432 function editor:OnEraseBar(evt, name)
flickerstreak@60 433 local key = barOptMap[name]
flickerstreak@60 434 barOptMap[name] = nil
flickerstreak@60 435 if key then
flickerstreak@60 436 options.args[key] = nil
flickerstreak@60 437 self:Refresh()
flickerstreak@60 438 end
flickerstreak@60 439 end
flickerstreak@60 440
flickerstreak@60 441 function editor:OnRenameBar(evt, oldname, newname)
flickerstreak@60 442 local key = barOptMap[oldname]
flickerstreak@60 443 barOptMap[oldname], barOptMap[newname] = nil, key
flickerstreak@60 444 if key then
flickerstreak@60 445 options.args[key].name = newname
flickerstreak@60 446 self:Refresh()
flickerstreak@60 447 end
flickerstreak@60 448 end
flickerstreak@60 449
flickerstreak@63 450 function editor:OnBarOptionGeneratorRegistered(evt)
flickerstreak@63 451 for name in pairs(barOptMap) do
flickerstreak@63 452 local bar = ReAction:GetBar(name)
flickerstreak@63 453 if bar then
flickerstreak@63 454 self:RefreshBarTree(bar)
flickerstreak@63 455 end
flickerstreak@63 456 end
flickerstreak@63 457 end
flickerstreak@63 458
flickerstreak@60 459 local _scratch = { }
flickerstreak@60 460 function editor:GetBarTypes()
flickerstreak@60 461 for k,v in pairs(_scratch) do
flickerstreak@60 462 _scratch[k] = nil
flickerstreak@60 463 end
flickerstreak@63 464 return ReAction:GetBarTypeOptions(_scratch)
flickerstreak@60 465 end
flickerstreak@60 466
flickerstreak@60 467 function editor:CreateBar()
flickerstreak@60 468 if tmp.barName and tmp.barName ~= "" then
flickerstreak@63 469 ReAction:CreateBar(tmp.barName, tmp.barType or ReAction:GetDefaultBarType(), tmp.barRows, tmp.barCols, tmp.barSize, tmp.barSpacing)
flickerstreak@81 470 AceConfigDialog:SelectGroup(editorName, barOptMap[tmp.barName])
flickerstreak@60 471 tmp.barName = nil
flickerstreak@60 472 end
flickerstreak@60 473 end
flickerstreak@60 474
flickerstreak@60 475 ReAction.RegisterCallback(editor,"OnCreateBar")
flickerstreak@63 476 ReAction.RegisterCallback(editor,"OnDestroyBar")
flickerstreak@60 477 ReAction.RegisterCallback(editor,"OnEraseBar")
flickerstreak@60 478 ReAction.RegisterCallback(editor,"OnRenameBar")
flickerstreak@63 479 ReAction.RegisterCallback(editor,"OnBarOptionGeneratorRegistered")
flickerstreak@60 480
flickerstreak@63 481 for name, bar in ReAction:IterateBars() do
flickerstreak@60 482 editor:CreateBarTree(bar)
flickerstreak@60 483 end
flickerstreak@60 484
flickerstreak@60 485 return editor
flickerstreak@44 486 end
flickerstreak@44 487
flickerstreak@60 488
flickerstreak@81 489 function module:LaunchBarEditor(bar, ...)
flickerstreak@60 490 if InCombatLockdown() then
flickerstreak@61 491 ReAction:UserError(L["ReAction config mode disabled during combat."])
flickerstreak@60 492 else
flickerstreak@60 493 if not self.editor then
flickerstreak@60 494 self.editor = NewEditor()
flickerstreak@60 495 end
flickerstreak@81 496 self.editor:Open(bar, ...)
flickerstreak@60 497 ReAction:SetConfigMode(true)
flickerstreak@60 498 end
flickerstreak@60 499 end
flickerstreak@60 500