diff ReAction.lua @ 60:44649a10378d

Fixed options handling to create a separate table for each bar instead of a shared table with proxy handler. Also simplified options registration and moved some options around.
author Flick <flickerstreak@gmail.com>
date Sat, 10 May 2008 00:08:01 +0000
parents 20003239af0b
children 2ee41dcd673f
line wrap: on
line diff
--- a/ReAction.lua	Mon Apr 28 23:34:17 2008 +0000
+++ b/ReAction.lua	Sat May 10 00:08:01 2008 +0000
@@ -150,21 +150,50 @@
   self:RegisterEvent("PLAYER_REGEN_DISABLED")
 
   self.bars = {}
-  self.options = {}
   self.defaultBarConfig = {}
 
-  self:RegisterOptions("global", self, {
-    unlock = {
-      type     = "toggle",
-      handler  = module,
-      name     = L["Unlock Bars"],
-      desc     = L["Unlock bars for dragging and resizing with the mouse"],
-      get      = function() return self.configMode end,
-      set      = function(info, value) self:SetConfigMode(value) end,
-      disabled = InCombatLockdown,
-      order    = 1
+  self.options = {
+    type = "group",
+    name = "ReAction",
+    childGroups = "tab",
+    args = {
+      _desc = {
+        type = "description",
+        name = L["Customizable replacement for Blizzard's Action Bars"],
+        order = 1,
+      },
+      global = {
+        type = "group",
+        name = L["Global Settings"],
+        desc = L["Global configuration settings"],
+        args = { 
+          unlock = {
+            type     = "toggle",
+            handler  = module,
+            name     = L["Unlock Bars"],
+            desc     = L["Unlock bars for dragging and resizing with the mouse"],
+            get      = function() return self.configMode end,
+            set      = function(info, value) self:SetConfigMode(value) end,
+            disabled = InCombatLockdown,
+            order    = 1
+          },
+        },
+        plugins = { },
+        order = 2,
+      },
+      module = {
+        type = "group",
+        childGroups = "select",
+        name = L["Module Settings"],
+        desc = L["Configuration settings for each module"],
+        args = { },
+        plugins = { },
+        order = 3,
+      },
+      profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db)
     },
-  })
+    plugins = { }
+  }
 
 end
 
@@ -344,25 +373,8 @@
   self:RefreshOptions()
 end
 
--- See modules/ReAction_ConfigUI for valid options contexts.
-function ReAction:RegisterOptions(context, module, opts)
-  if module == nil or context == nil then
-    error("ReAction:RegisterOptions requires a module object and context ID")
-  end
-  if not self.options[context] then
-    self.options[context] = {}
-  end
-  self.options[context][module] = opts
-  self.callbacks:Fire("OnOptionsRegistered", context, module, opts)
-end
-
-function ReAction:GetOptions(context)
-  if context then
-    if not self.options[context] then
-      self.options[context] = { }
-    end
-    return self.options[context]
-  end
+function ReAction:RegisterOptions(module, options, global)
+  self.options.args[global and "global" or "module"].plugins[module:GetName()] = options
 end
 
 function ReAction:RefreshOptions()