|
||||||
| Lua Code Discussion You scared? Terrified. Mortified. Petrified. Stupefied... by [coding]. | ||||||
![]() |
|
|
Thread Tools |
|
|
#1 |
|
Senior Member
Join Date: Aug 2005
Posts: 368
|
In the new patch 3.3.5 the chat tabs don't go totally invisible. Is there a way to make them work like they used to thru some API function?
|
|
|
|
|
|
#2 |
|
Seal Cub Clubbing Club
Join Date: May 2005
Location: California, US
Posts: 7,760
|
I spent some time last night fixing the 3.3.5 chat frame to look and act more like the chat frame we've all been using just fine for the last 5 years. You can see the results in the latest beta for PhanxChat over on WoWI, but here are the relevant code bits:
1. Overwrite some globals: Code:
CHAT_FRAME_FADE_OUT_TIME = 0 -- Seconds to wait before fading out chat frames the mouse moves out of. -- Default is 2. CHAT_TAB_HIDE_DELAY = 0 -- Seconds to wait before fading out chat tabs the mouse moves out of. -- Default is 1. CHAT_FRAME_TAB_SELECTED_MOUSEOVER_ALPHA = 1 CHAT_FRAME_TAB_SELECTED_NOMOUSE_ALPHA = 0 -- Opacity of the currently selected chat tab. -- Defaults are 1 and 0.4. CHAT_FRAME_TAB_ALERTING_MOUSEOVER_ALPHA = 1 CHAT_FRAME_TAB_ALERTING_NOMOUSE_ALPHA = 0 -- Opacity of currently alerting chat tabs. -- Defaults are 1 and 1. CHAT_FRAME_TAB_NORMAL_MOUSEOVER_ALPHA = 1 CHAT_FRAME_TAB_NORMAL_NOMOUSE_ALPHA = 0 -- Opacity of non-selected, non-alerting chat tabs. -- Defaults are 0.6 and 0.2. Code:
local noop = function() return end
for i = 1, 10 do
local tab = _G[("ChatFrame%dTab"):format(i)]
tab.noMouseAlpha = 0
FCFTab_UpdateAlpha(_G[("ChatFrame%d"):format(i)])
tab.leftSelectedTexture:SetAlpha(0)
tab.rightSelectedTexture:SetAlpha(0)
tab.middleSelectedTexture:SetAlpha(0)
tab.leftHighlightTexture:SetTexture(nil)
tab.rightHighlightTexture:SetTexture(nil)
tab.middleHighlightTexture:SetTexture([[Interface\PaperDollInfoFrame\UI-Character-Tab-Highlight]])
tab.middleHighlightTexture:SetWidth(76)
tab.middleHighlightTexture.SetVertexColor = noop
end
Code:
for i = 1, 10 do
local editBox = _G[("ChatFrame%dEditBox"):format(i)]
_G[("ChatFrame%sEditBoxLeft"):format(i)]:SetAlpha(0)
_G[("ChatFrame%sEditBoxRight"):format(i)]:SetAlpha(0)
_G[("ChatFrame%sEditBoxMid"):format(i)]:SetAlpha(0)
editBox.focusLeft:SetTexture([[Interface\ChatFrame\UI-ChatInputBorder-Left2]])
editBox.focusRight:SetTexture([[Interface\ChatFrame\UI-ChatInputBorder-Right2]])
editBox.focusMid:SetTexture([[Interface\ChatFrame\UI-ChatInputBorder-Mid2]])
end
Code:
FriendsMicroButton:SetScript("OnShow", FriendsMicroButton.Hide)
FriendsMicroButton:Hide()
GeneralDockManagerOverflowButton:SetScript("OnShow", GeneralDockManagerOverflowButton.Hide)
GeneralDockManagerOverflowButton:Hide()
Code:
local anchorPoints = { "TopLeft", "TopRight", "BottomLeft", "BottomRight", "Top", "Right", "Left", "Bottom" }
local function ChatFrame_StartResizing(self)
local chatFrame = self:GetParent()
if chatFrame.isLocked then return end
if chatFrame.isDocked and chatFrame ~= DEFAULT_CHAT_FRAME then return end
chatFrame.resizing = 1
chatFrame:StartSizing(self.anchorPoint)
end
local function ChatFrame_StopResizing(self)
local chatFrame = self:GetParent()
chatFrame:StopMovingOrSizing()
if chatFrame == DEFAULT_CHAT_FRAME then
FCF_DockUpdate()
end
chatFrame.resizing = nil
end
local oldSetChatWindowLocked = SetChatWindowLocked
function SetChatWindowLocked(index, locked, ...)
local f = _G["ChatFrame" .. index]
for _, v in ipairs(anchorPoints) do
local k = "resize" .. v
if f[k] then
f[k]:EnableMouse(not locked)
end
end
return oldSetChatWindowLocked(index, locked, ...)
end
for i = 1, 10 do
local f = _G[("ChatFrame%d"):format(i)]
if not f.resizeTopLeft then
f.background = _G[("ChatFrame%dBackground"):format(i)]
for _, v in ipairs(anchorPoints) do
local k = "resize" .. v
f[k] = CreateFrame("Button", "ChatFrame" .. i .. "Resize" .. v, f)
f[k].anchorPoint = v:upper()
f[k]:SetWidth(16)
f[k]:SetHeight(16)
f[k]:SetScript("OnMouseDown", ChatFrame_StartResizing)
f[k]:SetScript("OnMouseUp", ChatFrame_StopResizing)
LowerFrameLevel(f[k])
end
f.resizeTopLeft:SetPoint("TOPLEFT", f.background, -2, 2)
f.resizeTopRight:SetPoint("TOPRIGHT", f.background, 2, 2)
f.resizeBottomLeft:SetPoint("BOTTOMLEFT", f.background, -2, -3)
f.resizeBottomRight:SetPoint("BOTTOMRIGHT", f.background, 2, -3)
f.resizeTop:SetPoint("LEFT", f.resizeTopLeft, "RIGHT", 0, 0)
f.resizeTop:SetPoint("RIGHT", f.resizeTopRight, "LEFT", 0, 0)
f.resizeRight:SetPoint("TOP", f.resizeTopRight, "BOTTOM", 0, 0)
f.resizeRight:SetPoint("BOTTOM", f.resizeBottomRight, "TOP", 0, 0)
f.resizeBottom:SetPoint("LEFT", f.resizeBottomLeft, "RIGHT", 0, 0)
f.resizeBottom:SetPoint("RIGHT", f.resizeBottomRight, "LEFT", 0, 0)
f.resizeLeft:SetPoint("TOP", f.resizeTopLeft, "BOTTOM", 0, 0)
f.resizeLeft:SetPoint("BOTTOM", f.resizeBottomLeft, "TOP", 0, 0)
end
local b = _G[("ChatFrame%dResizeButton"):format(i)]
b:SetScript("OnShow", b.Hide)
b:Hide()
end
__________________
& Author/maintainer of Grid, PhanxChat, and many more. | PM me on CurseForge Troubleshoot an addon | Turn any code into an addon | More addon resources Need help with your code? Attach or paste your whole, real files. Please don't PM me about addon bugs, requests, or code help. Post a comment, ticket, or thread instead! |
|
|
|
|
|
#3 |
|
Legendary Member
Join Date: Nov 2006
Posts: 2,868
|
If this goes beyond chat tabs, then i'll add a couple
Allow the chatframe to be moved flush with the left and bottom sides of the screen. Code:
for i = 1, 10 do
local cf = _G[("ChatFrame%d"):format(i)]
cf:SetClampRectInsets(0,0,0,0)
end
Hide the new button area of the chatframe while keeping the buttons Code:
for i = 1, 10 do
local cf = _G[("ChatFrame%d"):format(i)]
_G[("ChatFrame%dButtonFrameUpButton"):format(i)]:SetParent(cf)
_G[("ChatFrame%dButtonFrameDownButton"):format(i)]:SetParent(cf)
_G[("ChatFrame%dButtonFrameBottomButton"):format(i)]:SetParent(cf)
_G[("ChatFrame%dButtonFrame"):format(i)]:Hide()
end
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Aug 2005
Posts: 368
|
Nice info. Thanks
Last edited by Galvin; 05-23-2010 at 06:54 AM. |
|
|
|
|
|
#5 |
|
Full Member
Join Date: Sep 2008
Posts: 181
|
Really unrelated question, but is the format version of this a lot more efficient or something?
Code:
_G[("ChatFrame%d"):format(i)]
Code:
_G["ChatFrame" .. i] |
|
|
|
|
|
#6 |
|
Wiki Master
Join Date: Feb 2005
Posts: 5,085
|
|
|
|
|
|
|
#7 |
|
Seal Cub Clubbing Club
Join Date: May 2005
Location: California, US
Posts: 7,760
|
Theoretically, I think so, but in practice you'd have to do it some really huge number of times before you saw an actual difference.
__________________
& Author/maintainer of Grid, PhanxChat, and many more. | PM me on CurseForge Troubleshoot an addon | Turn any code into an addon | More addon resources Need help with your code? Attach or paste your whole, real files. Please don't PM me about addon bugs, requests, or code help. Post a comment, ticket, or thread instead! |
|
|
|
|
|
#8 | |
|
Amazing Member
Join Date: Aug 2008
Posts: 1,316
|
Quote:
To fix the OnLoad problem, hook the FCF_RestorePositionAndDimensions function and reset the clamp insets
__________________
author of things use the search button! |
|
|
|
|
|
|
#9 |
|
Amazing Member
Join Date: Feb 2005
Posts: 1,076
|
Not for concatenating a single number; multiple ".." operations in a single statement are handled by a single operation. If you had multiple %-directives that needed to be handled, or something more complicated than %d, then yes. For (9 times out of 10) a single digit, the full-court-press string.format is a bit of an overkill. You wouldn't see a noticeable slowdown either though with only 10 loops, so pick your favorite flavor.
|
|
|
|
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
|
|
All times are GMT. The time now is 02:59 PM.
WowAce Forums






