From b05d157a3c2e0de28831340182a9efe3523b6691 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 15:52:51 +0400 Subject: [PATCH 01/20] This is already in the SLE update function --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 8 -------- 1 file changed, 8 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index 22c6678..e9844aa 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -133,14 +133,6 @@ function BG:UpdateFrames() BG:UpdateTex() end ---Hook to updating during profile change -E.UpdateAllHUD = E.UpdateAll -function E:UpdateAll() - E.UpdateAllHUD(self) - - BG:UpdateFrames() -end - function BG:RegisterHide() if E.db.sle.backgrounds.bottom.pethide then E.FrameLocks['BottomBG'] = true -- 1.7.9.5 From cba02342f38e6d4249e190b54d6e690460a092ce Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 15:54:52 +0400 Subject: [PATCH 02/20] Why call 4 functions when 1 is enough --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index e9844aa..949e113 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -157,11 +157,8 @@ function BG:RegisterHide() end function BG:Initialize() - BG:FramesPositions() - BG:FramesSize() BG:FramesCreate() - BG:FramesVisibility() - BG:UpdateTex() + BG:UpdateFrames() BG:RegisterHide() end -- 1.7.9.5 From 44404ceb8554dd5c259f18896cf8674d9c172052 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 15:57:40 +0400 Subject: [PATCH 03/20] rename 1 --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index 949e113..2f92a84 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -1,7 +1,7 @@ local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore local BG = E:NewModule('BackGrounds', 'AceHook-3.0', 'AceEvent-3.0'); -local BGbottom = CreateFrame('Frame', "BottomBG", E.UIParent); +local BGb = CreateFrame('Frame', "BottomBG", E.UIParent); local BGleft = CreateFrame('Frame', "LeftBG", E.UIParent); local BGright = CreateFrame('Frame', "RightBG", E.UIParent); local BGaction = CreateFrame('Frame', "ActionBG", E.UIParent); @@ -9,15 +9,15 @@ local BGaction = CreateFrame('Frame', "ActionBG", E.UIParent); --Frames setup function BG:FramesCreate() --Bottom - BGbottom:CreateBackdrop(E.private.sle.backgrounds.bottom.template); - BGbottom.backdrop:SetAllPoints(); - BGbottom:SetFrameLevel(BGbottom:GetFrameLevel() - 1) - BGbottom:SetFrameStrata('BACKGROUND'); - BGbottom:EnableMouse(true) - BGbottom:SetScript("OnShow", function() BGbottom:SetFrameStrata('BACKGROUND') end) + BGb:CreateBackdrop(E.private.sle.backgrounds.bottom.template); + BGb.backdrop:SetAllPoints(); + BGb:SetFrameLevel(BGb:GetFrameLevel() - 1) + BGb:SetFrameStrata('BACKGROUND'); + BGb:EnableMouse(true) + BGb:SetScript("OnShow", function() BGb:SetFrameStrata('BACKGROUND') end) --Texture - BGbottom.tex = BGbottom:CreateTexture(nil, 'OVERLAY') - BGbottom.tex:SetAlpha(0.5) + BGb.tex = BGb:CreateTexture(nil, 'OVERLAY') + BGb.tex:SetAlpha(0.5) --Left BGleft:CreateBackdrop(E.private.sle.backgrounds.left.template); @@ -51,7 +51,7 @@ function BG:FramesCreate() BGaction.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5) --Hiding - BGbottom:Hide() + BGb:Hide() BGleft:Hide() BGright:Hide() BGaction:Hide() @@ -59,8 +59,8 @@ end --Frames Size function BG:FramesSize() - BGbottom:SetWidth(E.db.sle.backgrounds.bottom.width) - BGbottom:SetHeight(E.db.sle.backgrounds.bottom.height) + BGb:SetWidth(E.db.sle.backgrounds.bottom.width) + BGb:SetHeight(E.db.sle.backgrounds.bottom.height) BGleft:SetWidth(E.db.sle.backgrounds.left.width) BGleft:SetHeight(E.db.sle.backgrounds.left.height) @@ -74,7 +74,7 @@ end --Frames points function BG:FramesPositions() - BGbottom:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.bottom.xoffset, 21 + E.db.sle.backgrounds.bottom.yoffset); + BGb:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.bottom.xoffset, 21 + E.db.sle.backgrounds.bottom.yoffset); BGleft:Point("BOTTOMRIGHT", E.UIParent, "BOTTOM", -(E.screenwidth/4 + 32)/2 - 1 + E.db.sle.backgrounds.left.xoffset, 21 + E.db.sle.backgrounds.left.yoffset); BGright:Point("BOTTOMLEFT", E.UIParent, "BOTTOM", (E.screenwidth/4 + 32)/2 + 1 + E.db.sle.backgrounds.right.xoffset, 21 + E.db.sle.backgrounds.right.yoffset); BGaction:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.action.xoffset, E.screenheight/6 + 9 + E.db.sle.backgrounds.action.yoffset); @@ -82,9 +82,9 @@ end --Updating textures function BG:UpdateTex() - BGbottom.tex:Point('TOPLEFT', BGbottom, 'TOPLEFT', 2, -2) - BGbottom.tex:Point('BOTTOMRIGHT', BGbottom, 'BOTTOMRIGHT', -2, 2) - BGbottom.tex:SetTexture(E.db.sle.backgrounds.bottom.texture) + BGb.tex:Point('TOPLEFT', BGb, 'TOPLEFT', 2, -2) + BGb.tex:Point('BOTTOMRIGHT', BGb, 'BOTTOMRIGHT', -2, 2) + BGb.tex:SetTexture(E.db.sle.backgrounds.bottom.texture) BGright.tex:Point('TOPLEFT', BGright, 'TOPLEFT', 2, -2) BGright.tex:Point('BOTTOMRIGHT', BGright, 'BOTTOMRIGHT', -2, 2) @@ -102,9 +102,9 @@ end --Visibility / Enable check function BG:FramesVisibility() if E.db.sle.backgrounds.bottom.enabled then - BGbottom:Show() + BGb:Show() else - BGbottom:Hide() + BGb:Hide() end if E.db.sle.backgrounds.left.enabled then -- 1.7.9.5 From 3a513d0f2ecd26cf68396f287af052822e74a3ab Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 15:58:48 +0400 Subject: [PATCH 04/20] rename 2 --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index 2f92a84..9874833 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -2,7 +2,7 @@ local BG = E:NewModule('BackGrounds', 'AceHook-3.0', 'AceEvent-3.0'); local BGb = CreateFrame('Frame', "BottomBG", E.UIParent); -local BGleft = CreateFrame('Frame', "LeftBG", E.UIParent); +local BGl = CreateFrame('Frame', "LeftBG", E.UIParent); local BGright = CreateFrame('Frame', "RightBG", E.UIParent); local BGaction = CreateFrame('Frame', "ActionBG", E.UIParent); @@ -20,14 +20,14 @@ function BG:FramesCreate() BGb.tex:SetAlpha(0.5) --Left - BGleft:CreateBackdrop(E.private.sle.backgrounds.left.template); - BGleft.backdrop:SetAllPoints(); - BGleft:SetFrameLevel(BGleft:GetFrameLevel() - 1) - BGleft:SetFrameStrata('BACKGROUND'); - BGleft:SetScript("OnShow", function() BGleft:SetFrameStrata('BACKGROUND') end) + BGl:CreateBackdrop(E.private.sle.backgrounds.left.template); + BGl.backdrop:SetAllPoints(); + BGl:SetFrameLevel(BGl:GetFrameLevel() - 1) + BGl:SetFrameStrata('BACKGROUND'); + BGl:SetScript("OnShow", function() BGl:SetFrameStrata('BACKGROUND') end) --Texture - BGleft.tex = BGleft:CreateTexture(nil, 'OVERLAY') - BGleft.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5) + BGl.tex = BGl:CreateTexture(nil, 'OVERLAY') + BGl.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5) --Right BGright:CreateBackdrop(E.private.sle.backgrounds.right.template); @@ -52,7 +52,7 @@ function BG:FramesCreate() --Hiding BGb:Hide() - BGleft:Hide() + BGl:Hide() BGright:Hide() BGaction:Hide() end @@ -62,8 +62,8 @@ function BG:FramesSize() BGb:SetWidth(E.db.sle.backgrounds.bottom.width) BGb:SetHeight(E.db.sle.backgrounds.bottom.height) - BGleft:SetWidth(E.db.sle.backgrounds.left.width) - BGleft:SetHeight(E.db.sle.backgrounds.left.height) + BGl:SetWidth(E.db.sle.backgrounds.left.width) + BGl:SetHeight(E.db.sle.backgrounds.left.height) BGright:SetWidth(E.db.sle.backgrounds.right.width) BGright:SetHeight(E.db.sle.backgrounds.right.height) @@ -75,7 +75,7 @@ end --Frames points function BG:FramesPositions() BGb:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.bottom.xoffset, 21 + E.db.sle.backgrounds.bottom.yoffset); - BGleft:Point("BOTTOMRIGHT", E.UIParent, "BOTTOM", -(E.screenwidth/4 + 32)/2 - 1 + E.db.sle.backgrounds.left.xoffset, 21 + E.db.sle.backgrounds.left.yoffset); + BGl:Point("BOTTOMRIGHT", E.UIParent, "BOTTOM", -(E.screenwidth/4 + 32)/2 - 1 + E.db.sle.backgrounds.left.xoffset, 21 + E.db.sle.backgrounds.left.yoffset); BGright:Point("BOTTOMLEFT", E.UIParent, "BOTTOM", (E.screenwidth/4 + 32)/2 + 1 + E.db.sle.backgrounds.right.xoffset, 21 + E.db.sle.backgrounds.right.yoffset); BGaction:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.action.xoffset, E.screenheight/6 + 9 + E.db.sle.backgrounds.action.yoffset); end @@ -90,9 +90,9 @@ function BG:UpdateTex() BGright.tex:Point('BOTTOMRIGHT', BGright, 'BOTTOMRIGHT', -2, 2) BGright.tex:SetTexture(E.db.sle.backgrounds.right.texture) - BGleft.tex:Point('TOPLEFT', BGleft, 'TOPLEFT', 2, -2) - BGleft.tex:Point('BOTTOMRIGHT', BGleft, 'BOTTOMRIGHT', -2, 2) - BGleft.tex:SetTexture(E.db.sle.backgrounds.left.texture) + BGl.tex:Point('TOPLEFT', BGl, 'TOPLEFT', 2, -2) + BGl.tex:Point('BOTTOMRIGHT', BGl, 'BOTTOMRIGHT', -2, 2) + BGl.tex:SetTexture(E.db.sle.backgrounds.left.texture) BGaction.tex:Point('TOPLEFT', BGaction, 'TOPLEFT', 2, -2) BGaction.tex:Point('BOTTOMRIGHT', BGaction, 'BOTTOMRIGHT', -2, 2) @@ -108,9 +108,9 @@ function BG:FramesVisibility() end if E.db.sle.backgrounds.left.enabled then - BGleft:Show() + BGl:Show() else - BGleft:Hide() + BGl:Hide() end if E.db.sle.backgrounds.right.enabled then -- 1.7.9.5 From d7e81d4262a39a1a275bb2b19acc4c40f91d935e Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 15:59:18 +0400 Subject: [PATCH 05/20] rename 3 --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index 9874833..c54a210 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -3,7 +3,7 @@ local BG = E:NewModule('BackGrounds', 'AceHook-3.0', 'AceEvent-3.0'); local BGb = CreateFrame('Frame', "BottomBG", E.UIParent); local BGl = CreateFrame('Frame', "LeftBG", E.UIParent); -local BGright = CreateFrame('Frame', "RightBG", E.UIParent); +local BGr = CreateFrame('Frame', "RightBG", E.UIParent); local BGaction = CreateFrame('Frame', "ActionBG", E.UIParent); --Frames setup @@ -30,14 +30,14 @@ function BG:FramesCreate() BGl.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5) --Right - BGright:CreateBackdrop(E.private.sle.backgrounds.right.template); - BGright.backdrop:SetAllPoints(); - BGright:SetFrameLevel(BGright:GetFrameLevel() - 1) - BGright:SetFrameStrata('BACKGROUND'); - BGright:SetScript("OnShow", function() BGright:SetFrameStrata('BACKGROUND') end) + BGr:CreateBackdrop(E.private.sle.backgrounds.right.template); + BGr.backdrop:SetAllPoints(); + BGr:SetFrameLevel(BGr:GetFrameLevel() - 1) + BGr:SetFrameStrata('BACKGROUND'); + BGr:SetScript("OnShow", function() BGr:SetFrameStrata('BACKGROUND') end) --Texture - BGright.tex = BGright:CreateTexture(nil, 'OVERLAY') - BGright.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5) + BGr.tex = BGr:CreateTexture(nil, 'OVERLAY') + BGr.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5) --Action BGaction:CreateBackdrop(E.private.sle.backgrounds.action.template); @@ -53,7 +53,7 @@ function BG:FramesCreate() --Hiding BGb:Hide() BGl:Hide() - BGright:Hide() + BGr:Hide() BGaction:Hide() end @@ -65,8 +65,8 @@ function BG:FramesSize() BGl:SetWidth(E.db.sle.backgrounds.left.width) BGl:SetHeight(E.db.sle.backgrounds.left.height) - BGright:SetWidth(E.db.sle.backgrounds.right.width) - BGright:SetHeight(E.db.sle.backgrounds.right.height) + BGr:SetWidth(E.db.sle.backgrounds.right.width) + BGr:SetHeight(E.db.sle.backgrounds.right.height) BGaction:SetWidth(E.db.sle.backgrounds.action.width) BGaction:SetHeight(E.db.sle.backgrounds.action.height) @@ -76,7 +76,7 @@ end function BG:FramesPositions() BGb:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.bottom.xoffset, 21 + E.db.sle.backgrounds.bottom.yoffset); BGl:Point("BOTTOMRIGHT", E.UIParent, "BOTTOM", -(E.screenwidth/4 + 32)/2 - 1 + E.db.sle.backgrounds.left.xoffset, 21 + E.db.sle.backgrounds.left.yoffset); - BGright:Point("BOTTOMLEFT", E.UIParent, "BOTTOM", (E.screenwidth/4 + 32)/2 + 1 + E.db.sle.backgrounds.right.xoffset, 21 + E.db.sle.backgrounds.right.yoffset); + BGr:Point("BOTTOMLEFT", E.UIParent, "BOTTOM", (E.screenwidth/4 + 32)/2 + 1 + E.db.sle.backgrounds.right.xoffset, 21 + E.db.sle.backgrounds.right.yoffset); BGaction:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.action.xoffset, E.screenheight/6 + 9 + E.db.sle.backgrounds.action.yoffset); end @@ -86,9 +86,9 @@ function BG:UpdateTex() BGb.tex:Point('BOTTOMRIGHT', BGb, 'BOTTOMRIGHT', -2, 2) BGb.tex:SetTexture(E.db.sle.backgrounds.bottom.texture) - BGright.tex:Point('TOPLEFT', BGright, 'TOPLEFT', 2, -2) - BGright.tex:Point('BOTTOMRIGHT', BGright, 'BOTTOMRIGHT', -2, 2) - BGright.tex:SetTexture(E.db.sle.backgrounds.right.texture) + BGr.tex:Point('TOPLEFT', BGr, 'TOPLEFT', 2, -2) + BGr.tex:Point('BOTTOMRIGHT', BGr, 'BOTTOMRIGHT', -2, 2) + BGr.tex:SetTexture(E.db.sle.backgrounds.right.texture) BGl.tex:Point('TOPLEFT', BGl, 'TOPLEFT', 2, -2) BGl.tex:Point('BOTTOMRIGHT', BGl, 'BOTTOMRIGHT', -2, 2) @@ -114,9 +114,9 @@ function BG:FramesVisibility() end if E.db.sle.backgrounds.right.enabled then - BGright:Show() + BGr:Show() else - BGright:Hide() + BGr:Hide() end if E.db.sle.backgrounds.action.enabled then -- 1.7.9.5 From 9981cddcf2baad521477cc62e1dbc1618be926c8 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 16:00:03 +0400 Subject: [PATCH 06/20] rename 4 --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 36 ++++++++++++------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index c54a210..533b2a6 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -4,7 +4,7 @@ local BG = E:NewModule('BackGrounds', 'AceHook-3.0', 'AceEvent-3.0'); local BGb = CreateFrame('Frame', "BottomBG", E.UIParent); local BGl = CreateFrame('Frame', "LeftBG", E.UIParent); local BGr = CreateFrame('Frame', "RightBG", E.UIParent); -local BGaction = CreateFrame('Frame', "ActionBG", E.UIParent); +local BGa = CreateFrame('Frame', "ActionBG", E.UIParent); --Frames setup function BG:FramesCreate() @@ -40,21 +40,21 @@ function BG:FramesCreate() BGr.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5) --Action - BGaction:CreateBackdrop(E.private.sle.backgrounds.action.template); - BGaction.backdrop:SetAllPoints(); - BGaction:SetFrameLevel(BGaction:GetFrameLevel() - 1) - BGaction:SetFrameStrata('BACKGROUND'); - BGaction:EnableMouse(true) - BGaction:SetScript("OnShow", function() BGaction:SetFrameStrata('BACKGROUND') end) + BGa:CreateBackdrop(E.private.sle.backgrounds.action.template); + BGa.backdrop:SetAllPoints(); + BGa:SetFrameLevel(BGa:GetFrameLevel() - 1) + BGa:SetFrameStrata('BACKGROUND'); + BGa:EnableMouse(true) + BGa:SetScript("OnShow", function() BGa:SetFrameStrata('BACKGROUND') end) --Texture - BGaction.tex = BGaction:CreateTexture(nil, 'OVERLAY') - BGaction.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5) + BGa.tex = BGa:CreateTexture(nil, 'OVERLAY') + BGa.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5) --Hiding BGb:Hide() BGl:Hide() BGr:Hide() - BGaction:Hide() + BGa:Hide() end --Frames Size @@ -68,8 +68,8 @@ function BG:FramesSize() BGr:SetWidth(E.db.sle.backgrounds.right.width) BGr:SetHeight(E.db.sle.backgrounds.right.height) - BGaction:SetWidth(E.db.sle.backgrounds.action.width) - BGaction:SetHeight(E.db.sle.backgrounds.action.height) + BGa:SetWidth(E.db.sle.backgrounds.action.width) + BGa:SetHeight(E.db.sle.backgrounds.action.height) end --Frames points @@ -77,7 +77,7 @@ function BG:FramesPositions() BGb:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.bottom.xoffset, 21 + E.db.sle.backgrounds.bottom.yoffset); BGl:Point("BOTTOMRIGHT", E.UIParent, "BOTTOM", -(E.screenwidth/4 + 32)/2 - 1 + E.db.sle.backgrounds.left.xoffset, 21 + E.db.sle.backgrounds.left.yoffset); BGr:Point("BOTTOMLEFT", E.UIParent, "BOTTOM", (E.screenwidth/4 + 32)/2 + 1 + E.db.sle.backgrounds.right.xoffset, 21 + E.db.sle.backgrounds.right.yoffset); - BGaction:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.action.xoffset, E.screenheight/6 + 9 + E.db.sle.backgrounds.action.yoffset); + BGa:Point("BOTTOM", E.UIParent, "BOTTOM", 0 + E.db.sle.backgrounds.action.xoffset, E.screenheight/6 + 9 + E.db.sle.backgrounds.action.yoffset); end --Updating textures @@ -94,9 +94,9 @@ function BG:UpdateTex() BGl.tex:Point('BOTTOMRIGHT', BGl, 'BOTTOMRIGHT', -2, 2) BGl.tex:SetTexture(E.db.sle.backgrounds.left.texture) - BGaction.tex:Point('TOPLEFT', BGaction, 'TOPLEFT', 2, -2) - BGaction.tex:Point('BOTTOMRIGHT', BGaction, 'BOTTOMRIGHT', -2, 2) - BGaction.tex:SetTexture(E.db.sle.backgrounds.action.texture) + BGa.tex:Point('TOPLEFT', BGa, 'TOPLEFT', 2, -2) + BGa.tex:Point('BOTTOMRIGHT', BGa, 'BOTTOMRIGHT', -2, 2) + BGa.tex:SetTexture(E.db.sle.backgrounds.action.texture) end --Visibility / Enable check @@ -120,9 +120,9 @@ function BG:FramesVisibility() end if E.db.sle.backgrounds.action.enabled then - BGaction:Show() + BGa:Show() else - BGaction:Hide() + BGa:Hide() end end -- 1.7.9.5 From e99f38fc0b52e98f648fc317d73fd4c7a44f5446 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 16:11:53 +0400 Subject: [PATCH 07/20] Variables replacement for frames sizing --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index 533b2a6..00589f5 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -59,17 +59,18 @@ end --Frames Size function BG:FramesSize() - BGb:SetWidth(E.db.sle.backgrounds.bottom.width) - BGb:SetHeight(E.db.sle.backgrounds.bottom.height) + local db = E.db.sle.backgrounds + BGb:SetWidth(db.bottom.width) + BGb:SetHeight(db.bottom.height) - BGl:SetWidth(E.db.sle.backgrounds.left.width) - BGl:SetHeight(E.db.sle.backgrounds.left.height) + BGl:SetWidth(db.left.width) + BGl:SetHeight(db.left.height) - BGr:SetWidth(E.db.sle.backgrounds.right.width) - BGr:SetHeight(E.db.sle.backgrounds.right.height) + BGr:SetWidth(db.right.width) + BGr:SetHeight(db.right.height) - BGa:SetWidth(E.db.sle.backgrounds.action.width) - BGa:SetHeight(E.db.sle.backgrounds.action.height) + BGa:SetWidth(db.action.width) + BGa:SetHeight(db.action.height) end --Frames points -- 1.7.9.5 From ef51914033ad78997dee635fe1792c311423e9ee Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 18:00:53 +0400 Subject: [PATCH 08/20] Conversion of size option to use a table values instead of setting them every time --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index 00589f5..a921994 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -6,6 +6,13 @@ local BGl = CreateFrame('Frame', "LeftBG", E.UIParent); local BGr = CreateFrame('Frame', "RightBG", E.UIParent); local BGa = CreateFrame('Frame', "ActionBG", E.UIParent); +local Fr = { + b = {BGb,"bottom"}, + l = {BGl,"left"}, + r = {BGr,"right"}, + a = {BGa,"action"}, +} + --Frames setup function BG:FramesCreate() --Bottom @@ -60,17 +67,10 @@ end --Frames Size function BG:FramesSize() local db = E.db.sle.backgrounds - BGb:SetWidth(db.bottom.width) - BGb:SetHeight(db.bottom.height) - - BGl:SetWidth(db.left.width) - BGl:SetHeight(db.left.height) - - BGr:SetWidth(db.right.width) - BGr:SetHeight(db.right.height) - - BGa:SetWidth(db.action.width) - BGa:SetHeight(db.action.height) + for k,v in pairs(Fr) do + v[1]:SetWidth(db[v[2]].width) + v[1]:SetHeight(db[v[2]].height) + end end --Frames points -- 1.7.9.5 From a0eac395ddc8b5c42da1a578c134d579b2cd0280 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 18:01:23 +0400 Subject: [PATCH 09/20] Converting texture option as well --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index a921994..aaf4269 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -83,21 +83,12 @@ end --Updating textures function BG:UpdateTex() - BGb.tex:Point('TOPLEFT', BGb, 'TOPLEFT', 2, -2) - BGb.tex:Point('BOTTOMRIGHT', BGb, 'BOTTOMRIGHT', -2, 2) - BGb.tex:SetTexture(E.db.sle.backgrounds.bottom.texture) - - BGr.tex:Point('TOPLEFT', BGr, 'TOPLEFT', 2, -2) - BGr.tex:Point('BOTTOMRIGHT', BGr, 'BOTTOMRIGHT', -2, 2) - BGr.tex:SetTexture(E.db.sle.backgrounds.right.texture) - - BGl.tex:Point('TOPLEFT', BGl, 'TOPLEFT', 2, -2) - BGl.tex:Point('BOTTOMRIGHT', BGl, 'BOTTOMRIGHT', -2, 2) - BGl.tex:SetTexture(E.db.sle.backgrounds.left.texture) - - BGa.tex:Point('TOPLEFT', BGa, 'TOPLEFT', 2, -2) - BGa.tex:Point('BOTTOMRIGHT', BGa, 'BOTTOMRIGHT', -2, 2) - BGa.tex:SetTexture(E.db.sle.backgrounds.action.texture) + local db = E.db.sle.backgrounds + for k,v in pairs(Fr) do + v[1].tex:Point('TOPLEFT', v[1], 'TOPLEFT', 2, -2) + v[1].tex:Point('BOTTOMRIGHT', v[1], 'BOTTOMRIGHT', -2, 2) + v[1].tex:SetTexture(db[v[2]].texture) + end end --Visibility / Enable check -- 1.7.9.5 From ece557036a9e90b15926a16552e4f6f3a3d19d21 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 18:02:36 +0400 Subject: [PATCH 10/20] 1 line instead of 2 --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index aaf4269..6c02635 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -68,8 +68,7 @@ end function BG:FramesSize() local db = E.db.sle.backgrounds for k,v in pairs(Fr) do - v[1]:SetWidth(db[v[2]].width) - v[1]:SetHeight(db[v[2]].height) + v[1]:SetSize(db[v[2]].width, db[v[2]].height) end end -- 1.7.9.5 From 2d25ee99623ac7816f3a6c7054a96ff29d695797 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 18:05:35 +0400 Subject: [PATCH 11/20] Show/hide conversion --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 29 ++++++------------------- 1 file changed, 7 insertions(+), 22 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index 6c02635..420ad18 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -92,28 +92,13 @@ end --Visibility / Enable check function BG:FramesVisibility() - if E.db.sle.backgrounds.bottom.enabled then - BGb:Show() - else - BGb:Hide() - end - - if E.db.sle.backgrounds.left.enabled then - BGl:Show() - else - BGl:Hide() - end - - if E.db.sle.backgrounds.right.enabled then - BGr:Show() - else - BGr:Hide() - end - - if E.db.sle.backgrounds.action.enabled then - BGa:Show() - else - BGa:Hide() + local db = E.db.sle.backgrounds + for k,v in pairs(Fr) do + if db[v[2]].enabled then + v[1]:Show() + else + v[1]:Hide() + end end end -- 1.7.9.5 From 5499aff764e73676abe7bbc22edffd487549c7bb Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 18:08:24 +0400 Subject: [PATCH 12/20] Well, we don't use k there anyway --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index 420ad18..c154790 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -67,7 +67,7 @@ end --Frames Size function BG:FramesSize() local db = E.db.sle.backgrounds - for k,v in pairs(Fr) do + for _,v in pairs(Fr) do v[1]:SetSize(db[v[2]].width, db[v[2]].height) end end @@ -83,7 +83,7 @@ end --Updating textures function BG:UpdateTex() local db = E.db.sle.backgrounds - for k,v in pairs(Fr) do + for _,v in pairs(Fr) do v[1].tex:Point('TOPLEFT', v[1], 'TOPLEFT', 2, -2) v[1].tex:Point('BOTTOMRIGHT', v[1], 'BOTTOMRIGHT', -2, 2) v[1].tex:SetTexture(db[v[2]].texture) @@ -93,7 +93,7 @@ end --Visibility / Enable check function BG:FramesVisibility() local db = E.db.sle.backgrounds - for k,v in pairs(Fr) do + for _,v in pairs(Fr) do if db[v[2]].enabled then v[1]:Show() else -- 1.7.9.5 From 54a9a1aa939346d260eacc431895f7d7735448ed Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 18:23:52 +0400 Subject: [PATCH 13/20] BGs creation convert --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 55 +++++++------------------ 1 file changed, 14 insertions(+), 41 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index c154790..f921824 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -15,53 +15,26 @@ local Fr = { --Frames setup function BG:FramesCreate() - --Bottom - BGb:CreateBackdrop(E.private.sle.backgrounds.bottom.template); - BGb.backdrop:SetAllPoints(); - BGb:SetFrameLevel(BGb:GetFrameLevel() - 1) - BGb:SetFrameStrata('BACKGROUND'); - BGb:EnableMouse(true) - BGb:SetScript("OnShow", function() BGb:SetFrameStrata('BACKGROUND') end) - --Texture - BGb.tex = BGb:CreateTexture(nil, 'OVERLAY') - BGb.tex:SetAlpha(0.5) - - --Left - BGl:CreateBackdrop(E.private.sle.backgrounds.left.template); - BGl.backdrop:SetAllPoints(); - BGl:SetFrameLevel(BGl:GetFrameLevel() - 1) - BGl:SetFrameStrata('BACKGROUND'); - BGl:SetScript("OnShow", function() BGl:SetFrameStrata('BACKGROUND') end) - --Texture - BGl.tex = BGl:CreateTexture(nil, 'OVERLAY') + local pr = E.private.sle.backgrounds + for _,v in pairs(Fr) do + v[1]:CreateBackdrop(pr[v[2]].template); + v[1].backdrop:SetAllPoints(); + v[1]:SetFrameLevel(v[1]:GetFrameLevel() - 1) + v[1]:SetScript("OnShow", function() v[1]:SetFrameStrata('BACKGROUND') end) + v[1].tex = v[1]:CreateTexture(nil, 'OVERLAY') + v[1]:Hide() + end + + BGb:EnableMouse(true) --Maybe add an option to actually allow change this click catching? + BGb.tex:SetAlpha(0.5) + --Also the problem. As long as bottom bg can be transparent it's no good in keeping fixed transparency for the texture. + --Maybe add an option to change this from using Elv's trnsparency to additional user-set one? BGl.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5) - --Right - BGr:CreateBackdrop(E.private.sle.backgrounds.right.template); - BGr.backdrop:SetAllPoints(); - BGr:SetFrameLevel(BGr:GetFrameLevel() - 1) - BGr:SetFrameStrata('BACKGROUND'); - BGr:SetScript("OnShow", function() BGr:SetFrameStrata('BACKGROUND') end) - --Texture - BGr.tex = BGr:CreateTexture(nil, 'OVERLAY') BGr.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5) - --Action - BGa:CreateBackdrop(E.private.sle.backgrounds.action.template); - BGa.backdrop:SetAllPoints(); - BGa:SetFrameLevel(BGa:GetFrameLevel() - 1) - BGa:SetFrameStrata('BACKGROUND'); BGa:EnableMouse(true) - BGa:SetScript("OnShow", function() BGa:SetFrameStrata('BACKGROUND') end) - --Texture - BGa.tex = BGa:CreateTexture(nil, 'OVERLAY') BGa.tex:SetAlpha(E.db.general.backdropfadecolor.a - 0.7 > 0 and E.db.general.backdropfadecolor.a - 0.7 or 0.5) - - --Hiding - BGb:Hide() - BGl:Hide() - BGr:Hide() - BGa:Hide() end --Frames Size -- 1.7.9.5 From 4e5670c560117daae531ecc8b5cc1693c15b6e2f Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 18:40:35 +0400 Subject: [PATCH 14/20] Hiding for pet battles convertion (see notes) This still needs to be tested, not fully sure this actually works. My tests say it works, will run more tests on clean install after i finish with all this stuff --- ElvUI_SLE/modules/backgrounds/backgrounds.lua | 34 ++++++++----------------- 1 file changed, 11 insertions(+), 23 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/backgrounds.lua b/ElvUI_SLE/modules/backgrounds/backgrounds.lua index f921824..b0ff229 100644 --- a/ElvUI_SLE/modules/backgrounds/backgrounds.lua +++ b/ElvUI_SLE/modules/backgrounds/backgrounds.lua @@ -7,10 +7,10 @@ local BGr = CreateFrame('Frame', "RightBG", E.UIParent); local BGa = CreateFrame('Frame', "ActionBG", E.UIParent); local Fr = { - b = {BGb,"bottom"}, - l = {BGl,"left"}, - r = {BGr,"right"}, - a = {BGa,"action"}, + BottomBG = {BGb,"bottom"}, + LeftBG = {BGl,"left"}, + RightBG = {BGr,"right"}, + ActionBG = {BGa,"action"}, } --Frames setup @@ -83,25 +83,13 @@ function BG:UpdateFrames() end function BG:RegisterHide() - if E.db.sle.backgrounds.bottom.pethide then - E.FrameLocks['BottomBG'] = true - else - E.FrameLocks['BottomBG'] = nil - end - if E.db.sle.backgrounds.left.pethide then - E.FrameLocks['LeftBG'] = true - else - E.FrameLocks['LeftBG'] = nil - end - if E.db.sle.backgrounds.right.pethide then - E.FrameLocks['RightBG'] = true - else - E.FrameLocks['RightBG'] = nil - end - if E.db.sle.backgrounds.action.pethide then - E.FrameLocks['ActionBG'] = true - else - E.FrameLocks['ActionBG'] = nil + local db = E.db.sle.backgrounds + for k,v in pairs(Fr) do + if db[v[2]].pethide then + E.FrameLocks[k] = true + else + E.FrameLocks[k] = nil + end end end -- 1.7.9.5 From 2732dfd2d9528b923413997bbfe7f7542e236430 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 18:56:18 +0400 Subject: [PATCH 15/20] Moving get values function out of every option to the group instead First try for bottom bg --- ElvUI_SLE/modules/backgrounds/options.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/options.lua b/ElvUI_SLE/modules/backgrounds/options.lua index cc21f01..9e5f0e4 100644 --- a/ElvUI_SLE/modules/backgrounds/options.lua +++ b/ElvUI_SLE/modules/backgrounds/options.lua @@ -62,6 +62,7 @@ E.Options.args.sle.args.backgrounds.args.bottom = { type = "group", name = L["Bottom BG"], order = 1, + get = function(info) return E.db.sle.backgrounds.bottom[ info[#info] ] end, disabled = function() return not E.db.sle.backgrounds.bottom.enabled end, args = { width = { --setting width (obviously) @@ -70,7 +71,6 @@ E.Options.args.sle.args.backgrounds.args.bottom = { name = L['Width'], desc = L["Sets width of the frame"], min = 200, max = E.screenwidth, step = 1, - get = function(info) return E.db.sle.backgrounds.bottom.width end, set = function(info, value) E.db.sle.backgrounds.bottom.width = value; BG:FramesSize() end, }, height = { @@ -79,7 +79,6 @@ E.Options.args.sle.args.backgrounds.args.bottom = { name = L['Height'], desc = L["Sets height of the frame"], min = 50, max = E.screenheight/2, step = 1, - get = function(info) return E.db.sle.backgrounds.bottom.height end, set = function(info, value) E.db.sle.backgrounds.bottom.height = value; BG:FramesSize() end, }, spacer = { --Empty slot for making sliders move to next line @@ -94,7 +93,6 @@ E.Options.args.sle.args.backgrounds.args.bottom = { name = L['X Offset'], desc = L["Sets X offset of the frame"], min = -E.screenwidth/2, max = E.screenwidth/2, step = 1, - get = function(info) return E.db.sle.backgrounds.bottom.xoffset end, set = function(info, value) E.db.sle.backgrounds.bottom.xoffset = value; BG:FramesPositions() end, }, yoffset = { @@ -103,7 +101,6 @@ E.Options.args.sle.args.backgrounds.args.bottom = { name = L['Y Offset'], desc = L["Sets Y offset of the frame"], min = -21, max = E.screenheight, step = 1, - get = function(info) return E.db.sle.backgrounds.bottom.yoffset end, set = function(info, value) E.db.sle.backgrounds.bottom.yoffset = value; BG:FramesPositions() end, }, --Setting custom texture for those who like it @@ -113,7 +110,6 @@ E.Options.args.sle.args.backgrounds.args.bottom = { width = 'full', name = L["Texture"], desc = L["Set the texture to use in this frame. Requirements are the same as the chat textures."], - get = function(info) return E.db.sle.backgrounds.bottom.texture end, set = function(info, value) E.db.sle.backgrounds.bottom.texture = value E:UpdateMedia() @@ -137,7 +133,6 @@ E.Options.args.sle.args.backgrounds.args.bottom = { type = "toggle", name = L["Hide in Pet Batlle"], desc = L["Show/Hide this frame during Pet Battles."], - get = function(info) return E.db.sle.backgrounds.bottom.pethide end, set = function(info, value) E.db.sle.backgrounds.bottom.pethide = value; BG:RegisterHide() end }, }, -- 1.7.9.5 From 43bdf6b0ab89879445a33b409fc3a866d99aaac5 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 18:59:19 +0400 Subject: [PATCH 16/20] Same for left --- ElvUI_SLE/modules/backgrounds/options.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/options.lua b/ElvUI_SLE/modules/backgrounds/options.lua index 9e5f0e4..88732c5 100644 --- a/ElvUI_SLE/modules/backgrounds/options.lua +++ b/ElvUI_SLE/modules/backgrounds/options.lua @@ -142,6 +142,7 @@ E.Options.args.sle.args.backgrounds.args.left = { order = 2, type = "group", name = L["Left BG"], + get = function(info) return E.db.sle.backgrounds.left[ info[#info] ] end, disabled = function() return not E.db.sle.backgrounds.left.enabled end, args = { width = { @@ -150,7 +151,6 @@ E.Options.args.sle.args.backgrounds.args.left = { name = L['Width'], desc = L["Sets width of the frame"], min = 150, max = E.screenwidth, step = 1, - get = function(info) return E.db.sle.backgrounds.left.width end, set = function(info, value) E.db.sle.backgrounds.left.width = value; BG:FramesSize() end, }, height = { @@ -159,7 +159,6 @@ E.Options.args.sle.args.backgrounds.args.left = { name = L['Height'], desc = L["Sets height of the frame"], min = 50, max = E.screenheight/2, step = 1, - get = function(info) return E.db.sle.backgrounds.left.height end, set = function(info, value) E.db.sle.backgrounds.left.height = value; BG:FramesSize() end, }, spacer = { @@ -173,7 +172,6 @@ E.Options.args.sle.args.backgrounds.args.left = { name = L['X Offset'], desc = L["Sets X offset of the frame"], min = -E.screenwidth/2, max = E.screenwidth/2, step = 1, - get = function(info) return E.db.sle.backgrounds.left.xoffset end, set = function(info, value) E.db.sle.backgrounds.left.xoffset = value; BG:FramesPositions() end, }, yoffset = { @@ -182,7 +180,6 @@ E.Options.args.sle.args.backgrounds.args.left = { name = L['Y Offset'], desc = L["Sets Y offset of the frame"], min = -21, max = E.screenheight, step = 1, - get = function(info) return E.db.sle.backgrounds.left.yoffset end, set = function(info, value) E.db.sle.backgrounds.left.yoffset = value; BG:FramesPositions() end, }, texture = { @@ -191,7 +188,6 @@ E.Options.args.sle.args.backgrounds.args.left = { width = 'full', name = L["Texture"], desc = L["Set the texture to use in this frame. Requirements are the same as the chat textures."], - get = function(info) return E.db.sle.backgrounds.left.texture end, set = function(info, value) E.db.sle.backgrounds.left.texture = value E:UpdateMedia() @@ -215,7 +211,6 @@ E.Options.args.sle.args.backgrounds.args.left = { type = "toggle", name = L["Hide in Pet Batlle"], desc = L["Show/Hide this frame during Pet Battles."], - get = function(info) return E.db.sle.backgrounds.left.pethide end, set = function(info, value) E.db.sle.backgrounds.left.pethide = value; BG:RegisterHide() end }, }, -- 1.7.9.5 From 41f128d7fe7244c1a66c42d6705243b02d4a7524 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 19:01:42 +0400 Subject: [PATCH 17/20] Same for right and action --- ElvUI_SLE/modules/backgrounds/options.lua | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/options.lua b/ElvUI_SLE/modules/backgrounds/options.lua index 88732c5..d88ba9f 100644 --- a/ElvUI_SLE/modules/backgrounds/options.lua +++ b/ElvUI_SLE/modules/backgrounds/options.lua @@ -220,6 +220,7 @@ E.Options.args.sle.args.backgrounds.args.right = { order = 2, type = "group", name = L["Right BG"], + get = function(info) return E.db.sle.backgrounds.right[ info[#info] ] end, disabled = function() return not E.db.sle.backgrounds.right.enabled end, args = { width = { @@ -228,7 +229,6 @@ E.Options.args.sle.args.backgrounds.args.right = { name = L['Width'], desc = L["Sets width of the frame"], min = 150, max = E.screenwidth, step = 1, - get = function(info) return E.db.sle.backgrounds.right.width end, set = function(info, value) E.db.sle.backgrounds.right.width = value; BG:FramesSize() end, }, height = { @@ -237,7 +237,6 @@ E.Options.args.sle.args.backgrounds.args.right = { name = L['Height'], desc = L["Sets height of the frame"], min = 50, max = E.screenheight/2, step = 1, - get = function(info) return E.db.sle.backgrounds.right.height end, set = function(info, value) E.db.sle.backgrounds.right.height = value; BG:FramesSize() end, }, spacer = { @@ -251,7 +250,6 @@ E.Options.args.sle.args.backgrounds.args.right = { name = L['X Offset'], desc = L["Sets X offset of the frame"], min = -E.screenwidth/2, max = E.screenwidth/2, step = 1, - get = function(info) return E.db.sle.backgrounds.right.xoffset end, set = function(info, value) E.db.sle.backgrounds.right.xoffset = value; BG:FramesPositions() end, }, yoffset = { @@ -260,7 +258,6 @@ E.Options.args.sle.args.backgrounds.args.right = { name = L['Y Offset'], desc = L["Sets Y offset of the frame"], min = -21, max = E.screenheight, step = 1, - get = function(info) return E.db.sle.backgrounds.right.yoffset end, set = function(info, value) E.db.sle.backgrounds.right.yoffset = value; BG:FramesPositions() end, }, texture = { @@ -269,7 +266,6 @@ E.Options.args.sle.args.backgrounds.args.right = { width = 'full', name = L["Texture"], desc = L["Set the texture to use in this frame. Requirements are the same as the chat textures."], - get = function(info) return E.db.sle.backgrounds.right.texture end, set = function(info, value) E.db.sle.backgrounds.right.texture = value E:UpdateMedia() @@ -293,7 +289,6 @@ E.Options.args.sle.args.backgrounds.args.right = { type = "toggle", name = L["Hide in Pet Batlle"], desc = L["Show/Hide this frame during Pet Battles."], - get = function(info) return E.db.sle.backgrounds.right.pethide end, set = function(info, value) E.db.sle.backgrounds.right.pethide = value; BG:RegisterHide() end }, }, @@ -303,6 +298,7 @@ E.Options.args.sle.args.backgrounds.args.action = { order = 4, type = "group", name = L["Actionbar BG"], + get = function(info) return E.db.sle.backgrounds.action[ info[#info] ] end, disabled = function() return not E.db.sle.backgrounds.action.enabled end, args = { width = { @@ -311,7 +307,6 @@ E.Options.args.sle.args.backgrounds.args.action = { name = L['Width'], desc = L["Sets width of the frame"], min = 200, max = E.screenwidth, step = 1, - get = function(info) return E.db.sle.backgrounds.action.width end, set = function(info, value) E.db.sle.backgrounds.action.width = value; BG:FramesSize() end, }, height = { @@ -320,7 +315,6 @@ E.Options.args.sle.args.backgrounds.args.action = { name = L['Height'], desc = L["Sets height of the frame"], min = 50, max = E.screenheight/2, step = 1, - get = function(info) return E.db.sle.backgrounds.action.height end, set = function(info, value) E.db.sle.backgrounds.action.height = value; BG:FramesSize() end, }, spacer = { @@ -334,7 +328,6 @@ E.Options.args.sle.args.backgrounds.args.action = { name = L['X Offset'], desc = L["Sets X offset of the frame"], min = -E.screenwidth/2, max = E.screenwidth/2, step = 1, - get = function(info) return E.db.sle.backgrounds.action.xoffset end, set = function(info, value) E.db.sle.backgrounds.action.xoffset = value; BG:FramesPositions() end, }, yoffset = { @@ -343,7 +336,6 @@ E.Options.args.sle.args.backgrounds.args.action = { name = L['Y Offset'], desc = L["Sets Y offset of the frame"], min = -21, max = E.screenheight, step = 1, - get = function(info) return E.db.sle.backgrounds.action.yoffset end, set = function(info, value) E.db.sle.backgrounds.action.yoffset = value; BG:FramesPositions() end, }, texture = { @@ -376,7 +368,6 @@ E.Options.args.sle.args.backgrounds.args.action = { type = "toggle", name = L["Hide in Pet Batlle"], desc = L["Show/Hide this frame during Pet Battles."], - get = function(info) return E.db.sle.backgrounds.action.pethide end, set = function(info, value) E.db.sle.backgrounds.action.pethide = value; BG:RegisterHide() end }, }, -- 1.7.9.5 From e4ae952e1b60b8180c7e17b5299a5d89f97a4cd8 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 19:05:37 +0400 Subject: [PATCH 18/20] re-register stuff on profile change just in case --- ElvUI_SLE/ElvUI_SLE.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/ElvUI_SLE/ElvUI_SLE.lua b/ElvUI_SLE/ElvUI_SLE.lua index 581b4e3..d835413 100644 --- a/ElvUI_SLE/ElvUI_SLE.lua +++ b/ElvUI_SLE/ElvUI_SLE.lua @@ -52,6 +52,7 @@ E.UpdateAllSLE = E.UpdateAll function E:UpdateAll() E.UpdateAllSLE(self) E:GetModule('BackGrounds'):UpdateFrames() + E:GetModule('BackGrounds'):RegisterHide() DTP:Update() DTP:DashboardShow() DTP:DashWidth() -- 1.7.9.5 From e7a3d1d5fadbece6322fca941597eadae4926d17 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 19:35:59 +0400 Subject: [PATCH 19/20] Making all 4 subgroups in less then 90 lines instead of ~330 --- ElvUI_SLE/modules/backgrounds/options.lua | 396 +++++++---------------------- 1 file changed, 85 insertions(+), 311 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/options.lua b/ElvUI_SLE/modules/backgrounds/options.lua index d88ba9f..c15e889 100644 --- a/ElvUI_SLE/modules/backgrounds/options.lua +++ b/ElvUI_SLE/modules/backgrounds/options.lua @@ -1,6 +1,14 @@ local E, L, V, P, G, _ = unpack(ElvUI); --Inport: Engine, Locales, PrivateDB, ProfileDB, GlobalDB, Localize Underscore local BG = E:GetModule('BackGrounds') +local drop = { + --Group name = {short name, order, minimum width} + ["Bottom BG"] = {"bottom", 1, 200}, + ["Left BG"] = {"left", 2, 150}, + ["Right BG"] = {"right", 3, 150}, + ["Actionbar BG"] = {"action", 4, 200}, +} + --Options for additional background frames. Main group E.Options.args.sle.args.backgrounds = { type = "group", @@ -57,319 +65,85 @@ E.Options.args.sle.args.backgrounds = { }, } } ---Subgroup for 1st frame. They are based on the same pattern -E.Options.args.sle.args.backgrounds.args.bottom = { - type = "group", - name = L["Bottom BG"], - order = 1, - get = function(info) return E.db.sle.backgrounds.bottom[ info[#info] ] end, - disabled = function() return not E.db.sle.backgrounds.bottom.enabled end, - args = { - width = { --setting width (obviously) - order = 3, - type = "range", - name = L['Width'], - desc = L["Sets width of the frame"], - min = 200, max = E.screenwidth, step = 1, - set = function(info, value) E.db.sle.backgrounds.bottom.width = value; BG:FramesSize() end, - }, - height = { - order = 4, - type = "range", - name = L['Height'], - desc = L["Sets height of the frame"], - min = 50, max = E.screenheight/2, step = 1, - set = function(info, value) E.db.sle.backgrounds.bottom.height = value; BG:FramesSize() end, - }, - spacer = { --Empty slot for making sliders move to next line - order = 5, - type = "description", - name = "", - }, - --Main means of moving frames. To create actual mover for them is veeeeeeeeeeery crapy idea. - xoffset = { - order = 6, - type = "range", - name = L['X Offset'], - desc = L["Sets X offset of the frame"], - min = -E.screenwidth/2, max = E.screenwidth/2, step = 1, - set = function(info, value) E.db.sle.backgrounds.bottom.xoffset = value; BG:FramesPositions() end, - }, - yoffset = { - order = 7, - type = "range", - name = L['Y Offset'], - desc = L["Sets Y offset of the frame"], - min = -21, max = E.screenheight, step = 1, - set = function(info, value) E.db.sle.backgrounds.bottom.yoffset = value; BG:FramesPositions() end, - }, - --Setting custom texture for those who like it - texture = { - order = 8, - type = 'input', - width = 'full', - name = L["Texture"], - desc = L["Set the texture to use in this frame. Requirements are the same as the chat textures."], - set = function(info, value) - E.db.sle.backgrounds.bottom.texture = value - E:UpdateMedia() - BG:UpdateTex() - end, - }, - template = { - order = 9, - type = "select", - name = L["Backdrop Template"], - desc = L["Change the template used for this backdrop."], - get = function(info) return E.private.sle.backgrounds.bottom.template end, - set = function(info, value) E.private.sle.backgrounds.bottom.template = value; E:StaticPopup_Show("PRIVATE_RL") end, - values = { - ['Default'] = L["Default"], - ['Transparent'] = L["Transparent"], + +--Subgroups +for k,v in pairs(drop) do + E.Options.args.sle.args.backgrounds.args[v[1]] = { + type = "group", + name = L[k], + order = v[2], + get = function(info) return E.db.sle.backgrounds[v[1]][ info[#info] ] end, + disabled = function() return not E.db.sle.backgrounds[v[1]].enabled end, + args = { + width = { --setting width (obviously) + order = 3, + type = "range", + name = L['Width'], + desc = L["Sets width of the frame"], + min = v[3], max = E.screenwidth, step = 1, + set = function(info, value) E.db.sle.backgrounds[v[1]].width = value; BG:FramesSize() end, }, - }, - pethide = { - order = 10, - type = "toggle", - name = L["Hide in Pet Batlle"], - desc = L["Show/Hide this frame during Pet Battles."], - set = function(info, value) E.db.sle.backgrounds.bottom.pethide = value; BG:RegisterHide() end - }, - }, -} ---Subgroup for 2nd frame -E.Options.args.sle.args.backgrounds.args.left = { - order = 2, - type = "group", - name = L["Left BG"], - get = function(info) return E.db.sle.backgrounds.left[ info[#info] ] end, - disabled = function() return not E.db.sle.backgrounds.left.enabled end, - args = { - width = { - order = 3, - type = "range", - name = L['Width'], - desc = L["Sets width of the frame"], - min = 150, max = E.screenwidth, step = 1, - set = function(info, value) E.db.sle.backgrounds.left.width = value; BG:FramesSize() end, - }, - height = { - order = 4, - type = "range", - name = L['Height'], - desc = L["Sets height of the frame"], - min = 50, max = E.screenheight/2, step = 1, - set = function(info, value) E.db.sle.backgrounds.left.height = value; BG:FramesSize() end, - }, - spacer = { - order = 5, - type = "description", - name = "", - }, - xoffset = { - order = 6, - type = "range", - name = L['X Offset'], - desc = L["Sets X offset of the frame"], - min = -E.screenwidth/2, max = E.screenwidth/2, step = 1, - set = function(info, value) E.db.sle.backgrounds.left.xoffset = value; BG:FramesPositions() end, - }, - yoffset = { - order = 7, - type = "range", - name = L['Y Offset'], - desc = L["Sets Y offset of the frame"], - min = -21, max = E.screenheight, step = 1, - set = function(info, value) E.db.sle.backgrounds.left.yoffset = value; BG:FramesPositions() end, - }, - texture = { - order = 8, - type = 'input', - width = 'full', - name = L["Texture"], - desc = L["Set the texture to use in this frame. Requirements are the same as the chat textures."], - set = function(info, value) - E.db.sle.backgrounds.left.texture = value - E:UpdateMedia() - BG:UpdateTex() - end, - }, - template = { - order = 9, - type = "select", - name = L["Backdrop Template"], - desc = L["Change the template used for this backdrop."], - get = function(info) return E.private.sle.backgrounds.left.template end, - set = function(info, value) E.private.sle.backgrounds.left.template = value; E:StaticPopup_Show("PRIVATE_RL") end, - values = { - ['Default'] = L["Default"], - ['Transparent'] = L["Transparent"], + height = { + order = 4, + type = "range", + name = L['Height'], + desc = L["Sets height of the frame"], + min = 50, max = E.screenheight/2, step = 1, + set = function(info, value) E.db.sle.backgrounds[v[1]].height = value; BG:FramesSize() end, }, - }, - pethide = { - order = 10, - type = "toggle", - name = L["Hide in Pet Batlle"], - desc = L["Show/Hide this frame during Pet Battles."], - set = function(info, value) E.db.sle.backgrounds.left.pethide = value; BG:RegisterHide() end - }, - }, -} ---Subgroup for 3rd frame -E.Options.args.sle.args.backgrounds.args.right = { - order = 2, - type = "group", - name = L["Right BG"], - get = function(info) return E.db.sle.backgrounds.right[ info[#info] ] end, - disabled = function() return not E.db.sle.backgrounds.right.enabled end, - args = { - width = { - order = 3, - type = "range", - name = L['Width'], - desc = L["Sets width of the frame"], - min = 150, max = E.screenwidth, step = 1, - set = function(info, value) E.db.sle.backgrounds.right.width = value; BG:FramesSize() end, - }, - height = { - order = 4, - type = "range", - name = L['Height'], - desc = L["Sets height of the frame"], - min = 50, max = E.screenheight/2, step = 1, - set = function(info, value) E.db.sle.backgrounds.right.height = value; BG:FramesSize() end, - }, - spacer = { - order = 5, - type = "description", - name = "", - }, - xoffset = { - order = 6, - type = "range", - name = L['X Offset'], - desc = L["Sets X offset of the frame"], - min = -E.screenwidth/2, max = E.screenwidth/2, step = 1, - set = function(info, value) E.db.sle.backgrounds.right.xoffset = value; BG:FramesPositions() end, - }, - yoffset = { - order = 7, - type = "range", - name = L['Y Offset'], - desc = L["Sets Y offset of the frame"], - min = -21, max = E.screenheight, step = 1, - set = function(info, value) E.db.sle.backgrounds.right.yoffset = value; BG:FramesPositions() end, - }, - texture = { - order = 8, - type = 'input', - width = 'full', - name = L["Texture"], - desc = L["Set the texture to use in this frame. Requirements are the same as the chat textures."], - set = function(info, value) - E.db.sle.backgrounds.right.texture = value - E:UpdateMedia() - BG:UpdateTex() - end, - }, - template = { - order = 9, - type = "select", - name = L["Backdrop Template"], - desc = L["Change the template used for this backdrop."], - get = function(info) return E.private.sle.backgrounds.right.template end, - set = function(info, value) E.private.sle.backgrounds.right.template = value; E:StaticPopup_Show("PRIVATE_RL") end, - values = { - ['Default'] = L["Default"], - ['Transparent'] = L["Transparent"], + spacer = { --Empty slot for making sliders move to next line + order = 5, + type = "description", + name = "", }, - }, - pethide = { - order = 10, - type = "toggle", - name = L["Hide in Pet Batlle"], - desc = L["Show/Hide this frame during Pet Battles."], - set = function(info, value) E.db.sle.backgrounds.right.pethide = value; BG:RegisterHide() end - }, - }, -} ---Subgroup for 4th frame -E.Options.args.sle.args.backgrounds.args.action = { - order = 4, - type = "group", - name = L["Actionbar BG"], - get = function(info) return E.db.sle.backgrounds.action[ info[#info] ] end, - disabled = function() return not E.db.sle.backgrounds.action.enabled end, - args = { - width = { - order = 3, - type = "range", - name = L['Width'], - desc = L["Sets width of the frame"], - min = 200, max = E.screenwidth, step = 1, - set = function(info, value) E.db.sle.backgrounds.action.width = value; BG:FramesSize() end, - }, - height = { - order = 4, - type = "range", - name = L['Height'], - desc = L["Sets height of the frame"], - min = 50, max = E.screenheight/2, step = 1, - set = function(info, value) E.db.sle.backgrounds.action.height = value; BG:FramesSize() end, - }, - spacer = { - order = 5, - type = "description", - name = "", - }, - xoffset = { - order = 6, - type = "range", - name = L['X Offset'], - desc = L["Sets X offset of the frame"], - min = -E.screenwidth/2, max = E.screenwidth/2, step = 1, - set = function(info, value) E.db.sle.backgrounds.action.xoffset = value; BG:FramesPositions() end, - }, - yoffset = { - order = 7, - type = "range", - name = L['Y Offset'], - desc = L["Sets Y offset of the frame"], - min = -21, max = E.screenheight, step = 1, - set = function(info, value) E.db.sle.backgrounds.action.yoffset = value; BG:FramesPositions() end, - }, - texture = { - order = 8, - type = 'input', - width = 'full', - name = L["Texture"], - desc = L["Set the texture to use in this frame. Requirements are the same as the chat textures."], - get = function(info) return E.db.sle.backgrounds.action.texture end, - set = function(info, value) - E.db.sle.backgrounds.action.texture = value - E:UpdateMedia() - BG:UpdateTex() - end, - }, - template = { - order = 9, - type = "select", - name = L["Backdrop Template"], - desc = L["Change the template used for this backdrop."], - get = function(info) return E.private.sle.backgrounds.action.template end, - set = function(info, value) E.private.sle.backgrounds.action.template = value; E:StaticPopup_Show("PRIVATE_RL") end, - values = { - ['Default'] = L["Default"], - ['Transparent'] = L["Transparent"], + xoffset = { + order = 6, + type = "range", + name = L['X Offset'], + desc = L["Sets X offset of the frame"], + min = -E.screenwidth/2, max = E.screenwidth/2, step = 1, + set = function(info, value) E.db.sle.backgrounds[v[1]].xoffset = value; BG:FramesPositions() end, + }, + yoffset = { + order = 7, + type = "range", + name = L['Y Offset'], + desc = L["Sets Y offset of the frame"], + min = -21, max = E.screenheight, step = 1, + set = function(info, value) E.db.sle.backgrounds[v[1]].yoffset = value; BG:FramesPositions() end, + }, + --Setting custom texture for those who like it + texture = { + order = 8, + type = 'input', + width = 'full', + name = L["Texture"], + desc = L["Set the texture to use in this frame. Requirements are the same as the chat textures."], + set = function(info, value) + E.db.sle.backgrounds[v[1]].texture = value + E:UpdateMedia() + BG:UpdateTex() + end, + }, + template = { + order = 9, + type = "select", + name = L["Backdrop Template"], + desc = L["Change the template used for this backdrop."], + get = function(info) return E.private.sle.backgrounds[v[1]].template end, + set = function(info, value) E.private.sle.backgrounds[v[1]].template = value; E:StaticPopup_Show("PRIVATE_RL") end, + values = { + ['Default'] = L["Default"], + ['Transparent'] = L["Transparent"], + }, + }, + pethide = { + order = 10, + type = "toggle", + name = L["Hide in Pet Batlle"], + desc = L["Show/Hide this frame during Pet Battles."], + set = function(info, value) E.db.sle.backgrounds[v[1]].pethide = value; BG:RegisterHide() end }, }, - pethide = { - order = 10, - type = "toggle", - name = L["Hide in Pet Batlle"], - desc = L["Show/Hide this frame during Pet Battles."], - set = function(info, value) E.db.sle.backgrounds.action.pethide = value; BG:RegisterHide() end - }, - }, -} - + } +end -- 1.7.9.5 From 33f97dddfedece34ef06a60151003d0ca2e347a1 Mon Sep 17 00:00:00 2001 From: Darthpred Date: Fri, 9 Nov 2012 19:50:33 +0400 Subject: [PATCH 20/20] order sorting --- ElvUI_SLE/modules/backgrounds/options.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ElvUI_SLE/modules/backgrounds/options.lua b/ElvUI_SLE/modules/backgrounds/options.lua index c15e889..b818700 100644 --- a/ElvUI_SLE/modules/backgrounds/options.lua +++ b/ElvUI_SLE/modules/backgrounds/options.lua @@ -76,7 +76,7 @@ for k,v in pairs(drop) do disabled = function() return not E.db.sle.backgrounds[v[1]].enabled end, args = { width = { --setting width (obviously) - order = 3, + order = 1, type = "range", name = L['Width'], desc = L["Sets width of the frame"], @@ -84,7 +84,7 @@ for k,v in pairs(drop) do set = function(info, value) E.db.sle.backgrounds[v[1]].width = value; BG:FramesSize() end, }, height = { - order = 4, + order = 2, type = "range", name = L['Height'], desc = L["Sets height of the frame"], @@ -92,12 +92,12 @@ for k,v in pairs(drop) do set = function(info, value) E.db.sle.backgrounds[v[1]].height = value; BG:FramesSize() end, }, spacer = { --Empty slot for making sliders move to next line - order = 5, + order = 3, type = "description", name = "", }, xoffset = { - order = 6, + order = 4, type = "range", name = L['X Offset'], desc = L["Sets X offset of the frame"], @@ -105,7 +105,7 @@ for k,v in pairs(drop) do set = function(info, value) E.db.sle.backgrounds[v[1]].xoffset = value; BG:FramesPositions() end, }, yoffset = { - order = 7, + order = 5, type = "range", name = L['Y Offset'], desc = L["Sets Y offset of the frame"], @@ -114,7 +114,7 @@ for k,v in pairs(drop) do }, --Setting custom texture for those who like it texture = { - order = 8, + order = 6, type = 'input', width = 'full', name = L["Texture"], @@ -126,7 +126,7 @@ for k,v in pairs(drop) do end, }, template = { - order = 9, + order = 7, type = "select", name = L["Backdrop Template"], desc = L["Change the template used for this backdrop."], @@ -138,7 +138,7 @@ for k,v in pairs(drop) do }, }, pethide = { - order = 10, + order = 8, type = "toggle", name = L["Hide in Pet Batlle"], desc = L["Show/Hide this frame during Pet Battles."], -- 1.7.9.5