diff --git a/ElvUI_ExtraActionBars/ElvUI_ExtraActionBars.toc b/ElvUI_ExtraActionBars/ElvUI_ExtraActionBars.toc index ab1c067..01edb13 100644 --- a/ElvUI_ExtraActionBars/ElvUI_ExtraActionBars.toc +++ b/ElvUI_ExtraActionBars/ElvUI_ExtraActionBars.toc @@ -7,6 +7,5 @@ ## SavedVariablesPerCharacter: ExtraBar_ButtonEntries, ExtraBar_ButtonSettings libs\AlternateButtonTemplate\AlternateButtonTemplate.xml -locales.lua config.lua core.lua \ No newline at end of file diff --git a/ElvUI_ExtraActionBars/config.lua b/ElvUI_ExtraActionBars/config.lua index 2b9fbce..b23d2ce 100644 --- a/ElvUI_ExtraActionBars/config.lua +++ b/ElvUI_ExtraActionBars/config.lua @@ -1,260 +1,238 @@ -local E, L, V, P, G, _ = unpack(ElvUI); --Import: Engine, Locales, PrivateDB, ProfileDB, GlobalDB -local EAB = E:NewModule('ExtraActionBars','AceEvent-3.0') -local AB = E:GetModule('ActionBars'); +local E, L, V, P, G, _ = unpack(ElvUI); +local EAB = E:NewModule("ExtraActionBars","AceEvent-3.0"); +local AB = E:GetModule("ActionBars"); --- Defaults -P['actionbar']['bar7'] = { - ['enabled'] = false, - ['mouseover'] = false, - ['buttons'] = 12, - ['buttonsPerRow'] = 12, - ['point'] = 'BOTTOMLEFT', - ['backdrop'] = true, - ['heightMult'] = 1, - ['widthMult'] = 1, - ['buttonsize'] = 30, - ['buttonspacing'] = 4, +local points = { + ["TOPLEFT"] = "TOPLEFT", + ["TOPRIGHT"] = "TOPRIGHT", + ["BOTTOMLEFT"] = "BOTTOMLEFT", + ["BOTTOMRIGHT"] = "BOTTOMRIGHT", +}; + +P["actionbar"]["bar7"] = { + ["enabled"] = false, + ["mouseover"] = false, + ["buttons"] = 12, + ["buttonsPerRow"] = 12, + ["point"] = "BOTTOMLEFT", + ["backdrop"] = true, + ["heightMult"] = 1, + ["widthMult"] = 1, + ["buttonsize"] = 30, + ["buttonspacing"] = 4, ["backdropSpacing"] = 4, - ['alpha'] = 1, - ['inheritGlobalFade'] = false, - ['showGrid'] = true, - ['paging'] = {}, - ['visibility'] = '[vehicleui] hide; show', -} + ["alpha"] = 1, + ["inheritGlobalFade"] = false, + ["showGrid"] = true, + ["paging"] = {}, + ["visibility"] = "[vehicleui] hide; show" +}; -P['actionbar']['bar8'] = { - ['enabled'] = false, - ['mouseover'] = false, - ['buttons'] = 12, - ['buttonsPerRow'] = 12, - ['point'] = 'BOTTOMLEFT', - ['backdrop'] = true, - ['heightMult'] = 1, - ['widthMult'] = 1, - ['buttonsize'] = 30, - ['buttonspacing'] = 4, +P["actionbar"]["bar8"] = { + ["enabled"] = false, + ["mouseover"] = false, + ["buttons"] = 12, + ["buttonsPerRow"] = 12, + ["point"] = "BOTTOMLEFT", + ["backdrop"] = true, + ["heightMult"] = 1, + ["widthMult"] = 1, + ["buttonsize"] = 30, + ["buttonspacing"] = 4, ["backdropSpacing"] = 4, - ['alpha'] = 1, - ['inheritGlobalFade'] = false, - ['showGrid'] = true, - ['paging'] = {}, - ['visibility'] = '[vehicleui] hide; show', -} + ["alpha"] = 1, + ["inheritGlobalFade"] = false, + ["showGrid"] = true, + ["paging"] = {}, + ["visibility"] = "[vehicleui] hide; show" +}; -P['actionbar']['bar9'] = { - ['enabled'] = false, - ['mouseover'] = false, - ['buttons'] = 12, - ['buttonsPerRow'] = 12, - ['point'] = 'BOTTOMLEFT', - ['backdrop'] = true, - ['heightMult'] = 1, - ['widthMult'] = 1, - ['buttonsize'] = 30, - ['buttonspacing'] = 4, +P["actionbar"]["bar9"] = { + ["enabled"] = false, + ["mouseover"] = false, + ["buttons"] = 12, + ["buttonsPerRow"] = 12, + ["point"] = "BOTTOMLEFT", + ["backdrop"] = true, + ["heightMult"] = 1, + ["widthMult"] = 1, + ["buttonsize"] = 30, + ["buttonspacing"] = 4, ["backdropSpacing"] = 4, - ['alpha'] = 1, - ['inheritGlobalFade'] = false, - ['showGrid'] = true, - ['paging'] = {}, - ['visibility'] = '[vehicleui] hide; show', -} + ["alpha"] = 1, + ["inheritGlobalFade"] = false, + ["showGrid"] = true, + ["paging"] = {}, + ["visibility"] = "[vehicleui] hide; show" +}; -P['actionbar']['bar10'] = { - ['enabled'] = false, - ['mouseover'] = false, - ['buttons'] = 12, - ['buttonsPerRow'] = 12, - ['point'] = 'BOTTOMLEFT', - ['backdrop'] = true, - ['heightMult'] = 1, - ['widthMult'] = 1, - ['buttonsize'] = 30, - ['buttonspacing'] = 4, +P["actionbar"]["bar10"] = { + ["enabled"] = false, + ["mouseover"] = false, + ["buttons"] = 12, + ["buttonsPerRow"] = 12, + ["point"] = "BOTTOMLEFT", + ["backdrop"] = true, + ["heightMult"] = 1, + ["widthMult"] = 1, + ["buttonsize"] = 30, + ["buttonspacing"] = 4, ["backdropSpacing"] = 4, - ['alpha'] = 1, - ['inheritGlobalFade'] = false, - ['showGrid'] = true, - ['paging'] = {}, - ['visibility'] = '[vehicleui] hide; show', -} + ["alpha"] = 1, + ["inheritGlobalFade"] = false, + ["showGrid"] = true, + ["paging"] = {}, + ["visibility"] = "[vehicleui] hide; show" +}; function EAB:InsertOptions() - if not E.Options.args.blazeplugins then - E.Options.args.blazeplugins = { - order = -2, - type = 'group', - name = 'Plugins (by Blazeflack)', - args = {}, - } - end - - local points = { - ['TOPLEFT'] = 'TOPLEFT', - ['TOPRIGHT'] = 'TOPRIGHT', - ['BOTTOMLEFT'] = 'BOTTOMLEFT', - ['BOTTOMRIGHT'] = 'BOTTOMRIGHT', - } - - E.Options.args.blazeplugins.args.EAB = { - order = 40, - type = 'group', - name = 'ExtraActionBars', - disabled = function() return not E.private.actionbar.enable end, - childGroups = 'tab', - args = {}, - } - - local group = E.Options.args.blazeplugins.args.EAB.args + local group = E.Options.args.actionbar.args; for i = 7, 10 do - local name = L['Bar ']..i - group['bar'..i] = { - order = i, + local name = L["Bar "]..i + group["bar" .. i] = { + order = 200 + i, + type = "group", name = name, - type = 'group', - disabled = function() return not E.private.actionbar.enable end, - get = function(info) return E.db.actionbar['bar'..i][ info[#info] ] end, - set = function(info, value) E.db.actionbar['bar'..i][ info[#info] ] = value; AB:PositionAndSizeBar('bar'..i) end, + disabled = function() return not E.private.actionbar.enable; end, + get = function(info) return E.db.actionbar["bar" .. i][ info[#info] ] end, + set = function(info, value) E.db.actionbar["bar" .. i][ info[#info] ] = value; AB:PositionAndSizeBar("bar" .. i); end, args = { info = { order = 1, - type = 'header', - name = name, + type = "header", + name = name }, enabled = { order = 2, - type = 'toggle', - name = L['Enable'], + type = "toggle", + name = L["Enable"] }, restorePosition = { order = 3, - type = 'execute', - name = L['Restore Bar'], - desc = L['Restore the actionbars default settings'], - func = function() E:CopyTable(E.db.actionbar['bar'..i], P.actionbar['bar'..i]); E:ResetMovers('Bar '..i); AB:PositionAndSizeBar('bar'..i) end, + type = "execute", + name = L["Restore Bar"], + desc = L["Restore the actionbars default settings"], + func = function() E:CopyTable(E.db.actionbar["bar" .. i], P.actionbar["bar" .. i]); E:ResetMovers(L["Bar " .. i]); AB:PositionAndSizeBar("bar" .. i) end }, point = { order = 4, - type = 'select', - name = L['Anchor Point'], - desc = L['The first button anchors itself to this point on the bar.'], - values = points, + type = "select", + name = L["Anchor Point"], + desc = L["The first button anchors itself to this point on the bar."], + values = points }, backdrop = { order = 5, - type = 'toggle', - name = L['Backdrop'], - desc = L['Toggles the display of the actionbars backdrop.'], + type = "toggle", + name = L["Backdrop"], + desc = L["Toggles the display of the actionbars backdrop."] }, showGrid = { - type = 'toggle', + type = "toggle", name = L["Show Empty Buttons"], order = 6, - set = function(info, value) E.db.actionbar['bar'..i][ info[#info] ] = value; AB:UpdateButtonSettingsForBar('bar'..i) end, + set = function(info, value) E.db.actionbar["bar" .. i][ info[#info] ] = value; --[[AB:UpdateButtonSettingsForBar("bar"..i)]] end }, mouseover = { order = 7, - name = L['Mouse Over'], - desc = L['The frame is not shown unless you mouse over the frame.'], - type = 'toggle', + type = "toggle", + name = L["Mouse Over"], + desc = L["The frame is not shown unless you mouse over the frame."] }, inheritGlobalFade = { order = 8, - type = 'toggle', + type = "toggle", name = L["Inherit Global Fade"], - desc = L["Inherit the global fade, mousing over, targetting, setting focus, losing health, entering combat will set the remove transparency. Otherwise it will use the transparency level in the general actionbar settings for global fade alpha."], + desc = L["Inherit the global fade, mousing over, targetting, setting focus, losing health, entering combat will set the remove transparency. Otherwise it will use the transparency level in the general actionbar settings for global fade alpha."] }, buttons = { order = 9, - type = 'range', - name = L['Buttons'], - desc = L['The amount of buttons to display.'], - min = 1, max = NUM_ACTIONBAR_BUTTONS, step = 1, + type = "range", + name = L["Buttons"], + desc = L["The amount of buttons to display."], + min = 1, max = NUM_ACTIONBAR_BUTTONS, step = 1 }, buttonsPerRow = { order = 10, - type = 'range', - name = L['Buttons Per Row'], - desc = L['The amount of buttons to display per row.'], - min = 1, max = NUM_ACTIONBAR_BUTTONS, step = 1, + type = "range", + name = L["Buttons Per Row"], + desc = L["The amount of buttons to display per row."], + min = 1, max = NUM_ACTIONBAR_BUTTONS, step = 1 }, buttonsize = { - type = 'range', - name = L['Button Size'], - desc = L['The size of the action buttons.'], - min = 15, max = 60, step = 1, order = 11, - disabled = function() return not E.private.actionbar.enable end, + type = "range", + name = L["Button Size"], + desc = L["The size of the action buttons."], + min = 15, max = 60, step = 1, }, buttonspacing = { - type = 'range', - name = L['Button Spacing'], - desc = L['The spacing between buttons.'], - min = 1, max = 10, step = 1, order = 12, - disabled = function() return not E.private.actionbar.enable end, + type = "range", + name = L["Button Spacing"], + desc = L["The spacing between buttons."], + min = -1, max = 10, step = 1 }, backdropSpacing = { - type = 'range', + order = 13, + type = "range", name = L["Backdrop Spacing"], desc = L["The spacing between the backdrop and the buttons."], - min = 0, max = 10, step = 1, - order = 13, - disabled = function() return not E.private.actionbar.enable end, + min = 0, max = 10, step = 1 }, heightMult = { order = 14, - type = 'range', - name = L['Height Multiplier'], - desc = L['Multiply the backdrops height or width by this value. This is usefull if you wish to have more than one bar behind a backdrop.'], - min = 1, max = 5, step = 1, + type = "range", + name = L["Height Multiplier"], + desc = L["Multiply the backdrops height or width by this value. This is usefull if you wish to have more than one bar behind a backdrop."], + min = 1, max = 5, step = 1 }, widthMult = { order = 15, - type = 'range', - name = L['Width Multiplier'], - desc = L['Multiply the backdrops height or width by this value. This is usefull if you wish to have more than one bar behind a backdrop.'], - min = 1, max = 5, step = 1, + type = "range", + name = L["Width Multiplier"], + desc = L["Multiply the backdrops height or width by this value. This is usefull if you wish to have more than one bar behind a backdrop."], + min = 1, max = 5, step = 1 }, alpha = { order = 16, - type = 'range', - name = L['Alpha'], + type = "range", + name = L["Alpha"], isPercent = true, - min = 0, max = 1, step = 0.01, + min = 0, max = 1, step = 0.01 }, paging = { - type = 'input', order = 17, - name = L['Action Paging'], + type = "input", + name = L["Action Paging"], desc = L["This works like a macro, you can run different situations to get the actionbar to page differently.\n Example: '[combat] 2;'"], - width = 'full', + width = "full", multiline = true, - get = function(info) return E.db.actionbar['bar'..i]['paging'][E.myclass] end, + get = function(info) return E.db.actionbar["bar" .. i]["paging"][E.myclass]; end, set = function(info, value) - if not E.db.actionbar['bar'..i]['paging'][E.myclass] then - E.db.actionbar['bar'..i]['paging'][E.myclass] = {} + if(not E.db.actionbar["bar" .. i]["paging"][E.myclass]) then + E.db.actionbar["bar" .. i]["paging"][E.myclass] = {}; end - E.db.actionbar['bar'..i]['paging'][E.myclass] = value - AB:UpdateButtonSettings() + E.db.actionbar["bar"..i]["paging"][E.myclass] = value; + AB:UpdateButtonSettings(); end, }, visibility = { - type = 'input', order = 18, - name = L['Visibility State'], + type = "input", + name = L["Visibility State"], desc = L["This works like a macro, you can run different situations to get the actionbar to show/hide differently.\n Example: '[combat] show;hide'"], - width = 'full', + width = "full", multiline = true, set = function(info, value) - E.db.actionbar['bar'..i]['visibility'] = value; - AB:UpdateButtonSettings() - end, - }, - }, - } + E.db.actionbar["bar" .. i]["visibility"] = value; + AB:UpdateButtonSettings(); + end + } + } + }; end end -E:RegisterModule(EAB:GetName()) \ No newline at end of file +E:RegisterModule(EAB:GetName()); \ No newline at end of file diff --git a/ElvUI_ExtraActionBars/core.lua b/ElvUI_ExtraActionBars/core.lua index 6ee7914..fc86e8b 100644 --- a/ElvUI_ExtraActionBars/core.lua +++ b/ElvUI_ExtraActionBars/core.lua @@ -7,8 +7,8 @@ local addon, ns = ...; local split = string.split; local function CreateBar(id) - local bar = CreateFrame("Frame", "ElvUI_Bar"..id, E.UIParent, "SecureHandlerBaseTemplate, SecureHandlerShowHideTemplate"); - local point, anchor, attachTo, x, y = split(",", AB["barDefaults"]["bar"..id].position); + local bar = CreateFrame("Frame", "ElvUI_Bar" .. id, E.UIParent, "SecureHandlerBaseTemplate, SecureHandlerShowHideTemplate"); + local point, anchor, attachTo, x, y = split(",", AB["barDefaults"]["bar" .. id].position); bar:Point(point, anchor, attachTo, x, y); bar.id = id; bar:CreateBackdrop("Default"); @@ -19,12 +19,13 @@ local function CreateBar(id) bar.backdrop:SetPoint("BOTTOMRIGHT", bar, "BOTTOMRIGHT", -offset, offset); bar.buttons = {}; - bar.bindButtons = AB["barDefaults"]["bar"..id].bindButtons; + bar.bindButtons = AB["barDefaults"]["bar" .. id].bindButtons; + AB:HookScript(bar, "OnEnter", "Bar_OnEnter"); AB:HookScript(bar, "OnLeave", "Bar_OnLeave"); for i = 1, 12 do - bar.buttons[i] = CreateFrame("CheckButton", format(bar:GetName().."Button%d", i), bar, "AlternateButtonTemplate"); + bar.buttons[i] = CreateFrame("CheckButton", format(bar:GetName() .. "Button%d", i), bar, "AlternateButtonTemplate"); AB:StyleButton(bar.buttons[i]); bar.buttons[i]:SetAttribute("saveentries", "ExtraBar_ButtonEntries"); @@ -36,7 +37,7 @@ local function CreateBar(id) bar:Execute([[ebButtons = newtable(); owner:GetChildList(ebButtons);]]); bar:SetAttribute("_onstate-page", [[ - for i, button in ipairs(buttons) do + for i, button in ipairs(ebButtons) do button:SetAttribute("actionpage", tonumber(newstate)); end ]]); diff --git a/ElvUI_ExtraActionBars/locales.lua b/ElvUI_ExtraActionBars/locales.lua deleted file mode 100644 index 4d1c43a..0000000 --- a/ElvUI_ExtraActionBars/locales.lua +++ /dev/null @@ -1,78 +0,0 @@ --- English localization file for enUS and enGB. -local L = LibStub("AceLocale-3.0"):NewLocale("ElvUI", "enUS", true); - -if not L then return end ---Nothing yet - ---We don't need the rest if we're on enUS or enGB locale, so stop here. -if GetLocale() == "enUS" then return end - ---German Localizations -local L = LibStub("AceLocale-3.0"):NewLocale("ElvUI", "deDE") -if L then - --Add translations here, eg. - -- L[' Alert'] = ' Alert', -end - ---Spanish (Spain) Localizations -local L = LibStub("AceLocale-3.0"):NewLocale("ElvUI", "esES") -if L then - --Add translations here, eg. - -- L[' Alert'] = ' Alert', -end - ---Spanish (Mexico) Localizations -local L = LibStub("AceLocale-3.0"):NewLocale("ElvUI", "esMX") -if L then - --Add translations here, eg. - -- L[' Alert'] = ' Alert', -end - ---French Localizations -local L = LibStub("AceLocale-3.0"):NewLocale("ElvUI", "frFR") -if L then - --Add translations here, eg. - -- L[' Alert'] = ' Alert', -end - ---Italian Localizations -local L = LibStub("AceLocale-3.0"):NewLocale("ElvUI", "itIT") -if L then - --Add translations here, eg. - -- L[' Alert'] = ' Alert', -end - ---Korean Localizations -local L = LibStub("AceLocale-3.0"):NewLocale("ElvUI", "koKR") -if L then - --Add translations here, eg. - -- L[' Alert'] = ' Alert', -end - ---Portuguese Localizations -local L = LibStub("AceLocale-3.0"):NewLocale("ElvUI", "ptBR") -if L then - --Add translations here, eg. - -- L[' Alert'] = ' Alert', -end - ---Russian Localizations -local L = LibStub("AceLocale-3.0"):NewLocale("ElvUI", "ruRU") -if L then - --Add translations here, eg. - -- L[' Alert'] = ' Alert', -end - ---Chinese (China, simplified) Localizations -local L = LibStub("AceLocale-3.0"):NewLocale("ElvUI", "zhCN") -if L then - --Add translations here, eg. - -- L[' Alert'] = ' Alert', -end - ---Chinese (Taiwan, traditional) Localizations -local L = LibStub("AceLocale-3.0"):NewLocale("ElvUI", "zhTW") -if L then - --Add translations here, eg. - -- L[' Alert'] = ' Alert', -end \ No newline at end of file