//==================================================================== // Base class for IRC tab panels // // Updated by Ron Prestenback // (c) 2003, Epic Games, Inc. All Rights Reserved // ==================================================================== class UT2K4IRC_Page extends UT2K4TabPanel abstract; var automated moEditBox ed_TextEntry; var automated GUISplitter sp_Main; var() config float MainSplitterPosition; var GUIScrollTextBox lb_TextDisplay; var localized string HasLeftText; var localized string HasJoinedText; var localized string WasKickedByText; var localized string NowKnownAsText; var localized string QuitText; var localized string SetsModeText; var localized string NewTopicText; var config int MaxChatScrollback; var config int InputHistorySize; var globalconfig bool bIRCTextToSpeechEnabled; var transient array InputHistory; var transient int InputHistoryPos; var transient bool bDoneInputScroll; var config color IRCTextColor; var config color IRCNickColor; var config color IRCActionColor; var config color IRCInfoColor; var config color IRCLinkColor; // Pure Virtual function ProcessInput(string Text) { } // This disconnects the IRC client at map change!! function Free() { } // When you hit enter in the input box, call the class function bool InternalOnKeyEvent(out byte Key, out byte State, float delta) { local string Input; local int Index; if ( (key==0xEC) && (State==3) ) { lb_TextDisplay.MyScrollText.WheelUp(); return true; } if ( (key==0xED) && (State==3) ) { lb_TextDisplay.MyScrollText.WheelDown(); return true; } // Only care about key-press events if(State != 1) return false; if( Key == 0x0D ) // ENTER { Input = ed_TextEntry.GetText(); if(Input != "") { // Add string to end of history Index = InputHistory.Length; InputHistory.Insert(Index, 1); InputHistory[Index] = Input; // If history is too long, remove chat from start of history if(InputHistory.Length > InputHistorySize) InputHistory.Remove(0, InputHistory.Length - InputHistorySize); // Once you enter something - reset history position to most recent entry InputHistoryPos = InputHistory.Length - 1; bDoneInputScroll = false; ProcessInput(Input); // Handle whatever you typed ed_TextEntry.SetText(""); // And empty box again. } return true; } else if( Key == 0x26 ) // UP { if( InputHistory.Length > 0 ) // do nothing if no history { ed_TextEntry.SetText( InputHistory[ InputHistoryPos ] ); InputHistoryPos--; if(InputHistoryPos < 0) InputHistoryPos = InputHistory.Length - 1; bDoneInputScroll = true; } return true; } else if( Key == 0x28 ) // DOWN { if( InputHistory.Length > 0 ) { if(!bDoneInputScroll) InputHistoryPos = 0; // Hack so pressing 'down' gives you the oldest input ed_TextEntry.SetText( InputHistory[ InputHistoryPos ] ); InputHistoryPos++; if(InputHistoryPos > InputHistory.Length - 1) InputHistoryPos = 0; bDoneInputScroll = true; } return true; } return false; } function string ColorizeLinks(string InString) { local int i; local string OutString, Character, Word, ColourlessWord; local bool InWord, HaveWord; i=0; while(true) { // Get the next word in the string while( i