local BFChat = LibStub('AceAddon-3.0'):GetAddon('BigFootChat') local L = LibStub("AceLocale-3.0"):GetLocale("BigFootChat") local MODNAME = "CHATFRAME" local BFChatFrame = BFChat:NewModule(MODNAME) local BFC_NUM_TAB=7 local chatchannelframe={} local buttonTemplate local ChatFrameEditBox local db local defaults = { profile = { enablechatchannel=false, enablechatchannelmove=false } } local BFC_TABS={ {text=L.Say,tabtype="/s ",texture="say"}, {text=L.PartyShort,tabtype="/p ",texture="party"}, {text=L.RaidShort,tabtype="/raid ",texture="raid"}, {text=L.BattleGroundShort,tabtype="/bg ",texture="battleground"}, {text=L.GuildShort,tabtype="/g ",texture="guild"}, {text=L.YellShort,tabtype="/y ",texture="yell"}, {text=L.WhisperToShort,tabtype="/w ",texture="whisper"}, {text=L.OfficerShort,tabtype="/o ",texture="officer"}, {text=L.BigFootShort,tabtype= nil,texture= nil}, } local optGetter, optSetter do local mod = BFChatFrame function optGetter(info) local key = info[#info] return db[key] end function optSetter(info, value) local key = info[#info] db[key] = value mod:Refresh() end end local options local getOptions=function() if not options then options={ type = "group", name = L["ChatFrame"], arg = MODNAME, get = optGetter, set = optSetter, args = { intro = { order = 1, type = "description", name = L["Fast chat channel provides you easy access to different channels"], }, enablechatchannel = { order = 2, type = "toggle", name = L["Enable channel buttons"], get = function() return BFChat:GetModuleEnabled(MODNAME) end, set = function(info, value) BFChat:SetModuleEnabled(MODNAME, value) end, width = full, }, } } end return options end function getBigFootChannel() local channelList = {GetChannelList()} local i,channel for i,channel in pairs(channelList) do if channel == L.BigFootChannel then return channelList[i-1] end end return nil end function BFC_SetChatType(_type) if _type then ChatEdit_HandleChatType(ChatFrameEditBox,"",_type) ChatFrameEditBox:Show(); ChatFrameEditBox:SetFocus(); ChatFrameEditBox:SetText(_type); else local bfChannel = getBigFootChannel() if bfChannel then bfChannel = "/"..bfChannel .." " ChatEdit_HandleChatType(ChatFrameEditBox,"",bfChannel) ChatFrameEditBox:Show(); ChatFrameEditBox:SetFocus(); ChatFrameEditBox:SetText(bfChannel); end end ChatEdit_OnSpacePressed(ChatFrameEditBox) end local function createChatTab(BigFootChat_e6955c64cf39bdb23dc86de1a9ec2117,BigFootChat_6d5e7d83d8358745ae4dcf61d16bd1f3,BigFootChat_9248008bbb6d0ee7ce13f6ee45680051,index) local chatTab=_G["BFCChatTab"..index] if not chatTab then chatTab=CreateFrame("Button","BFCChatTab"..index,UIParent,"BFCChatTabTemplate") chatTab.type=BigFootChat_6d5e7d83d8358745ae4dcf61d16bd1f3 chatTab.text=BigFootChat_e6955c64cf39bdb23dc86de1a9ec2117 _G[chatTab:GetName().."Text"]:SetText(chatTab.text) end if (index ==1) then chatTab:SetPoint("LEFT",_G.BFCIconFrameCalloutButton,"RIGHT",1,0) else chatTab:SetPoint("LEFT",_G["BFCChatTab"..(index-1)],"RIGHT",1,0) end chatTab:Show() return chatTab end function BFChatFrame:OnInitialize() self.db = BFChat.db:RegisterNamespace(MODNAME, defaults) db = self.db.profile self:SetEnabledState(BFChat:GetModuleEnabled(MODNAME)) BFChat:RegisterModuleOptions(MODNAME, getOptions, L["ChatFrame"]) ChatFrameEditBox = _G.ChatFrameEditBox or _G.ChatFrame1EditBox end function BFChatFrame:Refresh() end function BFChatFrame:OnEnable() chatchannelframe={} local i=0 for BigFootChat_63a9ce6f1eeac72ef41293b7d0303335,BigFootChat_8d0644c92128c1ff68223fd74ba63b56 in pairs(BFC_TABS) do i=i+1 tinsert(chatchannelframe,createChatTab(BigFootChat_8d0644c92128c1ff68223fd74ba63b56.text,BigFootChat_8d0644c92128c1ff68223fd74ba63b56.tabtype,BigFootChat_8d0644c92128c1ff68223fd74ba63b56.texture,i)) end local _point,rel,relp,xo,yo=ChatFrameEditBox:GetPoint() ChatFrameEditBox:SetPoint(_point,rel,relp,xo,yo-30) BFCChatFrame:Show() self:Refresh() end function BFChatFrame:OnDisable() local _point,rel,relp,xo,yo=ChatFrameEditBox:GetPoint() ChatFrameEditBox:SetPoint(_point,rel,relp,xo,yo+30) for BigFootChat_63a9ce6f1eeac72ef41293b7d0303335,BigFootChat_8d0644c92128c1ff68223fd74ba63b56 in pairs(chatchannelframe) do BigFootChat_8d0644c92128c1ff68223fd74ba63b56:ClearAllPoints() BigFootChat_8d0644c92128c1ff68223fd74ba63b56:Hide() end self:Refresh() end 
