From 415f7574d14cb366b63eb96464474e67d866d8ef Mon Sep 17 00:00:00 2001 From: shagu Date: Mon, 20 Sep 2021 11:08:15 +0200 Subject: [PATCH] chat-tweaks: enable mousewheel and sticky chat --- README.md | 3 +++ ShaguTweaks.toc | 1 + mods/chat-tweaks.lua | 52 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 mods/chat-tweaks.lua diff --git a/README.md b/README.md index 7476ac3..32cfcc5 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,9 @@ Every of the listed features below, can be completely disabled in that menu in c - **Chat Hyperlinks** *Copy website URLs from the chat, transforms CLINKs into real items and handles quest links.* +- **Chat Tweaks** + *Allows to scroll using the mouse wheel and enables sticky chat channels.* + - **Darkened UI** *Turns the entire interface into darker colors.* diff --git a/ShaguTweaks.toc b/ShaguTweaks.toc index 263ffbf..71b6392 100644 --- a/ShaguTweaks.toc +++ b/ShaguTweaks.toc @@ -53,3 +53,4 @@ mods\auto-dismount.lua mods\auto-stance.lua mods\tooltip-details.lua mods\hide-errors.lua +mods\chat-tweaks.lua diff --git a/mods/chat-tweaks.lua b/mods/chat-tweaks.lua new file mode 100644 index 0000000..02805c2 --- /dev/null +++ b/mods/chat-tweaks.lua @@ -0,0 +1,52 @@ +local _G = _G or getfenv(0) +local scrollspeed = 1 + +local module = ShaguTweaks:register({ + title = "Chat Tweaks", + description = "Allows to scroll using the mouse wheel and enables sticky chat channels.", + enabled = true, +}) + +local function ChatOnMouseWheel() + if arg1 > 0 then + if IsShiftKeyDown() then + this:ScrollToTop() + else + for i=1, scrollspeed do + this:ScrollUp() + end + end + elseif arg1 < 0 then + if IsShiftKeyDown() then + this:ScrollToBottom() + else + for i=1, scrollspeed do + this:ScrollDown() + end + end + end +end + +module.enable = function(self) + -- enable sticky chat types + ChatTypeInfo.WHISPER.sticky = 1 + ChatTypeInfo.OFFICER.sticky = 1 + ChatTypeInfo.RAID_WARNING.sticky = 1 + ChatTypeInfo.CHANNEL.sticky = 1 + + for i=1, NUM_CHAT_WINDOWS do + -- enable mouse wheel scrolling + _G["ChatFrame" .. i]:EnableMouseWheel(true) + _G["ChatFrame" .. i]:SetScript("OnMouseWheel", ChatOnMouseWheel) + + -- hide buttons + --_G["ChatFrame" .. i .. "UpButton"]:Hide() + --_G["ChatFrame" .. i .. "UpButton"].Show = function() return end + --_G["ChatFrame" .. i .. "DownButton"]:Hide() + --_G["ChatFrame" .. i .. "DownButton"].Show = function() return end + --_G["ChatFrame" .. i .. "BottomButton"]:Hide() + --_G["ChatFrame" .. i .. "BottomButton"].Show = function() return end + --_G["ChatFrameMenuButton"]:Hide() + --_G["ChatFrameMenuButton"].Show = function() return end + end +end