Quantcast

5.4.197

Steven Jackson [01-20-15 - 02:29]
5.4.197
Filename
Interface/AddOns/SVUI/packages/tool/buttons/raidleader.lua
diff --git a/Interface/AddOns/SVUI/packages/tool/buttons/raidleader.lua b/Interface/AddOns/SVUI/packages/tool/buttons/raidleader.lua
index 47ce614..f39ea7e 100644
--- a/Interface/AddOns/SVUI/packages/tool/buttons/raidleader.lua
+++ b/Interface/AddOns/SVUI/packages/tool/buttons/raidleader.lua
@@ -55,6 +55,17 @@ local Button_OnLeave = function(self)
 	GameTooltip:Hide()
 end

+local DockletButton_OnPostClick = function(self, button)
+	local docklet = SVUI_RaidToolDockButton
+	if(IsAltKeyDown() and (not InCombatLockdown()) and docklet:GetAttribute("hasDropDown") and docklet.GetMenuList) then
+		local list = docklet:GetMenuList();
+		SV.Dropdown:Open(docklet, list);
+	else
+		self:RemoveTextures();
+		SVUI_RaidToolMenu.toggled = true
+	end
+end
+
 local ToolButton_OnEnter = function(self, ...)
 	SVUI_RaidToolDockButton:SetPanelColor("highlight")
 	SVUI_RaidToolDockButton.Icon:SetGradient(unpack(SV.Media.gradient.bizzaro))
@@ -62,6 +73,8 @@ local ToolButton_OnEnter = function(self, ...)
 	GameTooltip:SetOwner(self, "ANCHOR_BOTTOMLEFT", 0, 4)
 	GameTooltip:ClearLines()
 	GameTooltip:AddDoubleLine("[Left-Click]", RAID_CONTROL, 0, 1, 0, 1, 1, 1)
+	GameTooltip:AddLine(" ")
+	GameTooltip:AddDoubleLine("[Alt + Click]", "Docking Options", 0, 0.5, 1, 0.5, 1, 0.5)
 	GameTooltip:Show()
 end

@@ -95,22 +108,30 @@ local function NewToolButton(name, parent, template, width, height, point, relat

 	return button;
 end
-
+local CURRENT_PARENT;
 function MOD:UpdateRaidLeader(event)
 	if InCombatLockdown() then
 		self.RaidLeaderNeedsUpdate = true;
 		self:RegisterEvent("PLAYER_REGEN_ENABLED");
 		return
 	end
+	if not CURRENT_PARENT then
+		CURRENT_PARENT = self.RaidTool.parent
+	end
 	if CheckRaidStatus() then
-		SV.Dock.TopLeft.Bar:Add(self.RaidTool)
+		if not CURRENT_PARENT then
+			self.RaidTool.Menu:Hide()
+			return
+		end
+		CURRENT_PARENT:Add(self.RaidTool)
 		if self.RaidTool.Menu.toggled == true then
 			self.RaidTool.Menu:Show()
 		else
 			self.RaidTool.Menu:Hide()
 		end
 	else
-		SV.Dock.TopLeft.Bar:Remove(self.RaidTool)
+		CURRENT_PARENT = self.RaidTool.parent
+		CURRENT_PARENT:Remove(self.RaidTool)
 		self.RaidTool.Menu:Hide()
 	end
 end
@@ -119,7 +140,7 @@ function MOD:LoadRaidLeaderTools()
 	local dock = SV.Dock.TopLeft.Bar

 	self.RaidTool = SV.Dock:SetDockButton("TopLeft", RAID_CONTROL, ICON_FILE, nil, "SVUI_RaidToolDockButton");
-	self.RaidTool:SetAttribute("hasDropDown", false);
+	--self.RaidTool:SetAttribute("hasDropDown", false);

 	self.RaidTool.Menu = CreateFrame("Frame", "SVUI_RaidToolMenu", self.RaidTool, "SecureHandlerClickTemplate");
 	self.RaidTool.Menu:SetStylePanel("Frame", 'Transparent');
@@ -137,11 +158,14 @@ function MOD:LoadRaidLeaderTools()
 	SVUI_RaidToolToggle:SetPushedTexture("")
 	SVUI_RaidToolToggle:SetHighlightTexture("")
 	SVUI_RaidToolToggle:SetFrameRef("SVUI_RaidToolMenu", SVUI_RaidToolMenu)
+	SVUI_RaidToolToggle:SetFrameRef("SVUI_RaidToolDockButton", self.RaidTool)
 	SVUI_RaidToolToggle:SetAttribute("_onclick", [=[
+		if(IsAltKeyDown()) then return end
+		local location = self:GetFrameRef("SVUI_RaidToolDockButton");
 		local raidUtil = self:GetFrameRef("SVUI_RaidToolMenu");
 		local closeButton = self:GetFrameRef("SVUI_RaidToolCloseButton");
 		raidUtil:Show();
-		local point = self:GetPoint();
+		local point = location:GetPoint();
 		local raidUtilPoint, raidUtilRelative, closeButtonPoint, closeButtonRelative
 		if point:find("BOTTOM") then
 			raidUtilPoint = "BOTTOMLEFT"
@@ -156,7 +180,7 @@ function MOD:LoadRaidLeaderTools()
 		raidUtil:SetPoint(raidUtilPoint, self, raidUtilRelative, 2, -2)
 		closeButton:SetPoint("BOTTOM", raidUtil, "BOTTOM", 0, 2)
 	]=]);
-	SVUI_RaidToolToggle:SetScript("PostClick", function(self) self:RemoveTextures(); SVUI_RaidToolMenu.toggled = true end);
+	SVUI_RaidToolToggle:SetScript("PostClick", DockletButton_OnPostClick);
 	SVUI_RaidToolToggle:HookScript("OnEnter", ToolButton_OnEnter)
 	SVUI_RaidToolToggle:HookScript("OnLeave", ToolButton_OnLeave)
 	SV:ManageVisibility(self.RaidTool);