# HG changeset patch # User Flick # Date 1207179073 0 # Node ID 0d95ce7a9ec28e809f697c765e2825580d0cc2e6 # Parent 9c89042bc328d5f53630340cbc06189fcc0877a3 - 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 diff -r 9c89042bc328 -r 0d95ce7a9ec2 Bar.lua --- a/Bar.lua Wed Apr 02 18:22:02 2008 +0000 +++ b/Bar.lua Wed Apr 02 23:31:13 2008 +0000 @@ -21,8 +21,8 @@ local f = CreateFrame("Frame",nil,config.parent or UIParent,"SecureStateDriverTemplate") f:SetFrameStrata("MEDIUM") - config.width = config.width or 400 - config.height = config.height or 80 + config.width = config.width or 480 + config.height = config.height or 40 f:SetWidth(config.width) f:SetWidth(config.height) diff -r 9c89042bc328 -r 0d95ce7a9ec2 Bindings.xml --- a/Bindings.xml Wed Apr 02 18:22:02 2008 +0000 +++ b/Bindings.xml Wed Apr 02 23:31:13 2008 +0000 @@ -1,10 +1,10 @@ - ReActionAddOn:ToggleLocked() + - ReActionAddOn:ToggleKeybindMode() + diff -r 9c89042bc328 -r 0d95ce7a9ec2 ReAction.lua --- a/ReAction.lua Wed Apr 02 18:22:02 2008 +0000 +++ b/ReAction.lua Wed Apr 02 23:31:13 2008 +0000 @@ -1,13 +1,17 @@ -- ReAction.lua -- See modules/ReAction_ModuleTemplate for Module API listing -- See Bar.lua for Bar object listing +local MAJOR_VERSION = GetAddOnMetadata("ReAction","Version") ------ LIBRARIES ------ local L = LibStub("AceLocale-3.0"):GetLocale("ReAction") ------ CORE ------ -local ReAction = LibStub("AceAddon-3.0"):NewAddon( "ReAction" ) +local ReAction = LibStub("AceAddon-3.0"):NewAddon( "ReAction", + "AceConsole-3.0" +) ReAction.revision = tonumber(("$Revision: 1 $"):match("%d+")) +ReAction.version = MAJOR_VERSION ReAction.L = L ------ GLOBALS ------ @@ -25,7 +29,7 @@ end ------ PRIVATE ------ -local SelectBar, DestroyBar, InitializeBars, TearDownBars, DeepCopy, SafeCall, CheckMethod +local SelectBar, DestroyBar, InitializeBars, TearDownBars, DeepCopy, SafeCall, CheckMethod, SlashHandler do local pcall = pcall local geterrorhandler = geterrorhandler @@ -106,6 +110,34 @@ error("Invalid method") end end + + local function CallOptsModule(method,...) + local m = ReAction:GetModule("ConfigUI",true) + if not m then + LoadAddOn("ReAction_ConfigUI") + m = ReAction:GetModule("ConfigUI") + end + if m and type(m) == "table" and type(m[method]) == "function" then + m[method](m,...) + else + ReAction:Print("Options module not found") + end + end + + SlashHandler = function(option) + if option == "config" then + CallOptsModule("OpenConfig",true) + elseif option == "unlock" then + CallOptsModule("SetConfigMode",true) + elseif option == "lock" then + CallOptsModule("SetConfigMode",false) + else + ReAction:Print(ReAction.version) + ReAction:Print("/reaction config") + ReAction:Print("/reaction unlock") + ReAction:Print("/reaction lock") + end + end end @@ -121,6 +153,9 @@ -- default profile is character-specific ) self.db.RegisterCallback(self,"OnProfileChanged") + self.callbacks = LibStub("CallbackHandler-1.0"):New(self) + self:RegisterChatCommand("reaction", SlashHandler) + self:RegisterChatCommand("rxn", SlashHandler) self.bars = {} end @@ -193,6 +228,7 @@ local bar = self.Bar:new( name, profile.bars[name] ) -- ReAction.Bar defined in Bar.lua self:CallMethodOnAllModules("ApplyToBar", bar) self.bars[name] = bar + self.callbacks:Fire("OnCreateBar", bar) return bar end @@ -202,6 +238,7 @@ DestroyBar(bar) self.db.profile.bars[name] = nil self:CallMethodOnAllModules("EraseBarConfig", name) + self.callbacks:Fire("OnEraseBar",name) end end @@ -221,7 +258,40 @@ local cfg = self.db.profile.bars cfg[newname], cfg[name] = cfg[name], nil self:CallMethodOnAllModules("RenameBarConfig", name, newname) + self.callbacks:Fire("OnRenameBar", name, newname) end end +ReAction.options = {} +-- 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 +end + +function ReAction:GetOptionContextList() + local c = {} + for k in self.options do + tinsert(c,k) + end + return c +end + +function ReAction:RefreshOptions() + self.callbacks:Fire("OnOptionsRefreshed") +end diff -r 9c89042bc328 -r 0d95ce7a9ec2 ReAction.toc --- a/ReAction.toc Wed Apr 02 18:22:02 2008 +0000 +++ b/ReAction.toc Wed Apr 02 23:31:13 2008 +0000 @@ -1,4 +1,4 @@ -## Interface: 20300 +## Interface: 20400 ## Title: ReAction ## Notes: Action button layout and configuration ## DefaultState: enabled diff -r 9c89042bc328 -r 0d95ce7a9ec2 lib/embeds.xml --- a/lib/embeds.xml Wed Apr 02 18:22:02 2008 +0000 +++ b/lib/embeds.xml Wed Apr 02 23:31:13 2008 +0000 @@ -7,6 +7,8 @@ + + diff -r 9c89042bc328 -r 0d95ce7a9ec2 locale/enUS.lua --- a/locale/enUS.lua Wed Apr 02 18:22:02 2008 +0000 +++ b/locale/enUS.lua Wed Apr 02 23:31:13 2008 +0000 @@ -11,7 +11,7 @@ L["ReAction: name already in use"] = true -- modules/ReAction_HideBlizzard -L["Hide Default Action Bars"] = true +L["Hide Blizzard Action Bars"] = true L["Hide the default main bar and extra action bars"] = true -- modules/ReAction_Action @@ -19,6 +19,8 @@ L["Create a new bar of standard action buttons"] = true -- modules/ReAction_ConfigUI +L["Customizable replacement for Blizzard's Action Bars"] = true +L["Action Bars"] = true L["Delete Bar"] = true L["Remove the bar from the current profile"] = true L["Rename Bar"] = true diff -r 9c89042bc328 -r 0d95ce7a9ec2 modules/FuBar_ReActionFu/FuBar_ReActionFu.lua --- 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 + diff -r 9c89042bc328 -r 0d95ce7a9ec2 modules/FuBar_ReActionFu/FuBar_ReActionFu.xml --- a/modules/FuBar_ReActionFu/FuBar_ReActionFu.xml Wed Apr 02 18:22:02 2008 +0000 +++ b/modules/FuBar_ReActionFu/FuBar_ReActionFu.xml Wed Apr 02 23:31:13 2008 +0000 @@ -2,14 +2,7 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/..\FrameXML\UI.xsd"> -