From 4dc2b12ebeb7065697beee6f72f9802c63375b76 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 12 Oct 2014 20:54:51 +0400 Subject: [PATCH] Use default unit dropdown menu in oUF. --- ShestakUI/Core/Functions.lua | 16 ------------ ShestakUI/Libs/oUF/oUF.lua | 4 +-- ShestakUI/Modules/UnitFrames/Layout.lua | 4 +-- ShestakUI/Modules/UnitFrames/RaidDPS.lua | 31 +++++------------------ ShestakUI/Modules/UnitFrames/RaidHeal.lua | 31 +++++------------------ 5 files changed, 17 insertions(+), 69 deletions(-) diff --git a/ShestakUI/Core/Functions.lua b/ShestakUI/Core/Functions.lua index 1ec2cd1a9e..ab156ab59b 100644 --- a/ShestakUI/Core/Functions.lua +++ b/ShestakUI/Core/Functions.lua @@ -479,22 +479,6 @@ local StopFlash = function(self) end end -T.SpawnMenu = function(self) - local unit = self.unit:gsub("(.)", string.upper, 1) - if unit == "Targettarget" or unit == "focustarget" or unit == "pettarget" then return end - - if _G[unit.."FrameDropDown"] then - ToggleDropDownMenu(nil, nil, _G[unit.."FrameDropDown"], "cursor") - elseif self.unit:match("party") then - ToggleDropDownMenu(nil, nil, _G["PartyMemberFrame"..self.id.."DropDown"], "cursor") - else - FriendsDropDown.unit = self.unit - FriendsDropDown.id = self.id - FriendsDropDown.initialize = RaidFrameDropDown_Initialize - ToggleDropDownMenu(nil, nil, FriendsDropDown, "cursor") - end -end - T.SetFontString = function(parent, fontName, fontHeight, fontStyle) local fs = parent:CreateFontString(nil, "ARTWORK") fs:SetFont(fontName, fontHeight, fontStyle) diff --git a/ShestakUI/Libs/oUF/oUF.lua b/ShestakUI/Libs/oUF/oUF.lua index f664de64f7..e5450057e8 100644 --- a/ShestakUI/Libs/oUF/oUF.lua +++ b/ShestakUI/Libs/oUF/oUF.lua @@ -227,7 +227,7 @@ local initObject = function(unit, style, styleFunc, header, ...) if(not header) then -- No header means it's a frame created through :Spawn(). object:SetAttribute("*type1", "target") - object:SetAttribute('*type2', 'menu') + object:SetAttribute('*type2', 'togglemenu') -- No need to enable this for *target frames. if(not (unit:match'target' or suffix == 'target')) then @@ -470,7 +470,7 @@ do end frame:SetAttribute('*type1', 'target') - frame:SetAttribute('*type2', 'menu') + frame:SetAttribute('*type2', 'togglemenu') frame:SetAttribute('toggleForVehicle', true) frame:SetAttribute('oUF-guessUnit', unit) end diff --git a/ShestakUI/Modules/UnitFrames/Layout.lua b/ShestakUI/Modules/UnitFrames/Layout.lua index 3c75bcbe1e..437d0fdaa2 100644 --- a/ShestakUI/Modules/UnitFrames/Layout.lua +++ b/ShestakUI/Modules/UnitFrames/Layout.lua @@ -22,14 +22,12 @@ local function Shared(self, unit) or (unit and unit:find("boss%d")) and "boss" or unit -- Menu - self.menu = T.SpawnMenu - if (unit == "arena" and C.unitframe.show_arena == true and unit ~= "arenatarget") or (unit == "boss" and C.unitframe.show_boss == true) then self:SetAttribute("type2", "focus") self:SetAttribute("type3", "macro") self:SetAttribute("macrotext3", "/clearfocus") else - self:SetAttribute("*type2", "menu") + self:SetAttribute("*type2", "togglemenu") end -- Backdrop for every units diff --git a/ShestakUI/Modules/UnitFrames/RaidDPS.lua b/ShestakUI/Modules/UnitFrames/RaidDPS.lua index 8b24fbaf25..83e6123d33 100644 --- a/ShestakUI/Modules/UnitFrames/RaidDPS.lua +++ b/ShestakUI/Modules/UnitFrames/RaidDPS.lua @@ -29,9 +29,6 @@ local function Shared(self, unit) self:SetScript("OnEnter", UnitFrame_OnEnter) self:SetScript("OnLeave", UnitFrame_OnLeave) - -- Menu - self.menu = T.SpawnMenu - -- Backdrop for every units self:CreateBackdrop("Default") @@ -301,6 +298,9 @@ oUF:Factory(function(self) "initial-height", T.Scale(partytarget_height), "showSolo", C.raidframe.solo_mode, "showPlayer", C.raidframe.player_in_party, + "groupBy", C.raidframe.by_role and "ASSIGNEDROLE", + "groupingOrder", C.raidframe.by_role and "TANK,HEALER,DAMAGER,NONE", + "sortMethod", C.raidframe.by_role and "NAME", "showParty", true, "showRaid", true, "yOffset", T.Scale(28), @@ -321,33 +321,16 @@ oUF:Factory(function(self) "initial-height", T.Scale(partytarget_height), "showSolo", C.raidframe.solo_mode, "showPlayer", C.raidframe.player_in_party, + "groupBy", C.raidframe.by_role and "ASSIGNEDROLE", + "groupingOrder", C.raidframe.by_role and "TANK,HEALER,DAMAGER,NONE", + "sortMethod", C.raidframe.by_role and "NAME", "showParty", true, "showRaid", true, "yOffset", T.Scale(28), "point", "BOTTOM" ) - local partypetupdate = CreateFrame("Frame") - partypetupdate:SetScript("OnEvent", function(...) - if InCombatLockdown() then return end - - local lastGroup = 1 - local numRaidMembers = GetNumGroupMembers() - if numRaidMembers > 0 then - local playerGroup - for member = 1, numRaidMembers do - _, _, playerGroup = GetRaidRosterInfo(member) - lastGroup = math.max(lastGroup, playerGroup) - end - end - - partypet:SetPoint("BOTTOMLEFT", party[lastGroup], "BOTTOMRIGHT", 44, 0) - end) - partypetupdate:RegisterEvent("PLAYER_ENTERING_WORLD") - partypetupdate:RegisterEvent("PLAYER_REGEN_ENABLED") - partypetupdate:RegisterEvent("GROUP_ROSTER_UPDATE") - partypetupdate:RegisterEvent("UNIT_ENTERED_VEHICLE") - partypetupdate:RegisterEvent("UNIT_EXITED_VEHICLE") + partypet:SetPoint("BOTTOMLEFT", party, "BOTTOMRIGHT", 44, 0) end if C.raidframe.show_raid == true then diff --git a/ShestakUI/Modules/UnitFrames/RaidHeal.lua b/ShestakUI/Modules/UnitFrames/RaidHeal.lua index 3c61614b6a..a05f96218e 100644 --- a/ShestakUI/Modules/UnitFrames/RaidHeal.lua +++ b/ShestakUI/Modules/UnitFrames/RaidHeal.lua @@ -25,9 +25,6 @@ local function Shared(self, unit) self:SetScript("OnEnter", UnitFrame_OnEnter) self:SetScript("OnLeave", UnitFrame_OnLeave) - -- Menu - self.menu = T.SpawnMenu - -- Backdrop for every units self:CreateBackdrop("Default") @@ -323,6 +320,9 @@ oUF:Factory(function(self) "initial-height", T.Scale(unit_height / 2), "showSolo", C.raidframe.solo_mode, "showPlayer", C.raidframe.player_in_party, + "groupBy", C.raidframe.by_role and "ASSIGNEDROLE", + "groupingOrder", C.raidframe.by_role and "TANK,HEALER,DAMAGER,NONE", + "sortMethod", C.raidframe.by_role and "NAME", "showParty", true, "showRaid", true, "xOffset", T.Scale(7), @@ -343,33 +343,16 @@ oUF:Factory(function(self) "initial-height", T.Scale(unit_height / 2), "showSolo", C.raidframe.solo_mode, "showPlayer", C.raidframe.player_in_party, + "groupBy", C.raidframe.by_role and "ASSIGNEDROLE", + "groupingOrder", C.raidframe.by_role and "TANK,HEALER,DAMAGER,NONE", + "sortMethod", C.raidframe.by_role and "NAME", "showParty", true, "showRaid", true, "xOffset", T.Scale(7), "point", "LEFT" ) - local partypetupdate = CreateFrame("Frame") - partypetupdate:SetScript("OnEvent", function(...) - if InCombatLockdown() then return end - - local lastGroup = 1 - local numRaidMembers = GetNumGroupMembers() - if numRaidMembers > 0 then - local playerGroup - for member = 1, numRaidMembers do - _, _, playerGroup = GetRaidRosterInfo(member) - lastGroup = math.max(lastGroup, playerGroup) - end - end - - partypet:SetPoint("TOPLEFT", party[lastGroup], "BOTTOMLEFT", 0, -((unit_height / 2) + 14.5)) - end) - partypetupdate:RegisterEvent("PLAYER_ENTERING_WORLD") - partypetupdate:RegisterEvent("PLAYER_REGEN_ENABLED") - partypetupdate:RegisterEvent("GROUP_ROSTER_UPDATE") - partypetupdate:RegisterEvent("UNIT_ENTERED_VEHICLE") - partypetupdate:RegisterEvent("UNIT_EXITED_VEHICLE") + partypet:SetPoint("TOPLEFT", party, "BOTTOMLEFT", 0, -((unit_height / 2) + 14.5)) end if C.raidframe.show_raid == true then