Quantcast

5.4.13

Steven Jackson [01-03-15 - 04:14]
5.4.13
Filename
Interface/AddOns/SVUI/framework/docks/dock_core.lua
Interface/AddOns/SVUI/packages/chat/SVChat.lua
Interface/AddOns/SVUI_StyleOMatic/components/blizzard/chat.lua
diff --git a/Interface/AddOns/SVUI/framework/docks/dock_core.lua b/Interface/AddOns/SVUI/framework/docks/dock_core.lua
index d781dbe..d45dabe 100644
--- a/Interface/AddOns/SVUI/framework/docks/dock_core.lua
+++ b/Interface/AddOns/SVUI/framework/docks/dock_core.lua
@@ -735,11 +735,9 @@ for location, settings in pairs(DOCK_LOCATIONS) do
 	};
 end

-local function SetSuperDockStyle(dock, isBottom)
+function Dock:SetSuperDockStyle(dock, isBottom)
 	if dock.backdrop then return end

-	local leftGradient = {}
-
 	local backdrop = CreateFrame("Frame", nil, dock)
 	backdrop:SetAllPoints(dock)
 	backdrop:SetFrameStrata("BACKGROUND")
@@ -747,7 +745,12 @@ local function SetSuperDockStyle(dock, isBottom)
 	backdrop.bg = backdrop:CreateTexture(nil, "BORDER")
 	backdrop.bg:SetAllPointsIn(backdrop)
 	backdrop.bg:SetTexture(1, 1, 1, 1)
-	backdrop.bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 0.8, 0, 0, 0, 0)
+
+	if(isBottom) then
+		backdrop.bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 0.8, 0, 0, 0, 0)
+	else
+		backdrop.bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 0, 0, 0, 0, 0.8)
+	end

 	backdrop.left = backdrop:CreateTexture(nil, "OVERLAY")
 	backdrop.left:SetTexture(1, 1, 1, 1)
@@ -1124,8 +1127,8 @@ function Dock:Initialize()
 	    SV.Mentalo:Add(dock.Bar, location .. " Dock ToolBar");

 		if(isBottom) then
-			dock.backdrop = SetSuperDockStyle(dock.Window, isBottom)
-			dock.Alert.backdrop = SetSuperDockStyle(dock.Alert, isBottom)
+			dock.backdrop = self:SetSuperDockStyle(dock.Window, isBottom)
+			dock.Alert.backdrop = self:SetSuperDockStyle(dock.Alert, isBottom)
 			dock.Alert.backdrop:Hide()
 		end

diff --git a/Interface/AddOns/SVUI/packages/chat/SVChat.lua b/Interface/AddOns/SVUI/packages/chat/SVChat.lua
index eb4150f..bdb0c98 100644
--- a/Interface/AddOns/SVUI/packages/chat/SVChat.lua
+++ b/Interface/AddOns/SVUI/packages/chat/SVChat.lua
@@ -112,6 +112,7 @@ local ICONARTFILE = [[Interface\AddOns\SVUI\assets\artwork\Icons\DOCK-CHAT]]
 local SCROLL_ALERT = [[Interface\AddOns\SVUI\assets\artwork\Chat\CHAT-SCROLL]]
 local WHISPER_ALERT = [[Interface\AddOns\SVUI\assets\artwork\Chat\CHAT-WHISPER]]
 local THROTTLE_CACHE = {};
+local COPY_LINES = {};
 local ACTIVE_HYPER_LINK;
 local TABS_DIRTY = false;
 --[[
@@ -747,6 +748,31 @@ do
 			alert:Hide()
 			chat.WhisperAlert = alert

+			--copy chat button
+			chat.button = CreateFrame('Frame', format("SVUI_CopyChatButton%d", id), chat)
+			chat.button:SetAlpha(0.35)
+			chat.button:SetSizeToScale(38, 18)
+			chat.button:SetPoint('TOPRIGHT', chat, 'TOPRIGHT', 0, 0)
+			chat.button:SetStylePanel('Default', 'Headline')
+
+			chat.button.Title = chat.button:CreateFontString()
+			chat.button.Title:FontManager("chattab")
+			chat.button.Title:SetText("copy")
+			chat.button.Title:SetAllPointsIn(chat.button)
+			chat.button.Title:SetTextColor(1,0.8,0)
+
+			chat.button:SetScript("OnMouseUp", function(self, btn)
+				if btn == "RightButton" and id == 1 then
+					ToggleFrame(ChatMenu)
+				else
+					MOD:CopyChat(chat)
+				end
+			end)
+
+			chat.button:SetScript("OnEnter", function(self) self:FadeIn() end)
+			chat.button:SetScript("OnLeave", function(self) self:FadeOut() end)
+			chat.button:FadeOut()
+
 			chat.InitConfig = true
 		end
 	end
@@ -1037,6 +1063,42 @@ do
 	end
 end

+local function removeIconFromLine(text)
+	for i=1, 8 do
+		text = gsub(text, "|TInterface\\TargetingFrame\\UI%-RaidTargetingIcon_"..i..":0|t", "")
+	end
+	text = gsub(text, "(|TInterface(.*)|t)", "")
+	return text
+end
+
+function MOD:GetLines(...)
+	local index = 1
+	for i = select("#", ...), 1, -1 do
+		local region = select(i, ...)
+		if region:GetObjectType() == "FontString" then
+			local line = tostring(region:GetText())
+			COPY_LINES[index] = removeIconFromLine(line)
+			index = index + 1
+		end
+	end
+	return index - 1
+end
+
+function MOD:CopyChat(frame)
+	if not SVUI_CopyChatFrame:IsShown() then
+		--local _, fontSize = FCF_GetChatWindowInfo(frame:GetID());
+		--if fontSize < 10 then fontSize = 12 end
+		--FCF_SetChatWindowFontSize(frame, frame, 0.01)
+		SVUI_CopyChatFrame:Show()
+		local lineCt = self:GetLines(frame:GetRegions())
+		local text = tconcat(COPY_LINES, "\n", 1, lineCt)
+		--FCF_SetChatWindowFontSize(frame, frame, fontSize)
+		SVUI_CopyChatFrameEditBox:SetText(text)
+	else
+		SVUI_CopyChatFrame:Hide()
+	end
+end
+
 local function DockFadeInChat()
 	local activeChatFrame = FCFDock_GetSelectedWindow(GENERAL_CHAT_DOCK)
 	activeChatFrame:FadeIn(0.2, activeChatFrame:GetAlpha(), 1)
@@ -1124,9 +1186,57 @@ function MOD:Load()
 	_G.InterfaceOptionsSocialPanelChatStyleButton:Hide()
 	_G.InterfaceOptionsSocialPanelChatStyle:SetAlpha(0)

-	-- NewHook(ChatFrame2, "SetPoint", function(self, a1, p, a2, x, y)
-	-- 	if(x > 2) then
-	-- 		self:SetPoint(a1, p, a2, 2, y)
-	-- 	end
-	-- end)
+	NewHook(ChatFrame2, "SetPoint", function(self, a1, p, a2, x, y)
+		if(x > 2) then
+			self:SetPoint(a1, p, a2, 2, y)
+		end
+	end)
+
+
+	local frame = CreateFrame("Frame", "SVUI_CopyChatFrame", self.Dock)
+	--frame:SetStylePanel('Default', 'Transparent')
+	frame:SetPoint('BOTTOMLEFT', self.Dock, 'TOPLEFT', 0, 0)
+	frame:SetPoint('BOTTOMRIGHT', self.Dock, 'TOPRIGHT', 0, 0)
+	frame:SetHeight(self.Dock:GetHeight())
+	frame:Hide()
+	frame:EnableMouse(true)
+	frame:SetFrameStrata("DIALOG")
+	SV.Dock:SetSuperDockStyle(frame)
+
+	frame.Title = frame:CreateFontString()
+	frame.Title:FontManager("header", "LEFT")
+	frame.Title:SetText("Copy Chat")
+	frame.Title:SetPoint("TOPLEFT", frame, "TOPLEFT", 4, 4)
+	frame.Title:SetTextColor(1,0.8,0)
+
+	local scrollArea = CreateFrame("ScrollFrame", "SVUI_CopyChatScrollFrame", frame, "UIPanelScrollFrameTemplate")
+	scrollArea:SetPoint("TOPLEFT", frame, "TOPLEFT", 8, -30)
+	scrollArea:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -30, 8)
+
+	local editBox = CreateFrame("EditBox", "SVUI_CopyChatFrameEditBox", frame)
+	editBox:SetMultiLine(true)
+	editBox:SetMaxLetters(99999)
+	editBox:EnableMouse(true)
+	editBox:SetAutoFocus(false)
+	editBox:FontManager("chatdialog", "LEFT")
+	editBox:SetWidth(scrollArea:GetWidth())
+	editBox:SetHeight(200)
+	editBox:SetScript("OnEscapePressed", function() SVUI_CopyChatFrame:Hide() end)
+
+	scrollArea:SetScrollChild(editBox)
+
+	editBox:SetScript("OnTextChanged", function(self, userInput)
+		if userInput then return end
+		local _, max = SVUI_CopyChatScrollFrameScrollBar:GetMinMaxValues()
+		for i=1, max do
+			ScrollFrameTemplate_OnMouseWheel(SVUI_CopyChatScrollFrame, -1)
+		end
+	end)
+
+	local close = CreateFrame("Button", "SVUI_CopyChatFrameCloseButton", frame, "UIPanelCloseButton")
+	close:SetPoint("TOPRIGHT")
+	close:SetFrameLevel(close:GetFrameLevel() + 1)
+	close:EnableMouse(true)
+
+	tinsert(UISpecialFrames, "SVUI_CopyChatFrame")
 end
\ No newline at end of file
diff --git a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/chat.lua b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/chat.lua
index bde3ab4..28ea85e 100644
--- a/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/chat.lua
+++ b/Interface/AddOns/SVUI_StyleOMatic/components/blizzard/chat.lua
@@ -477,6 +477,10 @@ local function ChatStyle()

 	PLUGIN:ApplyPaginationStyle(ChatConfigMoveFilterUpButton,true)
 	PLUGIN:ApplyPaginationStyle(ChatConfigMoveFilterDownButton,true)
+	PLUGIN:ApplyPaginationStyle(CombatLogQuickButtonFrame_CustomAdditionalFilterButton,true)
+
+	PLUGIN:ApplyScrollBarStyle(SVUI_CopyChatScrollFrameScrollBar)
+	PLUGIN:ApplyCloseButtonStyle(SVUI_CopyChatFrameCloseButton)

 	ChatConfigMoveFilterUpButton:ClearAllPoints()
 	ChatConfigMoveFilterDownButton:ClearAllPoints()