annotate modules/ReAction_ConfigUI/ReAction_ConfigUI.lua @ 83:1ad208c25618

Fixed display issues with renaming states/bars
author Flick <flickerstreak@gmail.com>
date Wed, 25 Jun 2008 23:35:24 +0000
parents 57f8151ea0f0
children fc83b3f5b322
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 end
flickerstreak@60 297
flickerstreak@60 298 function editor:CreateBarTree(bar)
flickerstreak@60 299 local name = bar:GetName()
flickerstreak@60 300 -- AceConfig doesn't allow spaces, etc, in arg key names, and they must be
flickerstreak@60 301 -- unique strings. So generate a unique key (it can be whatever) for the bar
flickerstreak@60 302 local args = options.args
flickerstreak@60 303 local key
flickerstreak@60 304 local i = 1
flickerstreak@60 305 repeat
flickerstreak@60 306 key = ("bar%s"):format(i)
flickerstreak@60 307 i = i+1
flickerstreak@60 308 until args[key] == nil
flickerstreak@60 309 barOptMap[name] = key
flickerstreak@60 310 args[key] = {
flickerstreak@60 311 type = "group",
flickerstreak@60 312 name = name,
flickerstreak@60 313 childGroups = "tab",
flickerstreak@60 314 args = {
flickerstreak@60 315 general = {
flickerstreak@60 316 type = "group",
flickerstreak@60 317 name = L["General"],
flickerstreak@60 318 order = 1,
flickerstreak@60 319 args = {
flickerstreak@60 320 name = {
flickerstreak@60 321 type = "input",
flickerstreak@60 322 name = L["Rename Bar"],
flickerstreak@60 323 get = function() return bar:GetName() end,
flickerstreak@60 324 set = function(info, value) return ReAction:RenameBar(bar, value) end,
flickerstreak@60 325 order = 1,
flickerstreak@60 326 },
flickerstreak@60 327 delete = {
flickerstreak@60 328 type = "execute",
flickerstreak@60 329 name = L["Delete Bar"],
flickerstreak@60 330 desc = function() return bar:GetName() end,
flickerstreak@60 331 confirm = true,
flickerstreak@60 332 func = function() ReAction:EraseBar(bar) end,
flickerstreak@60 333 order = 2
flickerstreak@60 334 },
flickerstreak@60 335 anchor = {
flickerstreak@60 336 type = "group",
flickerstreak@60 337 name = L["Anchor"],
flickerstreak@60 338 inline = true,
flickerstreak@60 339 args = {
flickerstreak@60 340 frame = {
flickerstreak@60 341 type = "input",
flickerstreak@60 342 name = L["Frame"],
flickerstreak@60 343 desc = L["The frame that the bar is anchored to"],
flickerstreak@60 344 get = function() local _, f = bar:GetAnchor(); return f end,
flickerstreak@60 345 set = function(info, val) bar:SetAnchor(nil,val) end,
flickerstreak@60 346 validate = function(info, name)
flickerstreak@60 347 if name then
flickerstreak@60 348 local f = ReAction:GetBar(name)
flickerstreak@60 349 if f then
flickerstreak@60 350 return true
flickerstreak@60 351 else
flickerstreak@60 352 f = _G[name]
flickerstreak@60 353 if f and type(f) == "table" and f.IsObjectType and f:IsObjectType("Frame") then
flickerstreak@60 354 return true
flickerstreak@60 355 end
flickerstreak@60 356 end
flickerstreak@60 357 end
flickerstreak@60 358 return false
flickerstreak@60 359 end,
flickerstreak@60 360 width = "double",
flickerstreak@60 361 order = 1
flickerstreak@60 362 },
flickerstreak@60 363 point = {
flickerstreak@60 364 type = "select",
flickerstreak@60 365 name = L["Point"],
flickerstreak@60 366 desc = L["Anchor point on the bar frame"],
flickerstreak@60 367 style = "dropdown",
flickerstreak@60 368 get = function() return bar:GetAnchor() end,
flickerstreak@60 369 set = function(info, val) bar:SetAnchor(val) end,
flickerstreak@60 370 values = pointTable,
flickerstreak@60 371 order = 2,
flickerstreak@60 372 },
flickerstreak@60 373 relativePoint = {
flickerstreak@60 374 type = "select",
flickerstreak@60 375 name = L["Relative Point"],
flickerstreak@60 376 desc = L["Anchor point on the target frame"],
flickerstreak@60 377 style = "dropdown",
flickerstreak@60 378 get = function() local p,f,r = bar:GetAnchor(); return r end,
flickerstreak@60 379 set = function(info, val) bar:SetAnchor(nil,nil,val) end,
flickerstreak@60 380 values = pointTable,
flickerstreak@60 381 order = 3,
flickerstreak@60 382 },
flickerstreak@60 383 x = {
flickerstreak@60 384 type = "input",
flickerstreak@60 385 pattern = "\-?%d+",
flickerstreak@60 386 name = L["X offset"],
flickerstreak@60 387 get = function() local p,f,r,x = bar:GetAnchor(); return ("%d"):format(x) end,
flickerstreak@60 388 set = function(info,val) bar:SetAnchor(nil,nil,nil,val) end,
flickerstreak@60 389 order = 4
flickerstreak@60 390 },
flickerstreak@60 391 y = {
flickerstreak@60 392 type = "input",
flickerstreak@60 393 pattern = "\-?%d+",
flickerstreak@60 394 name = L["Y offset"],
flickerstreak@60 395 get = function() local p,f,r,x,y = bar:GetAnchor(); return ("%d"):format(y) end,
flickerstreak@60 396 set = function(info,val) bar:SetAnchor(nil,nil,nil,nil,val) end,
flickerstreak@60 397 order = 5
flickerstreak@60 398 },
flickerstreak@60 399 },
flickerstreak@60 400 order = 3
flickerstreak@60 401 },
flickerstreak@60 402 },
flickerstreak@60 403 },
flickerstreak@60 404 }
flickerstreak@60 405 }
flickerstreak@60 406 self:RefreshBarTree(bar)
flickerstreak@60 407 end
flickerstreak@60 408
flickerstreak@60 409 function editor:RefreshBarTree(bar)
flickerstreak@63 410 local key = barOptMap[bar:GetName()]
flickerstreak@63 411 if key and options.args[key] then
flickerstreak@63 412 options.args[key].plugins = ReAction:GenerateBarOptionsTable(bar)
flickerstreak@63 413 AceConfigReg:NotifyChange(editorName)
flickerstreak@60 414 end
flickerstreak@60 415 end
flickerstreak@60 416
flickerstreak@60 417 function editor:OnCreateBar(evt, bar)
flickerstreak@60 418 self:CreateBarTree(bar)
flickerstreak@60 419 end
flickerstreak@60 420
flickerstreak@63 421 function editor:OnDestroyBar(evt, bar, name)
flickerstreak@63 422 local key = barOptMap[name]
flickerstreak@63 423 if key then
flickerstreak@63 424 options.args[key] = nil
flickerstreak@63 425 end
flickerstreak@63 426 self:Refresh()
flickerstreak@63 427 end
flickerstreak@63 428
flickerstreak@60 429 function editor:OnEraseBar(evt, name)
flickerstreak@60 430 local key = barOptMap[name]
flickerstreak@60 431 barOptMap[name] = nil
flickerstreak@60 432 if key then
flickerstreak@60 433 options.args[key] = nil
flickerstreak@60 434 self:Refresh()
flickerstreak@60 435 end
flickerstreak@60 436 end
flickerstreak@60 437
flickerstreak@83 438 function editor:OnRenameBar(evt, bar, oldname, newname)
flickerstreak@60 439 local key = barOptMap[oldname]
flickerstreak@60 440 barOptMap[oldname], barOptMap[newname] = nil, key
flickerstreak@60 441 if key then
flickerstreak@60 442 options.args[key].name = newname
flickerstreak@60 443 self:Refresh()
flickerstreak@60 444 end
flickerstreak@60 445 end
flickerstreak@60 446
flickerstreak@63 447 function editor:OnBarOptionGeneratorRegistered(evt)
flickerstreak@63 448 for name in pairs(barOptMap) do
flickerstreak@63 449 local bar = ReAction:GetBar(name)
flickerstreak@63 450 if bar then
flickerstreak@63 451 self:RefreshBarTree(bar)
flickerstreak@63 452 end
flickerstreak@63 453 end
flickerstreak@63 454 end
flickerstreak@63 455
flickerstreak@60 456 local _scratch = { }
flickerstreak@60 457 function editor:GetBarTypes()
flickerstreak@60 458 for k,v in pairs(_scratch) do
flickerstreak@60 459 _scratch[k] = nil
flickerstreak@60 460 end
flickerstreak@63 461 return ReAction:GetBarTypeOptions(_scratch)
flickerstreak@60 462 end
flickerstreak@60 463
flickerstreak@60 464 function editor:CreateBar()
flickerstreak@60 465 if tmp.barName and tmp.barName ~= "" then
flickerstreak@63 466 ReAction:CreateBar(tmp.barName, tmp.barType or ReAction:GetDefaultBarType(), tmp.barRows, tmp.barCols, tmp.barSize, tmp.barSpacing)
flickerstreak@81 467 AceConfigDialog:SelectGroup(editorName, barOptMap[tmp.barName])
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@81 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@81 493 self.editor:Open(bar, ...)
flickerstreak@60 494 ReAction:SetConfigMode(true)
flickerstreak@60 495 end
flickerstreak@60 496 end
flickerstreak@60 497