Mercurial > wow > reaction
comparison ReAction.lua @ 184:1ee86bbb05a0
more options rearranging
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Fri, 22 Oct 2010 16:03:04 +0000 |
parents | 55c2fc0c8d55 |
children | 2e7a322e0195 |
comparison
equal
deleted
inserted
replaced
183:1696ff2c80cc | 184:1ee86bbb05a0 |
---|---|
23 "OnConfigModeChanged" (mode) : after the config mode is changed | 23 "OnConfigModeChanged" (mode) : after the config mode is changed |
24 "OnBarOptionGeneratorRegistered" (module, function) : after an options generator function is registered | 24 "OnBarOptionGeneratorRegistered" (module, function) : after an options generator function is registered |
25 | 25 |
26 ReAction is also an AceAddon-3.0 and contains an AceDB-3.0, which in turn publish more events. | 26 ReAction is also an AceAddon-3.0 and contains an AceDB-3.0, which in turn publish more events. |
27 ]]-- | 27 ]]-- |
28 | |
29 local addonName, addonTable = ... | 28 local addonName, addonTable = ... |
30 local version = GetAddOnMetadata(addonName,"Version") | |
31 local ReAction = LibStub("AceAddon-3.0"):NewAddon( addonName, | 29 local ReAction = LibStub("AceAddon-3.0"):NewAddon( addonName, |
32 "AceEvent-3.0" | 30 "AceEvent-3.0" |
33 ) | 31 ) |
32 ReAction.version = GetAddOnMetadata(addonName,"Version") | |
34 addonTable.ReAction = ReAction | 33 addonTable.ReAction = ReAction |
35 | 34 |
36 ------ LIBRARIES ------ | 35 ------ LIBRARIES ------ |
37 local callbacks = LibStub("CallbackHandler-1.0"):New(ReAction) | 36 local callbacks = LibStub("CallbackHandler-1.0"):New(ReAction) |
38 local KB = LibStub("LibKeyBound-1.0") | 37 local LKB = LibStub("LibKeyBound-1.0") |
39 local L = LibStub("AceLocale-3.0"):GetLocale("ReAction") | 38 local L = LibStub("AceLocale-3.0"):GetLocale("ReAction") |
40 ReAction.L = L | 39 ReAction.L = L |
41 ReAction.KB = KB | 40 ReAction.LKB = LKB |
42 ReAction.callbacks = callbacks | 41 ReAction.callbacks = callbacks |
43 | 42 |
44 ------ PRIVATE ------ | 43 ------ PRIVATE ------ |
45 local private = { } | 44 local private = { } |
46 local bars = {} | 45 local bars = {} |
132 function ReAction:OnInitialize() | 131 function ReAction:OnInitialize() |
133 self.db = LibStub("AceDB-3.0"):New("ReAction_DB", | 132 self.db = LibStub("AceDB-3.0"):New("ReAction_DB", |
134 { | 133 { |
135 profile = { | 134 profile = { |
136 bars = { }, | 135 bars = { }, |
137 defaultBar = { } | 136 defaultBar = { }, |
137 closeOptionsOnEditorLaunch = true, | |
138 } | 138 } |
139 }, | 139 }, |
140 true -- use global 'Default' (locale-specific) | 140 true -- use global 'Default' (locale-specific) |
141 ) | 141 ) |
142 KB.RegisterCallback(self,"LIBKEYBOUND_ENABLED") | 142 LKB.RegisterCallback(self,"LIBKEYBOUND_ENABLED") |
143 KB.RegisterCallback(self,"LIBKEYBOUND_DISABLED") | 143 LKB.RegisterCallback(self,"LIBKEYBOUND_DISABLED") |
144 | 144 |
145 self:RegisterEvent("PLAYER_REGEN_DISABLED") | 145 self:RegisterEvent("PLAYER_REGEN_DISABLED") |
146 | 146 |
147 self:InitializeOptions() | 147 self:InitializeOptions() |
148 end | 148 end |
177 | 177 |
178 function ReAction:UserError(msg) | 178 function ReAction:UserError(msg) |
179 -- any user errors should be flashed to the UIErrorsFrame | 179 -- any user errors should be flashed to the UIErrorsFrame |
180 UIErrorsFrame:AddMessage(msg) | 180 UIErrorsFrame:AddMessage(msg) |
181 end | 181 end |
182 | |
183 function ReAction:RebuildAll() | |
184 TearDownBars() | |
185 InitializeBars() | |
186 end | |
187 | |
182 | 188 |
183 -- usage: | 189 -- usage: |
184 -- (1) ReAction:CreateBar(name, [cfgTable]) | 190 -- (1) ReAction:CreateBar(name, [cfgTable]) |
185 -- (2) ReAction:CreateBar(name, "barType", [nRows], [nCols], [btnSize], [btnSpacing]) | 191 -- (2) ReAction:CreateBar(name, "barType", [nRows], [nCols], [btnSize], [btnSpacing]) |
186 function ReAction:CreateBar(name, config, ...) | 192 function ReAction:CreateBar(name, config, ...) |
382 end | 388 end |
383 | 389 |
384 function ReAction:SetKeybindMode( mode ) | 390 function ReAction:SetKeybindMode( mode ) |
385 if mode ~= private.kbMode then | 391 if mode ~= private.kbMode then |
386 if mode then | 392 if mode then |
387 KB:Activate() | 393 LKB:Activate() |
388 else | 394 else |
389 KB:Deactivate() | 395 LKB:Deactivate() |
390 end | 396 end |
391 private.kbMode = KB:IsShown() or false | 397 private.kbMode = LKB:IsShown() or false |
392 end | 398 end |
393 end | 399 end |
394 | 400 |
395 function ReAction:GetKeybindMode( mode ) | 401 function ReAction:GetKeybindMode( mode ) |
396 return private.kbMode | 402 return private.kbMode |