diff --git a/ElvUI_SLE/modules/datatexts/add_panels.lua b/ElvUI_SLE/modules/datatexts/add_panels.lua index 64e1aa8..e7722d0 100644 --- a/ElvUI_SLE/modules/datatexts/add_panels.lua +++ b/ElvUI_SLE/modules/datatexts/add_panels.lua @@ -39,11 +39,6 @@ end -- New panels function DTP:CreateDataPanels(panel, name, point, x, slot, short) - --if E.db.sle.datatext[short.."transparent"] then - -- panel:SetTemplate("Transparent") - --else - -- panel:SetTemplate("Default", true) - --end panel:SetFrameStrata('LOW') panel:Point(point, E.UIParent, point, x, 0); DT:RegisterPanel(panel, slot, 'ANCHOR_BOTTOM', 0, -4) @@ -72,48 +67,16 @@ function DTP:ExtraDataBarSetup() else v[5]:Hide() end - if db[v[1]].transparent then - v[5]:SetTemplate("Transparent") - else - v[5]:SetTemplate("Default", true) + if not E.private.sle.datatext[v[1].."hide"] then + if db[v[1]].transparent then + v[5]:SetTemplate("Transparent") + else + v[5]:SetTemplate("Default", true) + end end end end - ---function DTP:SetDataPanelStyle() --- local db = E.db.sle.datatext --- for _,v in pairs(panels) do --- if db[v[1]].transparent then --- --- else --- --- end --- end ---end - - ---[[ -function DTP:SetDataPanelStyle() - if E.db.datatexts.panelTransparency then - LeftChatDataPanel:SetTemplate("Transparent") - LeftChatToggleButton:SetTemplate("Transparent") - LeftMiniPanel:SetTemplate("Transparent") - RightChatDataPanel:SetTemplate("Transparent") - RightChatToggleButton:SetTemplate("Transparent") - RightMiniPanel:SetTemplate("Transparent") - ElvConfigToggle:SetTemplate("Transparent") - else - LeftChatDataPanel:SetTemplate("Default", true) - LeftChatToggleButton:SetTemplate("Default", true) - LeftMiniPanel:SetTemplate("Default", true) - RightChatDataPanel:SetTemplate("Default", true) - RightChatToggleButton:SetTemplate("Default", true) - RightMiniPanel:SetTemplate("Default", true) - ElvConfigToggle:SetTemplate("Default", true) - end -end]] - function DTP:Update() DTP:ExtraDataBarSetup() DTP:Resize() diff --git a/ElvUI_SLE/modules/datatexts/options.lua b/ElvUI_SLE/modules/datatexts/options.lua index 9db650b..58134df 100644 --- a/ElvUI_SLE/modules/datatexts/options.lua +++ b/ElvUI_SLE/modules/datatexts/options.lua @@ -1,338 +1,195 @@ -local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB +local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore +local DTP = E:GetModule('DTPanels') +local DT = E:GetModule('DataTexts') -P['sle'] = { - --Background frames - ['backgrounds'] = { - ['bottom'] = { - ['enabled'] = false, - ['trans'] = false, - ['texture'] = "", - ['width'] = E.screenwidth/4 + 32, - ['height'] = E.screenheight/6 - 13, - ['xoffset'] = 0, - ['yoffset'] = 0, - ['pethide'] = true, - }, - ['left'] = { - ['enabled'] = false, - ['trans'] = false, - ['texture'] = "", - ['width'] = E.screenwidth/10 - 4, - ['height'] = E.screenheight/5 + 11, - ['xoffset'] = 0, - ['yoffset'] = 0, - ['pethide'] = true, - }, - ['right'] = { - ['enabled'] = false, - ['trans'] = false, - ['texture'] = "", - ['width'] = E.screenwidth/10 - 4, - ['height'] = E.screenheight/5 + 11, - ['xoffset'] = 0, - ['yoffset'] = 0, - ['pethide'] = true, - }, - ['action'] = { - ['enabled'] = false, - ['trans'] = false, - ['texture'] = "", - ['width'] = E.screenwidth/4 + 32, - ['height'] = E.screenheight/20 + 5, - ['xoffset'] = 0, - ['yoffset'] = 0, - ['pethide'] = true, - }, - }, - - --Caster Name - ['castername'] = false, - - --Raid marks - ['marks'] = { - ['enabled'] = true, - ['growth'] = "RIGHT", - ['showinside'] = false, - ['size'] = 18, - }, - - --Exp/Rep Bar - ['exprep'] = { - ['explong'] = false, - ['replong'] = false, - }, - - --Power text on classbars - ['powtext'] = false; - - --Auto release - ['pvpautorelease'] = true, - - --Datatexts panels - ['datatext'] = { - ['dp1'] = { - ['enabled'] = false, - ['width'] = E.screenwidth/5, - ['transparent'] = false, - }, - ['dp2'] = { - ['enabled'] = false, - ['width'] = E.screenwidth/5, - ['transparent'] = false, - }, - ['top'] = { - ['enabled'] = true, - ['width'] = E.screenwidth/5 - 4, - ['transparent'] = false, - }, - ['dp3'] = { - ['enabled'] = false, - ['width'] = E.screenwidth/5, - ['transparent'] = false, - }, - ['dp4'] = { - ['enabled'] = false, - ['width'] = E.screenwidth/5, - ['transparent'] = false, - }, - ['dp5'] = { - ['enabled'] = false, - ['width'] = E.screenwidth/4 - 60, - ['transparent'] = false, - }, - ['bottom'] = { - ['enabled'] = false, - ['width'] = E.screenwidth/10 - 4, - ['transparent'] = false, - }, - ['dp6'] = { - ['enabled'] = false, - ['width'] = E.screenwidth/4 - 60, - ['transparent'] = false, - }, - ['chatleft'] = { - ['enabled'] = true, - ['width'] = 396, - }, - ['chatright'] = { - ['enabled'] = true, - ['width'] = 396, - }, - ['dashboard'] = { - ['enable'] = false, - ['width'] = 100, - }, - }, - - --Combat Icon - ['combatico'] = { - ['pos'] = 'TOP', - }, - - --UI Buttons - ['uibuttons'] = { - ['enable'] = false, - ['size'] = 17, - ['mouse'] = false, - ['position'] = "uib_vert", - }, - - --Autoloot - ['lootwin'] = false, - ['lootalpha'] = 1, - - --Error messages - ['errors'] = false, +local datatexts = {} +local drop = { + --Group name = {short name, order, slot} + ["DP_1"] = {"dp1", 1, 3}, + ["DP_2"] = {"dp2", 2, 3}, + ["Top_Center"] = {"top", 3, 1}, + ["DP_3"] = {"dp3", 4, 3}, + ["DP_4"] = {"dp4", 5, 3}, + ["DP_5"] = {"dp5", 6, 3}, + ["Bottom_Panel"] = {"bottom", 7, 1}, + ["DP_6"] = {"dp6", 8, 3}, +} +local chatT = { + --Group name = {short name, order, elv's varible, chat panel(used to call functions)} + ["Left Chat"] = {"chatleft", 9, "leftChatPanel", "LeftChat"}, + ["Right Chat"] = {"chatright", 10, "rightChatPanel", "RightChat"}, } ---For some reason datatext settings refuses to work if there is no general setting block here O_o ---Core -P['general'] = { - ["taintLog"] = false, - ["autoscale"] = true, - ["stickyFrames"] = true, - ['loginmessage'] = true, - ["interruptAnnounce"] = "NONE", - ["autoRepair"] = "NONE", - ['autoRoll'] = false, - ['vendorGrays'] = false, - ['autoAcceptInvite'] = false, - ['bottomPanel'] = false, - - ["fontSize"] = 12, - ["font"] = "ElvUI Font", - ["bordercolor"] = { r = 0.1,g = 0.1,b = 0.1 }, - ["backdropcolor"] = { r = 0.1,g = 0.1,b = 0.1 }, - ["backdropfadecolor"] = { r = .054,g = .054,b = .054, a = 0.8 }, - ["valuecolor"] = {r = 23/255,g = 132/255,b = 209/255}, - - ['mapAlpha'] = 1, - ['tinyWorldMap'] = true, - - ['minimap'] = { - ['size'] = 176, - ['locationText'] = 'MOUSEOVER', - }, +function DT:PanelLayoutOptions() + for name, _ in pairs(DT.RegisteredDataTexts) do + if name ~= 'Version' then + datatexts[name] = name + end + end + datatexts[''] = '' - ['experience'] = { - ['enable'] = true, - ['width'] = 475, - ['height'] = 10, - ['textFormat'] = 'NONE', - ['textSize'] = 11, - }, - ['reputation'] = { - ['enable'] = true, - ['width'] = 475, - ['height'] = 10, - ['textFormat'] = 'NONE', - ['textSize'] = 11, - }, - ['threat'] = { - ['enable'] = true, - ['position'] = 'RIGHTCHAT', - ['textSize'] = 12, - }, - ['totems'] = { - ['enable'] = true, - ['growthDirection'] = 'VERTICAL', - ['sortDirection'] = 'ASCENDING', - ['size'] = 40, - ['spacing'] = 4, - } -}; - -P.chat.editboxhistory = 5 -P.auras.perRow = 19 + local table = E.Options.args.datatexts.args.panels.args + local i = 0 + for pointLoc, tab in pairs(P.datatexts.panels) do + i = i + 1 + if not _G[pointLoc] then table[pointLoc] = nil; return; end + if type(tab) == 'table' then + table[pointLoc] = { + type = 'group', + args = {}, + name = L[pointLoc] or pointLoc, + guiInline = true, + order = i + -10, + } + for option, value in pairs(tab) do + table[pointLoc].args[option] = { + type = 'select', + name = L[option] or option:upper(), + values = datatexts, + get = function(info) return E.db.datatexts.panels[pointLoc][ info[#info] ] end, + set = function(info, value) E.db.datatexts.panels[pointLoc][ info[#info] ] = value; DT:LoadDataTexts() end, + } + end + elseif type(tab) == 'string' then + table[pointLoc] = { + type = 'select', + name = L[pointLoc] or pointLoc, + values = datatexts, + get = function(info) return E.db.datatexts.panels[pointLoc] end, + set = function(info, value) E.db.datatexts.panels[pointLoc] = value; DT:LoadDataTexts() end, + } + end + end +end ---Datatexts -if IsAddOnLoaded("ElvUI_LocPlus") then -P['datatexts'] = { - ['font'] = 'ElvUI Font', - ['fontSize'] = 12, - ['fontOutline'] = 'NONE', - - ['panels'] = { - ['LeftChatDataPanel'] = { - ['left'] = 'Armor', - ['middle'] = 'Durability', - ['right'] = 'Avoidance', - }, - ['RightChatDataPanel'] = { - ['left'] = 'System', - ['middle'] = 'Time', - ['right'] = 'Gold', - }, - ['DP_1'] = { - ['left'] = 'Swatter', - ['middle'] = 'Skada', - ['right'] = 'MrtWoo', - }, - ['DP_2'] = { - ['left'] = 'Altoholic', - ['middle'] = 'TellMeWhen', - ['right'] = 'AtlasLoot', - }, - ['DP_3'] = { - ['left'] = 'Notes', - ['middle'] = 'DBM-LDB', - ['right'] = 'WIM', - }, - ['DP_4'] = { - ['left'] = '', - ['middle'] = '', - ['right'] = '', +--Datatext panels +E.Options.args.sle.args.datatext = { + type = "group", + name = L["Datatext Panels"], + order = 6, + childGroups = "select", + args = { + header = { + order = 1, + type = "header", + name = L["Additional Datatext Panels"], + }, + intro = { + order = 2, + type = "description", + name = L["DP_DESC"] + }, + Reset = { + order = 3, + type = 'execute', + name = L['Restore Defaults'], + desc = L["Reset these options to defaults"], + func = function() E:GetModule('SLE'):Reset(nil, nil, true) end, + }, + spacer = { + order = 4, + type = 'description', + name = "", + }, + dashboard = { + order = 5, + type = "toggle", + name = L["Dashboard"], + desc = L["Show/Hide dashboard."], + get = function(info) return E.db.sle.datatext.dashboard.enable end, + set = function(info, value) E.db.sle.datatext.dashboard.enable = value; DTP:DashboardShow() end + }, + width = { + order = 6, + type = "range", + name = L["Dashboard Panels Width"], + desc = L["Sets size of dashboard panels."], + disabled = function() return not E.db.sle.datatext.dashboard.enable end, + min = 75, max = 200, step = 1, + get = function(info) return E.db.sle.datatext.dashboard.width end, + set = function(info, value) E.db.sle.datatext.dashboard.width = value; DTP:DashWidth() end, }, - ['DP_5'] = { - ['left'] = 'Bags', - ['middle'] = 'Gold', - ['right'] = 'Armor', - }, - ['DP_6'] = { - ['left'] = 'Spell/Heal Power', - ['middle'] = 'Haste', - ['right'] = 'Crit Chance', - }, - ['Bottom_Panel'] = 'System', - ['LeftMiniPanel'] = 'Guild', - ['RightMiniPanel'] = 'Friends', - ['RightCoordDtPanel'] = 'System', --LocPlus - ['LeftCoordDtPanel'] = 'Durability', --LocPlus }, - ['localtime'] = true, - ['time24'] = false, - ['battleground'] = true, - ['minimapPanels'] = true, - ['leftChatPanel'] = true, - ['rightChatPanel'] = true, } -else -P['datatexts'] = { - ['font'] = 'ElvUI Font', - ['fontSize'] = 12, - ['fontOutline'] = 'NONE', - - ['panels'] = { - ['LeftChatDataPanel'] = { - ['left'] = 'Armor', - ['middle'] = 'Durability', - ['right'] = 'Avoidance', - }, - ['RightChatDataPanel'] = { - ['left'] = 'System', - ['middle'] = 'Time', - ['right'] = 'Gold', - }, - ['DP_1'] = { - ['left'] = 'Swatter', - ['middle'] = 'Skada', - ['right'] = 'MrtWoo', - }, - ['DP_2'] = { - ['left'] = 'Altoholic', - ['middle'] = 'TellMeWhen', - ['right'] = 'AtlasLoot', - }, - ['DP_3'] = { - ['left'] = 'Notes', - ['middle'] = 'DBM-LDB', - ['right'] = 'WIM', - }, - ['DP_4'] = { - ['left'] = '', - ['middle'] = '', - ['right'] = '', - }, - ['DP_5'] = { - ['left'] = 'Bags', - ['middle'] = 'Gold', - ['right'] = 'Armor', - }, - ['DP_6'] = { - ['left'] = 'Spell/Heal Power', - ['middle'] = 'Haste', - ['right'] = 'Crit Chance', + +for k,v in pairs(drop) do +E.Options.args.sle.args.datatext.args[v[1]] = { + order = v[2], + type = "group", + name = L[k], + get = function(info) return E.db.sle.datatext[v[1]][ info[#info] ] end, + args = { + enabled = { + order = 1, + type = "toggle", + name = L["Enable"], + desc = L["Show/Hide this panel."], + set = function(info, value) E.db.sle.datatext[v[1]].enabled = value; DTP:ExtraDataBarSetup() end + }, + width = { + order = 2, + type = "range", + name = L['Width'], + desc = L["Sets size of this panel"], + disabled = function() return not E.db.sle.datatext[v[1]].enabled end, + min = 100 * v[3], max = E.screenwidth/2, step = 1, + set = function(info, value) E.db.sle.datatext[v[1]].width = value; DTP:Resize() end, + }, + hide = { + order = 3, + type = "toggle", + name = L['Hide panel background'], + desc = L["Don't show this panel, only datatexts assinged to it"], + disabled = function() return not E.db.sle.datatext[v[1]].enabled end, + get = function(info) return E.private.sle.datatext[v[1].."hide"] end, + set = function(info, value) E.private.sle.datatext[v[1].."hide"] = value; E:StaticPopup_Show("PRIVATE_RL") end, + }, + transparent = { + order = 4, + name = L['Panel Transparency'], + type = 'toggle', + disabled = function() return not E.db.sle.datatext[v[1]].enabled or E.private.sle.datatext[v[1].."hide"] end, + --get = function(info) return E.db.sle.datatext[v[1]]."transparent"] end, + set = function(info, value) E.db.sle.datatext[v[1]].transparent = value; DTP:ExtraDataBarSetup() end, }, - ['Bottom_Panel'] = 'System', - ['LeftMiniPanel'] = 'Guild', - ['RightMiniPanel'] = 'Friends', }, - ['localtime'] = true, - ['time24'] = false, - ['battleground'] = true, - ['minimapPanels'] = true, - ['leftChatPanel'] = true, - ['rightChatPanel'] = true, } end -P.unitframe.units.player.classbar.xOffset = 0 -P.unitframe.units.player.classbar.yOffset = 0 -P.unitframe.units.player.classbar.offset = false -P.unitframe.units.player.fixTo = "health" -P.unitframe.units.target.fixTo = "health" -P.unitframe.units.targettarget.fixTo = "health" -P.unitframe.units.focus.fixTo = "health" -P.unitframe.units.arena.fixTo = "health" -P.unitframe.units.boss.fixTo = "health" +for k,v in pairs(chatT) do +E.Options.args.sle.args.datatext.args[v[1]] = { + order = v[2], + type = "group", + name = L[k], + args = { + enabled = { + order = 1, + type = "toggle", + name = L["Enable"], + desc = L["Show/Hide this panel."], + get = function(info) return E.db.datatexts[v[3]] end, + set = function(info, value) + E.db.datatexts[v[3]] = value; + if E.db[v[4].."PanelFaded"] then + E.db[v[4].."PanelFaded"] = true; + Hide[v[4]]() + end + E:GetModule('Chat'):UpdateAnchors() + E:GetModule('Layout'):ToggleChatPanels() + E:GetModule('Bags'):PositionBagFrames() + end + }, + width = { + order = 2, + type = "range", + name = L['Width'], + desc = L["Sets size of this panel"], + disabled = function() return not E.db.datatexts[v[3]] end, + min = 150, max = E.screenwidth/2, step = 1, + get = function(info) return E.db.sle.datatext[v[1]].width end, + set = function(info, value) E.db.sle.datatext[v[1]].width = value; DTP:ChatResize() end, + }, + }, +} +end \ No newline at end of file