OSDN Git Service

Added chat input line on SceneWindow.
authorLatif Khalifa <latifer@streamgrid.net>
Sun, 7 Aug 2011 07:22:29 +0000 (07:22 +0000)
committerLatif Khalifa <latifer@streamgrid.net>
Sun, 7 Aug 2011 07:22:29 +0000 (07:22 +0000)
Stub chat overlay (but wired into the rest of Radegast chat system).

git-svn-id: https://radegast.googlecode.com/svn/trunk@1074 f7a694da-4d33-11de-9ad6-1127a62b9fcd

Radegast/Core/ChatBufferItem.cs
Radegast/Core/ChatTextManager.cs
Radegast/GUI/Consoles/ChatConsole.cs
Radegast/GUI/Consoles/TabsConsole.cs
Radegast/GUI/Rendering/ChatBox.cs [new file with mode: 0644]
Radegast/GUI/Rendering/ChatOverlay.cs [new file with mode: 0644]
Radegast/GUI/Rendering/Rendering.Designer.cs
Radegast/GUI/Rendering/Rendering.cs
Radegast/Radegast.csproj

index e2daebb..21c07e9 100644 (file)
 // $Id$
 //
 using System;
+using OpenMetaverse;
 
 namespace Radegast
 {
     public class ChatBufferItem
     {
         private DateTime timestamp;
+        private string from;
+        private UUID id;
         private string text;
         private ChatBufferTextStyle style;
+        private ChatEventArgs rawMessage;
 
         public ChatBufferItem()
         {
 
         }
 
-        public ChatBufferItem(DateTime timestamp, string text, ChatBufferTextStyle style)
+        public ChatBufferItem(DateTime timestamp, string from, UUID id, string text, ChatBufferTextStyle style)
         {
             this.timestamp = timestamp;
             this.text = text;
@@ -56,6 +60,18 @@ namespace Radegast
             set { timestamp = value; }
         }
 
+        public string From
+        {
+            get { return from; }
+            set { from = value; }
+        }
+
+        public UUID ID
+        {
+            get { return id; }
+            set { id = value; }
+        }
+
         public string Text
         {
             get { return text; }
@@ -67,6 +83,12 @@ namespace Radegast
             get { return style; }
             set { style = value; }
         }
+
+        public ChatEventArgs RawMessage
+        {
+            get { return rawMessage; }
+            set { rawMessage = value; }
+        }
     }
 
     public enum ChatBufferTextStyle
index 9752a76..3d4d7f0 100644 (file)
@@ -40,6 +40,8 @@ namespace Radegast
 {
     public class ChatTextManager : IDisposable
     {
+        public event EventHandler<ChatLineAddedArgs> ChatLineAdded;
+
         private RadegastInstance instance;
         private RadegastNetcom netcom { get { return instance.Netcom; } }
         private GridClient client { get { return instance.Client; } }
@@ -103,7 +105,7 @@ namespace Radegast
             if (e.Message.ToLower().Contains("autopilot canceled")) return; //workaround the stupid autopilot alerts
 
             ChatBufferItem item = new ChatBufferItem(
-                DateTime.Now, "Alert message: " + e.Message, ChatBufferTextStyle.Alert);
+                DateTime.Now, "Alert message", UUID.Zero, ": " + e.Message, ChatBufferTextStyle.Alert);
 
             ProcessBufferItem(item, true);
         }
@@ -116,10 +118,10 @@ namespace Radegast
         public void PrintStartupMessage()
         {
             ChatBufferItem title = new ChatBufferItem(
-                DateTime.Now, Properties.Resources.RadegastTitle + "." + RadegastBuild.CurrentRev, ChatBufferTextStyle.StartupTitle);
+                DateTime.Now, "", UUID.Zero, Properties.Resources.RadegastTitle + "." + RadegastBuild.CurrentRev, ChatBufferTextStyle.StartupTitle);
 
             ChatBufferItem ready = new ChatBufferItem(
-                DateTime.Now, "Ready.", ChatBufferTextStyle.StatusBlue);
+                DateTime.Now, "", UUID.Zero, "Ready.", ChatBufferTextStyle.StatusBlue);
 
             ProcessBufferItem(title, true);
             ProcessBufferItem(ready, true);
@@ -129,6 +131,11 @@ namespace Radegast
 
         public void ProcessBufferItem(ChatBufferItem item, bool addToBuffer)
         {
+            if (ChatLineAdded != null)
+            {
+                ChatLineAdded(this, new ChatLineAddedArgs(item));
+            }
+
             lock (SyncChat)
             {
                 instance.LogClientMessage("chat.txt", item.Text);
@@ -180,7 +187,7 @@ namespace Radegast
                         break;
                 }
 
-                textPrinter.PrintTextLine(item.Text);
+                textPrinter.PrintTextLine(item.From + item.Text);
             }
         }
 
@@ -189,8 +196,6 @@ namespace Radegast
         {
             StringBuilder sb = new StringBuilder();
 
-            sb.AppendFormat("(channel {0}) {1}", e.Channel, client.Self.Name);
-
             switch (e.Type)
             {
                 case ChatType.Normal:
@@ -209,7 +214,7 @@ namespace Radegast
             sb.Append(e.Message);
 
             ChatBufferItem item = new ChatBufferItem(
-                DateTime.Now, sb.ToString(), ChatBufferTextStyle.StatusDarkBlue);
+                DateTime.Now, string.Format("(channel {0}) {1}", e.Channel, client.Self.Name), client.Self.AgentID, sb.ToString(), ChatBufferTextStyle.StatusDarkBlue);
 
             ProcessBufferItem(item, true);
 
@@ -241,17 +246,18 @@ namespace Radegast
 #endif
             }
 
+            ChatBufferItem item = new ChatBufferItem();
+            item.ID = e.SourceID;
+            item.RawMessage = e;
             StringBuilder sb = new StringBuilder();
-            // if (e.SourceType == ChatSourceType.Object) {
-            //    sb.Append(e.Position + " ");
-            // }
+
             if (e.SourceType == ChatSourceType.Agent)
             {
-                sb.Append(instance.Names.Get(e.SourceID, e.FromName));
+                item.From = instance.Names.Get(e.SourceID, e.FromName);
             }
             else
             {
-                sb.Append(e.FromName);
+                item.From = e.FromName;
             }
 
             bool isEmote = e.Message.ToLower().StartsWith("/me ");
@@ -287,7 +293,6 @@ namespace Radegast
                     sb.Append(e.Message);
             }
 
-            ChatBufferItem item = new ChatBufferItem();
             item.Timestamp = DateTime.Now;
             item.Text = sb.ToString();
 
@@ -338,4 +343,14 @@ namespace Radegast
             set { textPrinter = value; }
         }
     }
+
+    public class ChatLineAddedArgs : EventArgs
+    {
+        ChatBufferItem mItem;
+
+        public ChatLineAddedArgs(ChatBufferItem item)
+        {
+            mItem = item;
+        }
+    }
 }
index f019bd8..a4b4f1e 100644 (file)
@@ -400,7 +400,7 @@ namespace Radegast
                 ProcessChatInput(cbxInput.Text, ChatType.Normal);
         }
 
-        private void ProcessChatInput(string input, ChatType type)
+        public void ProcessChatInput(string input, ChatType type)
         {
             if (string.IsNullOrEmpty(input)) return;
             chatHistory.Add(input);
index cd854c7..b1c040b 100644 (file)
@@ -108,6 +108,7 @@ namespace Radegast
         private GridClient client { get { return instance.Client; } }
         private RadegastNetcom netcom { get { return instance.Netcom; } }
         private ChatTextManager mainChatManger;
+        public ChatTextManager MainChatManger { get { return mainChatManger; } }
 
         private Dictionary<string, RadegastTab> tabs = new Dictionary<string, RadegastTab>();
         public Dictionary<string, RadegastTab> Tabs { get { return tabs; } }
@@ -500,6 +501,8 @@ namespace Radegast
             {
                 ChatBufferItem line = new ChatBufferItem(
                     DateTime.Now,
+                    string.Empty,
+                    UUID.Zero,
                     msg,
                     style
                 );
diff --git a/Radegast/GUI/Rendering/ChatBox.cs b/Radegast/GUI/Rendering/ChatBox.cs
new file mode 100644 (file)
index 0000000..5afef97
--- /dev/null
@@ -0,0 +1,40 @@
+// 
+// Radegast Metaverse Client
+// Copyright (c) 2009-2011, Radegast Development Team
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+//     * Redistributions of source code must retain the above copyright notice,
+//       this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above copyright
+//       notice, this list of conditions and the following disclaimer in the
+//       documentation and/or other materials provided with the distribution.
+//     * Neither the name of the application "Radegast", nor the names of its
+//       contributors may be used to endorse or promote products derived from
+//       this software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// $Id$
+//
+
+using System;
+using System.Windows.Forms;
+
+namespace Radegast.Rendering
+{
+    public class ChatBox : TextBox
+    {
+    }
+}
diff --git a/Radegast/GUI/Rendering/ChatOverlay.cs b/Radegast/GUI/Rendering/ChatOverlay.cs
new file mode 100644 (file)
index 0000000..d8cc49a
--- /dev/null
@@ -0,0 +1,67 @@
+// 
+// Radegast Metaverse Client
+// Copyright (c) 2009-2011, Radegast Development Team
+// All rights reserved.
+// 
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are met:
+// 
+//     * Redistributions of source code must retain the above copyright notice,
+//       this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above copyright
+//       notice, this list of conditions and the following disclaimer in the
+//       documentation and/or other materials provided with the distribution.
+//     * Neither the name of the application "Radegast", nor the names of its
+//       contributors may be used to endorse or promote products derived from
+//       this software without specific prior written permission.
+// 
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// $Id$
+//
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Drawing;
+
+namespace Radegast.Rendering
+{
+    public class ChatOverlay : IDisposable
+    {
+        RadegastInstance Instance;
+        SceneWindow Window;
+        float runningTime;
+
+        public ChatOverlay(RadegastInstance instance, SceneWindow window)
+        {
+            this.Instance = instance;
+            this.Window = window;
+            Instance.TabConsole.MainChatManger.ChatLineAdded += new EventHandler<ChatLineAddedArgs>(MainChatManger_ChatLineAdded);
+        }
+
+        public void Dispose()
+        {
+            Instance.TabConsole.MainChatManger.ChatLineAdded -= new EventHandler<ChatLineAddedArgs>(MainChatManger_ChatLineAdded);
+        }
+
+        void MainChatManger_ChatLineAdded(object sender, ChatLineAddedArgs e)
+        {
+        }
+
+        public void RenderChat(float time)
+        {
+            runningTime += time;
+        }
+    }
+}
index b17c0f8..3d50bfa 100644 (file)
@@ -91,8 +91,13 @@ namespace Radegast.Rendering
             this.cbAA = new System.Windows.Forms.CheckBox();\r
             this.chkWireFrame = new System.Windows.Forms.CheckBox();\r
             this.ctxMenu = new System.Windows.Forms.ContextMenuStrip(this.components);\r
+            this.pnlChat = new System.Windows.Forms.Panel();\r
+            this.cbChatType = new System.Windows.Forms.ComboBox();\r
+            this.btnSay = new System.Windows.Forms.Button();\r
+            this.txtChat = new Radegast.Rendering.ChatBox();\r
             this.pnlDebug.SuspendLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.tbDrawDistance)).BeginInit();\r
+            this.pnlChat.SuspendLayout();\r
             this.SuspendLayout();\r
             // \r
             // pnlDebug\r
@@ -468,10 +473,65 @@ namespace Radegast.Rendering
             this.ctxMenu.Size = new System.Drawing.Size(61, 4);\r
             this.ctxMenu.Opening += new System.ComponentModel.CancelEventHandler(this.ctxObjects_Opening);\r
             // \r
+            // pnlChat\r
+            // \r
+            this.pnlChat.Controls.Add(this.cbChatType);\r
+            this.pnlChat.Controls.Add(this.btnSay);\r
+            this.pnlChat.Controls.Add(this.txtChat);\r
+            this.pnlChat.Dock = System.Windows.Forms.DockStyle.Bottom;\r
+            this.pnlChat.Location = new System.Drawing.Point(0, 314);\r
+            this.pnlChat.Name = "pnlChat";\r
+            this.pnlChat.Size = new System.Drawing.Size(779, 23);\r
+            this.pnlChat.TabIndex = 9;\r
+            // \r
+            // cbChatType\r
+            // \r
+            this.cbChatType.AccessibleName = "Chat type";\r
+            this.cbChatType.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));\r
+            this.cbChatType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;\r
+            this.cbChatType.Enabled = false;\r
+            this.cbChatType.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.cbChatType.FormattingEnabled = true;\r
+            this.cbChatType.Items.AddRange(new object[] {\r
+            "Whisper",\r
+            "Normal",\r
+            "Shout"});\r
+            this.cbChatType.Location = new System.Drawing.Point(700, 0);\r
+            this.cbChatType.Name = "cbChatType";\r
+            this.cbChatType.Size = new System.Drawing.Size(73, 21);\r
+            this.cbChatType.TabIndex = 2;\r
+            // \r
+            // btnSay\r
+            // \r
+            this.btnSay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));\r
+            this.btnSay.Enabled = false;\r
+            this.btnSay.FlatAppearance.BorderSize = 0;\r
+            this.btnSay.FlatStyle = System.Windows.Forms.FlatStyle.Flat;\r
+            this.btnSay.Location = new System.Drawing.Point(650, 0);\r
+            this.btnSay.Name = "btnSay";\r
+            this.btnSay.Size = new System.Drawing.Size(50, 22);\r
+            this.btnSay.TabIndex = 1;\r
+            this.btnSay.Text = "Say";\r
+            this.btnSay.UseVisualStyleBackColor = true;\r
+            this.btnSay.Click += new System.EventHandler(this.btnSay_Click);\r
+            // \r
+            // txtChat\r
+            // \r
+            this.txtChat.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)\r
+                        | System.Windows.Forms.AnchorStyles.Right)));\r
+            this.txtChat.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;\r
+            this.txtChat.Location = new System.Drawing.Point(0, 1);\r
+            this.txtChat.Name = "txtChat";\r
+            this.txtChat.Size = new System.Drawing.Size(650, 20);\r
+            this.txtChat.TabIndex = 0;\r
+            this.txtChat.TextChanged += new System.EventHandler(this.txtChat_TextChanged);\r
+            this.txtChat.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtChat_KeyDown);\r
+            // \r
             // SceneWindow\r
             // \r
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);\r
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;\r
+            this.Controls.Add(this.pnlChat);\r
             this.Controls.Add(this.pnlDebug);\r
             this.Name = "SceneWindow";\r
             this.Size = new System.Drawing.Size(779, 500);\r
@@ -479,6 +539,8 @@ namespace Radegast.Rendering
             this.pnlDebug.ResumeLayout(false);\r
             this.pnlDebug.PerformLayout();\r
             ((System.ComponentModel.ISupportInitialize)(this.tbDrawDistance)).EndInit();\r
+            this.pnlChat.ResumeLayout(false);\r
+            this.pnlChat.PerformLayout();\r
             this.ResumeLayout(false);\r
 \r
         }\r
@@ -491,32 +553,36 @@ namespace Radegast.Rendering
         public System.Windows.Forms.CheckBox chkWireFrame;\r
         public System.Windows.Forms.Button btnResetView;\r
         public System.Windows.Forms.Label label2;\r
-        private System.Windows.Forms.HScrollBar hsSpecular;\r
-        private System.Windows.Forms.HScrollBar hsDiffuse;\r
-        private System.Windows.Forms.HScrollBar hsAmbient;\r
-        private System.Windows.Forms.HScrollBar hsLOD;\r
-        private System.Windows.Forms.Button button_vparam;\r
-        private System.Windows.Forms.TextBox textBox_x;\r
-        private System.Windows.Forms.ComboBox comboBox1;\r
-        private System.Windows.Forms.TextBox textBox_z;\r
-        private System.Windows.Forms.TextBox textBox_y;\r
-        private System.Windows.Forms.Label label4;\r
-        private System.Windows.Forms.TextBox textBox_sx;\r
-        private System.Windows.Forms.Label label3;\r
-        private System.Windows.Forms.Label label1;\r
-        private System.Windows.Forms.TextBox textBox_sz;\r
-        private System.Windows.Forms.TextBox textBox_sy;\r
-        private System.Windows.Forms.Button button1;\r
-        private System.Windows.Forms.TextBox textBox_morphamount;\r
-        private System.Windows.Forms.Label label5;\r
-        private System.Windows.Forms.ComboBox comboBox_morph;\r
-        private System.Windows.Forms.Button button_driver;\r
-        private System.Windows.Forms.TextBox textBox_driveramount;\r
-        private System.Windows.Forms.Label label6;\r
-        private System.Windows.Forms.ComboBox comboBox_driver;\r
-        private System.Windows.Forms.TrackBar tbDrawDistance;\r
-        private System.Windows.Forms.Label lblDrawDistance;\r
-        private System.Windows.Forms.CheckBox cbMisc;\r
+        public System.Windows.Forms.Panel pnlChat;\r
+        public Radegast.Rendering.ChatBox txtChat;\r
+        public System.Windows.Forms.HScrollBar hsSpecular;\r
+        public System.Windows.Forms.HScrollBar hsDiffuse;\r
+        public System.Windows.Forms.HScrollBar hsAmbient;\r
+        public System.Windows.Forms.HScrollBar hsLOD;\r
+        public System.Windows.Forms.Button button_vparam;\r
+        public System.Windows.Forms.TextBox textBox_x;\r
+        public System.Windows.Forms.ComboBox comboBox1;\r
+        public System.Windows.Forms.TextBox textBox_z;\r
+        public System.Windows.Forms.TextBox textBox_y;\r
+        public System.Windows.Forms.Label label4;\r
+        public System.Windows.Forms.TextBox textBox_sx;\r
+        public System.Windows.Forms.Label label3;\r
+        public System.Windows.Forms.Label label1;\r
+        public System.Windows.Forms.TextBox textBox_sz;\r
+        public System.Windows.Forms.TextBox textBox_sy;\r
+        public System.Windows.Forms.Button button1;\r
+        public System.Windows.Forms.TextBox textBox_morphamount;\r
+        public System.Windows.Forms.Label label5;\r
+        public System.Windows.Forms.ComboBox comboBox_morph;\r
+        public System.Windows.Forms.Button button_driver;\r
+        public System.Windows.Forms.TextBox textBox_driveramount;\r
+        public System.Windows.Forms.Label label6;\r
+        public System.Windows.Forms.ComboBox comboBox_driver;\r
+        public System.Windows.Forms.TrackBar tbDrawDistance;\r
+        public System.Windows.Forms.Label lblDrawDistance;\r
+        public System.Windows.Forms.CheckBox cbMisc;\r
+        public System.Windows.Forms.Button btnSay;\r
+        public System.Windows.Forms.ComboBox cbChatType;\r
 \r
     }\r
 }\r
index f8100d5..673599d 100644 (file)
@@ -117,10 +117,16 @@ namespace Radegast.Rendering
         /// </summary>\r
         public bool CacheDecodedTextures = false;\r
 \r
+        /// <summary>\r
+        /// Size of OpenGL window we're drawing on\r
+        /// </summary>\r
+        int[] Viewport = new int[4];\r
+\r
         #endregion Public fields\r
 \r
         #region Private fields\r
 \r
+        ChatOverlay chatOverlay;\r
         Camera Camera;\r
         SceneObject trackedObject;\r
         Vector3 lastTrackedObjectPos = RHelp.InvalidPosition;\r
@@ -143,7 +149,6 @@ namespace Radegast.Rendering
         Dictionary<UUID, Bitmap> sculptCache = new Dictionary<UUID, Bitmap>();\r
         OpenTK.Matrix4 ModelMatrix;\r
         OpenTK.Matrix4 ProjectionMatrix;\r
-        int[] Viewport = new int[4];\r
         System.Diagnostics.Stopwatch renderTimer;\r
         float lastFrameTime = 0f;\r
         float advTimerTick = 0f;\r
@@ -193,6 +198,9 @@ namespace Radegast.Rendering
             InitCamera();\r
             SetWaterPlanes();\r
 \r
+            chatOverlay = new ChatOverlay(instance, this);\r
+            cbChatType.SelectedIndex = 1;\r
+\r
             tbDrawDistance.Value = (int)DrawDistance;\r
             lblDrawDistance.Text = string.Format("Draw distance: {0}", tbDrawDistance.Value);\r
             pnlDebug.Visible = Instance.GlobalSettings["scene_viewer_debug_panel"];\r
@@ -217,6 +225,12 @@ namespace Radegast.Rendering
 \r
             PendingTextures.Close();\r
 \r
+            if (chatOverlay != null)\r
+            {\r
+                chatOverlay.Dispose();\r
+                chatOverlay = null;\r
+            }\r
+\r
             Client.Objects.TerseObjectUpdate -= new EventHandler<TerseObjectUpdateEventArgs>(Objects_TerseObjectUpdate);\r
             Client.Objects.ObjectUpdate -= new EventHandler<PrimEventArgs>(Objects_ObjectUpdate);\r
             Client.Objects.ObjectDataBlockUpdate -= new EventHandler<ObjectDataBlockUpdateEventArgs>(Objects_ObjectDataBlockUpdate);\r
@@ -2911,6 +2925,7 @@ namespace Radegast.Rendering
                 GLHUDBegin();\r
                 RenderText(RenderPass.Simple);\r
                 RenderStats();\r
+                chatOverlay.RenderChat(lastFrameTime);\r
                 GLHUDEnd();\r
                 GL.Disable(EnableCap.Blend);\r
             }\r
@@ -3632,5 +3647,52 @@ namespace Radegast.Rendering
         }\r
 \r
         #endregion\r
+\r
+        private void txtChat_TextChanged(object sender, EventArgs e)\r
+        {\r
+            if (txtChat.Text.Length > 0)\r
+            {\r
+                btnSay.Enabled = cbChatType.Enabled = true;\r
+                if (!txtChat.Text.StartsWith("/"))\r
+                {\r
+                    if (!Instance.State.IsTyping && !Instance.GlobalSettings["no_typing_anim"])\r
+                    {\r
+                        Instance.State.SetTyping(true);\r
+                    }\r
+                }\r
+            }\r
+            else\r
+            {\r
+                btnSay.Enabled = cbChatType.Enabled = false;\r
+                if (!Instance.GlobalSettings["no_typing_anim"])\r
+                {\r
+                    Instance.State.SetTyping(false);\r
+                }\r
+            }\r
+        }\r
+\r
+        private void txtChat_KeyDown(object sender, KeyEventArgs e)\r
+        {\r
+            if (e.KeyCode != Keys.Enter) return;\r
+            e.Handled = e.SuppressKeyPress = true;\r
+            ChatConsole chat = (ChatConsole)Instance.TabConsole.Tabs["chat"].Control;\r
+            \r
+            if (e.Shift)\r
+                chat.ProcessChatInput(txtChat.Text, ChatType.Whisper);\r
+            else if (e.Control)\r
+                chat.ProcessChatInput(txtChat.Text, ChatType.Shout);\r
+            else\r
+                chat.ProcessChatInput(txtChat.Text, ChatType.Normal);\r
+\r
+            txtChat.Text = string.Empty;\r
+        }\r
+\r
+        private void btnSay_Click(object sender, EventArgs e)\r
+        {\r
+            ChatConsole chat = (ChatConsole)Instance.TabConsole.Tabs["chat"].Control;\r
+            chat.ProcessChatInput(txtChat.Text, (ChatType)cbChatType.SelectedIndex);\r
+            txtChat.Select();\r
+            txtChat.Text = string.Empty;\r
+        }\r
     }\r
 }\r
index f609073..d54d114 100644 (file)
     <Compile Include="GUI\Notifications\TeleportNotification.Designer.cs">\r
       <DependentUpon>TeleportNotification.cs</DependentUpon>\r
     </Compile>\r
+    <Compile Include="GUI\Rendering\ChatBox.cs">\r
+      <SubType>Component</SubType>\r
+    </Compile>\r
+    <Compile Include="GUI\Rendering\ChatOverlay.cs" />\r
     <Compile Include="GUI\Rendering\Compat.cs" />\r
     <Compile Include="GUI\Rendering\Frustum.cs" />\r
     <Compile Include="GUI\Rendering\ImageUtils.cs" />\r