vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 --[[
2 Tell Track
3  
4 By AnduinLothar, sarf & Lash
5  
6 This mod allows you to keep track of people you have had whisper conversations with.
7  
8 Thanks goes to Lash for the idea, support and the development of the XML file
9 (as well as providing acceleration to the rear end of sarf).
10 Remember, only Lash prevented your CPU from suffering from loops galore!
11  
12 CosmosUI URL:
13 http://www.cosmosui.org/
14  
15 Change Log:
16 v1.1 (2/11/05) - Taken Over by AnduinLothar:
17 -The newest whisper appears on the bottom and TellTrack auto-scrolls when updated.
18 -Also added a "Delete All" option to the right-click menu.
19 -Now monitors incomming whispers and adds their sender to the list.
20 -If they were the last one to whisper their name is red. If you whispered last their name is green.
21 -Added /re or /retell slash commands to whisper the last person you whispered.
22 -Made retell bindable too. (I use shift-r)
23 -Works w/o cosmos now.
24 v1.2 (2/15/05)
25 -TellTrack is now resizable! Drag the bottom right corner. Remade button graphics to stretch correctly.
26 -Added ability to extend up to 20 or down to 2 visible names.
27 -List is now invertable "/telltrackinvert" or use cosmos options or right-click menu (cosmos only).
28 -Bugfix for variable saving for non-cosmos users.
29 v1.21 (2/15/05)
30 -Updated the toc version number to 4211.
31 -Updated the right-click menu height
32 v1.22 (2/15/05)
33 -Compressed images.
34 -Made image alpha layers compatible with UI transparency (TransNUI)
35 v1.23 (2/19/05)
36 -Fixed name length trunkating.
37 -Fixed right-click indexing and menu problems.
38 -Added resize tooltip.
39 -Optimized the arrow buttons code.
40 -Fixed a rare bug where if you closed TellTrack while resizing or moving you couldn't click on anything.
41 -Tooltip now scales correctly (set parent to UIParent)
42 v1.24 (2/21/05)
43 -Fixed too many buttons showing onload.
44 -Fixed unhooking issue with Sky.
45 -Fixed reseting offset on Cosmos options cancil and login/reload.
46 v1.25 (2/21/05)
47 -Fixed Resize bug with too many buttons showing
48 v1.3 (3/25/05)
49 -Updated TOC to 1300
50 -Fixed RMB Menu to use Earth instead of the obsolete Cosmos Menu
51 -French Localization by Elzix and Sasmira
52 -Fixed Wrong Faction Detected
53 v1.4 (7/25/05)
54 -Updated TOC to 1600
55 -Added Khaos Configuration Support
56 -Added Visibility Options Support
57 -Added Sky Slash command Support
58 -Fixed TellTrack not showing onload.
59 v1.5 (8/2/05)
60 -Added Shift-Click 'Who'
61 -Added Alt-Click group invitation
62 -Added Control-Click add to friends list
63 -Added (Optional) Whisper Conversation Issolation
64 (first click shows conversation, second click whispers)
65 -Fixed inverted auto-scrolls on button update
66 -Added list auto-scrolls for outgoing whispers.
67 -If whisper frame is visible, 'enter' initiates a whisper
68 -If there is not current conversation issolation defaults to off
69 -When whisper frame is not visible a number on the TellTrack frame indicates the number of unread whipers from each person
70 -Added option to not store list between login
71 -Added VisibilityOptions for TellTrack Border/ScrollButtons
72 -Auto WhisperChatFrame Creation
73 -WhisperChatFrame saved for each realm/character
74 -Added option to hide all other whispers
75 -Added optional whisper frame time stamping
76 -Compatibility with ChatTimeStamp seperator and date options.
77 -Will utilize Clock value for time stamps if availible.
78 v1.51 (9/18/05)
79 -Fixed TellTrackTooltip nil bug.
80 v1.52 (10/05/05)
81 -Fixed a bug whispering players whose name started with a special character.
82 v1.6 (10/12/05)
83 -TOC updated to 1800
84 -updated to use chatFrame:Clear()
85 -Added 'Whisper First' option to open whisper on first click rather than view the chat log.
86 -Fix for capitalization bug which caused whisper frame to not show received messages under certain circumstances
87 v1.7 (11/13/05)
88 -German localization updated.
89 -Fixed the percentage issue
90 -Renamed TellTrack_AddWhipser to TellTrack_AddWhisper.
91 -Guilded and Sky whispers should now be hidden.
92 v1.71 (11/16/05)
93 -GuildAds should now be hidden.
94 -Fix: <GM> whispers will not be hidden
95 v1.8 (12/3/05)
96 -SlashCommands issolated all to the namespace: "/telltrack"
97 SubCommands: enabled, invert, dontsavelist, autowhisperframe, hidewhispers, timestamps, whisperfirst, clearall
98 -Added Limited Chinese support
99 -DropDownMenu no longer requires Earth
100 -Dragging will now be more snappy with a new OnDragStart technique.
101 v1.81 (1/2/06)
102 -Removed debug that was causing error w/o Sea
103 v1.9 (3/20/06)
104 -Fixed RegisterForSave bug
105 -Updated TOC to 11000
106 v1.91 (4/18/06)
107 -Fixed ancient resizing bug that showed the wrong number of buttons on new sessions.
108 v1.92 (8/22/06)
109 -Added Telepathy whisper ignores
110 -Updated toc to 11200
111  
112 ]]--
113  
114 -- Variables
115  
116 TellTrack_ButtonCount = 1;
117 TellTrack_TooltipSetId = 0;
118 TellTrack_Array = {};
119 TellTrack_ID = 0;
120 TellTrack_LastTell = nil;
121 TellTrack_ArrayMaxSize = 20;
122 TellTrack_ArrayOffset = 1;
123  
124 TellTrack_WhisperMessages = {};
125 TellTrack_WhisperChatFrame = {};
126 TellTrack_CurrentConversation = {name="",showAll=true};
127  
128 TellTrack_Cosmos_Registered = nil;
129 TellTrack_Khaos_Registered = nil;
130 TellTrack_Satellite_Registered = nil;
131  
132 local SavedSendChatMessage = nil;
133 local SavedFCF_SelectDockFrame = nil;
134 local SavedChatFrame_OpenChat = nil;
135 local SavedFCF_Close = nil;
136 local SavedFCF_OpenNewWindow = nil;
137  
138 SELECTED_CHAT_FRAME = DEFAULT_CHAT_FRAME;
139  
140 -- executed on load, calls general set-up functions
141 function TellTrack_OnLoad()
142 TellTrack_Register();
143 TellTrack_UpdateTellTrackButtonsText();
144  
145 if (Sea and Sea.util and Sea.util.hook) then
146 Sea.util.hook("SendChatMessage", "TellTrack_SendChatMessage", "before");
147 Sea.util.hook("FCF_SelectDockFrame", "TellTrack_FCF_SelectDockFrame", "after");
148 Sea.util.hook("ChatFrame_OpenChat", "TellTrack_ChatFrame_OpenChat", "replace");
149 Sea.util.hook("FCF_Close", "TellTrack_FCF_Close", "before");
150 Sea.util.hook("FCF_OpenNewWindow", "TellTrack_FCF_OpenNewWindow", "replace");
151 else
152 -- Hook the chat event handler 'before'
153 if (SendChatMessage ~= SavedSendChatMessage) then
154 SavedSendChatMessage = SendChatMessage;
155 SendChatMessage = TellTrack_SendChatMessage;
156 end
157  
158 -- Hook dock frame selection 'after'
159 if (FCF_SelectDockFrame ~= TellTrack_FCF_SelectDockFrame) then
160 SavedFCF_SelectDockFrame = FCF_SelectDockFrame;
161 FCF_SelectDockFrame = TellTrack_FCF_SelectDockFrame;
162 end
163  
164 -- Hook Open Chat to Open as whisper
165 if (ChatFrame_OpenChat ~= TellTrack_ChatFrame_OpenChat) then
166 SavedChatFrame_OpenChat = ChatFrame_OpenChat;
167 ChatFrame_OpenChat = TellTrack_ChatFrame_OpenChat;
168 end
169  
170 -- Hook Open Chat to Open as whisper
171 if (FCF_Close ~= TellTrack_FCF_Close) then
172 SavedFCF_Close = FCF_Close;
173 FCF_Close = TellTrack_FCF_Close;
174 end
175  
176 -- Hook Open Chat to Open as whisper
177 if (FCF_OpenNewWindow ~= TellTrack_FCF_OpenNewWindow) then
178 SavedFCF_OpenNewWindow = FCF_OpenNewWindow;
179 FCF_OpenNewWindow = TellTrack_FCF_OpenNewWindow;
180 end
181 end
182  
183 TellTrack_SlashSubCommandList = {
184 enabled = {func=function(msg) TellTrack_ChatCommandToggler(msg, TellTrack_Toggle_Enabled) end, help=TELLTRACK_CHAT_COMMAND_ENABLE_INFO};
185 invert = {func=function(msg) TellTrack_ChatCommandToggler(msg, TellTrack_Toggle_Inverted) end, help= TELLTRACK_CHAT_COMMAND_INVERT_INFO};
186 dontsavelist = {func=function(msg) TellTrack_ChatCommandToggler(msg, TellTrack_Toggle_DontSaveList) end, help= TELLTRACK_CHAT_COMMAND_DONTSAVELIST_INFO};
187 autowhisperframe = {func=function(msg) TellTrack_ChatCommandToggler(msg, TellTrack_Toggle_AutoWhisperFrame) end, help= TELLTRACK_CHAT_COMMAND_AUTOWHISPERFRAME_INFO};
188 hidewhispers = {func=function(msg) TellTrack_ChatCommandToggler(msg, TellTrack_Toggle_HideOtherWhispers) end, help= TELLTRACK_CHAT_COMMAND_HIDEOTHERWHISPERS_INFO};
189 timestamps = {func=function(msg) TellTrack_ChatCommandToggler(msg, TellTrack_Toggle_TimeStamps) end, help=TELLTRACK_CHAT_COMMAND_TIMESTAMPS_INFO};
190 whisperfirst = {func=function(msg) TellTrack_ChatCommandToggler(msg, TellTrack_Toggle_WhisperFirst) end, help=TELLTRACK_CHAT_COMMAND_WHISPERFIRST_INFO};
191 clearall = {func=TellTrack_Menu_DeleteAll, help=TELLTRACK_CHAT_COMMAND_CLEARALL_INFO};
192 };
193  
194 end
195  
196 function TellTrack_Register_Khaos()
197 local optionSet = {
198 id="TellTrack";
199 text=TELLTRACK_CONFIG_HEADER;
200 helptext=TELLTRACK_CONFIG_HEADER_INFO;
201 difficulty=1;
202 options={
203 {
204 id="Header";
205 text=TELLTRACK_CONFIG_HEADER;
206 helptext=TELLTRACK_CONFIG_HEADER_INFO;
207 type=K_HEADER;
208 difficulty=1;
209 };
210 {
211 id="TellTrackEnable";
212 type=K_TEXT;
213 text=TELLTRACK_ENABLED;
214 helptext=TELLTRACK_ENABLED_INFO;
215 callback=function(state) if (state.checked) then TellTrack_Toggle_Enabled(1) else TellTrack_Toggle_Enabled(0) end end;
216 feedback=function(state) if (state.checked) then return TELLTRACK_CHAT_ENABLED; else return TELLTRACK_CHAT_DISABLED; end end;
217 check=true;
218 --default={checked=TellTrack_Enabled};
219 default={checked=true};
220 disabled={checked=false};
221 };
222 {
223 id="TellTrackInvert";
224 type=K_TEXT;
225 text=TELLTRACK_INVERTED;
226 helptext=TELLTRACK_INVERTED_INFO;
227 callback=function(state) if (state.checked) then TellTrack_Toggle_Inverted(1) else TellTrack_Toggle_Inverted(0) end end;
228 feedback=function(state) if (state.checked) then return TELLTRACK_CHAT_INVERTED; else return TELLTRACK_CHAT_NORMALIZED; end end;
229 check=true;
230 --default={checked=TellTrack_InvertedList};
231 default={checked=false};
232 disabled={checked=false};
233 };
234 {
235 id="TellTrackDontSaveList";
236 type=K_TEXT;
237 text=TELLTRACK_DONTSAVELIST;
238 helptext=TELLTRACK_DONTSAVELIST_INFO;
239 callback=function(state) if (state.checked) then TellTrack_Toggle_DontSaveList(1) else TellTrack_Toggle_DontSaveList(0) end end;
240 feedback=function(state) if (state.checked) then return TELLTRACK_CHAT_DONTSAVELIST; else return TELLTRACK_CHAT_SAVELIST; end end;
241 check=true;
242 --default={checked=TellTrack_DontSaveList};
243 default={checked=false};
244 disabled={checked=false};
245 };
246 {
247 id="TellTrackAutoWhisperFrame";
248 type=K_TEXT;
249 text=TELLTRACK_AUTOWHISPERFRAME;
250 helptext=TELLTRACK_AUTOWHISPERFRAME_INFO;
251 callback=function(state) if (state.checked) then TellTrack_Toggle_AutoWhisperFrame(1) else TellTrack_Toggle_AutoWhisperFrame(0) end end;
252 feedback=function(state) if (state.checked) then return TELLTRACK_CHAT_AUTOWHISPERFRAME; else return TELLTRACK_CHAT_MANUALWHISPERFRAME; end end;
253 check=true;
254 --default={checked=TellTrack_AutoWhisperFrame};
255 default={checked=true};
256 disabled={checked=false};
257 };
258 {
259 id="TellTrackHideOtherWhispers";
260 type=K_TEXT;
261 text=TELLTRACK_HIDEOTHERWHISPERS;
262 helptext=TELLTRACK_HIDEOTHERWHISPERS_INFO;
263 callback=function(state) if (state.checked) then TellTrack_Toggle_HideOtherWhispers(1) else TellTrack_Toggle_HideOtherWhispers(0) end end;
264 feedback=function(state) if (state.checked) then return TELLTRACK_CHAT_HIDEOTHERWHISPERS; else return TELLTRACK_CHAT_SHOWOTHERWHISPERS; end end;
265 check=true;
266 --default={checked=TellTrack_HideOtherWhispers};
267 default={checked=false};
268 disabled={checked=false};
269 };
270 {
271 id="TellTrackTimeStamps";
272 type=K_TEXT;
273 text=TELLTRACK_TIMESTAMPS;
274 helptext=TELLTRACK_TIMESTAMPS_INFO;
275 callback=function(state) if (state.checked) then TellTrack_Toggle_TimeStamps(1) else TellTrack_Toggle_TimeStamps(0) end end;
276 feedback=function(state) if (state.checked) then return TELLTRACK_CHAT_TIMESTAMPS; else return TELLTRACK_CHAT_NOTIMESTAMPS; end end;
277 check=true;
278 --default={checked=TellTrack_TimeStamps};
279 default={checked=false};
280 disabled={checked=false};
281 };
282 {
283 id="TellTrackWhisperFirst";
284 type=K_TEXT;
285 text=TELLTRACK_WHISPERFIRST;
286 helptext=TELLTRACK_WHISPERFIRST_INFO;
287 callback=function(state) if (state.checked) then TellTrack_Toggle_WhisperFirst(1) else TellTrack_Toggle_WhisperFirst(0) end end;
288 feedback=function(state) if (state.checked) then return TELLTRACK_CHAT_WHISPERFIRST; else return TELLTRACK_CHAT_LOGFIRST; end end;
289 check=true;
290 --default={checked=TellTrack_TimeStamps};
291 default={checked=false};
292 disabled={checked=false};
293 };
294 };
295 };
296 Khaos.registerOptionSet(
297 "chat",
298 optionSet
299 );
300 TellTrack_Khaos_Registered = 1;
301 end
302  
303  
304 -- registers the mod with Cosmos
305 function TellTrack_Register_Cosmos()
306 Cosmos_RegisterConfiguration(
307 "COS_TELLTRACK",
308 "SECTION",
309 TELLTRACK_CONFIG_HEADER,
310 TELLTRACK_CONFIG_HEADER_INFO
311 );
312 Cosmos_RegisterConfiguration(
313 "COS_TELLTRACK_HEADER",
314 "SEPARATOR",
315 TELLTRACK_CONFIG_HEADER,
316 TELLTRACK_CONFIG_HEADER_INFO
317 );
318 Cosmos_RegisterConfiguration(
319 "COS_TELLTRACK_ENABLED",
320 "CHECKBOX",
321 TELLTRACK_ENABLED,
322 TELLTRACK_ENABLED_INFO,
323 TellTrack_Toggle_Enabled,
324 TellTrack_Enabled
325 );
326 Cosmos_RegisterConfiguration(
327 "COS_TELLTRACK_INVERTED",
328 "CHECKBOX",
329 TELLTRACK_INVERTED,
330 TELLTRACK_INVERTED_INFO,
331 TellTrack_Toggle_Inverted,
332 TellTrack_InvertedList
333 );
334 Cosmos_RegisterConfiguration(
335 "COS_TELLTRACK_DONTSAVELIST",
336 "CHECKBOX",
337 TELLTRACK_DONTSAVELIST,
338 TELLTRACK_DONTSAVELIST_INFO,
339 TellTrack_Toggle_DontSaveList,
340 TellTrack_DontSaveList
341 );
342 Cosmos_RegisterConfiguration(
343 "COS_TELLTRACK_AUTOWHISPERFRAME",
344 "CHECKBOX",
345 TELLTRACK_AUTOWHISPERFRAME,
346 TELLTRACK_AUTOWHISPERFRAME_INFO,
347 TellTrack_Toggle_AutoWhisperFrame,
348 TellTrack_AutoWhisperFrame
349 );
350 Cosmos_RegisterConfiguration(
351 "COS_TELLTRACK_TIMESTAMPS",
352 "CHECKBOX",
353 TELLTRACK_TIMESTAMPS,
354 TELLTRACK_TIMESTAMPS_INFO,
355 TellTrack_Toggle_TimeStamps,
356 TellTrack_TimeStamps
357 );
358 Cosmos_RegisterConfiguration(
359 "COS_TELLTRACK_WHISPERFIRST",
360 "CHECKBOX",
361 TELLTRACK_WHISPERFIRST,
362 TELLTRACK_WHISPERFIRST_INFO,
363 TellTrack_Toggle_WhisperFirst,
364 TellTrack_WhisperFirst
365 );
366  
367 TellTrack_Cosmos_Registered = 1;
368 end
369  
370 function TellTrack_Register_Satellite()
371 Satellite.registerSlashCommand(
372 {
373 id="TellTrack";
374 commands = {"/telltrack","/ttrack"};
375 onExecute = TellTrack_ChatCommandHandler;
376 helpText = TELLTRACK_CHAT_COMMAND_INFO;
377 }
378 );
379 Satellite.registerSlashCommand(
380 {
381 id="Retell";
382 commands = {"/re", "/retell"};
383 onExecute = TellTrack_WhisperToPreviousTarget;
384 helpText = BINDING_NAME_TELLTRACK_RETELL;
385 }
386 );
387 TellTrack_Satellite_Registered = 1;
388 end
389  
390 -- registers the mod with the system, integrating it with slash commands and "master" AddOns
391 function TellTrack_Register()
392 if (Khaos) then
393 if (not TellTrack_Khaos_Registered) then
394 TellTrack_Register_Khaos();
395 end
396 elseif (Cosmos_RegisterConfiguration) then
397 if (not TellTrack_Cosmos_Registered) then
398 TellTrack_Register_Cosmos();
399 end
400 end
401  
402  
403 if (Satellite) then
404 if (not TellTrack_Satellite_Registered) then
405 TellTrack_Register_Satellite();
406 end
407 else
408 SlashCmdList["TELLTRACK"] = TellTrack_ChatCommandHandler;
409 SLASH_TELLTRACK1 = "/telltrack";
410 SLASH_TELLTRACK2 = "/ttrack";
411 SlashCmdList["TELLTRACKRETELL"] = TellTrack_WhisperToPreviousTarget;
412 SLASH_TELLTRACKRETELL1 = "/re";
413 SLASH_TELLTRACKRETELL2 = "/retell";
414 end
415  
416 this:RegisterEvent("VARIABLES_LOADED");
417 this:RegisterEvent("CHAT_MSG_WHISPER");
418 this:RegisterEvent("CHAT_MSG_WHISPER_INFORM");
419 this:RegisterEvent("PLAYER_ENTERING_WORLD");
420  
421 if ( Eclipse ) then
422 --Set the ui section to be TellTrack if we have Khaos
423 local uisec = "TellTrack";
424 --If we don't have Khaos, then use the Cosmos section
425 if (not Khaos) then
426 uisec = "COS_TELLTRACK";
427 end
428 --Register with VisibilityOptions
429 Eclipse.registerForVisibility( {
430 name = "TellTrackFrame"; --The name of the config, in this case also the name of the frame
431 nototal = true; --This addon has an option to hide the frame already, so we don't need to register with total
432 uisec = uisec; --This puts the options, in the TellTrack section, it is not neccisary but helps to keep VisOpts section cleaner
433 uiname = TELLTRACK_CONFIG_HEADER; --This is the base name of this reg to display in the description and ui
434 slashcom = { "telltrack", "tt" }; --These are the slash commands
435 } );
436 Eclipse.registerForVisibility( {
437 name = "TellTrackBorder"; --The name of the config
438 frames = {"TellTrackFrameArrowUpButton", "TellTrackFrameArrowDownButton", "TellTrackFrameBackground"};
439 uisec = uisec; --This puts the options, in the TellTrack section, it is not neccisary but helps to keep VisOpts section cleaner
440 uiname = TELLTRACK_BORDER_CONFIG_HEADER; --This is the base name of this reg to display in the description and ui
441 slashcom = { "telltrackborder", "ttborder" }; --These are the slash commands
442 state = { show = true }; --Because the frame is not visible when registered, we need to let VisOpts know it should be visible
443 } );
444 else
445 if ( TransNUI_RegisterUI ) then
446 TransNUI_RegisterUI("TellTrackFrame", { "telltrack" }, TELLTRACK_CONFIG_TRANSNUI, TELLTRACK_CONFIG_TRANSNUI_INFO, 0);
447 end
448 if ( PopNUI_RegisterUI ) then
449 PopNUI_RegisterUI("TellTrackFrame", { "telltrack" }, {"TellTrack_Enabled", 1, true}, TELLTRACK_CONFIG_POPNUI, TELLTRACK_CONFIG_POPNUI_INFO);
450 end
451 end
452 end
453  
454 function TellTrack_ChatCommandToggler(msg, func)
455 if msg == nil then
456 msg = "";
457 end
458 msg = string.lower(msg);
459  
460 -- Toggle appropriately
461 if ( (string.find(msg, 'on')) or ((string.find(msg, '1')) and (not string.find(msg, '-1')) ) ) then
462 func(1);
463 else
464 if ( (string.find(msg, 'off')) or (string.find(msg, '0')) ) then
465 func(0);
466 else
467 func(-1);
468 end
469 end
470 end
471  
472 --Master Chat Command Handler
473 function TellTrack_ChatCommandHandler(msg)
474 local _, _, subcom, toggle = string.find(msg, "[ ]*(%w+)[ ]*(.*)");
475 if (subcom) then
476 subcom = strlower(subcom);
477 --Sea.io.print("TellTrack - ", subcom, " ", toggle);
478 else
479 TellTrack_ChatCommand_Help();
480 return;
481 end
482 if (TellTrack_SlashSubCommandList[subcom]) then
483 TellTrack_SlashSubCommandList[subcom].func(toggle);
484 else
485 TellTrack_ChatCommand_Help();
486 end
487 end
488  
489 function TellTrack_ChatCommand_Help()
490 TellTrack_Print (TELLTRACK_CHAT_QUESTION_MARK_INFO,1.0,1.0,0);
491 TellTrack_Print (TELLTRACK_CHAT_USE_INFO,1.0,1.0,0);
492 for subcom, info in TellTrack_SlashSubCommandList do
493 TellTrack_Print(subcom.." - ".. info.help,1.0,1.0,0);
494 end
495 end
496  
497 -- Does things with the hooked function
498 function TellTrack_SendChatMessage(text, type, language, target)
499 -- saves target for 'Retell' regardless of TellTrack_Enabled
500 target = TellTrack_Capitalize(target);
501 if ( type == "WHISPER" ) then
502 TellTrack_LastTell = target;
503 end
504 if ( TellTrack_Enabled == 1 ) then
505 if ( type == "WHISPER" ) then
506 -- prevent data message transfers from being used
507 if ( strsub(text, 1, 1) ~= "<" ) then
508 TellTrack_HandleMessageSentOrRecieved(target, false);
509 end
510 end
511 end
512 if (SavedSendChatMessage) then
513 SavedSendChatMessage(text, type, language, target);
514 end
515 end
516  
517 function TellTrack_Capitalize(text)
518 if (not text) then
519 return;
520 end
521 if( string.find(text, "^[a-zA-Z].*") ) then
522 text = strupper(strsub(text,1,1))..strlower(strsub(text,2));
523 else
524 text = strupper(strsub(text,1,2))..strlower(strsub(text,3));
525 end
526 return text;
527 end
528  
529 function TellTrack_startsWith(s, prefix)
530 local isAtBeginning = false;
531 if (type(s) == "string") and (type(prefix) == "string") then
532 if (s == prefix) then
533 isAtBeginning = true;
534 elseif ( string.len(s) > string.len(prefix) ) then
535 if( string.sub(s, 1, string.len(prefix)) == prefix ) then
536 isAtBeginning = true;
537 end
538 end
539 end
540 return isAtBeginning;
541 end
542  
543  
544 -- Handles events
545 function TellTrack_OnEvent(event)
546 if ( event == "VARIABLES_LOADED" ) then
547 local value = TellTrack_Enabled;
548 if ( TellTrack_Cosmos_Registered ) then
549 value = getglobal("COS_TELLTRACK_ENABLED_X");
550 TellTrack_InvertedList = getglobal("COS_TELLTRACK_INVERTED_X");
551 end
552 if (value == nil) then
553 -- defaults to off
554 value = 0;
555 end
556 if (TellTrack_InvertedList == nil) then
557 -- defaults to off
558 TellTrack_InvertedList = 0;
559 end
560 if (not TellTrack_WhisperChatFrame[GetRealmName()]) then
561 TellTrack_WhisperChatFrame[GetRealmName()] = {};
562 end
563 if (not TellTrack_Khaos_Registered) then
564 TellTrack_Toggle_Enabled(value);
565 end
566 if ( TellTrack_DontSaveList == 1 ) then
567 TellTrack_SavedList = {};
568 end
569 TellTrack_LoadNames();
570 --Initialize Menu
571 UIDropDownMenu_Initialize(TellTrackDropDown, TellTrackTextButton_InitializeMenuArray, "MENU");
572 elseif ( event == "PLAYER_ENTERING_WORLD" ) then
573 TellTrack_ModifyButtonCount(TellTrackFrame:GetHeight());
574 elseif ( event == "CHAT_MSG_WHISPER" ) or ( event == "CHAT_MSG_WHISPER_INFORM" ) then
575 --For some reason TellTrack_HookAllAddMessages doesn't work on VARIABLES_LOADED...
576 TellTrack_HookAllAddMessages();
577  
578 --Special Hidden Whisper Ignores
579 if ( IsAddOnLoaded("Sky") ) and (string.len(arg1) > 4) and (string.sub(arg1,1,4) == "<Sky") then
580 --Hide Sky messages
581 return;
582 elseif ( IsAddOnLoaded("Guilded") ) and (string.len(arg1) > 2) and (string.sub(arg1,1,2) == "<G") and ( (string.len(arg1) ~= 4) or (string.sub(arg1,1,4) ~= "<GM>") ) then
583 --Hide Guilded messages
584 return;
585 elseif ( IsAddOnLoaded("GuildAds") ) and (string.len(arg1) > 3) and (string.sub(arg1,1,3) == "<GA") then
586 --Hide GuildAds messages
587 return;
588 elseif ( IsAddOnLoaded("Telepathy") ) and (string.len(arg1) > 3) and (string.sub(arg1,1,3) == "<T>") then
589 --Hide Telepathy messages
590 return;
591 end
592  
593 local type = string.sub(event,10);
594 if ( event == "CHAT_MSG_WHISPER" ) then
595 TellTrack_HandleMessageSentOrRecieved(arg2, true, arg1);
596 end
597 local time;
598 if (Clock_GetTimeText) then
599 time = Clock_GetTimeText();
600 else
601 local hour, minute = GetGameTime();
602 time = {h=hour,m=minute};
603 end
604 local message = gsub(arg1, "%%", "%%%%");
605 table.insert(TellTrack_WhisperMessages, {type=type,name=arg2,msg=message,time=time, date=date()});
606 end
607 end
608  
609 function TellTrack_AddWhisper(chatFrame, text, name, type, time)
610 local info = ChatTypeInfo[type];
611 chatFrame:AddMessage(format(TEXT(getglobal("CHAT_"..type.."_GET"))..text, "|Hplayer:"..name.."|h".."["..name.."]".."|h"), info.r, info.g, info.b, info.id, time);
612 end
613  
614 function TellTrack_GetTimeStamp(time)
615 local separator = ">";
616 if (ChatTimeStamps_TimeStamp) and (not ChatTimeStamps_SEPARATOR) then
617 separator = "";
618 end
619 if (not time) then
620 if (ChatTimeStamps_LOCALTIME) then
621 time = date();
622 elseif (Clock_GetTimeText) then
623 time = Clock_GetTimeText();
624 else
625 local hour, minute = GetGameTime();
626 time = {h=hour,m=minute};
627 end
628 end
629 if (type(time) == "string") then
630 return time..separator.." ";
631 end
632  
633 if (time.h < 10) then
634 time.h = "0"..time.h;
635 end
636  
637 if (time.m < 10) then
638 time.m = "0"..time.m;
639 end
640 return time.h..":"..time.m..separator.." ";
641 end
642  
643 function TellTrack_ClearChatFrame(chatFrame)
644 chatFrame:Clear();
645 end
646  
647 function TellTrack_ShowConversationWith(name, showAll)
648 if (not TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]) then
649 if (TellTrack_AutoWhisperFrame) and (FCF_GetNumActiveChatFrames() < NUM_CHAT_WINDOWS ) then
650 TellTrack_CreateWhisperChatFrame();
651 else
652 return;
653 end
654 end
655 local WhisperFrame = getglobal(TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]);
656 TellTrack_CurrentConversation = {name=name,showAll=true};
657 TellTrack_ClearChatFrame(WhisperFrame);
658 TellTrack_CurrentConversation.showAll = showAll;
659 local found = 0;
660 --Display only the valid whispers.
661 for i, data in TellTrack_WhisperMessages do
662 if (showAll) or (data.name == name) then
663 if (ChatTimeStamps_LOCALTIME) then
664 TellTrack_AddWhisper(WhisperFrame, data.msg, data.name, data.type, data.date);
665 else
666 TellTrack_AddWhisper(WhisperFrame, data.msg, data.name, data.type, data.time);
667 end
668 found = found + 1;
669 end
670 end
671  
672 if (found == 0) then
673 TellTrack_CurrentConversation.showAll = true;
674 local timeStamp = TellTrack_TimeStamps;
675 TellTrack_TimeStamps = 0;
676 WhisperFrame:AddMessage(format(TELLTRACK_NO_CURRENT_CONVERSATION, name));
677 TellTrack_TimeStamps = timeStamp;
678 FCF_SetWindowName(WhisperFrame, TELLTRACK_WHISPER_FRAME_TITLE);
679 else
680 FCF_SetWindowName(WhisperFrame, name);
681 end
682  
683 -- Show the frame and tab
684 FCF_SelectDockFrame(WhisperFrame);
685 end
686  
687 function TellTrack_ShowAllWhispers()
688 TellTrack_ShowConversationWith(TellTrack_CurrentConversation.name, true);
689 end
690  
691 function TellTrack_WhisperChatFrame_AddMessage(this, text, r, g, b, id, time)
692 if (this:GetName() ~= TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]) then
693 -- incorrect whisper frame
694 SavedWhisperChatFrame_AddMessages[this:GetName()](this, text, r, g, b, id);
695 return;
696 end
697 local stamps = ChatTimeStamps_ENABLED;
698 ChatTimeStamps_ENABLED = 0;
699 if (strlen(text) < 5) then
700 SavedWhisperChatFrame_AddMessages[this:GetName()](this, text, r, g, b, id);
701 ChatTimeStamps_ENABLED = stamps;
702 return;
703 end
704 local timedText = text;
705 if (TellTrack_TimeStamps == 1) then
706 timedText = TellTrack_GetTimeStamp(time)..text;
707 end
708 if (not TellTrack_CurrentConversation) or (TellTrack_CurrentConversation.showAll) then
709 SavedWhisperChatFrame_AddMessages[this:GetName()](this, timedText, r, g, b, id);
710 ChatTimeStamps_ENABLED = stamps;
711 return;
712 end
713 local name = TellTrack_CurrentConversation.name;
714 if (TellTrack_startsWith(text, format(TEXT(getglobal("CHAT_WHISPER_GET")), "|Hplayer:"..name.."|h".."["..name.."]".."|h"))) or
715 (TellTrack_startsWith(text, format(TEXT(getglobal("CHAT_WHISPER_INFORM_GET")), "|Hplayer:"..name.."|h".."["..name.."]".."|h"))) then
716 SavedWhisperChatFrame_AddMessages[this:GetName()](this, timedText, r, g, b, id);
717 ChatTimeStamps_ENABLED = stamps;
718 return;
719 end
720 end
721  
722 function TellTrack_RedrawWhisperFrame()
723 if ( not GetRealmName() or not UnitName("player") ) then
724 return;
725 end;
726 if (not TellTrack_WhisperChatFrame[GetRealmName()] ) then
727 TellTrack_WhisperChatFrame[GetRealmName()] = {};
728 end
729 if (not TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]) then
730 return;
731 end
732 local WhisperFrame = getglobal(TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]);
733 local scrollOffset = WhisperFrame:GetCurrentScroll();
734 TellTrack_ClearChatFrame(WhisperFrame);
735 for i, data in TellTrack_WhisperMessages do
736 if (TellTrack_CurrentConversation.showAll) or (data.name == TellTrack_CurrentConversation.name) then
737 TellTrack_AddWhisper(WhisperFrame, data.msg, data.name, data.type, data.time);
738 end
739 end
740 WhisperFrame:SetScrollFromBottom(scrollOffset)
741 end
742  
743 function TellTrack_HookAllAddMessages()
744 if (SavedWhisperChatFrame_AddMessages) then
745 --Sea.io.print("Failed to set up TellTrack_WhisperChatFrame_AddMessage hooks.");
746 return;
747 end
748 SavedWhisperChatFrame_AddMessages = {};
749 local frameName = ""
750 for i=1, NUM_CHAT_WINDOWS do
751 frameName = "ChatFrame"..i;
752 if (getglobal(frameName).AddMessage ~= TellTrack_WhisperChatFrame_AddMessage) then
753 SavedWhisperChatFrame_AddMessages[frameName] = getglobal(frameName).AddMessage;
754 getglobal(frameName).AddMessage = TellTrack_WhisperChatFrame_AddMessage;
755 end
756 end
757 --Sea.io.print("Set up TellTrack_WhisperChatFrame_AddMessage hooks.");
758 end
759  
760 function TellTrack_ChatFrame_OpenChat(text, chatFrame)
761 if (text == "") and (SELECTED_CHAT_FRAME:GetName() == TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]) and (TellTrack_CurrentConversation) and (TellTrack_CurrentConversation.name) and (TellTrack_CurrentConversation.name ~= "") then
762 TellTrack_InitiateWhisperToTarget(TellTrack_CurrentConversation.name);
763 else
764 if (SavedChatFrame_OpenChat) then
765 SavedChatFrame_OpenChat(text, chatFrame);
766 else
767 return true;
768 end
769 end
770 end
771  
772 function TellTrack_FCF_OpenNewWindow(name)
773 if (TellTrack_HideOtherWhispers == 1) then
774 local temp, shown;
775 local newChatFrame = nil;
776 for i=1, NUM_CHAT_WINDOWS do
777 temp, temp, temp, temp, temp, temp, shown, temp = GetChatWindowInfo(i);
778 chatFrame = getglobal("ChatFrame"..i);
779 if ( (not shown and not chatFrame.isDocked) or (count == NUM_CHAT_WINDOWS) ) then
780 newChatFrame = chatFrame;
781 break;
782 end
783 end
784 if (SavedFCF_OpenNewWindow) then
785 SavedFCF_OpenNewWindow(name);
786 else
787 Sea.util.Hooks.FCF_OpenNewWindow.orig(name);
788 end
789 ChatFrame_RemoveMessageGroup(newChatFrame, "WHISPER");
790 else
791 if (SavedFCF_OpenNewWindow) then
792 SavedFCF_OpenNewWindow(name);
793 else
794 return true;
795 end
796 end
797 end
798  
799 function TellTrack_FCF_Close(chatFrame)
800 if ( not chatFrame ) then
801 chatFrame = FCF_GetCurrentChatFrame();
802 end
803 if (chatFrame:GetName() == TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]) then
804 TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")] = nil;
805 end
806 if (SavedFCF_Close) then
807 SavedFCF_Close(chatFrame);
808 else
809 return true, chatFrame;
810 end
811 end
812  
813 function TellTrack_FCF_SelectDockFrame(frame)
814 if (SavedFCF_SelectDockFrame ) then
815 SavedFCF_SelectDockFrame(frame);
816 end
817 if (frame:GetName() == TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")] ) then
818 if (TellTrack_CurrentConversation.showAll) then
819 for i = 1, TellTrack_ArrayMaxSize do
820 if (TellTrack_Array[i]) then
821 TellTrack_Array[i].unread = 0;
822 end
823 end
824 elseif (TellTrack_CurrentConversation.name ~= "") then
825 for i = 1, TellTrack_ArrayMaxSize do
826 if (TellTrack_Array[i]) and (TellTrack_Array[i].name == TellTrack_CurrentConversation.name) then
827 TellTrack_Array[i].unread = 0;
828 end
829 end
830 end
831 TellTrack_UpdateTellTrackButtonsText();
832 end
833 SELECTED_CHAT_FRAME = frame;
834 end
835  
836 function TellTrack_CreateWhisperChatFrame(name)
837 if (TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]) then
838 --check for not valid?
839 return;
840 end
841 local temp, shown;
842 local count = 1;
843 local chatFrame;
844  
845 for i=1, NUM_CHAT_WINDOWS do
846 temp, temp, temp, temp, temp, temp, shown, temp = GetChatWindowInfo(i);
847 chatFrame = getglobal("ChatFrame"..i);
848 chatTab = getglobal("ChatFrame"..i.."Tab");
849 if ( (not shown and not chatFrame.isDocked) or (count == NUM_CHAT_WINDOWS) ) then
850 if (type(name) ~= "string" or name == "") then
851 name = "TellTrack";
852 end
853  
854 -- initialize the frame
855 FCF_SetWindowName(chatFrame, name);
856 FCF_SetWindowColor(chatFrame, DEFAULT_CHATFRAME_COLOR.r, DEFAULT_CHATFRAME_COLOR.g, DEFAULT_CHATFRAME_COLOR.b);
857 FCF_SetWindowAlpha(chatFrame, DEFAULT_CHATFRAME_ALPHA);
858 SetChatWindowLocked(i, nil);
859  
860 -- Listen to the standard messages
861 ChatFrame_RemoveAllMessageGroups(chatFrame);
862 ChatFrame_AddMessageGroup(chatFrame, "WHISPER");
863  
864 -- Show the frame and tab
865 chatFrame:Show();
866 chatTab:Show();
867 SetChatWindowShown(i, 1);
868  
869 -- Dock the frame by default
870 FCF_DockFrame(chatFrame);
871  
872 TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")] = chatFrame:GetName();
873 break;
874 end
875 count = count + 1;
876 end
877 end
878  
879 function TellTrack_HideWhispersInOtherFrames()
880 if (not TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]) then
881 --check for not valid?
882 return;
883 end
884 local chatFrameName;
885 for i=1, NUM_CHAT_WINDOWS do
886 chatFrameName = "ChatFrame"..i;
887 if (chatFrameName ~= TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]) then
888 ChatFrame_RemoveMessageGroup(getglobal(chatFrameName), "WHISPER");
889 end
890 end
891 end
892  
893 -- Toggles the enabled/disabled state of an option and returns the new state
894 -- if toggle is 1, it's enabled
895 -- if toggle is 0, it's disabled
896 -- otherwise, it's toggled
897 function TellTrack_Generic_Toggle(toggle, variableName, CVarName, enableMessage, disableMessage, CosmosVarName, KhaosVarName)
898 local oldvalue = getglobal(variableName);
899 local newvalue = toggle;
900 if ( ( toggle ~= 1 ) and ( toggle ~= 0 ) ) then
901 if (oldvalue == 1) then
902 newvalue = 0;
903 elseif ( oldvalue == 0 ) then
904 newvalue = 1;
905 else
906 newvalue = 0;
907 end
908 end
909 setglobal(variableName, newvalue);
910 setglobal(CVarName, newvalue);
911 if ( ( newvalue ~= oldvalue ) and ( not TellTrack_Cosmos_Registered ) and ( not TellTrack_Khaos_Registered ) ) then
912 if ( newvalue == 1 ) then
913 TellTrack_Print(TEXT(getglobal(enableMessage)));
914 else
915 TellTrack_Print(TEXT(getglobal(disableMessage)));
916 end
917 end
918 -- TellTrack_Register_Cosmos();
919 if (TellTrack_Khaos_Registered) then
920 if (Khaos.getSetKey("TellTrack", KhaosVarName)) then
921 Khaos.setSetKeyParameter("TellTrack",KhaosVarName, "checked", (newvalue == 1));
922 end
923 elseif (TellTrack_Cosmos_Registered) then
924 if ( CosmosVarName ) then
925 Cosmos_UpdateValue(CosmosVarName, CSM_CHECKONOFF, newvalue);
926 Cosmos_SetCVar(CosmosVarName, newvalue);
927 end
928 else
929 -- No more RegisterForSave
930 end
931 return newvalue;
932 end
933  
934 -- Toggles the enabled/disabled state of the TellTrack
935 -- if toggle is 1, it's enabled
936 -- if toggle is 0, it's disabled
937 -- otherwise, it's toggled
938 function TellTrack_Toggle_Enabled(toggle)
939 local oldvalue = TellTrack_Enabled;
940 local newvalue = TellTrack_Generic_Toggle(toggle, "TellTrack_Enabled", "COS_TELLTRACK_ENABLED", "TELLTRACK_CHAT_ENABLED", "TELLTRACK_CHAT_DISABLED", "COS_TELLTRACK_ENABLED", "TellTrackEnable");
941 if ( TellTrack_Enabled == 0 ) then
942 TellTrackFrame:Hide();
943 if (TellTrackTooltip) then
944 TellTrackTooltip:Hide();
945 end
946 else
947 TellTrackFrame:Show();
948 end
949 end
950  
951 -- Toggles the inverted/normalized state of the TellTrack list
952 -- if toggle is 1, it's enabled
953 -- if toggle is 0, it's disabled
954 -- otherwise, it's toggled
955 function TellTrack_Toggle_Inverted(toggle)
956 local oldvalue = TellTrack_InvertedList;
957 local newvalue = TellTrack_Generic_Toggle(toggle, "TellTrack_InvertedList", "COS_TELLTRACK_INVERTED", "TELLTRACK_CHAT_INVERTED", "TELLTRACK_CHAT_NORMALIZED", "COS_TELLTRACK_INVERTED", "TellTrackInvert");
958 --only change (reset offset) telltrack if TellTrack_InvertedList was changed
959 if ( oldvalue ~= newvalue ) then
960 if ( newvalue == 1 ) then
961 TellTrack_ChangeArrayOffset(TellTrack_ArrayMaxSize);
962 else
963 TellTrack_ChangeArrayOffset(1);
964 end
965 TellTrack_UpdateTellTrackButtonsText();
966 end
967 end
968  
969 -- Toggles the saved state of the TellTrack list accross sessions
970 -- if toggle is 1, it's enabled
971 -- if toggle is 0, it's disabled
972 -- otherwise, it's toggled
973 function TellTrack_Toggle_DontSaveList(toggle)
974 local oldvalue = TellTrack_DontSaveList;
975 local newvalue = TellTrack_Generic_Toggle(toggle, "TellTrack_DontSaveList", "COS_TELLTRACK_DONTSAVELIST", "TELLTRACK_CHAT_DONTSAVELIST", "TELLTRACK_CHAT_SAVELIST", "COS_TELLTRACK_DONTSAVELIST", "TellTrackDontSaveList");
976 end
977  
978 -- Toggles the auto creation of TellTrack whisper frame
979 -- if toggle is 1, it's enabled
980 -- if toggle is 0, it's disabled
981 -- otherwise, it's toggled
982 function TellTrack_Toggle_AutoWhisperFrame(toggle)
983 local oldvalue = TellTrack_AutoWhisperFrame;
984 local newvalue = TellTrack_Generic_Toggle(toggle, "TellTrack_AutoWhisperFrame", "COS_TELLTRACK_AUTOWHISPERFRAME", "TELLTRACK_CHAT_AUTOWHISPERFRAME", "TELLTRACK_CHAT_MANUALWHISPERFRAME", "COS_TELLTRACK_AUTOWHISPERFRAME", "TellTrackAutoWhisperFrame");
985 end
986  
987 -- Toggles Hiding Whispers outside the whisper frame
988 -- if toggle is 1, it's enabled
989 -- if toggle is 0, it's disabled
990 -- otherwise, it's toggled
991 function TellTrack_Toggle_HideOtherWhispers(toggle)
992 local oldvalue = TellTrack_HideOtherWhispers;
993 local newvalue = TellTrack_Generic_Toggle(toggle, "TellTrack_HideOtherWhispers", "COS_TELLTRACK_HIDEOTHERWHISPERS", "TELLTRACK_CHAT_HIDEOTHERWHISPERS", "TELLTRACK_CHAT_SHOWOTHERWHISPERS", "COS_TELLTRACK_HIDEOTHERWHISPERS", "TellTrackHideOtherWhispers");
994 if ( newvalue == 1 ) then
995 TellTrack_HideWhispersInOtherFrames();
996 end
997 end
998  
999 -- Toggles Whisper chat stamping
1000 -- if toggle is 1, it's enabled
1001 -- if toggle is 0, it's disabled
1002 -- otherwise, it's toggled
1003 function TellTrack_Toggle_TimeStamps(toggle)
1004 local oldvalue = TellTrack_TimeStamps;
1005 local newvalue = TellTrack_Generic_Toggle(toggle, "TellTrack_TimeStamps", "COS_TELLTRACK_TIMESTAMPS", "TELLTRACK_CHAT_TIMESTAMPS", "TELLTRACK_CHAT_NOTIMESTAMPS", "COS_TELLTRACK_TIMESTAMPS", "TellTrackTimeStamps");
1006 TellTrack_RedrawWhisperFrame();
1007 end
1008  
1009 -- Toggles the whisper first option
1010 -- if toggle is 1, it's enabled
1011 -- if toggle is 0, it's disabled
1012 -- otherwise, it's toggled
1013 function TellTrack_Toggle_WhisperFirst(toggle)
1014 local oldvalue = TellTrack_WhisperFirst;
1015 local newvalue = TellTrack_Generic_Toggle(toggle, "TellTrack_WhisperFirst", "COS_TELLTRACK_WHISPERFIRST", "TELLTRACK_CHAT_WHISPERFIRST", "TELLTRACK_CHAT_LOGFIRST", "COS_TELLTRACK_WHISPERFIRST", "TellTrackWhisperFirst");
1016 end
1017  
1018 -- Prints out text to a chat box.
1019 function TellTrack_Print(msg,r,g,b,frame,id,unknown4th)
1020 if(unknown4th) then
1021 local temp = id;
1022 id = unknown4th;
1023 unknown4th = id;
1024 end
1025  
1026 if (not r) then r = 1.0; end
1027 if (not g) then g = 1.0; end
1028 if (not b) then b = 1.0; end
1029 if ( frame ) then
1030 frame:AddMessage(msg,r,g,b,id,unknown4th);
1031 else
1032 if ( DEFAULT_CHAT_FRAME ) then
1033 DEFAULT_CHAT_FRAME:AddMessage(msg, r, g, b,id,unknown4th);
1034 end
1035 end
1036 end
1037  
1038 function TellTrack_ArrowButton_OnLoad(frame)
1039 frame:RegisterForClicks("LeftButtonUp", "RightButtonUp");
1040 end
1041  
1042 function TellTrack_ArrowUpButton_OnClick(button)
1043 local id = this:GetID();
1044 if ( not id ) then
1045 return
1046 end
1047 if ( button == "RightButton" ) then
1048 TellTrack_ChangeArrayOffset(1);
1049 elseif ( button == "LeftButton" ) then
1050 TellTrack_PageUp();
1051 end
1052 end
1053  
1054 function TellTrack_ArrowDownButton_OnClick(button)
1055 local id = this:GetID();
1056 if ( not id ) then
1057 return;
1058 end
1059 if ( button == "RightButton" ) then
1060 TellTrack_ChangeArrayOffset(TellTrack_ArrayMaxSize);
1061 elseif ( button == "LeftButton" ) then
1062 TellTrack_PageDown();
1063 end
1064 end
1065  
1066 function TellTrack_QButton_OnLoad()
1067 this:RegisterForClicks("LeftButtonUp", "RightButtonUp");
1068 end
1069  
1070 function TellTrack_QButton_OnClick(button)
1071 local id = this:GetID();
1072 if ( not id ) then
1073 return
1074 end
1075 TellTrack_ChatCommand_Help();
1076 --TellTrack_Print(TELLTRACK_CHAT_QUESTION_MARK_INFO,1.0,1.0,0);
1077 end
1078  
1079 function TellTrackTextButton_OnEnter()
1080 local id = this:GetID();
1081 if ( id ) then
1082 TellTrackTooltip:SetOwner(TellTrackFrame, "ANCHOR_TOPLEFT");
1083 TellTrackSetTooltip(id);
1084 end
1085 end
1086  
1087 function TellTrackTextButton_OnLeave()
1088 if ( TellTrackTooltip:IsOwned(TellTrackFrame) ) then
1089 TellTrackTooltip:Hide();
1090 end
1091 end
1092  
1093 function TellTrackTextButton_OnLoad()
1094 this:RegisterForClicks("LeftButtonUp", "RightButtonUp");
1095 end
1096  
1097 function TellTrack_InitiateWhisperByID(id)
1098 local name = TellTrackGetName(id);
1099 TellTrack_InitiateWhisperToTarget(name);
1100 end
1101  
1102 -- 1/20/05 'Retell' added by AnduinLothar
1103 function TellTrack_InitiateWhisperToPreviousTarget()
1104 if ( not TellTrack_LastTell ) then
1105 return;
1106 end
1107 TellTrack_InitiateWhisperToTarget(TellTrack_LastTell);
1108 end
1109  
1110 function TellTrack_WhisperToPreviousTarget(msg)
1111 if ( not TellTrack_LastTell ) then
1112 return;
1113 end
1114 SendChatMessage(msg, "WHISPER", this.language, TellTrack_LastTell);
1115 end
1116  
1117 function TellTrack_InitiateWhisperToTarget(name)
1118 if ( not name ) then
1119 return;
1120 end
1121 local chatFrame = DEFAULT_CHAT_FRAME;
1122 chatFrame.editBox.chatType = "WHISPER";
1123 chatFrame.editBox.tellTarget = name;
1124 ChatEdit_UpdateHeader(chatFrame.editBox);
1125 if ( not chatFrame.editBox:IsVisible() ) then
1126 if (SavedChatFrame_OpenChat) then
1127 SavedChatFrame_OpenChat("", chatFrame);
1128 else
1129 Sea.util.Hooks.ChatFrame_OpenChat.orig("", chatFrame);
1130 end
1131 end
1132 end
1133  
1134 function TellTrack_Menu_Whisper()
1135 TellTrack_InitiateWhisperByID(TellTrack_ID);
1136 end
1137  
1138 function TellTrack_Menu_Show_Conversation()
1139 TellTrack_ShowConversationWith(TellTrackGetName(TellTrack_ID), false);
1140 end
1141  
1142 function TellTrack_Menu_Who()
1143 local name = TellTrackGetName(TellTrack_ID);
1144 SendWho("n-\""..name.."\"");
1145 end
1146  
1147 function TellTrack_Menu_GroupeInvite()
1148 local name = TellTrackGetName(TellTrack_ID);
1149 InviteByName(name);
1150 end
1151  
1152 function TellTrack_Menu_AddToFriend()
1153 local name = TellTrackGetName(TellTrack_ID);
1154 AddFriend(name);
1155 end
1156  
1157 function TellTrack_Menu_Delete()
1158 TellTrack_EraseByID(TellTrack_ID);
1159 end
1160  
1161 -- Function by AnduinLothar used in right click menu
1162  
1163 function TellTrack_Menu_DeleteAll()
1164 --Print("TT: Reseting Tell List");
1165 TellTrack_Array = {};
1166 --Print("TT: Updating Tell Track Button");
1167 TellTrack_UpdateTellTrackButtonsText();
1168 -- saves the names to the list
1169 TellTrack_SaveNames();
1170 end
1171  
1172 -- Modified by AnduinLothar to add "Delete All", and "Invert List"
1173  
1174 function TellTrackTextButton_InitializeMenuArray()
1175 local info = { }
1176 table.insert(info, { text = " "..BINDING_HEADER_TELLTRACKHEADER, isTitle = 1 });
1177 table.insert(info, { text = TELLTRACK_WHISPER, func = TellTrack_Menu_Whisper });
1178 table.insert(info, { text = TELLTRACK_SHOW_CONVERSATION, func = TellTrack_Menu_Show_Conversation });
1179 table.insert(info, { text = TELLTRACK_WHO, func = TellTrack_Menu_Who });
1180 table.insert(info, { text = TELLTRACK_GRPINV, func = TellTrack_Menu_GroupeInvite });
1181 table.insert(info, { text = TELLTRACK_ADDFRIEND, func = TellTrack_Menu_AddToFriend });
1182 table.insert(info, { text = TELLTRACK_DELETE, func = TellTrack_Menu_Delete });
1183 table.insert(info, { text = "|cFFCCCCCC--------------|r", disabled = 1, notClickable = 1 });
1184 table.insert(info, { text = TELLTRACK_DELETE_ALL, func = TellTrack_Menu_DeleteAll });
1185 table.insert(info, { text = TELLTRACK_INVERT, func = TellTrack_Toggle_Inverted });
1186 table.insert(info, { text = TELLTRACK_SHOW_ALL_WHISPERS, func = TellTrack_ShowAllWhispers });
1187 table.insert(info, { text = TELLTRACK_CREATE_CHATFRAME, func = TellTrack_CreateWhisperChatFrame });
1188 table.insert(info, { text = "|cFFCCCCCC--------------|r", disabled = 1, notClickable = 1 });
1189 table.insert(info, { text = TELLTRACK_CANCEL, func = function () end });
1190 for index, menuLine in info do
1191 UIDropDownMenu_AddButton(menuLine);
1192 end
1193 end
1194  
1195 function TellTrackTextButton_GetMenuLevels(menu)
1196 if ( not menu ) then
1197 return 0;
1198 end
1199 local menuLevels = 1;
1200 for i = 1, getn(menu) do
1201 if ( menu[i][1] ) then
1202 menuLevels = menuLevels + TellTrackTextButton_GetMenuLevels(menu[i]);
1203 break;
1204 end
1205 end
1206 return menuLevels;
1207 end
1208  
1209 function TellTrackTextButton_ShowMenu()
1210 ToggleDropDownMenu(1, nil, TellTrackDropDown, "cursor", 0, 0);
1211 return true;
1212 end
1213  
1214 function TellTrackTextButton_OnClick(button)
1215 local id = this:GetID();
1216 if ( not id ) then
1217 return;
1218 end
1219 if ( TellTrack_Array[TellTrack_GetArrayId(id)] == nil ) then
1220 return;
1221 end
1222 TellTrack_ID = id;
1223 if ( button == "RightButton" ) then
1224 if ( not TellTrackTextButton_ShowMenu() ) then
1225 TellTrack_EraseByID(id);
1226 end
1227 elseif ( button == "LeftButton" ) then
1228 if (IsShiftKeyDown()) then
1229 TellTrack_Menu_Who();
1230 elseif (IsAltKeyDown()) then
1231 TellTrack_Menu_GroupeInvite();
1232 elseif (IsControlKeyDown()) then
1233 TellTrack_Menu_AddToFriend();
1234 else
1235 local name = TellTrackGetName(id);
1236 if (TellTrack_WhisperFirst == 1) then
1237 if (SELECTED_DOCK_FRAME.editBox:IsVisible()) and (SELECTED_DOCK_FRAME.editBox.chatType == "WHISPER") and (SELECTED_DOCK_FRAME.editBox. tellTarget == name) then
1238 TellTrack_ShowConversationWith(name, false);
1239 else
1240 TellTrack_InitiateWhisperToTarget(name);
1241 end
1242 else
1243 if (SELECTED_DOCK_FRAME == getglobal(TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")])) and (TellTrack_CurrentConversation.name == name) then
1244 TellTrack_InitiateWhisperToTarget(name);
1245 --TellTrack_InitiateWhisperByID(id);
1246 else
1247 TellTrack_ShowConversationWith(name, false);
1248 end
1249 end
1250 end
1251 end
1252 end
1253  
1254 function TellTrack_GetArrayId(id)
1255 local newID
1256 if ( TellTrack_InvertedList == 1 ) then
1257 newID = TellTrack_ArrayMaxSize - (id + TellTrack_ArrayOffset) + 2;
1258 else
1259 newID = (id + TellTrack_ArrayOffset) - 1;
1260 end
1261 return newID;
1262 end
1263  
1264 function TellTrack_EraseByID(id)
1265 if ( id ) then
1266 id = TellTrack_GetArrayId(id);
1267 if ( TellTrack_Array ) and ( TellTrack_Array[id] ) then
1268 if ( ( TellTrackTooltip:IsVisible() ) and ( TellTrack_TooltipSetId == id ) ) then
1269 TellTrackTooltip:Hide();
1270 end
1271 TellTrack_Array[id] = nil;
1272 end
1273 TellTrack_CompressList();
1274 TellTrack_UpdateTellTrackButtonsText();
1275 end
1276 end
1277  
1278 function TellTrackGetName(id)
1279 if ( id ) then
1280 id = TellTrack_GetArrayId(id);
1281 if ( ( TellTrack_Array ) and ( TellTrack_Array[id] ) and ( TellTrack_Array[id].name ) ) then
1282 return TellTrack_Array[id].name;
1283 end
1284 end
1285 return nil;
1286 end
1287  
1288 function TellTrackSetTooltip(id)
1289 local name = TellTrackGetName(id);
1290 if ( name ) then
1291 TellTrackTooltip:SetText(name);
1292 TellTrack_TooltipSetId = id;
1293 end
1294 end
1295  
1296 -- Yet another function from George Warner, modified a bit to fit my own nefarious purposes.
1297 -- It can now accept r, g and b specifications, too (leaving out a), as well as handle 255 255 255
1298 -- Source : http://www.cosmosui.org/cgi-bin/bugzilla/show_bug.cgi?id=159
1299 function TellTrack_GetColorFormatString(a, r, g, b)
1300 local percent = false;
1301 if ( ( ( not b ) or ( b <= 1 ) ) and ( a <= 1 ) and ( r <= 1 ) and ( g <= 1) ) then percent = true; end
1302 if ( ( not b ) and ( a ) and ( r ) and ( g ) ) then b = g; g = r; r = a; if ( percent ) then a = 1; else a = 255; end end
1303 if ( percent ) then a = a * 255; r = r * 255; g = g * 255; b = b * 255; end
1304 a = TellTrack_GetByteValue(a); r = TellTrack_GetByteValue(r); g = TellTrack_GetByteValue(g); b = TellTrack_GetByteValue(b);
1305  
1306 --return format("[c%02X%02X%02X%02X%%s]r", a, r, g, b);
1307 return format("|c%02X%02X%02X%02X%%s|r", a, r, g, b);
1308 end
1309  
1310 function TellTrack_UpdateTellTrackButtonsText()
1311 local lastSentToNameFormatStr = TellTrack_GetColorFormatString(0.2, 1.0, 0.2);
1312 local lastRecievedFromNameFormatStr = TellTrack_GetColorFormatString(1.0, 0.2, 0.2);
1313 local noNameFormatStr = TellTrack_GetColorFormatString(0.4, 0.4, 0.4);
1314 local id = 0;
1315 for i = 1, TellTrack_ButtonCount do
1316 local buttonText = getglobal("TellTrack"..i.."Text");
1317 local formatStr, valueStr;
1318 id = TellTrack_GetArrayId(i);
1319 if ( ( TellTrack_Array[id] ) and ( TellTrack_Array[id].name ) ) then
1320 if( TellTrack_Array[id].sentTo ) then
1321 formatStr = lastSentToNameFormatStr;
1322 else
1323 formatStr = lastRecievedFromNameFormatStr;
1324 end
1325 valueStr = TellTrack_Array[id].name;
1326 if (TellTrack_Array[id].unread) and (TellTrack_Array[id].unread > 0) then
1327 valueStr = "("..TellTrack_Array[id].unread..") "..valueStr;
1328 end
1329 else
1330 formatStr = noNameFormatStr;
1331 valueStr = "Empty";
1332 end
1333 if ( buttonText ) then
1334 buttonText:SetText(format(formatStr, valueStr));
1335 buttonText:Show();
1336 end
1337 end
1338 end
1339  
1340 --[[ The following function was edited by AnduinLothar (1/15/05)
1341 to add the following features:
1342  
1343 The last person whispered is automaticly moved to the bottom
1344 of the list and everytime you whisper it autoscrolls to the
1345 bottom of the list. Also if the list is full the top name is
1346 deleted and the new name is appended to the bottom.
1347  
1348 1/17/05
1349 Added recieved/sent boolean for color on button reload.
1350  
1351 ]]--
1352 function TellTrack_HandleMessageSentOrRecieved(target, recieved, msg)
1353 local tempName = strlower(target);
1354 local firstEmptySlotIndex = nil;
1355 local previousNameInstance = nil;
1356 for i = 1, TellTrack_ArrayMaxSize do
1357 if ( ( not firstEmptySlotIndex ) and ( not TellTrack_Array[i] )) then
1358 --Print("TT: First empty slot "..i);
1359 firstEmptySlotIndex = i;
1360 elseif( not firstEmptySlotIndex ) then
1361 if( TellTrack_Array[i].compareName == tempName ) then
1362 --Print("TT: Found in array");
1363 previousNameInstance = i;
1364 end
1365 end
1366 end
1367 if( (not firstEmptySlotIndex) and (not previousNameInstance) ) then
1368 --Print("TT: No empty slots found, deleting first name");
1369 TellTrack_Array[1] = nil;
1370 TellTrack_CompressList();
1371 firstEmptySlotIndex = TellTrack_ArrayMaxSize;
1372 elseif( (not firstEmptySlotIndex) and previousNameInstance) then
1373 firstEmptySlotIndex = TellTrack_ArrayMaxSize+1;
1374 end
1375 for i = 1, TellTrack_ArrayMaxSize do
1376 if ( previousNameInstance == i and firstEmptySlotIndex == i+1) then
1377 --Print("TT: Name found is last name sent "..i);
1378 TellTrack_Array[i].sentTo = not recieved;
1379 if (not TellTrack_Array[i].unread) then
1380 TellTrack_Array[i].unread = 0;
1381 end
1382 if (recieved) and (TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]) then
1383 if (not getglobal(TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]):IsVisible()) or (TellTrack_CurrentConversation.name ~= target and not TellTrack_CurrentConversation.showAll) then
1384 TellTrack_Array[i].unread = TellTrack_Array[i].unread + 1;
1385 end
1386 end
1387 firstEmptySlotIndex = firstEmptySlotIndex-1
1388 if (TellTrack_InvertedList == 1) then
1389 if( i < TellTrack_ArrayMaxSize-TellTrack_ButtonCount and (TellTrack_ArrayMaxSize-i+1) ~= TellTrack_ArrayOffset ) then
1390 TellTrack_ChangeArrayOffset(TellTrack_ArrayMaxSize-i+1);
1391 end
1392 else
1393 if( i > TellTrack_ButtonCount and (i-TellTrack_ButtonCount+1) ~= TellTrack_ArrayOffset ) then
1394 TellTrack_ChangeArrayOffset(i-TellTrack_ButtonCount+1);
1395 end
1396 end
1397 elseif ( previousNameInstance == i and firstEmptySlotIndex ~= i+1) then
1398 --Print("TT: Removing old instance at "..i);
1399 TellTrack_Array[i] = nil;
1400 TellTrack_CompressList()
1401 firstEmptySlotIndex = firstEmptySlotIndex-1;
1402 elseif ( firstEmptySlotIndex == i ) then
1403 --Print("TT: Adding to array "..i);
1404 TellTrack_Array[i] = {};
1405 TellTrack_Array[i].name = target;
1406 TellTrack_Array[i].compareName = tempName;
1407 TellTrack_Array[i].sentTo = not recieved;
1408 if (not TellTrack_Array[i].unread) then
1409 TellTrack_Array[i].unread = 0;
1410 end
1411 if (recieved) and (TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]) then
1412 if (not getglobal(TellTrack_WhisperChatFrame[GetRealmName()][UnitName("player")]):IsVisible()) or (TellTrack_CurrentConversation.name ~= target and not TellTrack_CurrentConversation.showAll) then
1413 TellTrack_Array[i].unread = TellTrack_Array[i].unread + 1;
1414 end
1415 end
1416 if (TellTrack_InvertedList == 1) then
1417 if( i < TellTrack_ArrayMaxSize-TellTrack_ButtonCount and (TellTrack_ArrayMaxSize-i+1) ~= TellTrack_ArrayOffset ) then
1418 TellTrack_ChangeArrayOffset(TellTrack_ArrayMaxSize-i+1);
1419 end
1420 else
1421 if( i > TellTrack_ButtonCount and (i-TellTrack_ButtonCount+1) ~= TellTrack_ArrayOffset ) then
1422 TellTrack_ChangeArrayOffset(i-TellTrack_ButtonCount+1);
1423 end
1424 end
1425 end
1426 end
1427 --Print("TT: Updating Tell Track Button");
1428 TellTrack_UpdateTellTrackButtonsText();
1429 -- saves the names to the list
1430 TellTrack_SaveNames();
1431 end
1432  
1433 -- thanks again to Lash for the idea and the pushing of this function :)
1434 function TellTrack_CompressList()
1435 local index;
1436 local otherArray = {};
1437 index = 1;
1438 if ( TellTrack_Array ) then
1439 for k, v in TellTrack_Array do
1440 otherArray[index] = v;
1441 index = index + 1;
1442 end
1443 end
1444 TellTrack_Array = otherArray;
1445 TellTrack_UpdateTellTrackButtonsText();
1446 end
1447  
1448  
1449 function TellTrack_ChangeArrayOffset(offset)
1450 local capSize = TellTrack_ArrayMaxSize - TellTrack_ButtonCount+1;
1451 if ( offset <= 0 ) then
1452 offset = 1;
1453 end
1454 if ( offset > capSize ) then
1455 offset = capSize;
1456 end
1457 TellTrack_ArrayOffset = offset;
1458 TellTrack_UpdateTellTrackButtonsText();
1459 end
1460  
1461 function TellTrack_PageDown()
1462 TellTrack_ChangeArrayOffset(TellTrack_ArrayOffset + TellTrack_ButtonCount);
1463 end
1464  
1465 function TellTrack_PageUp()
1466 TellTrack_ChangeArrayOffset(TellTrack_ArrayOffset - TellTrack_ButtonCount);
1467 end
1468  
1469 function TellTrack_OnMouseWheel(value)
1470 if ( value > 0 ) then
1471 TellTrack_ChangeArrayOffset(TellTrack_ArrayOffset - 1);
1472 elseif ( value < 0 ) then
1473 TellTrack_ChangeArrayOffset(TellTrack_ArrayOffset + 1);
1474 end
1475 end
1476  
1477  
1478 function TellTrack_QButton_OnEnter()
1479 TellTrackTooltip:SetOwner(TellTrackFrame, "ANCHOR_TOPLEFT");
1480 TellTrackTooltip:SetText(TELLTRACK_QUESTION_MARK_TOOLTIP);
1481 end
1482  
1483 function TellTrack_QButton_OnLeave()
1484 if ( TellTrackTooltip:IsOwned(TellTrackFrame) ) then
1485 TellTrackTooltip:Hide();
1486 end
1487 end
1488  
1489 function TellTrack_ResizeButton_OnEnter()
1490 TellTrackTooltip:SetOwner(TellTrackFrame, "ANCHOR_TOPLEFT");
1491 TellTrackTooltip:SetText(TELLTRACK_RESIZE_TOOLTIP);
1492 end
1493  
1494 function TellTrack_ResizeButton_OnLeave()
1495 if ( TellTrackTooltip:IsOwned(TellTrackFrame) ) then
1496 TellTrackTooltip:Hide();
1497 end
1498 end
1499  
1500 function TellTrack_IsClassHorde(class)
1501 local hordeClasses = { "Orc", "Tauren", "Troll", "Undead" };
1502 for k, v in hordeClasses do
1503 if ( class == v ) then
1504 return true;
1505 end
1506 end
1507 return false;
1508 end
1509  
1510 -- returns the index name for the load/save funcs
1511 function TellTrack_GetListIndex()
1512 local firstString = GetCVar("realmName");
1513 local secondString = UnitRace("player");
1514 --local secondString = UnitName("player");
1515 if ( not firstString ) or ( not secondString ) then
1516 return nil;
1517 end
1518 if ( TellTrack_IsClassHorde(secondString) ) then
1519 secondString = "Horde";
1520 else
1521 secondString = "Alliance";
1522 end
1523 return format("%s_%s", firstString, secondString);
1524 end
1525  
1526 function TellTrack_LoadNames()
1527 local index = TellTrack_GetListIndex();
1528 if ( not index ) then
1529 if ( Cosmos_ScheduleByName ) then
1530 Cosmos_ScheduleByName("TELLTRACK_LOADNAMES", 0.5, TellTrack_LoadNames);
1531 end
1532 return;
1533 end
1534 if ( not TellTrack_SavedList ) then
1535 return;
1536 end;
1537 local list = TellTrack_SavedList[index];
1538 --1/20/05 now aditionally loads sentTo instead of just names. This allows loading of 'recieved/sent' status.
1539 if ( list ) then
1540 for k, v in list do
1541 if(type(v) == "table") then
1542 if(v.name and v.sentTo ~= nil) then
1543 TellTrack_HandleMessageSentOrRecieved(v.name, not v.sentTo);
1544 elseif(v.name) then
1545 TellTrack_HandleMessageSentOrRecieved(v.name, false);
1546 end
1547 elseif(type(v) == "string") then
1548 TellTrack_HandleMessageSentOrRecieved(v, false); --Support for previous TellTrack Saved Lists (all are marked as sent)
1549 end
1550 TellTrack_Array[k].unread = 0;
1551 end
1552 end
1553 end
1554  
1555 function TellTrack_SaveNames()
1556 local index = TellTrack_GetListIndex();
1557 if ( not index ) then
1558 if ( Cosmos_ScheduleByName ) then
1559 Cosmos_ScheduleByName("TELLTRACK_SAVENAMES", 0.5, TellTrack_SaveNames);
1560 end
1561 return;
1562 end
1563 --[[
1564 local list = {};
1565 for k, v in TellTrack_Array do
1566 if (v.name) then
1567 table.insert(list, v.name);
1568 end
1569 end
1570 ]]--
1571 --1/20/05 now saves whole array instead of just names. This allows saving of 'recieved/sent' status.
1572 list = TellTrack_Array;
1573  
1574 if ( not TellTrack_SavedList ) then
1575 TellTrack_SavedList = {};
1576 end
1577 TellTrack_SavedList[index] = list;
1578 end
1579  
1580 -- helper function - returns value as a byte
1581 function TellTrack_GetByteValue(pValue)
1582 local value = tonumber(pValue);
1583 if ( value <= 0 ) then return 0; end
1584 if ( value >= 255 ) then return 255; end
1585 return value;
1586 end
1587  
1588  
1589 function TellTrack_ModifyButtonCount(height)
1590 height = height - 44; --insets and arrow buttons
1591 local newCount = floor((height)/20);
1592 if ( newCount ~= TellTrack_ButtonCount ) then
1593 TellTrack_ButtonCount = newCount;
1594 for i=1, TellTrack_ArrayMaxSize do
1595 local thisButton = getglobal("TellTrack"..i);
1596 if not thisButton:IsVisible() and i <= TellTrack_ButtonCount then
1597 thisButton:Show();
1598 elseif thisButton:IsVisible() and i > TellTrack_ButtonCount then
1599 thisButton:Hide();
1600 end
1601 end
1602 end
1603 local offset = floor((height-TellTrack_ButtonCount*20+20)/2);
1604 TellTrackFrameArrowUpButton:SetHeight(offset);
1605 TellTrackFrameArrowDownButton:SetHeight(offset);
1606 end
1607  
1608 function TellTrackFrame_OnSizeChanged()
1609 local width = TellTrackFrame:GetWidth()-24;
1610 TellTrackFrameArrowUpButton:SetWidth(width);
1611 for i=1, TellTrack_ArrayMaxSize do
1612 getglobal("TellTrack"..i):SetWidth(width);
1613 end
1614 TellTrackFrameArrowDownButton:SetWidth(width);
1615 TellTrack_ModifyButtonCount(TellTrackFrame:GetHeight());
1616 TellTrack_ChangeArrayOffset(TellTrack_ArrayOffset);
1617 TellTrack_UpdateTellTrackButtonsText();
1618 end
1619  
1620 function TellTrack_ArrowButton_OnSizeChanged(frame)
1621 local height = frame:GetHeight();
1622 getglobal(frame:GetName().."RightBG"):SetHeight(height);
1623 getglobal(frame:GetName().."LeftBG"):SetHeight(height);
1624 getglobal(frame:GetName().."Arrow"):SetHeight(height);
1625 end
1626  
1627