Compare with Previous | Blame | View Log
--HIDE VOICE CHAT BUTTONS (OR SKIN AND ADD OPTIONS FOR PLACEMENT/VISIBILITY --?--) local _, CC = ... --access to our personal global table CC.f = CreateFrame("Frame") --UPVALUES-- local gsub = gsub local strmatch = strmatch local channelNicks = CC.channelNicks local globalChannelNicks = CC.globalChannelNicks local timeFormat = CC.timeFormat local whisperfromText = strsub(CHAT_WHISPER_GET, 4) --isolate the localized bit from the %s local saysText = strsub(CHAT_SAY_GET, 4) local dummyfunc = function(self) self:Hide() end local OldAddMessages = {} --this is the prehook to :AddMessage() local function NewAddMessage(frame, msg, ...) msg = tostring(msg) or "" --add timestamp if enabled if CC.timeStamps then msg = format("%s %s", BetterDate(timeFormat, time()), msg) end --channel nicknames if CC.shortChannels then if strmatch(msg, "%d+%. .-|h") then for k,v in pairs(globalChannelNicks) do msg = gsub(msg, "|h"..k.."|h", "|h"..v.."|h", 1) end else for k,v in pairs(channelNicks) do --msg = gsub(msg, "|h["..k.."]|h", "|h"..v.."|h", 1) msg = gsub(msg, "|h%["..k.."]|h", "|h"..v.."|h", 1) end end --normal say messages msg = gsub(msg, "]|h "..saysText, "]|h: ", 1) --whispers msg = gsub(msg, "|h "..whisperfromText, "|h: ", 1) end --player names (remove brackets) msg = msg:gsub("(|Hplayer.-|h)%[(.-)%](|h)", "%1%2%3", 1) msg = msg:gsub("(|HBNplayer.-|h)%[(.-)%](|h)", "%1%2%3", 1) --change Away and Busy tags - revert to AFK and DND if CC.DND_AFK then msg = gsub(msg, CHAT_FLAG_DND, "<DND>", 1) msg = gsub(msg, CHAT_FLAG_AFK, "<AFK>", 1) end --after editing the message, send on through return OldAddMessages[frame](frame, msg, ...) end --minimize buttons local function AdjustMinimizeButtons(chatFrame, minB) minB:SetParent(chatFrame) minB.parent = chatFrame minB:ClearAllPoints() if chatFrame == ChatFrame2 then minB:SetPoint("BOTTOMRIGHT", CombatLogQuickButtonFrame_Custom, "TOPRIGHT", 0, 1) else minB:SetPoint("BOTTOMRIGHT", chatFrame, "TOPRIGHT", 23, 1) end minB:SetSize(24, 24) minB:SetScript("OnClick", function(self) local cf = self.parent FCF_MinimizeFrame(cf, strupper(cf.buttonSide)) end) minB.hooked = true end --skin each chat frame local CFskinned = {} local function SetUpWindow(frame) local chatFrame = _G[frame] if chatFrame and not CFskinned[frame] then local eb = _G[frame.."EditBox"] --allow for use of the arrow keys in the editbox without holding alt if CC.enableArrowKeys then eb:SetAltArrowKeyMode(false) end --again here for newly created ones chatFrame:SetClampRectInsets(0,0,0,0) --move editbox to top if CC.editboxTop then eb:ClearAllPoints() eb:SetPoint("BOTTOMLEFT", chatFrame, "TOPLEFT", -6, .5) eb:SetPoint("BOTTOMRIGHT", chatFrame, "TOPRIGHT", 29, .5) end --change editbox textures if not CC.editboxTexture then eb.focusLeft:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\UI-ChatInputBorderFocus-Left") eb.focusMid:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\UI-ChatInputBorderFocus-Mid") eb.focusRight:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\UI-ChatInputBorderFocus-Right") _G[frame.."EditBoxLeft"]:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\UI-ChatInputBorder-Left2") _G[frame.."EditBoxMid"]:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\UI-ChatInputBorder-Mid2") _G[frame.."EditBoxRight"]:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\UI-ChatInputBorder-Right2") end --change tab textures for being on bottom if CC.tabsBottom then local tabs = _G[frame.."Tab"] tabs.leftTexture:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\ChatFrameTab-BGLeft") tabs.middleTexture:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\ChatFrameTab-BGMid") tabs.rightTexture:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\ChatFrameTab-BGRight") tabs.leftSelectedTexture:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\ChatFrameTab-SelectedLeft") tabs.middleSelectedTexture:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\ChatFrameTab-SelectedMid") tabs.rightSelectedTexture:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\ChatFrameTab-SelectedRight") tabs.leftHighlightTexture:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\ChatFrameTab-HighlightLeft") tabs.middleHighlightTexture:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\ChatFrameTab-HighlightMid") tabs.rightHighlightTexture:SetTexture("Interface\\AddOns\\ChipperChat\\CHATFRAME\\ChatFrameTab-HighlightRight") end --move minimize button & hide button frame if not chatFrame.isDocked then AdjustMinimizeButtons(chatFrame, chatFrame.buttonFrame.minimizeButton) end hooksecurefunc("FCFDock_RemoveChatFrame", function(dock, chatFrame) --hook for those still docked local minB = chatFrame.buttonFrame.minimizeButton if not minB.hooked then AdjustMinimizeButtons(chatFrame, minB) end end) chatFrame.buttonFrame:Hide() chatFrame.buttonFrame:HookScript("OnShow", chatFrame.buttonFrame.Hide) --add ability to hold shift to jump to top/bottom when scrolling chatFrame:HookScript("OnMouseWheel", function(self, delta) if IsShiftKeyDown() then if delta > 0 then self:ScrollToTop() else self:ScrollToBottom() end end end) --add prehook to edit messages as they come through OldAddMessages[chatFrame] = chatFrame.AddMessage chatFrame.AddMessage = NewAddMessage --mark this frame off as being skinned already --if this function gets run for the same chat frame twice, bad things happen... CFskinned[frame] = true end end local function ChatTweaks() --remove sticky chat from these channels (back to old way - no more mistells) ChatTypeInfo["WHISPER"].sticky = CC.whisperSticky ChatTypeInfo["CHANNEL"].sticky = CC.channelSticky ChatTypeInfo["BN_WHISPER"].sticky = CC.BNwhisperSticky --hide general buttons ChatFrameMenuButton:Hide() QuickJoinToastButton:Hide() if CC.hideVoiceChat then ChatFrameChannelButton:Hide() ChatFrameToggleVoiceDeafenButton:Hide() ChatFrameToggleVoiceMuteButton:Hide() end --10 chat frames possible, according to NUM_CHAT_WINDOWS for i=1, NUM_CHAT_WINDOWS do local frame = format("ChatFrame%d", i) SetUpWindow(frame) end --hook this to skin/alter temporary whisper/conversation windows hooksecurefunc("FCF_SetTemporaryWindowType", function(chatFrame) SetUpWindow(chatFrame:GetName()) end) --timestamps control if CC.timeStamps then --this takes care of setting the CVar and everything else InterfaceOptionsSocialPanelTimestamps:SetValue("none") end -----ALL DIFFERENT IN 8.0----- --keep b.net toast frame on screen (it's aligned with the button frame, which we hide, not the chat frame) --[[if CC.moveToaster then local xoffset local BNToastFrame = BNToastFrame hooksecurefunc("BNToastFrame_UpdateAnchor", function() if BNToastFrame.buttonSide == "left" then xoffset = 5 else xoffset = -5 end BNToastFrame:ClearAllPoints() if BNToastFrame.topSide then BNToastFrame:SetPoint("BOTTOM"..BNToastFrame.buttonSide, ChatFrame1, "TOP"..BNToastFrame.buttonSide, xoffset, BN_TOAST_TOP_OFFSET) else BNToastFrame:SetPoint("TOP"..BNToastFrame.buttonSide, ChatFrame1, "BOTTOM"..BNToastFrame.buttonSide, xoffset, BN_TOAST_BOTTOM_OFFSET) end end) end]] --clean up (unregistered event and put function on garbage heap) CC.f:UnregisterEvent("PLAYER_ENTERING_WORLD") ChatTweaks = nil end --move to corners of screen again --in main chunk to change insets before chat frame position gets called by default UI --if the chat frame is placed before insets are changed, it will get bumped away from the edges again --SetMaxLines clears the chat frame, putting it here still lets us see GMotD, etc. --makes chat history longer (to scroll back farther) do for i=1, NUM_CHAT_WINDOWS do local f = _G["ChatFrame"..i] f:SetClampRectInsets(0,23,0,0) f:SetMaxLines(CC.chatHistory) end end --move chat tabs to the bottom --(in main chunk to catch chat frames that are undocked at load) if CC.tabsBottom then GeneralDockManager:ClearAllPoints() GeneralDockManager:SetPoint("TOPLEFT",ChatFrame1,"BOTTOMLEFT",0,2) GeneralDockManager:SetPoint("TOPRIGHT",ChatFrame1,"BOTTOMRIGHT",0,2) --on bottom for undocked chat frames also hooksecurefunc("FCF_SetTabPosition", function(chatFrame,x) local chatTab = _G[chatFrame:GetName().."Tab"]; chatTab:ClearAllPoints() chatTab:SetPoint("TOPLEFT", chatFrame:GetName().."Background", "BOTTOMLEFT", x+2, 10) end) end CC.f:RegisterEvent("PLAYER_ENTERING_WORLD") CC.f:SetScript("OnEvent", ChatTweaks)