mirror of
https://github.com/Bluewhale1337/ElvUIModernized.git
synced 2026-07-27 08:24:44 +00:00
chat
This commit is contained in:
@@ -88,62 +88,62 @@ local hyperlinkTypes = {
|
|||||||
CH.Keywords = {}
|
CH.Keywords = {}
|
||||||
|
|
||||||
local numScrollMessages
|
local numScrollMessages
|
||||||
local function ChatFrame_OnMouseScroll(frame, delta)
|
local function ChatFrame_OnMouseScroll()
|
||||||
numScrollMessages = CH.db.numScrollMessages or 3
|
numScrollMessages = CH.db.numScrollMessages or 3
|
||||||
if CH.db.scrollDirection == "TOP" then
|
if CH.db.scrollDirection == "TOP" then
|
||||||
if delta < 0 then
|
if arg1 < 0 then
|
||||||
if IsShiftKeyDown() then
|
if IsShiftKeyDown() then
|
||||||
frame:ScrollToBottom()
|
this:ScrollToBottom()
|
||||||
elseif IsAltKeyDown() then
|
elseif IsAltKeyDown() then
|
||||||
frame:ScrollDown()
|
this:ScrollDown()
|
||||||
else
|
else
|
||||||
for i = 1, numScrollMessages do
|
for i = 1, numScrollMessages do
|
||||||
frame:ScrollDown()
|
this:ScrollDown()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif delta > 0 then
|
elseif arg1 > 0 then
|
||||||
if IsShiftKeyDown() then
|
if IsShiftKeyDown() then
|
||||||
frame:ScrollToTop()
|
this:ScrollToTop()
|
||||||
elseif IsAltKeyDown() then
|
elseif IsAltKeyDown() then
|
||||||
frame:ScrollUp()
|
this:ScrollUp()
|
||||||
else
|
else
|
||||||
for i = 1, numScrollMessages do
|
for i = 1, numScrollMessages do
|
||||||
frame:ScrollUp()
|
this:ScrollUp()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if CH.db.scrollDownInterval ~= 0 then
|
if CH.db.scrollDownInterval ~= 0 then
|
||||||
if frame.ScrollTimer then
|
if this.ScrollTimer then
|
||||||
CH:CancelTimer(frame.ScrollTimer, true)
|
CH:CancelTimer(this.ScrollTimer, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
frame.ScrollTimer = CH:ScheduleTimer("ScrollToBottom", CH.db.scrollDownInterval, frame)
|
this.ScrollTimer = CH:ScheduleTimer("ScrollToBottom", CH.db.scrollDownInterval, this)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if delta < 0 then
|
if arg1 < 0 then
|
||||||
if IsShiftKeyDown() then
|
if IsShiftKeyDown() then
|
||||||
frame:ScrollToBottom()
|
this:ScrollToBottom()
|
||||||
else
|
else
|
||||||
for i = 1, numScrollMessages do
|
for i = 1, numScrollMessages do
|
||||||
frame:ScrollDown()
|
this:ScrollDown()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif delta > 0 then
|
elseif arg1 > 0 then
|
||||||
if IsShiftKeyDown() then
|
if IsShiftKeyDown() then
|
||||||
frame:ScrollToTop()
|
this:ScrollToTop()
|
||||||
else
|
else
|
||||||
for i = 1, numScrollMessages do
|
for i = 1, numScrollMessages do
|
||||||
frame:ScrollUp()
|
this:ScrollUp()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if CH.db.scrollDownInterval ~= 0 then
|
if CH.db.scrollDownInterval ~= 0 then
|
||||||
if frame.ScrollTimer then
|
if this.ScrollTimer then
|
||||||
CH:CancelTimer(frame.ScrollTimer, true)
|
CH:CancelTimer(this.ScrollTimer, true)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- frame.ScrollTimer = CH:ScheduleTimer("ScrollToBottom", CH.db.scrollDownInterval, frame)
|
-- this.ScrollTimer = CH:ScheduleTimer("ScrollToBottom", CH.db.scrollDownInterval, this)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1003,15 +1003,15 @@ function CH:ChatFrame_MessageEventHandler(event, ...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function CH:ChatFrame_OnEvent(event, ...)
|
function CH:ChatFrame_OnEvent(event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
|
||||||
if CH.ChatFrame_MessageEventHandler(self, event, unpack(arg)) then
|
if CH.ChatFrame_MessageEventHandler(self, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function CH:FloatingChatFrame_OnEvent(self, event, ...)
|
function CH:FloatingChatFrame_OnEvent()
|
||||||
CH.ChatFrame_OnEvent(self, event, unpack(arg))
|
CH.ChatFrame_OnEvent(this, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10)
|
||||||
FloatingChatFrame_OnEvent(self, event, 1)
|
FloatingChatFrame_OnEvent(this, event, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function OnTextChanged(self)
|
local function OnTextChanged(self)
|
||||||
@@ -1074,12 +1074,17 @@ function CH:SetupChat()
|
|||||||
frame:SetFading(self.db.fade)
|
frame:SetFading(self.db.fade)
|
||||||
|
|
||||||
if not frame.scriptsSet then
|
if not frame.scriptsSet then
|
||||||
frame:SetScript("OnMouseWheel", function() ChatFrame_OnMouseScroll(this, arg1) end)
|
frame:SetScript("OnMouseWheel", ChatFrame_OnMouseScroll)
|
||||||
frame:EnableMouseWheel(true)
|
frame:EnableMouseWheel(true)
|
||||||
|
|
||||||
if id ~= 2 then
|
if id ~= 2 then
|
||||||
frame:SetScript("OnEvent", function() CH:FloatingChatFrame_OnEvent(this, event, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10) end)
|
frame:SetScript("OnEvent", CH.FloatingChatFrame_OnEvent)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
hooksecurefunc(frame, "StopMovingOrSizing", function()
|
||||||
|
CH:PositionChat(true)
|
||||||
|
end)
|
||||||
|
|
||||||
frame.scriptsSet = true
|
frame.scriptsSet = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1111,8 +1116,7 @@ function CH:SetupChat()
|
|||||||
end
|
end
|
||||||
|
|
||||||
DEFAULT_CHAT_FRAME:SetParent(LeftChatPanel)
|
DEFAULT_CHAT_FRAME:SetParent(LeftChatPanel)
|
||||||
self:ScheduleRepeatingTimer("PositionChat", 1)
|
self:ScheduleTimer("PositionChat", 1)
|
||||||
-- self:PositionChat(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function PrepareMessage(author, message)
|
local function PrepareMessage(author, message)
|
||||||
@@ -1662,13 +1666,11 @@ function CH:Initialize()
|
|||||||
frame:SetFrameStrata("DIALOG")
|
frame:SetFrameStrata("DIALOG")
|
||||||
|
|
||||||
local scrollArea = CreateFrame("ScrollFrame", "CopyChatScrollFrame", frame, "UIPanelScrollFrameTemplate")
|
local scrollArea = CreateFrame("ScrollFrame", "CopyChatScrollFrame", frame, "UIPanelScrollFrameTemplate")
|
||||||
|
scrollArea:SetWidth(662)
|
||||||
|
scrollArea:SetHeight(162)
|
||||||
scrollArea:SetPoint("TOPLEFT", frame, "TOPLEFT", 8, -30)
|
scrollArea:SetPoint("TOPLEFT", frame, "TOPLEFT", 8, -30)
|
||||||
scrollArea:SetPoint("BOTTOMRIGHT", frame, "BOTTOMRIGHT", -30, 8)
|
|
||||||
S:HandleScrollBar(CopyChatScrollFrameScrollBar)
|
S:HandleScrollBar(CopyChatScrollFrameScrollBar)
|
||||||
scrollArea:SetScript("OnSizeChanged", function()
|
|
||||||
CopyChatFrameEditBox:SetWidth(this:GetWidth())
|
|
||||||
CopyChatFrameEditBox:SetHeight(this:GetHeight())
|
|
||||||
end)
|
|
||||||
HookScript(scrollArea, "OnVerticalScroll", function()
|
HookScript(scrollArea, "OnVerticalScroll", function()
|
||||||
CopyChatFrameEditBox:SetHitRectInsets(0, 0, arg1, (CopyChatFrameEditBox:GetHeight() - arg1 - this:GetHeight()))
|
CopyChatFrameEditBox:SetHitRectInsets(0, 0, arg1, (CopyChatFrameEditBox:GetHeight() - arg1 - this:GetHeight()))
|
||||||
end)
|
end)
|
||||||
@@ -1683,18 +1685,25 @@ function CH:Initialize()
|
|||||||
editBox:SetHeight(200)
|
editBox:SetHeight(200)
|
||||||
editBox:SetScript("OnEscapePressed", function() CopyChatFrame:Hide() end)
|
editBox:SetScript("OnEscapePressed", function() CopyChatFrame:Hide() end)
|
||||||
scrollArea:SetScrollChild(editBox)
|
scrollArea:SetScrollChild(editBox)
|
||||||
CopyChatFrameEditBox:SetScript("OnTextChanged", function()
|
--[[CopyChatFrameEditBox:SetScript("OnTextChanged", function()
|
||||||
local scrollBar = CopyChatScrollFrameScrollBar
|
local scrollBar = CopyChatScrollFrameScrollBar
|
||||||
local _, max = scrollBar:GetMinMaxValues()
|
local _, max = scrollBar:GetMinMaxValues()
|
||||||
for i = 1, max do
|
for i = 1, max do
|
||||||
scrollBar:SetValue(scrollBar:GetValue() + (scrollBar:GetHeight() / 2))
|
scrollBar:SetValue(scrollBar:GetValue() + (scrollBar:GetHeight() / 2))
|
||||||
end
|
end
|
||||||
|
end)]]
|
||||||
|
|
||||||
|
frame:SetScript("OnSizeChanged", function()
|
||||||
|
local width, height = this:GetWidth() - 38, this:GetHeight() - 38
|
||||||
|
scrollArea:SetWidth(width)
|
||||||
|
scrollArea:SetHeight(height)
|
||||||
|
CopyChatFrameEditBox:SetWidth(width)
|
||||||
|
CopyChatFrameEditBox:SetHeight(height)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local close = CreateFrame("Button", "CopyChatFrameCloseButton", frame, "UIPanelCloseButton")
|
local close = CreateFrame("Button", "CopyChatFrameCloseButton", frame, "UIPanelCloseButton")
|
||||||
close:SetPoint("TOPRIGHT", 0, 0)
|
close:SetPoint("TOPRIGHT", 0, 0)
|
||||||
close:SetFrameLevel(close:GetFrameLevel() + 1)
|
close:SetFrameLevel(close:GetFrameLevel() + 1)
|
||||||
close:EnableMouse(true)
|
|
||||||
S:HandleCloseButton(close)
|
S:HandleCloseButton(close)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user