Mercurial > wow > reaction
changeset 50:c3c64e2def50
Assorted cleanup for hide/show grid, action ID labels, draggable resizing, etc
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Tue, 22 Apr 2008 20:37:44 +0000 |
parents | dcf8116560a1 |
children | c964fb84560c |
files | Bar.lua ReAction.lua locale/enUS.lua modules/ReAction_Action/ReAction_Action.lua modules/ReAction_ConfigUI/ReAction_ConfigUI.lua |
diffstat | 5 files changed, 47 insertions(+), 38 deletions(-) [+] |
line wrap: on
line diff
--- a/Bar.lua Mon Apr 14 23:03:19 2008 +0000 +++ b/Bar.lua Tue Apr 22 20:37:44 2008 +0000 @@ -214,7 +214,7 @@ ClampToButtons = function(bar) local bw, bh = GetButtonSize(bar) local r, c, s = GetButtonGrid(bar) - SetSize(bar, (bw+s)*c, (bh+s)*r ) + SetSize(bar, (bw+s)*c + 1, (bh+s)*r + 1) end HideGameTooltip = function() @@ -485,29 +485,25 @@ self.menuOpts = { type = "group", args = { - --[[ openConfig = { type = "execute", - name = L["Configure..."], - desc = L["Open the configuration dialogue for this bar"], - func = function() CloseMenu(self.controlFrame); module:OpenConfig(self) end, + name = L["Layout..."], + desc = L["Open the layout editor for this bar"], + func = function() CloseMenu(self.controlFrame); ReAction:CallModuleMethod("ConfigUI","LaunchLayoutEditor",self) end, disabled = InCombatLockdown, order = 1 }, - --]] delete = { type = "execute", name = L["Delete Bar"], desc = L["Remove the bar from the current profile"], + confirm = L["Are you sure you want to remove this bar?"], func = function() ReAction:EraseBar(self) end, order = 2 }, } } end - if self.modMenuOpts == nil then - self.modMenuOpts = { } - end OpenMenu(self.controlFrame, self.menuOpts) end @@ -515,12 +511,6 @@ ------ Export as a class-factory ------ ReAction.Bar = { - prototype = Bar, - - IsInstance = function(self, x) - return type(x) == "table" and x._classID == Bar._classID - end, - new = function(self, ...) local x = { } for k,v in pairs(Bar) do
--- a/ReAction.lua Mon Apr 14 23:03:19 2008 +0000 +++ b/ReAction.lua Tue Apr 22 20:37:44 2008 +0000 @@ -41,15 +41,13 @@ if type(x) == "string" then name = x bar = ReAction:GetBar(name) - elseif ReAction.Bar:IsInstance(x) then - bar = x + else for k,v in pairs(ReAction.bars) do - if v == bar then + if v == x then name = k + bar = x end end - else - error("bad argument to SelectBar") end return bar, name end @@ -118,10 +116,16 @@ ReAction:ShowConfig() elseif option == "layout" then ReAction:ShowLayout() + elseif option == "unlock" then + ReAction:SetConfigMode(true) + elseif option == "lock" then + ReAction:SetConfigMode(false) else ReAction:Print(("%3.1f.%d"):format(ReAction.version,ReAction.revision)) ReAction:Print("/reaction config") ReAction:Print("/reaction layout") + ReAction:Print("/reaction lock") + ReAction:Print("/reaction unlock") end end end
--- a/locale/enUS.lua Mon Apr 14 23:03:19 2008 +0000 +++ b/locale/enUS.lua Tue Apr 22 20:37:44 2008 +0000 @@ -22,10 +22,11 @@ "Drag to move", "Shift-drag for sticky mode", "Right-click for options", -"Configure...", -"Open the configuration dialogue for this bar", +"Layout...", +"Open the layout editor for this bar", "Delete Bar", "Remove the bar from the current profile", +"Are you sure you want to remove this bar?", -- modules/ReAction_HideBlizzard "Hide Blizzard Action Bars",
--- a/modules/ReAction_Action/ReAction_Action.lua Mon Apr 14 23:03:19 2008 +0000 +++ b/modules/ReAction_Action/ReAction_Action.lua Tue Apr 22 20:37:44 2008 +0000 @@ -130,29 +130,38 @@ if b then if mode then ActionButton_ShowGrid(b.frame) - if not b.actionIDLabel then - local label = b:GetFrame():CreateFontString(nil,"OVERLAY","GameFontNormalLarge") - label:SetAllPoints() - label:SetJustifyH("CENTER") - label:SetShadowColor(0,0,0,1) - label:SetShadowOffset(2,-2) - label:SetText(tostring(b:GetActionID())) - b.actionIDLabel = label - end - b.actionIDLabel:Show() + self:showActionIDLabel(b) else - if b.actionIDLabel then - b.actionIDLabel:Hide() - end ActionButton_HideGrid(b.frame) + self:hideActionIDLabel(b) end - end end end end end +function module:showActionIDLabel(button) + if not button.actionIDLabel then + local label = button:GetFrame():CreateFontString(nil,"OVERLAY","GameFontNormalLarge") + label:SetAllPoints() + label:SetJustifyH("CENTER") + label:SetShadowColor(0,0,0,1) + label:SetShadowOffset(2,-2) + label:SetText(tostring(button:GetActionID())) + button.actionIDLabel = label + end + button.actionIDLabel:Show() +end + +function module:hideActionIDLabel(button) + if button.actionIDLabel then + button.actionIDLabel:Hide() + end +end + + + -- use-count of action IDs local ActionIDList = setmetatable( {}, { __index = function(self, idx) @@ -213,6 +222,11 @@ if not module.db.profile.hideEmptyButtons then ActionButton_ShowGrid(self.frame) end + + if ReAction.configMode then + ActionButton_ShowGrid(self.frame) + module:showActionIDLabel(self) + end end function Button:Destroy()
--- a/modules/ReAction_ConfigUI/ReAction_ConfigUI.lua Mon Apr 14 23:03:19 2008 +0000 +++ b/modules/ReAction_ConfigUI/ReAction_ConfigUI.lua Tue Apr 22 20:37:44 2008 +0000 @@ -185,8 +185,8 @@ end function module:CreateBar() - if self.tmpBarType and self.tmpBarType ~= "" then - ReAction:CreateBar(self.tmpBarName, self.tmpBarType, self.tmpBarRows, self.tmpBarCols, self.tmpBarSize, self.tmpBarSpacing) + if self.tmpBarName and self.tmpBarName ~= "" then + ReAction:CreateBar(self.tmpBarName, self.tmpBarType or ReAction.defaultBarConfigChoice, self.tmpBarRows, self.tmpBarCols, self.tmpBarSize, self.tmpBarSpacing) self.tmpBarName = nil end end