annotate modules/ReAction_ConfigUI/ReAction_ConfigUI.lua @ 76:c8c8610fd864

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