diff --git a/ElvUI_SLE/core/modules.lua b/ElvUI_SLE/core/modules.lua index 59784ed..55a2629 100644 --- a/ElvUI_SLE/core/modules.lua +++ b/ElvUI_SLE/core/modules.lua @@ -14,8 +14,7 @@ local modules = { ['SLE_AddonInstaller'] = {}, ['SLE_Bags'] = {'AceHook-3.0'}, ['SLE_Loot'] = {'AceHook-3.0', 'AceEvent-3.0'}, - ['SLE_RaidFlares'] = {'AceHook-3.0', 'AceEvent-3.0'}, - ['SLE_RaidMarks'] = {'AceHook-3.0', 'AceEvent-3.0'}, + ['SLE_RaidMarkers'] = {'AceEvent-3.0'}, ['SLE_SquareMinimapButtons'] = {'AceHook-3.0', 'AceEvent-3.0'}, ['SLE_Threat'] = {'AceHook-3.0', 'AceEvent-3.0'}, ['SLE_PvPMover'] = {'AceHook-3.0', 'AceEvent-3.0'}, diff --git a/ElvUI_SLE/core/toolkit.lua b/ElvUI_SLE/core/toolkit.lua index 0665fe9..a47c8d3 100644 --- a/ElvUI_SLE/core/toolkit.lua +++ b/ElvUI_SLE/core/toolkit.lua @@ -230,7 +230,7 @@ function SLE:Reset(group) E:ResetMovers(L["Dashboard"]) end if group == "marks" or group == "all" then - E:CopyTable(E.db.sle.marks, P.sle.marks) + E:CopyTable(E.db.sle.raidmarkers, P.sle.raidmarkers) E:ResetMovers("RM") end if group == "all" then diff --git a/ElvUI_SLE/defaults/private.lua b/ElvUI_SLE/defaults/private.lua index 1621d39..3b62f21 100644 --- a/ElvUI_SLE/defaults/private.lua +++ b/ElvUI_SLE/defaults/private.lua @@ -43,11 +43,6 @@ V['sle'] = { ['pvp'] = "NONE", ['setoverlay'] = false, }, - - ['marks'] = { - ['marks'] = false, - ['flares'] = false, - }, --Minimap Moduel ['minimap'] = { diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua index 586daf5..4e4941a 100644 --- a/ElvUI_SLE/defaults/profile.lua +++ b/ElvUI_SLE/defaults/profile.lua @@ -230,15 +230,6 @@ P['sle'] = { ['quest'] = false, }, - --Flares (Raid) - ['flares'] = { - ['growth'] = "RIGHT", - ['showinside'] = false, - ['size'] = 20, - ['tooltips'] = true, - ['mouseover'] = false, - }, - --LFR options ['lfrshow'] = { ['enabled'] = false, @@ -277,15 +268,6 @@ P['sle'] = { }, }, - --Marks (Raid) - ['marks'] = { - ['growth'] = "RIGHT", - ['showinside'] = false, - ['target'] = false, - ['size'] = 18, - ['mouseover'] = false, - }, - --Media ['media'] = { ['fonts'] = { @@ -403,6 +385,17 @@ P['sle'] = { --PvP Auto release ['pvpautorelease'] = true, + --Raid Markers + ['raidmarkers'] = { + ['enable'] = true, + ['visibility'] = 'DEFAULT', + ['backdrop'] = false, + ['buttonSize'] = 22, + ['spacing'] = 2, + ['orientation'] = 'HORIZONTAL', + ['modifier'] = 'shift-', + }, + --Threat ['threat'] = { ['enable'] = true, diff --git a/ElvUI_SLE/modules/load_modules.xml b/ElvUI_SLE/modules/load_modules.xml index 6a9be38..fe6f3a3 100644 --- a/ElvUI_SLE/modules/load_modules.xml +++ b/ElvUI_SLE/modules/load_modules.xml @@ -14,11 +14,11 @@ <Script file='exprepbar.lua'/> <Script file='farm.lua'/> <Script file='loot.lua'/> - <Include file='marks\load_marks.xml'/> <Include file='minimap\load_minimap.xml'/> <Script file='nameplates.lua'/> <Script file='raidutility.lua'/> <Script file='pvpmover.lua'/> + <Script file='raidmarkers.lua'/> <Script file='screensaver.lua'/> <Script file='threat.lua'/> <Script file='tooltip.lua'/> diff --git a/ElvUI_SLE/modules/marks/flares.lua b/ElvUI_SLE/modules/marks/flares.lua deleted file mode 100644 index 8c25c01..0000000 --- a/ElvUI_SLE/modules/marks/flares.lua +++ /dev/null @@ -1,212 +0,0 @@ -local E, L, V, P, G = unpack(ElvUI); -local RF = E:GetModule('SLE_RaidFlares'); -local template = "SecureActionButtonTemplate" - -BINDING_HEADER_SHADOWLIGHT_WORLDMARKER = "|cff1784d1Shadow & Light|r" -_G["BINDING_NAME_CLICK SquareFlareMarker:LeftButton"] = L["Square Flare"]; -_G["BINDING_NAME_CLICK TriangleFlareMarker:LeftButton"] = L["Triangle Flare"]; -_G["BINDING_NAME_CLICK DiamondFlareMarker:LeftButton"] = L["Diamond Flare"]; -_G["BINDING_NAME_CLICK CrossFlareMarker:LeftButton"] = L["Cross Flare"]; -_G["BINDING_NAME_CLICK StarFlareMarker:LeftButton"] = L["Star Flare"]; -_G["BINDING_NAME_CLICK CircleFlareMarker:LeftButton"] = L["Circle Flare"]; -_G["BINDING_NAME_CLICK MoonFlareMarker:LeftButton"] = L["Moon Flare"]; -_G["BINDING_NAME_CLICK SkullFlareMarker:LeftButton"] = L["Skull Flare"]; - -local mainFlares, f1, f2, f3, f4, f5, f6, f7, f8, f9, FlareB - -local function CreateFrames() - mainFlares = CreateFrame("Frame", "Main_Flares", E.UIParent) - mainFlares:Point("CENTER", E.UIParent, "CENTER", 0, 40); - mainFlares:SetFrameStrata('LOW'); - mainFlares:CreateBackdrop(); - mainFlares.backdrop:SetAllPoints(); - mainFlares:Hide(); - - f1 = CreateFrame("Button", "SquareFlareMarker", Main_Flares, template) - f2 = CreateFrame("Button", "TriangleFlareMarker", Main_Flares, template) - f3 = CreateFrame("Button", "DiamondFlareMarker", Main_Flares, template) - f4 = CreateFrame("Button", "CrossFlareMarker", Main_Flares, template) - f5 = CreateFrame("Button", "StarFlareMarker", Main_Flares, template) - f6 = CreateFrame("Button", "ClearFlaresMarker", Main_Flares, template) - f7 = CreateFrame("Button", "MoonFlareMarker", Main_Flares, template) - f8 = CreateFrame("Button", "SkullFlareMarker", Main_Flares, template) - f9 = CreateFrame("Button", "ClearFlaresMarker", Main_Flares, template) - - FlareB = {f1,f2,f3,f4,f5,f6,f7,f8,f9} -end - -local function SetupButton(button, flare) - if not mainFlares then return end - button:CreateBackdrop() - button.backdrop:SetAllPoints() - button:SetAttribute("type", "macro") - button:SetAttribute("macrotext", flare) - button:RegisterForClicks("AnyDown") - - button.tex = button:CreateTexture(nil, 'OVERLAY') - button.tex:Point('TOPLEFT', button, 'TOPLEFT', 2, -2) - button.tex:Point('BOTTOMRIGHT', button, 'BOTTOMRIGHT', -2, 2) - if button == f1 then - button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_6") - button:SetScript("OnEnter", function(self) if (E.db.sle.flares.tooltips==true) then GameTooltip:SetOwner(self, "ANCHOR_CURSOR"); GameTooltip:ClearLines(); GameTooltip:AddLine(L["Square World Marker"]); GameTooltip:Show() end end) - button:SetScript("OnLeave", function(self) GameTooltip:Hide() end) - elseif button == f2 then - button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_4") - button:SetScript("OnEnter", function(self) if (E.db.sle.flares.tooltips==true) then GameTooltip:SetOwner(self, "ANCHOR_CURSOR"); GameTooltip:ClearLines(); GameTooltip:AddLine(L["Triangle World Marker"]); GameTooltip:Show() end end) - button:SetScript("OnLeave", function(self) GameTooltip:Hide() end) - elseif button == f3 then - button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_3") - button:SetScript("OnEnter", function(self) if (E.db.sle.flares.tooltips==true) then GameTooltip:SetOwner(self, "ANCHOR_CURSOR"); GameTooltip:ClearLines(); GameTooltip:AddLine(L["Diamond World Marker"]); GameTooltip:Show() end end) - button:SetScript("OnLeave", function(self) GameTooltip:Hide() end) - elseif button == f4 then - button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_7") - button:SetScript("OnEnter", function(self) if (E.db.sle.flares.tooltips==true) then GameTooltip:SetOwner(self, "ANCHOR_CURSOR"); GameTooltip:ClearLines(); GameTooltip:AddLine(L["Cross World Marker"]); GameTooltip:Show() end end) - button:SetScript("OnLeave", function(self) GameTooltip:Hide() end) - elseif button == f5 then - button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_1") - button:SetScript("OnEnter", function(self) if (E.db.sle.flares.tooltips==true) then GameTooltip:SetOwner(self, "ANCHOR_CURSOR"); GameTooltip:ClearLines(); GameTooltip:AddLine(L["Star World Marker"]); GameTooltip:Show() end end) - button:SetScript("OnLeave", function(self) GameTooltip:Hide() end) - elseif button == f6 then - button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_2") - button:SetScript("OnEnter", function(self) if (E.db.sle.flares.tooltips==true) then GameTooltip:SetOwner(self, "ANCHOR_CURSOR"); GameTooltip:ClearLines(); GameTooltip:AddLine(L["Circle World Marker"]); GameTooltip:Show() end end) - button:SetScript("OnLeave", function(self) GameTooltip:Hide() end) - elseif button == f7 then - button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_5") - button:SetScript("OnEnter", function(self) if (E.db.sle.flares.tooltips==true) then GameTooltip:SetOwner(self, "ANCHOR_CURSOR"); GameTooltip:ClearLines(); GameTooltip:AddLine(L["Moon World Marker"]); GameTooltip:Show() end end) - button:SetScript("OnLeave", function(self) GameTooltip:Hide() end) - elseif button == f8 then - button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_8") - button:SetScript("OnEnter", function(self) if (E.db.sle.flares.tooltips==true) then GameTooltip:SetOwner(self, "ANCHOR_CURSOR"); GameTooltip:ClearLines(); GameTooltip:AddLine(L["Skull World Marker"]); GameTooltip:Show() end end) - button:SetScript("OnLeave", function(self) GameTooltip:Hide() end) - elseif button == f9 then - button.tex:SetTexture("Interface\\AddOns\\ElvUI_SLE\\media\\textures\\clearmarker.blp") - button:SetScript("OnEnter", function(self) if (E.db.sle.flares.tooltips==true) then GameTooltip:SetOwner(self, "ANCHOR_CURSOR"); GameTooltip:ClearLines(); GameTooltip:AddLine(L["Clear World Markers"]); GameTooltip:Show() end end) - button:SetScript("OnLeave", function(self) GameTooltip:Hide() end) - end -end - -local function CreateButtons() - if not mainFlares then return end - for i = 1, 9 do - if i ~= 9 then - SetupButton(FlareB[i], "/clearworldmarker".. i .."\n/worldmarker ".. i) - else - SetupButton(FlareB[i], "/clearworldmarker all") - end - end -end - -local function FrameButtonsSize() - if not mainFlares then return end - for i = 1, 9 do - FlareB[i]:Size(E.db.sle.flares.size) - end -end - -local function FrameButtonsGrowth() - if not mainFlares then return end - local db = E.db.sle.flares - local size = db.size - local width, height, x, y, anchor, point - local t = {9*size+9,size+4,"LEFT","RIGHT","TOP","BOTTOM",1,0,-1} - for i = 1, 9 do - FlareB[i]:ClearAllPoints() - end - - if db.growth == "RIGHT" then - width, height, anchor, point, _, _, x, y = unpack(t) - elseif db.growth == "LEFT" then - width, height, point, anchor, _, _, _, y, x = unpack(t) - elseif db.growth == "UP" then - height, width, _, _, point, anchor, y, x = unpack(t) - elseif db.growth == "DOWN" then - height, width, _, _, anchor, point, _, x, y = unpack(t) - end - - mainFlares:SetWidth(width) - mainFlares:SetHeight(height) - - for i = 1, 9 do - if i == 1 then - FlareB[i]:Point(anchor, Main_Flares, anchor, 2 * x, 2 * y) - else - FlareB[i]:Point(anchor, FlareB[i-1], point, x, y) - end - end -end - -local function Mouseover() - if not mainFlares then return end - local db = E.db.sle.flares - if db.mouseover then - mainFlares:SetScript("OnUpdate", function(self) - if MouseIsOver(self) then - UIFrameFadeIn(self, 0.2, self:GetAlpha(), 1) - else - UIFrameFadeOut(self, 0.2, self:GetAlpha(), 0) - end - end) - else - mainFlares:SetScript("OnUpdate", nil) - if mainFlares:IsShown() then - UIFrameFadeIn(mainFlares, 0.2, mainFlares:GetAlpha(), 1) - end - end -end - -local function UpdateVisibility() - if not mainFlares then return end - local inInstance, instanceType = IsInInstance() - local db = E.db.sle.flares - local show = false - - if (inInstance and instanceType ~= "pvp") and db.showinside then - show = true - elseif not inInstance and db.showinside then - show = false - elseif not db.showinside then - show = true - end - - if show then - E.FrameLocks['Main_Flares'] = true - mainFlares:Show() - for i = 1, 9 do - FlareB[i]:Show() - end - else - E.FrameLocks['Main_Flares'] = nil - mainFlares:Hide() - for i = 1, 9 do - FlareB[i]:Hide() - end - end - Mouseover() -end - -local function Backdrop() - if not mainFlares then return end - if E.db.sle.flares.backdrop then - mainFlares.backdrop:Show() - else - mainFlares.backdrop:Hide() - end -end - -function RF:Update() - if not mainFlares then return end - FrameButtonsSize() - FrameButtonsGrowth() - UpdateVisibility() - Backdrop() -end - -function RF:Initialize() - if not E.private.sle.marks.flares then return end - CreateFrames() - RF:Update() - CreateButtons() - self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateVisibility); - - E:CreateMover(mainFlares, "FlareMover", "RF", nil, nil, nil, "ALL,S&L,S&L MISC") -end \ No newline at end of file diff --git a/ElvUI_SLE/modules/marks/load_marks.xml b/ElvUI_SLE/modules/marks/load_marks.xml deleted file mode 100644 index 289c801..0000000 --- a/ElvUI_SLE/modules/marks/load_marks.xml +++ /dev/null @@ -1,4 +0,0 @@ -<Ui xmlns="http://www.blizzard.com/wow/ui/"> - <Script file='flares.lua'/> - <Script file='marks.lua'/> -</Ui> \ No newline at end of file diff --git a/ElvUI_SLE/modules/marks/marks.lua b/ElvUI_SLE/modules/marks/marks.lua deleted file mode 100644 index 3664b2b..0000000 --- a/ElvUI_SLE/modules/marks/marks.lua +++ /dev/null @@ -1,190 +0,0 @@ -local E, L, V, P, G = unpack(ElvUI); -local RM = E:GetModule('SLE_RaidMarks') -local Mtemplate = "SecureActionButtonTemplate" -local IsInInstance = IsInInstance -local UnitExists = UnitExists -local mark_menu, m1, m2, m3, m4, m5, m6, m7, m8, MarkB -local UIFrameFadeIn = UIFrameFadeIn -local UIFrameFadeOut = UIFrameFadeOut - ---Main frame -local function CreateFrames() - mark_menu = CreateFrame("Frame", "Mark_Menu", E.UIParent) - mark_menu:Point("BOTTOMRIGHT", RightChatTab, "TOPRIGHT", 2, 3) --Default positon - mark_menu:SetFrameStrata('LOW'); - mark_menu:CreateBackdrop(); - mark_menu.backdrop:SetAllPoints(); - - m1 = CreateFrame("Button", "M1", Mark_Menu, Mtemplate) - m2 = CreateFrame("Button", "M2", Mark_Menu, Mtemplate) - m3 = CreateFrame("Button", "M3", Mark_Menu, Mtemplate) - m4 = CreateFrame("Button", "M4", Mark_Menu, Mtemplate) - m5 = CreateFrame("Button", "M5", Mark_Menu, Mtemplate) - m6 = CreateFrame("Button", "M6", Mark_Menu, Mtemplate) - m7 = CreateFrame("Button", "M7", Mark_Menu, Mtemplate) - m8 = CreateFrame("Button", "M8", Mark_Menu, Mtemplate) - - MarkB = {m1,m2,m3,m4,m5,m6,m7,m8} - - mark_menu:Hide() -end - -local function SetupButton(button, mark) - button:CreateBackdrop() - button.backdrop:SetAllPoints() - button:SetAttribute("type", "macro") - button:SetAttribute("macrotext", '/script SetRaidTargetIcon("target",'..mark..')') - - button.tex = button:CreateTexture(nil, 'OVERLAY') - button.tex:Point('TOPLEFT', button, 'TOPLEFT', 2, -2) - button.tex:Point('BOTTOMRIGHT', button, 'BOTTOMRIGHT', -2, 2) - button.tex:SetTexture("INTERFACE/TARGETINGFRAME/UI-RaidTargetingIcon_"..mark) -end - ---Buttons creation -local function CreateButtons() - if not mark_menu then return end - for i = 1, 8 do - SetupButton(MarkB[i], 9 - i) - end -end - ---Setting/updating buttons' size -local function FrameButtonsSize() - if not mark_menu then return end - for i = 1, 8 do - MarkB[i]:Size(E.db.sle.marks.size) - end -end - ---Setting growth direction for buttons -local function FrameButtonsGrowth() - if not mark_menu then return end - local db = E.db.sle.marks - local size = db.size - local width, height, x, y, anchor, point - local t = {8*size+11,size+4,"LEFT","RIGHT","TOP","BOTTOM",1,0,-1} - for i = 1, 8 do - MarkB[i]:ClearAllPoints() - end - - if db.growth == "RIGHT" then - width, height, anchor, point, _, _, x, y = unpack(t) - elseif db.growth == "LEFT" then - width, height, point, anchor, _, _, _, y, x = unpack(t) - elseif db.growth == "UP" then - height, width, _, _, point, anchor, y, x = unpack(t) - elseif db.growth == "DOWN" then - height, width, _, _, anchor, point, _, x, y = unpack(t) - end - - mark_menu:SetWidth(width) - mark_menu:SetHeight(height) - - for i = 1, 8 do - if i == 1 then - MarkB[i]:Point(anchor, Mark_Menu, anchor, 2 * x, 2 * y) - else - MarkB[i]:Point(anchor, MarkB[i-1], point, x, y) - end - end -end - -local function Mouseover() - if not mark_menu then return end - local db = E.db.sle.marks - if db.mouseover then - mark_menu:SetScript("OnUpdate", function(self) - if MouseIsOver(self) then - UIFrameFadeIn(self, 0.2, self:GetAlpha(), 1) - else - UIFrameFadeOut(self, 0.2, self:GetAlpha(), 0) - end - end) - else - mark_menu:SetScript("OnUpdate", nil) - if mark_menu:IsShown() then - UIFrameFadeIn(mark_menu, 0.2, mark_menu:GetAlpha(), 1) - end - end -end - ---Visibility/enable check -local function UpdateVisibility() - if not mark_menu then return end - local inInstance, instanceType = IsInInstance() - local db = E.db.sle.marks - local show = false - if (inInstance and instanceType ~= "pvp") and db.showinside then - if db.target and UnitExists("target") then - show = true - elseif db.target and not UnitExists("target") then - show = false - else - show = true - end - elseif not inInstance and db.showinside then - show = false - elseif not db.showinside then - if db.target and UnitExists("target") then - show = true - elseif db.target and not UnitExists("target") then - show = false - else - show = true - end - end - - if show then - E.FrameLocks['Mark_Menu'] = true - mark_menu:Show() - for i = 1, 8 do - MarkB[i]:Show() - end - else - E.FrameLocks['Mark_Menu'] = nil - mark_menu:Hide() - for i = 1, 8 do - MarkB[i]:Hide() - end - end - Mouseover() -end - -local function Target() - if not mark_menu then return end - local db = E.db.sle.marks - if db.target then - RM:RegisterEvent("PLAYER_TARGET_CHANGED", UpdateVisibility); - else - RM:UnregisterEvent("PLAYER_TARGET_CHANGED"); - end -end - -local function Backdrop() - if not mark_menu then return end - if E.db.sle.marks.backdrop then - mark_menu.backdrop:Show() - else - mark_menu.backdrop:Hide() - end -end - -function RM:Update() - if not mark_menu then return end - FrameButtonsSize() - FrameButtonsGrowth() - Target() - UpdateVisibility() - Backdrop() -end - -function RM:Initialize() - if not E.private.sle.marks.marks then return end - CreateFrames() - RM:Update() - CreateButtons() - self:RegisterEvent("PLAYER_ENTERING_WORLD", UpdateVisibility); - - E:CreateMover(mark_menu, "MarkMover", "RM", nil, nil, nil, "ALL,S&L,S&L MISC") -end \ No newline at end of file diff --git a/ElvUI_SLE/modules/raidmarkers.lua b/ElvUI_SLE/modules/raidmarkers.lua new file mode 100644 index 0000000..64d79ab --- /dev/null +++ b/ElvUI_SLE/modules/raidmarkers.lua @@ -0,0 +1,150 @@ +local E, L, V, P, G = unpack(ElvUI); +local RM = E:GetModule('SLE_RaidMarkers'); + +local layouts = { + [1] = {RT = 1, WM = 5}, -- Star + [2] = {RT = 2, WM = 6}, -- Circle + [3] = {RT = 3, WM = 3}, -- Diamond + [4] = {RT = 4, WM = 2}, -- Triangle + [5] = {RT = 5, WM = 7}, -- Moon + [6] = {RT = 6, WM = 1}, -- Square + [7] = {RT = 7, WM = 4}, -- Cross + [8] = {RT = 8, WM = 8}, -- Skull + [9] = {RT = 0, WM = 0}, -- clear target/worldmarker +} + +function RM:CreateButtons() + for k, layout in ipairs(layouts) do + local button = CreateFrame("Button", ("RaidMarkerBarButton%d"):format(k), self.frame, "SecureActionButtonTemplate") + button:SetHeight(self.db.buttonSize) + button:SetWidth(self.db.buttonSize) + button:SetTemplate('Transparent') + + local image = button:CreateTexture(nil, "ARTWORK") + image:SetAllPoints() + image:SetTexture(k == 9 and "Interface\\BUTTONS\\UI-GroupLoot-Pass-Up" or ("Interface\\TargetingFrame\\UI-RaidTargetingIcon_%d"):format(k)) + + local target, worldmarker = layout.RT, layout.WM + + if target then + button:SetAttribute("type1", "macro") + button:SetAttribute("macrotext1", ("/tm %d"):format(k)) + end + + button:RegisterForClicks("AnyDown") + self.frame.buttons[k] = button + end +end + +function RM:UpdateWorldMarkersAndTooltips() + for i = 1, 9 do + local target, worldmarker = layouts[i].RT, layouts[i].WM + local button = self.frame.buttons[i] + + if target and not worldmarker then + button:SetScript("OnEnter", function(self) + self:SetBackdropBorderColor(.7, .7, 0) + GameTooltip:SetOwner(self, "ANCHOR_BOTTOM") + GameTooltip:SetText(L["Raid Markers"]) + GameTooltip:AddLine(k == 9 and L["Click to clear the mark."] or L["Click to mark the target."], 1, 1, 1) + GameTooltip:Show() + end) + else + local modifier = self.db.modifier or "shift-" + button:SetAttribute(("%stype1"):format(modifier), "macro") + button.modifier = modifier + button:SetAttribute(("%smacrotext1"):format(modifier), worldmarker == 0 and "/cwm all" or ("/cwm %d\n/wm %d"):format(worldmarker, worldmarker)) + + button:SetScript("OnEnter", function(self) + self:SetBackdropBorderColor(.7, .7, 0) + GameTooltip:SetOwner(self, "ANCHOR_BOTTOM") + GameTooltip:SetText(L["Raid Markers"]) + GameTooltip:AddLine(k == 9 and ("%s\n%s"):format(L["Click to clear the mark."], (L["%sClick to remove all worldmarkers."]):format(button.modifier:upper())) + or ("%s\n%s"):format(L["Click to mark the target."], (L["%sClick to place a worldmarker."]):format(button.modifier:upper())), 1, 1, 1) + GameTooltip:Show() + end) + end + + button:SetScript("OnLeave", function(self) + self:SetBackdropBorderColor(0, 0, 0) + GameTooltip:Hide() + end) + end +end + +function RM:UpdateBar() + local height, width + + if self.db.orientation == "VERTICAL" then + width = self.db.buttonSize + 3 + height = (self.db.buttonSize * 9) + (self.db.spacing * 9) + else + width = (self.db.buttonSize * 9) + (self.db.spacing * 9) + height = self.db.buttonSize + 3 + end + + self.frame:SetWidth(width) + self.frame:SetHeight(height) + + for i = 9, 1, -1 do + local button = self.frame.buttons[i] + local prev = self.frame.buttons[i + 1] + button:ClearAllPoints() + + button:SetWidth(self.db.buttonSize) + button:SetHeight(self.db.buttonSize) + + if self.db.orientation == "VERTICAL" then + if i == 9 then + button:SetPoint("TOP", 0, -3) + else + button:SetPoint("TOP", prev, "BOTTOM", 0, -self.db.spacing) + end + else + if i == 9 then + button:SetPoint("LEFT", 3, 0) + else + button:SetPoint("LEFT", prev, "RIGHT", self.db.spacing, 0) + end + end + end + + if self.db.enable then self.frame:Show() else self.frame:Hide() end +end + +function RM:ToggleSettings() + if self.db.enable then + RegisterStateDriver(self.frame, "visibility", self.db.visibility == 'DEFAULT' and '[noexists, nogroup] hide; show' or '[group] show; hide') + else + UnregisterStateDriver(self.frame, "visibility") + self.frame:Hide() + end + if self.db.backdrop then + self.frame.backdrop:Show() + else + self.frame.backdrop:Hide() + end + + self:UpdateBar() + self:UpdateWorldMarkersAndTooltips() +end + +function RM:Initialize() + self.db = E.db.sle.raidmarkers + + self.frame = CreateFrame("Frame", "RaidMarkerBar", E.UIParent, "SecureHandlerStateTemplate") + self.frame:SetResizable(false) + self.frame:SetClampedToScreen(true) + self.frame:SetFrameStrata('LOW') + self.frame:CreateBackdrop('Transparent') + self.frame:ClearAllPoints() + self.frame:Point("BOTTOMRIGHT", RightChatPanel, "TOPRIGHT", -1, 3) + self.frame.buttons = {} + + self.frame.backdrop:SetAllPoints() + + E:CreateMover(self.frame, "RaidMarkerBarAnchor", L['Raid Marker Bar']) + + self:CreateButtons() + self:ToggleSettings() +end \ No newline at end of file diff --git a/ElvUI_SLE/options/load_options.xml b/ElvUI_SLE/options/load_options.xml index 5230d99..3ed4be7 100644 --- a/ElvUI_SLE/options/load_options.xml +++ b/ElvUI_SLE/options/load_options.xml @@ -15,9 +15,9 @@ <Script file='farm_c.lua'/> <Script file='imports_c.lua'/> <Script file='loot_c.lua'/> - <Script file='marks_c.lua'/> <Script file='minimap_c.lua'/> <Script file='nameplates_c.lua'/> + <Script file='raidmarkers_c.lua'/> <Script file='raidutility_c.lua'/> <Script file='threat_c.lua'/> <Script file='tooltip_c.lua'/> diff --git a/ElvUI_SLE/options/marks_c.lua b/ElvUI_SLE/options/marks_c.lua deleted file mode 100644 index c156114..0000000 --- a/ElvUI_SLE/options/marks_c.lua +++ /dev/null @@ -1,187 +0,0 @@ -local E, L, V, P, G = unpack(ElvUI); -local RM = E:GetModule('SLE_RaidMarks') -local RF = E:GetModule('SLE_RaidFlares') - -local function configTable() - E.Options.args.sle.args.options.args.marks = { - order = 4, - type = "group", - name = L["Raid Marks"], - args = { - --[[intro = { - order = 1, - type = 'description', - name = L['Options for panels providing fast access to raid markers and flares.'], - },]] - marks = { - order = 2, - type = "group", - name = L["Raid Marks"], - set = function(info, value) E.db.sle.marks[ info[#info] ] = value; RM:Update() end, - args = { - marksheader = { - order = 1, - type = "header", - name = L["Raid Marks"], - }, - enabled = { - order = 2, - type = "toggle", - name = L["Enable"], - desc = L["Show/Hide raid marks."], - get = function(info) return E.private.sle.marks.marks end, - set = function(info, value) E.private.sle.marks.marks = value; E:StaticPopup_Show("PRIVATE_RL") end - }, - backdrop = { - order = 3, - type = "toggle", - name = L["Backdrop"], - disabled = function() return not E.private.sle.marks.marks end, - get = function(info) return E.db.sle.marks.backdrop end, - }, - Reset = { - order = 4, - type = 'execute', - name = L['Restore Defaults'], - desc = L["Reset these options to defaults"], - disabled = function() return not E.private.sle.marks.marks end, - func = function() E:GetModule('SLE'):Reset("marks") end, - }, - spacer = { - order = 5, - type = 'description', - name = "", - }, - showinside = { - order = 6, - type = "toggle", - name = L["Show only in instances"], - desc = L["Selecting this option will have the Raid Markers appear only while in a raid or dungeon."], - disabled = function() return not E.private.sle.marks.marks end, - get = function(info) return E.db.sle.marks.showinside end, - }, - target = { - order = 7, - type = "toggle", - name = L["Target Exists"], - desc = L["Selecting this option will have the Raid Markers appear only when you have a target."], - disabled = function() return not E.private.sle.marks.marks end, - get = function(info) return E.db.sle.marks.target end, - }, - mouseover = { - order = 7, - type = "toggle", - name = L["Mouse Over"], - desc = L["Show on mouse over."], - disabled = function() return not E.private.sle.marks.marks end, - get = function(info) return E.db.sle.marks.mouseover end, - }, - size = { - order = 9, - type = "range", - name = L['Size'], - desc = L["Sets size of buttons"], - disabled = function() return not E.private.sle.marks.marks end, - min = 15, max = 30, step = 1, - get = function(info) return E.db.sle.marks.size end, - }, - growth = { - order = 10, - type = "select", - name = L["Direction"], - desc = L["Change the direction of buttons growth from the skull marker"], - disabled = function() return not E.private.sle.marks.marks end, - get = function(info) return E.db.sle.marks.growth end, - values = { - ['RIGHT'] = L["Right"], - ['LEFT'] = L["Left"], - ['UP'] = L["Up"], - ['DOWN'] = L["Down"], - }, - }, - }, - }, - flares = { - order = 3, - type = "group", - name = L["Raid Flares"], - set = function(info, value) E.db.sle.flares[ info[#info] ] = value; RF:Update() end, - args = { - header = { - order = 1, - type = "header", - name = L["Raid Flares"], - }, - enabled = { - order = 2, - type = "toggle", - name = L["Enable"], - desc = L["Show/Hide Raid Flares."], - get = function(info) return E.private.sle.marks.flares end, - set = function(info, value) E.private.sle.marks.flares = value; E:StaticPopup_Show("PRIVATE_RL") end - }, - backdrop = { - order = 3, - type = "toggle", - name = L["Backdrop"], - disabled = function() return not E.private.sle.marks.flares end, - get = function(info) return E.db.sle.flares.backdrop end, - }, - spacer = { - order = 5, - type = 'description', - name = "", - }, - showinside = { - order = 6, - type = "toggle", - name = L["Show only in instances"], - desc = L["Selecting this option will have the Raid Flares appear only while in a raid or dungeon."], - disabled = function() return not E.private.sle.marks.flares end, - get = function(info) return E.db.sle.flares.showinside end, - }, - mouseover = { - order = 7, - type = "toggle", - name = L["Mouse Over"], - desc = L["Show on mouse over."], - disabled = function() return not E.private.sle.marks.flares end, - get = function(info) return E.db.sle.flares.mouseover end, - }, - tooltips = { - order = 8, - type = "toggle", - name = L["Show Tooltip"], - disabled = function() return not E.private.sle.marks.flares end, - get = function(info) return E.db.sle.flares.tooltips end, - }, - size = { - order = 9, - type = "range", - name = L['Size'], - desc = L["Sets size of buttons"], - disabled = function() return not E.private.sle.marks.flares end, - min = 15, max = 30, step = 1, - get = function(info) return E.db.sle.flares.size end, - }, - growth = { - order = 9, - type = "select", - name = L["Direction"], - desc = L["Change the direction of buttons growth from the square marker"], - disabled = function() return not E.private.sle.marks.flares end, - get = function(info) return E.db.sle.flares.growth end, - values = { - ['RIGHT'] = L["Right"], - ['LEFT'] = L["Left"], - ['UP'] = L["Up"], - ['DOWN'] = L["Down"], - }, - }, - }, - }, - }, - } -end - -table.insert(E.SLEConfigs, configTable) \ No newline at end of file diff --git a/ElvUI_SLE/options/raidmarkers_c.lua b/ElvUI_SLE/options/raidmarkers_c.lua new file mode 100644 index 0000000..adf44ef --- /dev/null +++ b/ElvUI_SLE/options/raidmarkers_c.lua @@ -0,0 +1,101 @@ +local E, L, V, P, G = unpack(ElvUI); +local RM = E:GetModule('SLE_RaidMarkers') + +local raidmarkerVisibility = { + DEFAULT = L['Use Default'], + INPARTY = AGGRO_WARNING_IN_PARTY, +} + +local function configTable() + E.Options.args.sle.args.options.args.raidmarkerbars = { + order = 4, + type = "group", + name = L["Raid Marks"], + get = function(info) return E.db.sle.raidmarkers[ info[#info] ] end, + set = function(info, value) E.db.sle.raidmarkers[ info[#info] ] = value; RM:ToggleSettings() end, + args = { + marks = { + order = 2, + type = "group", + name = L["Raid Markers"], + args = { + marksheader = { + order = 1, + type = "header", + name = L["Raid Markers"], + }, + enable = { + order = 2, + type = "toggle", + name = L["Enable"], + desc = L["Show/Hide raid marks."], + }, + reset = { + order = 3, + type = 'execute', + name = L['Restore Defaults'], + desc = L["Reset these options to defaults"], + disabled = function() return not E.db.sle.raidmarkers.enable end, + func = function() E:GetModule('SLE'):Reset("marks") end, + }, + space1 = { + order = 4, + type = 'description', + name = "", + }, + visibility = { + type = 'select', + order = 5, + name = L["Visibility"], + disabled = function() return not E.db.sle.raidmarkers.enable end, + values = raidmarkerVisibility, + }, + backdrop = { + type = 'toggle', + order = 6, + name = L["Backdrop"], + disabled = function() return not E.db.sle.raidmarkers.enable end, + }, + buttonSize = { + order = 7, + type = 'range', + name = L['Button Size'], + min = 16, max = 40, step = 1, + disabled = function() return not E.db.sle.raidmarkers.enable end, + }, + spacing = { + order = 8, + type = 'range', + name = L["Button Spacing"], + min = 0, max = 10, step = 1, + disabled = function() return not E.db.sle.raidmarkers.enable end, + }, + orientation = { + order = 9, + type = 'select', + name = L['Orientation'], + disabled = function() return not E.db.sle.raidmarkers.enable end, + values = { + ['HORIZONTAL'] = L['Horizontal'], + ['VERTICAL'] = L['Vertical'], + }, + }, + modifier = { + order = 10, + type = 'select', + name = L['Modifier Key'], + desc = L['Set the modifier key for placing world markers.'], + disabled = function() return not E.db.sle.raidmarkers.enable end, + values = { + ['shift-'] = L['Shift Key'], + ['ctrl-'] = L['Ctrl Key'], + ['alt-'] = L['Alt Key'], + }, + }, + }, + }, + }, + } +end + +table.insert(E.SLEConfigs, configTable) \ No newline at end of file