diff modules/FuBar_ReActionFu/FuBar_ReActionFu.lua @ 30:0d95ce7a9ec2

- added Ace3 externs - converted ReAction_ConfigUI to use blizzard interface addons panel via AceConfigDialog-3.0 - partially converted FuBar module to LibRock, deprecated it (going to remove it entirely later) - cleaned up a couple other tidbits
author Flick <flickerstreak@gmail.com>
date Wed, 02 Apr 2008 23:31:13 +0000
parents 21bcaf8215ff
children
line wrap: on
line diff
--- a/modules/FuBar_ReActionFu/FuBar_ReActionFu.lua	Wed Apr 02 18:22:02 2008 +0000
+++ b/modules/FuBar_ReActionFu/FuBar_ReActionFu.lua	Wed Apr 02 23:31:13 2008 +0000
@@ -5,27 +5,28 @@
 
 -- local imports
 local ReAction = ReAction
-local L = ReAction.L
-local _G = _G
-local Tablet = AceLibrary("Tablet-2.0")
-local Dewdrop = AceLibrary("Dewdrop-2.0")
 
 -- module declaration
 local moduleID = "ReActionFu"
-local rmodule = ReAction:NewModule( moduleID )
-local module  = AceLibrary("AceAddon-2.0"):new("FuBarPlugin-2.0")
-rmodule.fubar = module
+local module = ReAction:NewModule( moduleID,
+  "FuBarPlugin-3.0"
+)
 
-module.hasIcon = "Interface\\Icons\\INV_Qiraj_JewelEncased"
-module.hasNoColor = true
-module.clickableTooltip = false
-module.cannotDetachTooltip = true
-module.hideMenuTitle = true
-module.independentProfile = true
-module.defaultPosition = "LEFT"
-module.defaultMinimapPosition = 240 -- degrees
+local fubarOptions = {
+  iconPath = "Interface\\Icons\\INV_Qiraj_JewelEncased",
+  hasNoColor = true,
+  tooltipType = "Tablet-2.0",
+  configType = "Dewdrop-2.0",
+  hasNoText = true,
+  defaultPosition = "LEFT",
+  defaultMinimapPosition = 240, -- degrees
+  clickableTooltip = false,
+  independentProfile = true
+  cannotDetachTooltip = true
+  hideMenuTitle = true
+}
 
-function rmodule:OnInitialize()
+function module:OnInitialize()
   self.db = ReAction.db:RegisterNamespace(moduleID,
     {
       profile = {
@@ -39,17 +40,35 @@
     self:Hide()
   end
 
+  self.OnMenuRequest = {
+    type = "group",
+    handler = ReAction,
+    args = {
+      -- include profile management by default
+      profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(ReAction.db)
+    }
+  }
+
+  -- insert each module's registered global opts into the table top level
+  local opts = self.OnMenuRequest
+  for m, tbl in pairs(ReAction:GetOptions("global")) do
+    if tbl.args then
+      for k, v in pairs(tbl.args) do
+        opts.args[k] = v
+      end
+    end
+  end
+
+  -- listen for new module adds
+  ReAction.RegisterCallback(self, "OnOptionsRegistered")
+
+  -- configure FuBarPlugin
+  for k, v in pairs(fubarOptions) do
+    self:SetFuBarOption(k,v)
+  end
 end
 
-function rmodule:OnEnable()
-
-end
-
-function rmodule:OnDisable()
-
-end
-
-function rmodule:OnProfileChanged()
+function module:OnProfileChanged()
   if self.db.profile.requireFuBar == true then
     module:Hide()
   else
@@ -57,32 +76,23 @@
   end
 end
 
-function module:OnTooltipUpdate()
-
-end
-
-function module:OnClick(button)
-
-end
-
-function module:OnMenuRequest( level, value, inTooltip, valueN_1, valueN_2, valueN_3, valueN_4 )
-  if not self.aceOptionsTable then
-    local opts = { 
-      type = "group",
-      handler = ReAction,
-      args = {
-      }
-    }
-    Dewdrop:InjectAceOptionsTable(ReAction,opts)
-    self.aceOptionsTable = opts
-  end
-  for _, m in ReAction:IterateModules() do
-    if m and type(m.GetGlobalOptions) == "function" then
-      for k,v in pairs(m:GetGlobalOptions()) do
-        self.aceOptionsTable.args[k] = v
+function module:OnOptionsRegistered( evtName, context, module, opts )
+  if context == "global" then
+    if opts.args then
+      for k, v in pairs(tbl.args) do
+        opts.args[k] = v
       end
     end
   end
-  Dewdrop:FeedAceOptionsTable(self.aceOptionsTable)
 end
 
+function module:OnFuBarClick(button)
+  -- TODO:
+  -- alt, shift, ctrl clicks
+end
+
+function module:OnUpdateFuBarTooltip()
+  -- TODO:
+  -- display status of config mode, keybind mode, etc
+end
+