WoWInterface SVN ChatEdit

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk
    from Rev 4 to Rev 3
    Reverse comparison

Rev 4 → Rev 3

ChatEdit/ChatEdit.xml
17,13 → 17,13
ChatEdit:Hide()
</OnEscapePressed>
<OnMouseDown>
ChatEdit:OnMouseDown(self)
ChatEdit:OnMouseDown()
</OnMouseDown>
<OnMouseUp>
ChatEdit:OnMouseUp(self)
ChatEdit:OnMouseUp()
</OnMouseUp>
<OnHide>
ChatEdit:OnHide(self)
ChatEdit:OnHide()
</OnHide>
</Scripts>
<FontString inherits="GameFontHighlightSmall"/>
32,110 → 32,14
<Frames>
<!-- Used for hidden scroll offset measurement -->
<MessageFrame name="$parentMessageFrame" setAllPoints="true" enableMouse="false" hidden="true"/>
<Frame name="$parentScrollUp">
<Size>
<AbsDimension y="10"/>
</Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset>
<AbsDimension x="-2" y="3"/>
</Offset>
</Anchor>
<Anchor point="TOPRIGHT" relativeTo="$parent" relativePoint="TOPRIGHT">
<Offset>
<AbsDimension x="2" y="3"/>
</Offset>
</Anchor>
</Anchors>
<!--
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentBackground" urgency="5" file="Interface\ChatFrame\ChatFrameBackground">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMRIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
-->
</Frame>
<Frame name="$parentScrollDown">
<Size>
<AbsDimension y="10"/>
</Size>
<Anchors>
<Anchor point="BOTTOMLEFT" relativeTo="$parent" relativePoint="BOTTOMLEFT">
<Offset>
<AbsDimension x="-2" y="-4"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMRIGHT">
<Offset>
<AbsDimension x="2" y="-4"/>
</Offset>
</Anchor>
</Anchors>
<!--
<Layers>
<Layer level="BACKGROUND">
<Texture name="$parentBackground" urgency="5" file="Interface\ChatFrame\ChatFrameBackground">
<Anchors>
<Anchor point="TOPLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMLEFT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
<Anchor point="BOTTOMRIGHT">
<Offset>
<AbsDimension x="0" y="0"/>
</Offset>
</Anchor>
</Anchors>
</Texture>
</Layer>
</Layers>
-->
</Frame>
</Frames>
<Scripts>
<OnLoad>
ChatEdit:OnLoad(self)
</OnLoad>
<!--
<OnEvent>
ChatEdit:OnEvent(self, event)
</OnEvent>
-->
<OnSizeChanged>
ChatEdit:OnSizeChanged(self)
</OnSizeChanged>
ChatEdit/ChatEdit.lua
10,7 → 10,7
CHAT_EDIT_HOVER_SCROLL_TIMER = 1/10;
 
for i=1, 7 do
_G["ChatFrame"..i]:SetMaxLines(CHAT_EDIT_MAX_LINES);
getglobal("ChatFrame"..i):SetMaxLines(CHAT_EDIT_MAX_LINES);
end
 
local function Compare(x, y)
33,7 → 33,7
elseif (type(ChatEditScrollFrame.text) == "string") then
if (ChatEditScrollFrameEditBox:GetText() ~= ChatEditScrollFrame.text) then
ChatEditScrollFrameEditBox:SetText(ChatEditScrollFrame.text);
self.ignoreTextChange = 1; --This used to be 2, not sure why
self.ignoreTextChange = 2;
end
 
else
52,7 → 52,7
end
 
local name, fontSize, r, g, b, a, shown, locked, docked = GetChatWindowInfo(id);
local chatFrame = _G["ChatFrame"..id];
local chatFrame = getglobal("ChatFrame"..id);
ChatEditScrollFrame:SetParent(chatFrame);
ChatEditScrollFrame:SetAllPoints(chatFrame);
ChatEditScrollFrame:SetScrollChild(ChatEditScrollFrameEditBox);
99,8 → 99,8
-- SetFontObject, SetFont and SetText all trigger OnTextChanged. Ignore them any amount of times. 'ignore' still updates the rect.
self.ignoreTextChange = ignores;
 
self.hoverUp = ChatEditScrollFrameScrollUp
self.hoverDown = ChatEditScrollFrameScrollDown
self.hoverUp = getglobal(chatFrame:GetName().."ResizeTop")
self.hoverDown = getglobal(chatFrame:GetName().."ResizeBottom")
 
--/run for i=1111111000, 1111111040 do Portfolio.Print(i) end
end
141,7 → 141,7
end
 
function ChatEdit:HideNormalChat(id)
local chatFrame = _G["ChatFrame"..id];
local chatFrame = getglobal("ChatFrame"..id);
if (not self.CurrentScroll) then
self.CurrentScroll = {}
end
171,7 → 171,7
end
 
function ChatEdit:RestoreNormalChat(id)
local chatFrame = _G["ChatFrame"..id];
local chatFrame = getglobal("ChatFrame"..id);
if (self.CurrentScroll and self.CurrentScroll[id]) then
chatFrame:SetScrollOffset(self.CurrentScroll[id])
end
244,17 → 244,17
end
 
--[[
function ChatEdit.OnMouseWheel(self,direction)
function ChatEdit.OnMouseWheel()
if ( IsShiftKeyDown() ) then
if ( direction > 0 ) then
if ( arg1 > 0 ) then
ChatEditScrollFrame:ScrollToTop()
elseif ( direction < 0 ) then
elseif ( arg1 < 0 ) then
ChatEditScrollFrame:ScrollToBottom();
end
else
if ( direction > 0 ) then
if ( arg1 > 0 ) then
ChatEditScrollFrame:ScrollUp();
elseif ( direction < 0 ) then
elseif ( arg1 < 0 ) then
ChatEditScrollFrame:ScrollDown();
end
end
262,7 → 262,7
]]--
 
function ChatEdit:OnLoad(frame)
--frame:RegisterEvent("PLAYER_ENTERING_WORLD");
frame:RegisterEvent("PLAYER_ENTERING_WORLD");
local chatData = {}
for id=1, NUM_CHAT_WINDOWS do
-- init curr text storage
273,69 → 273,35
ScrollFrame_OnLoad(frame);
 
self.ignoreTextChange = 0;
 
ChatEdit:SetUpHooks();
end
 
function ChatEdit.ColorText(text, r, g, b, id)
function ChatEdit.ColorText(text, r, g, b)
local color = "|c"..format("FF%.2X%.2X%.2X", (r or 1) * 255, (g or 1) * 255, (b or 1) * 255);
text = gsub(text, "|r", color)
local colorPrefix = format("[%.2f,%.2f,%.2f,%s]", r, g, b, id or "")
text = colorPrefix..color..text.."|r"
text = color..text.."|r"
return text
end
 
-- after hook
-- Insert at the end, remove from the front
-- only store as many as are normally visible.
-- addToFront causes it to add to the front of the array, which is usually the oldest text (combat log does this)
function ChatEdit.ChatFrameAddMessage(self, text, r, g, b, lineID, addToFront)
-- only store as many as are normally visible
function ChatEdit.ChatFrameAddMessage(self, text, r, g, b, lineID)
local id = self:GetID()
if (type(text) ~= "string" and type(text) ~= "number") then
return
return;
end
local currentMax = getn(ChatEditScrollFrame.chatData[id])
if (addToFront) then
tinsert(ChatEditScrollFrame.chatData[id], 1, ChatEdit.ColorText(text, r, g, b))
if (currentMax > self:GetMaxLines()) then
tremove(ChatEditScrollFrame.chatData[id])
end
else
tinsert(ChatEditScrollFrame.chatData[id], ChatEdit.ColorText(text, r, g, b))
if (currentMax > self:GetMaxLines()) then
tremove(ChatEditScrollFrame.chatData[id], 1)
end
table.insert(ChatEditScrollFrame.chatData[id], ChatEdit.ColorText(text, r, g, b))
if (getn(ChatEditScrollFrame.chatData[id]) > self:GetMaxLines()) then
table.remove(ChatEditScrollFrame.chatData[id], 1)
end
end
 
-- after hook
-- Clear the message history
function ChatEdit.ChatFrameClear(self)
local id = self:GetID()
ChatEditScrollFrame.chatData[id] = {}
end
 
-- after hook
-- Truncate the message history
function ChatEdit.ChatFrameSetMaxLines(self, maxLines)
local id = self:GetID()
--[[ This would remove from the end, but we need to remove from the front
for i=maxLines+1, getn(ChatEditScrollFrame.chatData[id]) do
t[i] = nil;
end
]]--
local currentMax = getn(ChatEditScrollFrame.chatData[id])
if (currentMax > maxLines) then
ChatEditScrollFrame.chatData[id] = { unpack(ChatEditScrollFrame.chatData, currentMax-maxLines, currentMax) }
end
end
 
function ChatEdit.WorldFrameOnMouseDown(self, button)
if (button == "LeftButton" and IsShiftKeyDown()) then
function ChatEdit.WorldFrameOnMouseDown()
if (arg1 == "LeftButton" and IsShiftKeyDown()) then
local chatFrame;
for id=1, NUM_CHAT_WINDOWS do
chatFrame = _G["ChatFrame"..id];
if (chatFrame:IsVisible() and chatFrame:IsMouseOver()) then
chatFrame = getglobal("ChatFrame"..id);
if (chatFrame:IsVisible() and MouseIsOver(chatFrame)) then
ChatEdit:Show(id);
return;
end
343,7 → 309,7
end
 
if (ChatEditScrollFrame:IsVisible()) then
if (ChatEditScrollFrame:IsMouseOver()) then
if (MouseIsOver(ChatEditScrollFrame)) then
ChatEditScrollFrameEditBox:SetFocus(1);
else
ChatEdit:Hide()
357,8 → 323,6
local frame = _G["ChatFrame"..id];
-- hook AddMessage
hooksecurefunc(frame, "AddMessage", ChatEdit.ChatFrameAddMessage);
hooksecurefunc(frame, "Clear", ChatEdit.ChatFrameClear);
hooksecurefunc(frame, "SetMaxLines", ChatEdit.ChatFrameSetMaxLines);
end
 
if (type(WorldFrame:GetScript("OnMouseDown")) == "function") then
371,20 → 335,18
end
end
 
--[[
function ChatEdit:OnEvent(frame, event)
if (event == "PLAYER_ENTERING_WORLD") then
self:SetUpHooks()
end
end
]]--
 
function ChatEdit:OnSizeChanged(frame)
local name, fontSize, r, g, b, a, shown, locked, docked = GetChatWindowInfo(frame:GetParent():GetID());
function ChatEdit:OnSizeChanged()
local name, fontSize, r, g, b, a, shown, locked, docked = GetChatWindowInfo(this:GetParent():GetID());
if (docked) then
ChatEditScrollFrameEditBox:SetWidth(DEFAULT_CHAT_FRAME:GetWidth());
else
ChatEditScrollFrameEditBox:SetWidth(frame:GetWidth());
ChatEditScrollFrameEditBox:SetWidth(this:GetWidth());
end
if (self.newText) then
ChatEdit:ScrollToBottom();
401,7 → 363,7
end
 
function ChatEdit:OnUpdate()
if (self.hoverUp:IsMouseOver()) then
if (MouseIsOver(self.hoverUp)) then
if (not self.scrollTimer) then
self.scrollTimer = GetTime();
elseif (GetTime() > (self.scrollTimer + CHAT_EDIT_HOVER_SCROLL_TIMER)) then
410,7 → 372,7
self.scrollTimer = GetTime();
end
 
elseif (self.hoverDown:IsMouseOver()) then
elseif (MouseIsOver(self.hoverDown)) then
if (not self.scrollTimer) then
self.scrollTimer = GetTime();
elseif (GetTime() > (self.scrollTimer + CHAT_EDIT_HOVER_SCROLL_TIMER)) then
425,14 → 387,14
end
end
 
function ChatEdit:OnMouseDown(frame)
frame:SetScript("OnUpdate", function() ChatEdit:OnUpdate() end)
function ChatEdit:OnMouseDown()
this:SetScript("OnUpdate", function() ChatEdit:OnUpdate() end)
end
 
function ChatEdit:OnMouseUp(frame)
frame:SetScript("OnUpdate", nil)
function ChatEdit:OnMouseUp()
this:SetScript("OnUpdate", nil)
end
 
function ChatEdit:OnHide(frame)
frame:SetScript("OnUpdate", nil)
function ChatEdit:OnHide()
this:SetScript("OnUpdate", nil)
end
ChatEdit/ChatEdit.toc
1,12 → 1,13
## Interface: 40000
## Interface: 30100
## Title: ChatEdit
## Title-deDE: ChatErweiterung
## Notes: Select and copy chat directly from the frame and still click through it.
## Notes-deDE: Erlaubt es Text aus dem Chatfenster direkt zu kopieren.
## Author: AnduinLothar
## Version: 3.0
## X-Date: Jan 12 2010
## Version: 2.0
## X-Date: Oct 15 2008
## X-Category: Chat
## X-Website: http://www.wowinterface.com/downloads/info5438-ChatEdit.html
## X-CompatibleLocales: enUS, enGB, deDE, frFR, koKR, zhCN, zhTW, esES
## X-Embeds: SeaHooks
ChatEdit.xml