Skip to content

Commit

Permalink
Use default unit dropdown menu in oUF.
Browse files Browse the repository at this point in the history
  • Loading branch information
Shestak committed Oct 12, 2014
1 parent 244f1bb commit 4dc2b12
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 69 deletions.
16 changes: 0 additions & 16 deletions ShestakUI/Core/Functions.lua
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions ShestakUI/Libs/oUF/oUF.lua
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions ShestakUI/Modules/UnitFrames/Layout.lua
Expand Up @@ -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
Expand Down
31 changes: 7 additions & 24 deletions ShestakUI/Modules/UnitFrames/RaidDPS.lua
Expand Up @@ -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")

Expand Down Expand Up @@ -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),
Expand All @@ -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
Expand Down
31 changes: 7 additions & 24 deletions ShestakUI/Modules/UnitFrames/RaidHeal.lua
Expand Up @@ -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")

Expand Down Expand Up @@ -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),
Expand All @@ -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
Expand Down

0 comments on commit 4dc2b12

Please sign in to comment.