Mercurial > wow > reaction
changeset 81:57f8151ea0f0
- Fixed some snafus with creating bars
- Added support for opening the bar editor to a particular path
- Creating bars/states now selects the new bar/state in the config editor
- moved Bar:SetStateAttribute() back to working optionally on buttons rather than buttonFrame container
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Wed, 25 Jun 2008 21:07:18 +0000 |
parents | 42ec2938d65a |
children | 5b7fd67a28ea |
files | Bar.lua ReAction.lua State.lua modules/ReAction_ConfigUI/ReAction_ConfigUI.lua |
diffstat | 4 files changed, 28 insertions(+), 19 deletions(-) [+] |
line wrap: on
line diff
--- a/Bar.lua Tue Jun 24 23:47:27 2008 +0000 +++ b/Bar.lua Wed Jun 25 21:07:18 2008 +0000 @@ -265,7 +265,7 @@ end end --- Set an attribute on the frame (or buttonFrame if 'buttonFrame' = true) +-- Set an attribute on the frame (or each button if 'doButtons' = true) -- Either or both 'map' and 'default' can be passed: -- - If 'map' is omitted, then 'default' is set to the attribute. -- - If 'map' is provided, then it is interpreted as an unordered @@ -274,8 +274,7 @@ -- string, e.g. "<state1>:<value1>;<state2>:<value2>". If 'default' -- is also provided, then its value will be converted to a string -- and appended. -function Bar:SetStateAttribute( attribute, map, default, buttonFrame ) - local f = buttonFrame and self:GetButtonFrame() or self:GetFrame() +function Bar:SetStateAttribute( attribute, map, default, doButtons ) local value = default if map then local tmp = { } @@ -287,6 +286,12 @@ end value = table.concat(tmp,";") end - f:SetAttribute(attribute, value) - SecureStateHeader_Refresh(f) + if doButtons then + for b in self:IterateButtons() do + b:GetFrame():SetAttribute(attribute,value) + end + else + self:GetFrame():SetAttribute(attribute, value) + end + SecureStateHeader_Refresh(self:GetFrame()) end
--- a/ReAction.lua Tue Jun 24 23:47:27 2008 +0000 +++ b/ReAction.lua Wed Jun 25 21:07:18 2008 +0000 @@ -287,9 +287,9 @@ config.spacing = select(5,...) or config.spacing or 3 config.width = config.width or config.btnColumns*(config.btnWidth + config.spacing) + 1 config.height = config.height or config.btnRows*(config.btnHeight + config.spacing) + 1 - config.anchor = config.anchor or "BOTTOM" - config.anchorTo = config.anchorTo or "UIParent" - config.relativePoint = config.relativePoint or "BOTTOM" + config.anchor = config.anchor or "UIParent" + config.point = config.point or "BOTTOM" + config.relpoint = config.relpoint or "BOTTOM" config.y = config.y or 200 config.x = config.x or 0 end @@ -359,7 +359,7 @@ function ReAction:RegisterBarType( name, config, isDefaultChoice ) defaultBarConfig[name] = config if isDefaultChoice then - defaultBarConfigChoice = name + private.defaultBarConfigChoice = name end self:RefreshOptions() end @@ -462,6 +462,6 @@ CallModuleMethod("ConfigUI","OpenConfig") end -function ReAction:ShowEditor(bar) - CallModuleMethod("ConfigUI","LaunchBarEditor",bar) +function ReAction:ShowEditor(bar, ...) + CallModuleMethod("ConfigUI","LaunchBarEditor",bar, ...) end
--- a/State.lua Tue Jun 24 23:47:27 2008 +0000 +++ b/State.lua Wed Jun 25 21:07:18 2008 +0000 @@ -151,7 +151,7 @@ table.insert(hs, state) end end - bar:SetStateAttribute("hidestates", nil, table.concat(hs,","), true) -- pass to buttons + bar:GetButtonFrame():SetAttribute("hidestates", table.concat(hs,",")) end, keybindstate = function( bar, states ) @@ -500,7 +500,7 @@ }, hide = { name = L["Hide Bar"], - order = 91, + order = 90, type = "toggle", set = "SetProp", get = "GetProp", @@ -508,14 +508,14 @@ keybindstate = { name = L["Override Keybinds"], desc = L["Set this state to maintain its own set of keybinds which override the defaults when active"], - order = 92, + order = 91, type = "toggle", set = "SetProp", get = "GetProp", }, position = { name = L["Position"], - order = 93, + order = 92, type = "group", inline = true, args = { @@ -574,7 +574,7 @@ }, scale = { name = L["Scale"], - order = 94, + order = 93, type = "group", inline = true, args = { @@ -1009,6 +1009,7 @@ -- TODO: select default state options and pass as final argument states[name] = { } optionMap[bar].args[name] = CreateStateOptions(bar,name) + ReAction:ShowEditor(bar, moduleID, name) private.newstatename = "" end end, @@ -1040,7 +1041,7 @@ -- -- The options table is static, i.e. not bar-specific and should only reference handler method -- strings (either existing ones or those added via optHandler). The existing options are ordered --- 91-100. Order #1 is reserved for the heading. +-- 90-99. Order #1 is reserved for the heading. -- -- The contents of optHandler, if provided, will be added to the existing StateHandler metatable. -- See above, for existing API. In particular see the properties set up in the New method: self.bar,
--- a/modules/ReAction_ConfigUI/ReAction_ConfigUI.lua Tue Jun 24 23:47:27 2008 +0000 +++ b/modules/ReAction_ConfigUI/ReAction_ConfigUI.lua Wed Jun 25 21:07:18 2008 +0000 @@ -284,9 +284,9 @@ } AceConfigReg:RegisterOptionsTable(editorName, options) - function editor:Open(bar) + function editor:Open(bar, ...) if bar then - AceConfigDialog:SelectGroup(editorName, barOptMap[bar:GetName()]) + AceConfigDialog:SelectGroup(editorName, barOptMap[bar:GetName()], ...) end AceConfigDialog:Open(editorName,self) end @@ -467,6 +467,7 @@ function editor:CreateBar() if tmp.barName and tmp.barName ~= "" then ReAction:CreateBar(tmp.barName, tmp.barType or ReAction:GetDefaultBarType(), tmp.barRows, tmp.barCols, tmp.barSize, tmp.barSpacing) + AceConfigDialog:SelectGroup(editorName, barOptMap[tmp.barName]) tmp.barName = nil end end @@ -485,14 +486,14 @@ end -function module:LaunchBarEditor(bar) +function module:LaunchBarEditor(bar, ...) if InCombatLockdown() then ReAction:UserError(L["ReAction config mode disabled during combat."]) else if not self.editor then self.editor = NewEditor() end - self.editor:Open(bar) + self.editor:Open(bar, ...) ReAction:SetConfigMode(true) end end