Mercurial > wow > reaction
comparison 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 |
comparison
equal
deleted
inserted
replaced
29:9c89042bc328 | 30:0d95ce7a9ec2 |
---|---|
3 | 3 |
4 --]] | 4 --]] |
5 | 5 |
6 -- local imports | 6 -- local imports |
7 local ReAction = ReAction | 7 local ReAction = ReAction |
8 local L = ReAction.L | |
9 local _G = _G | |
10 local Tablet = AceLibrary("Tablet-2.0") | |
11 local Dewdrop = AceLibrary("Dewdrop-2.0") | |
12 | 8 |
13 -- module declaration | 9 -- module declaration |
14 local moduleID = "ReActionFu" | 10 local moduleID = "ReActionFu" |
15 local rmodule = ReAction:NewModule( moduleID ) | 11 local module = ReAction:NewModule( moduleID, |
16 local module = AceLibrary("AceAddon-2.0"):new("FuBarPlugin-2.0") | 12 "FuBarPlugin-3.0" |
17 rmodule.fubar = module | 13 ) |
18 | 14 |
19 module.hasIcon = "Interface\\Icons\\INV_Qiraj_JewelEncased" | 15 local fubarOptions = { |
20 module.hasNoColor = true | 16 iconPath = "Interface\\Icons\\INV_Qiraj_JewelEncased", |
21 module.clickableTooltip = false | 17 hasNoColor = true, |
22 module.cannotDetachTooltip = true | 18 tooltipType = "Tablet-2.0", |
23 module.hideMenuTitle = true | 19 configType = "Dewdrop-2.0", |
24 module.independentProfile = true | 20 hasNoText = true, |
25 module.defaultPosition = "LEFT" | 21 defaultPosition = "LEFT", |
26 module.defaultMinimapPosition = 240 -- degrees | 22 defaultMinimapPosition = 240, -- degrees |
23 clickableTooltip = false, | |
24 independentProfile = true | |
25 cannotDetachTooltip = true | |
26 hideMenuTitle = true | |
27 } | |
27 | 28 |
28 function rmodule:OnInitialize() | 29 function module:OnInitialize() |
29 self.db = ReAction.db:RegisterNamespace(moduleID, | 30 self.db = ReAction.db:RegisterNamespace(moduleID, |
30 { | 31 { |
31 profile = { | 32 profile = { |
32 requireFuBar = false | 33 requireFuBar = false |
33 } | 34 } |
37 | 38 |
38 if self.db.profile.requireFuBar == true then | 39 if self.db.profile.requireFuBar == true then |
39 self:Hide() | 40 self:Hide() |
40 end | 41 end |
41 | 42 |
43 self.OnMenuRequest = { | |
44 type = "group", | |
45 handler = ReAction, | |
46 args = { | |
47 -- include profile management by default | |
48 profile = LibStub("AceDBOptions-3.0"):GetOptionsTable(ReAction.db) | |
49 } | |
50 } | |
51 | |
52 -- insert each module's registered global opts into the table top level | |
53 local opts = self.OnMenuRequest | |
54 for m, tbl in pairs(ReAction:GetOptions("global")) do | |
55 if tbl.args then | |
56 for k, v in pairs(tbl.args) do | |
57 opts.args[k] = v | |
58 end | |
59 end | |
60 end | |
61 | |
62 -- listen for new module adds | |
63 ReAction.RegisterCallback(self, "OnOptionsRegistered") | |
64 | |
65 -- configure FuBarPlugin | |
66 for k, v in pairs(fubarOptions) do | |
67 self:SetFuBarOption(k,v) | |
68 end | |
42 end | 69 end |
43 | 70 |
44 function rmodule:OnEnable() | 71 function module:OnProfileChanged() |
45 | |
46 end | |
47 | |
48 function rmodule:OnDisable() | |
49 | |
50 end | |
51 | |
52 function rmodule:OnProfileChanged() | |
53 if self.db.profile.requireFuBar == true then | 72 if self.db.profile.requireFuBar == true then |
54 module:Hide() | 73 module:Hide() |
55 else | 74 else |
56 self:Show() | 75 self:Show() |
57 end | 76 end |
58 end | 77 end |
59 | 78 |
60 function module:OnTooltipUpdate() | 79 function module:OnOptionsRegistered( evtName, context, module, opts ) |
61 | 80 if context == "global" then |
62 end | 81 if opts.args then |
63 | 82 for k, v in pairs(tbl.args) do |
64 function module:OnClick(button) | 83 opts.args[k] = v |
65 | |
66 end | |
67 | |
68 function module:OnMenuRequest( level, value, inTooltip, valueN_1, valueN_2, valueN_3, valueN_4 ) | |
69 if not self.aceOptionsTable then | |
70 local opts = { | |
71 type = "group", | |
72 handler = ReAction, | |
73 args = { | |
74 } | |
75 } | |
76 Dewdrop:InjectAceOptionsTable(ReAction,opts) | |
77 self.aceOptionsTable = opts | |
78 end | |
79 for _, m in ReAction:IterateModules() do | |
80 if m and type(m.GetGlobalOptions) == "function" then | |
81 for k,v in pairs(m:GetGlobalOptions()) do | |
82 self.aceOptionsTable.args[k] = v | |
83 end | 84 end |
84 end | 85 end |
85 end | 86 end |
86 Dewdrop:FeedAceOptionsTable(self.aceOptionsTable) | |
87 end | 87 end |
88 | 88 |
89 function module:OnFuBarClick(button) | |
90 -- TODO: | |
91 -- alt, shift, ctrl clicks | |
92 end | |
93 | |
94 function module:OnUpdateFuBarTooltip() | |
95 -- TODO: | |
96 -- display status of config mode, keybind mode, etc | |
97 end | |
98 |