diff --git a/CompactChatFrame.toc b/CompactChatFrame.toc new file mode 100644 index 0000000..7c9b4ea --- /dev/null +++ b/CompactChatFrame.toc @@ -0,0 +1,7 @@ +## Interface: 11302 +## Title: Compact Chat Frame +## Author: coolmodi +## Notes: Shortens channel names to the uppercase letters, removes zone name, puts editbox on top and unclamps chat frame. +## Version: 1.0 + +main.lua \ No newline at end of file diff --git a/README.md b/README.md index f39fc99..8c5cc81 100644 --- a/README.md +++ b/README.md @@ -1 +1,18 @@ -# CompactChatFrame \ No newline at end of file +A super small addon that: + +* Shortens channel names down to their uppercase letters. +* Removes zone names from general and local defense. +* Positions editbox on top of chat frames. +* Makes chat frame freely movable to position it right at the border of the screen + +>[1. General - The Barrens] [coolmodi]: I like turtles + +>[4. LookingForGroup] [coolmodi]: Need friends + +becomes + +>[1. G] [coolmodi]: I like turtles + +>[4. LFG] [coolmodi]: Need friends + +There's also the `/ccfreset` command to reset chat frame positions, in case you manage to put them off screen completely. By default resets the default chat frame, `/ccfreset 2` would reset the second chat frame. \ No newline at end of file diff --git a/main.lua b/main.lua new file mode 100644 index 0000000..e545729 --- /dev/null +++ b/main.lua @@ -0,0 +1,36 @@ +-- Unclamp chat frames and put editbox on top +for i=1, NUM_CHAT_WINDOWS, 1 do + local cf = _G["ChatFrame"..i]; + cf:SetClampedToScreen(false); + cf.editBox:ClearAllPoints(); + cf.editBox:SetPoint("BOTTOMLEFT", cf, "TOPLEFT", -5, 5); + cf.editBox:SetPoint("BOTTOMRIGHT", cf, "TOPRIGHT", 5, 5); +end + +-- Shorten channel names. +-- This particular function is only used for outputting names in chat, so it has no side effects. +local origfunc = ChatFrame_ResolvePrefixedChannelName; +function ChatFrame_ResolvePrefixedChannelName(communityChannel) + local channelName = origfunc(communityChannel); + + if channelName:find("%u") then + local start = channelName:find("-"); + if start then + channelName = channelName:sub(1, start-2); + end + return channelName:gsub("%l", ""); + end + + return channelName; +end + +-- Every command has it's history... +SLASH_CCFSLASH1 = "/ccfreset"; +SlashCmdList["CCFSLASH"] = function(arg) + local argnum = tonumber(arg); + if argnum == nil or argnum > NUM_CHAT_WINDOWS then + argnum = 1; + end + _G["ChatFrame"..argnum]:ClearAllPoints(); + _G["ChatFrame"..argnum]:SetPoint("BOTTOMLEFT", UIParent, 100, 100); +end; \ No newline at end of file