diff --git a/.gitignore b/.gitignore index 676af957a..942751b06 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ compile.bat *.resources *~ *.userprefs +.vs \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..5cb7c52ad --- /dev/null +++ b/.travis.yml @@ -0,0 +1,39 @@ +language: csharp +solution: Radegast.sln + +os: + - linux + +branches: + except: + - /^build-/ + +install: +<<<<<<< HEAD + - "export BUILD_MAJOR=2" + - "export BUILD_MINOR=19" + - "export GIT_TAG=build-$BUILD_MAJOR.$BUILD_MINOR.$TRAVIS_BUILD_NUMBER-$TRAVIS_OS_NAME-$TRAVIS_BRANCH-$(date -u '+%Y-%m-%d')" + - "export GIT_ARTIFACT=Radegast-$GIT_TAG.zip" + - "./ci/install.sh" +======= + - "./runprebuild.sh" +>>>>>>> parent of 4828a00... Moving all build numbers to one location + +before_deploy: + - "export GIT_TAG=build-$TRAVIS_BUILD_NUMBER-$TRAVIS_OS_NAME-$TRAVIS_BRANCH-$(date -u '+%Y-%m-%d')" + - "export GIT_ARTIFACT=Radegast-$GIT_TAG.zip" + - "./before_deploy.sh" + +deploy: + provider: releases + api_key: + secure: wDIvmLG2B0wA4Ngp+avp1qQOU3lpUIC79C/iEo/BDNA4TQJLeAvYrQ7mXVjXrSP41LCB9aWmjjlTJk8nRbEcTWwiYTRDPRqvxo32/BPsW6zaBrqHGP1dF3R8L/KtVRf97iNJJRXWHZssNYsuakBKTHp6dPt68qU6k3cig7aiVH/qTwawYpI9/qtUUdfuN3h9/PciujyAr/XBpTzS7xLHsHShchMpgEVhGqtjd+yR2z0qojNs645Iit7lZOMrtjuqNLjxXS3WLbWVHT22upX+00ovlJXT6fUtkHKWuAW3hSEN525/I8bl7NExLpy9yOUa/D1JALBgrd2qxhsECJ+sJ9ms59iQxYJOOpfuk6KIjmtD+i4f6h2rSOjOtbc1dUvA9+SH27o00DPjFQKPA0lLqEPGBxdlFE0ocOHI2UW1wvTRSAUhJe6QLLatVLJl5TfcDOsM7JC29XeuHXL1wHFRqEq8agpdR8UqueaDkfAWVPXQRywVD/aUFrMMJEfxTncVhRXepLL3z2uHwjpRaw5JJ7hsU5eaEEvIRMzR73IOCHlfmqCtjE7bMVmO9Zn0BjGJURHCk77I395QLWnCOuMShWm1OnH5Klxjehlgqtpdhaj83OgsnE7/sXsMPaqxwtzusTRsRYmJz/4D5B7/TPVNDzK2Xewr0NKEBmY3n/MnAqc= + skip_cleanup: true + file: $GIT_ARTIFACT + on: + repo: nooperation/radegast + all_branches: true + +env: + global: + secure: u7t+c2187aIGA/Kn/DV1/4kjJ/BmQ6/x5AKAbqdFy7R8xdY2ohOpbITclZ7aox+6PdErmrQBUNZoTfQmehYTw/DOIhA6DE3N4wJ0tGVMnOWAwsX/KWddeQkycfF/SIhcOUrl+3Muv9CJiskYHul7mnfNZzv78ZHFfoaP3zt0Jy6JEOJmAiE36OLh9NBGRyRjVWLg4AVTXdNo0vFmOZgzOoJHPAtkB/18OjZp1RHe5l9io5ww4BY/ZcxodG52WaqTwKh2fCt1juF64a1rncQiUgkBWl7jocErS3DOQ9c5/60kAhimEVAKyaSJJlpBXbYwY7IIAatDwa6ep/0xZ5pIh6QW0ffSXuxBrf15NmlKZqmuUVJ32avVRJ53rvg2MZLrsJwBC+8bsrk6RyXoph/lCweiepHm5v0c68i89xviXXV8X9xN8fxyCGQOMKR6xP7/uMbpEbIWiSmuz5ayw19HFKkTeefqWq+Q4McaTOXf56lJ7gQIDN1QLOlmGJd7A57ftJYlfr5He7hS5ciXrEshDh+Yu4PdIUz2pB73LsHmT22XPWs575g0nxwcsE3dv86h/CuVWuOyZT6u5DIokj4k+rF2rXqqXCrJ3/Wp9T26S3UO/Q5gVVXTEymIsBqjPzbnbuRcYwK97r8vEXJ1dGKZMrhNX33GnqBVVIfrs7ZJHas= diff --git a/NullBuild.txt b/NullBuild.txt deleted file mode 100644 index 58d4e512b..000000000 --- a/NullBuild.txt +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/README.md b/README.md index c0044fb2c..b9ffcfcf4 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Developers: # License **Radegast Metaverse Client**
-*Copyright © 2009-2011, Radegast Development Team*
+*Copyright © 2009-2016, 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: @@ -73,3 +73,7 @@ http://commandline.codeplex.com/
Uses code snippets from CSAT Library (MIT License)
Copyright © 2011 mjt
http://code.google.com/p/csat/
+ +Uses SmartIrc4net (LGPL)
+Copyright © 2003-2005 Mirco Bauer
+http://www.meebey.net/projects/smartirc4net/
diff --git a/Radegast/Core/ChatBufferItem.cs b/Radegast/Core/ChatBufferItem.cs index 409378376..96ab366b2 100644 --- a/Radegast/Core/ChatBufferItem.cs +++ b/Radegast/Core/ChatBufferItem.cs @@ -104,6 +104,8 @@ public enum ChatBufferTextStyle Error, Alert, OwnerSay, - Invisible + Invisible, + Emote, + Self } } diff --git a/Radegast/Core/ChatTextManager.cs b/Radegast/Core/ChatTextManager.cs index 0053d1f56..43a2cb745 100644 --- a/Radegast/Core/ChatTextManager.cs +++ b/Radegast/Core/ChatTextManager.cs @@ -35,11 +35,14 @@ using Radegast.Netcom; using OpenMetaverse; using OpenMetaverse.StructuredData; +using System.Web.Script.Serialization; +using System.ComponentModel; namespace Radegast { public class ChatTextManager : IDisposable { + public event EventHandler ChatLineAdded; private RadegastInstance instance; @@ -51,6 +54,8 @@ public class ChatTextManager : IDisposable private bool showTimestamps; + public static Dictionary fontSettings = new Dictionary(); + public ChatTextManager(RadegastInstance instance, ITextPrinter textPrinter) { this.textPrinter = textPrinter; @@ -75,9 +80,32 @@ public void Dispose() private void InitializeConfig() { Settings s = instance.GlobalSettings; + var serializer = new JavaScriptSerializer(); if (s["chat_timestamps"].Type == OSDType.Unknown) + { s["chat_timestamps"] = OSD.FromBoolean(true); + } + if (s["chat_fonts"].Type == OSDType.Unknown) + { + try + { + s["chat_fonts"] = serializer.Serialize(Settings.DefaultFontSettings); + } + catch (Exception ex) + { + System.Windows.Forms.MessageBox.Show("Failed to save default font settings: " + ex.Message); + } + } + + try + { + fontSettings = serializer.Deserialize>(s["chat_fonts"]); + } + catch (Exception ex) + { + System.Windows.Forms.MessageBox.Show("Failed to read chat font settings: " + ex.Message); + } showTimestamps = s["chat_timestamps"].AsBoolean(); @@ -91,6 +119,19 @@ void s_OnSettingChanged(object sender, SettingsEventArgs e) showTimestamps = e.Value.AsBoolean(); ReprintAllText(); } + else if(e.Key == "chat_fonts") + { + try + { + var serializer = new JavaScriptSerializer(); + fontSettings = serializer.Deserialize>(e.Value); + } + catch (Exception ex) + { + System.Windows.Forms.MessageBox.Show("Failed to read new font settings: " + ex.Message); + } + ReprintAllText(); + } } private void netcom_ChatSent(object sender, ChatSentEventArgs e) @@ -143,59 +184,60 @@ public void ProcessBufferItem(ChatBufferItem item, bool addToBuffer) if (showTimestamps) { - textPrinter.ForeColor = SystemColors.GrayText; - textPrinter.PrintText(item.Timestamp.ToString("[HH:mm] ")); + if(fontSettings.ContainsKey("Timestamp")) + { + var fontSetting = fontSettings["Timestamp"]; + textPrinter.ForeColor = fontSetting.ForeColor; + textPrinter.BackColor = fontSetting.BackColor; + textPrinter.Font = fontSetting.Font; + textPrinter.PrintText(item.Timestamp.ToString("[HH:mm] ")); + } + else + { + textPrinter.ForeColor = SystemColors.GrayText; + textPrinter.BackColor = Color.Transparent; + textPrinter.Font = Settings.FontSetting.DefaultFont; + textPrinter.PrintText(item.Timestamp.ToString("[HH:mm] ")); + } } - switch (item.Style) + if(fontSettings.ContainsKey("Name")) { - case ChatBufferTextStyle.Normal: - textPrinter.ForeColor = SystemColors.WindowText; - break; - - case ChatBufferTextStyle.StatusBlue: - textPrinter.ForeColor = Color.Blue; - break; - - case ChatBufferTextStyle.StatusDarkBlue: - textPrinter.ForeColor = Color.DarkBlue; - break; - - case ChatBufferTextStyle.LindenChat: - textPrinter.ForeColor = Color.DarkGreen; - break; - - case ChatBufferTextStyle.ObjectChat: - textPrinter.ForeColor = Color.DarkCyan; - break; - - case ChatBufferTextStyle.StartupTitle: - textPrinter.ForeColor = SystemColors.WindowText; - textPrinter.Font = new Font(textPrinter.Font, FontStyle.Bold); - break; - - case ChatBufferTextStyle.Alert: - textPrinter.ForeColor = Color.DarkRed; - break; - - case ChatBufferTextStyle.Error: - textPrinter.ForeColor = Color.Red; - break; - - case ChatBufferTextStyle.OwnerSay: - textPrinter.ForeColor = Color.FromArgb(255, 180, 150, 0); - break; + var fontSetting = fontSettings["Name"]; + textPrinter.ForeColor = fontSetting.ForeColor; + textPrinter.BackColor = fontSetting.BackColor; + textPrinter.Font = fontSetting.Font; + } + else + { + textPrinter.ForeColor = SystemColors.WindowText; + textPrinter.BackColor = Color.Transparent; + textPrinter.Font = Settings.FontSetting.DefaultFont; } if (item.Style == ChatBufferTextStyle.Normal && item.ID != UUID.Zero && instance.GlobalSettings["av_name_link"]) { textPrinter.InsertLink(item.From, string.Format("secondlife:///app/agent/{0}/about", item.ID)); - textPrinter.PrintTextLine(item.Text); } else { - textPrinter.PrintTextLine(item.From + item.Text); + textPrinter.PrintText(item.From); } + + if(fontSettings.ContainsKey(item.Style.ToString())) + { + var fontSetting = fontSettings[item.Style.ToString()]; + textPrinter.ForeColor = fontSetting.ForeColor; + textPrinter.BackColor = fontSetting.BackColor; + textPrinter.Font = fontSetting.Font; + } + else + { + textPrinter.ForeColor = SystemColors.WindowText; + textPrinter.BackColor = Color.Transparent; + textPrinter.Font = Settings.FontSetting.DefaultFont; + } + textPrinter.PrintTextLine(item.Text); } } @@ -315,15 +357,34 @@ private void ProcessIncomingChat(ChatEventArgs e) switch (e.SourceType) { case ChatSourceType.Agent: - item.Style = - (e.FromName.EndsWith("Linden") ? - ChatBufferTextStyle.LindenChat : ChatBufferTextStyle.Normal); + if(e.FromName.EndsWith("Linden")) + { + item.Style = ChatBufferTextStyle.LindenChat; + } + else if(isEmote) + { + item.Style = ChatBufferTextStyle.Emote; + } + else if(e.SourceID == client.Self.AgentID) + { + item.Style = ChatBufferTextStyle.Self; + } + else + { + item.Style = ChatBufferTextStyle.Normal; + } break; - case ChatSourceType.Object: if (e.Type == ChatType.OwnerSay) { - item.Style = ChatBufferTextStyle.OwnerSay; + if(isEmote) + { + item.Style = ChatBufferTextStyle.Emote; + } + else + { + item.Style = ChatBufferTextStyle.OwnerSay; + } } else if (e.Type == ChatType.Debug) { diff --git a/Radegast/Core/IMTextManager.cs b/Radegast/Core/IMTextManager.cs index ddff2685c..d74c8b1cc 100644 --- a/Radegast/Core/IMTextManager.cs +++ b/Radegast/Core/IMTextManager.cs @@ -36,6 +36,8 @@ using Radegast.Netcom; using OpenMetaverse; using OpenMetaverse.StructuredData; +using System.Web.Script.Serialization; +using System.Collections.Generic; namespace Radegast { @@ -54,6 +56,8 @@ public class IMTextManager bool showTimestamps; + public static Dictionary fontSettings = new Dictionary(); + public IMTextManager(RadegastInstance instance, ITextPrinter textPrinter, IMTextManagerType type, UUID sessionID, string sessionName) { this.sessionID = sessionID; @@ -72,9 +76,32 @@ public IMTextManager(RadegastInstance instance, ITextPrinter textPrinter, IMText private void InitializeConfig() { Settings s = instance.GlobalSettings; + var serializer = new JavaScriptSerializer(); if (s["im_timestamps"].Type == OSDType.Unknown) + { s["im_timestamps"] = OSD.FromBoolean(true); + } + if (s["chat_fonts"].Type == OSDType.Unknown) + { + try + { + s["chat_fonts"] = serializer.Serialize(Settings.DefaultFontSettings); + } + catch (Exception ex) + { + System.Windows.Forms.MessageBox.Show("Failed to save default font settings: " + ex.Message); + } + } + + try + { + fontSettings = serializer.Deserialize>(s["chat_fonts"]); + } + catch (Exception ex) + { + System.Windows.Forms.MessageBox.Show("Failed to read chat font settings: " + ex.Message); + } showTimestamps = s["im_timestamps"].AsBoolean(); @@ -88,6 +115,19 @@ void s_OnSettingChanged(object sender, SettingsEventArgs e) showTimestamps = e.Value.AsBoolean(); ReprintAllText(); } + else if(e.Key == "chat_fonts") + { + try + { + var serializer = new JavaScriptSerializer(); + fontSettings = serializer.Deserialize>(e.Value); + } + catch (Exception ex) + { + System.Windows.Forms.MessageBox.Show("Failed to read new font settings: " + ex.Message); + } + ReprintAllText(); + } } private void AddNetcomEvents() @@ -107,7 +147,7 @@ private void netcom_InstantMessageSent(object sender, InstantMessageSentEventArg if (e.SessionID != sessionID) return; textBuffer.Add(e); - ProcessIM(e); + ProcessIM(e, true); } private void netcom_InstantMessageReceived(object sender, InstantMessageEventArgs e) @@ -123,23 +163,23 @@ private void netcom_InstantMessageReceived(object sender, InstantMessageEventArg } textBuffer.Add(e); - ProcessIM(e); + ProcessIM(e, true); } - public void ProcessIM(object e) + public void ProcessIM(object e, bool isNewMessage) { if (e is InstantMessageEventArgs) - this.ProcessIncomingIM((InstantMessageEventArgs)e); + this.ProcessIncomingIM((InstantMessageEventArgs)e, isNewMessage); else if (e is InstantMessageSentEventArgs) - this.ProcessOutgoingIM((InstantMessageSentEventArgs)e); + this.ProcessOutgoingIM((InstantMessageSentEventArgs)e, isNewMessage); } - private void ProcessOutgoingIM(InstantMessageSentEventArgs e) + private void ProcessOutgoingIM(InstantMessageSentEventArgs e, bool isNewMessage) { - PrintIM(e.Timestamp, netcom.LoginOptions.FullName, instance.Client.Self.AgentID, e.Message); + PrintIM(e.Timestamp, netcom.LoginOptions.FullName, instance.Client.Self.AgentID, e.Message, isNewMessage); } - private void ProcessIncomingIM(InstantMessageEventArgs e) + private void ProcessIncomingIM(InstantMessageEventArgs e, bool isNewMessage) { string msg = e.IM.Message; @@ -165,7 +205,7 @@ private void ProcessIncomingIM(InstantMessageEventArgs e) { instance.MediaManager.PlayUISound(UISounds.IM); } - PrintIM(DateTime.Now, instance.Names.Get(e.IM.FromAgentID, e.IM.FromAgentName), e.IM.FromAgentID, msg); + PrintIM(DateTime.Now, instance.Names.Get(e.IM.FromAgentID, e.IM.FromAgentName), e.IM.FromAgentID, msg, isNewMessage); if (!AutoResponseSent && Type == IMTextManagerType.Agent && e.IM.FromAgentID != UUID.Zero && e.IM.FromAgentName != "Second Life") { @@ -192,7 +232,7 @@ private void ProcessIncomingIM(InstantMessageEventArgs e) instance.Client.Network.CurrentSim.ID, null); - PrintIM(DateTime.Now, instance.Client.Self.Name, instance.Client.Self.AgentID, instance.GlobalSettings["auto_response_text"].AsString()); + PrintIM(DateTime.Now, instance.Client.Self.Name, instance.Client.Self.AgentID, instance.GlobalSettings["auto_response_text"].AsString(), isNewMessage); } } } @@ -207,24 +247,75 @@ public void DisplayNotification(string message) if (showTimestamps) { - textPrinter.ForeColor = SystemColors.GrayText; - textPrinter.PrintText(DateTime.Now.ToString("[HH:mm] ")); + if(fontSettings.ContainsKey("Timestamp")) + { + var fontSetting = fontSettings["Timestamp"]; + textPrinter.ForeColor = fontSetting.ForeColor; + textPrinter.BackColor = fontSetting.BackColor; + textPrinter.Font = fontSetting.Font; + textPrinter.PrintText(DateTime.Now.ToString("[HH:mm] ")); + } + else + { + textPrinter.ForeColor = SystemColors.GrayText; + textPrinter.BackColor = Color.Transparent; + textPrinter.Font = Settings.FontSetting.DefaultFont; + textPrinter.PrintText(DateTime.Now.ToString("[HH:mm] ")); + } + } + + if(fontSettings.ContainsKey("Notification")) + { + var fontSetting = fontSettings["Notification"]; + textPrinter.ForeColor = fontSetting.ForeColor; + textPrinter.BackColor = fontSetting.BackColor; + textPrinter.Font = fontSetting.Font; + } + else + { + textPrinter.ForeColor = Color.DarkCyan; + textPrinter.BackColor = Color.Transparent; + textPrinter.Font = Settings.FontSetting.DefaultFont; } - textPrinter.ForeColor = Color.DarkCyan; instance.LogClientMessage(sessionName + ".txt", message); textPrinter.PrintTextLine(message); } - private void PrintIM(DateTime timestamp, string fromName, UUID fromID, string message) + private void PrintIM(DateTime timestamp, string fromName, UUID fromID, string message, bool isNewMessage) { if (showTimestamps) { - textPrinter.ForeColor = SystemColors.GrayText; - textPrinter.PrintText(timestamp.ToString("[HH:mm] ")); + if(fontSettings.ContainsKey("Timestamp")) + { + var fontSetting = fontSettings["Timestamp"]; + textPrinter.ForeColor = fontSetting.ForeColor; + textPrinter.BackColor = fontSetting.BackColor; + textPrinter.Font = fontSetting.Font; + textPrinter.PrintText(DateTime.Now.ToString("[HH:mm] ")); + } + else + { + textPrinter.ForeColor = SystemColors.GrayText; + textPrinter.BackColor = Color.Transparent; + textPrinter.Font = Settings.FontSetting.DefaultFont; + textPrinter.PrintText(DateTime.Now.ToString("[HH:mm] ")); + } } - textPrinter.ForeColor = SystemColors.WindowText; + if(fontSettings.ContainsKey("Name")) + { + var fontSetting = fontSettings["Name"]; + textPrinter.ForeColor = fontSetting.ForeColor; + textPrinter.BackColor = fontSetting.BackColor; + textPrinter.Font = fontSetting.Font; + } + else + { + textPrinter.ForeColor = SystemColors.WindowText; + textPrinter.BackColor = Color.Transparent; + textPrinter.Font = Settings.FontSetting.DefaultFont; + } if (instance.GlobalSettings["av_name_link"]) { @@ -239,15 +330,66 @@ private void PrintIM(DateTime timestamp, string fromName, UUID fromID, string me if (message.StartsWith("/me ")) { + if(fontSettings.ContainsKey("Emote")) + { + var fontSetting = fontSettings["Emote"]; + textPrinter.ForeColor = fontSetting.ForeColor; + textPrinter.BackColor = fontSetting.BackColor; + textPrinter.Font = fontSetting.Font; + } + else + { + textPrinter.ForeColor = SystemColors.WindowText; + textPrinter.BackColor = Color.Transparent; + textPrinter.Font = Settings.FontSetting.DefaultFont; + } + sb.Append(message.Substring(3)); } else { + if(fromID == instance.Client.Self.AgentID) + { + if(fontSettings.ContainsKey("OutgoingIM")) + { + var fontSetting = fontSettings["OutgoingIM"]; + textPrinter.ForeColor = fontSetting.ForeColor; + textPrinter.BackColor = fontSetting.BackColor; + textPrinter.Font = fontSetting.Font; + } + else + { + textPrinter.ForeColor = SystemColors.WindowText; + textPrinter.BackColor = Color.Transparent; + textPrinter.Font = Settings.FontSetting.DefaultFont; + } + } + else + { + if(fontSettings.ContainsKey("IncomingIM")) + { + var fontSetting = fontSettings["IncomingIM"]; + textPrinter.ForeColor = fontSetting.ForeColor; + textPrinter.BackColor = fontSetting.BackColor; + textPrinter.Font = fontSetting.Font; + } + else + { + textPrinter.ForeColor = SystemColors.WindowText; + textPrinter.BackColor = Color.Transparent; + textPrinter.Font = Settings.FontSetting.DefaultFont; + } + } + sb.Append(": "); sb.Append(message); } - instance.LogClientMessage(sessionName + ".txt", fromName + sb.ToString()); + if(isNewMessage) + { + instance.LogClientMessage(sessionName + ".txt", fromName + sb.ToString()); + } + textPrinter.PrintTextLine(sb.ToString()); } @@ -308,11 +450,37 @@ private void PrintLastLog() string msg = lines[i].Trim(); if (!string.IsNullOrEmpty(msg)) { - textPrinter.PrintTextLine(msg, SystemColors.GrayText); + if(fontSettings.ContainsKey("History")) + { + var fontSetting = fontSettings["History"]; + textPrinter.ForeColor = fontSetting.ForeColor; + textPrinter.BackColor = fontSetting.BackColor; + textPrinter.Font = fontSetting.Font; + } + else + { + textPrinter.ForeColor = SystemColors.GrayText; + textPrinter.BackColor = Color.Transparent; + textPrinter.Font = Settings.FontSetting.DefaultFont; + } + textPrinter.PrintTextLine(msg); } } - textPrinter.PrintTextLine("====", SystemColors.GrayText); + if(fontSettings.ContainsKey("History")) + { + var fontSetting = fontSettings["History"]; + textPrinter.ForeColor = fontSetting.ForeColor; + textPrinter.BackColor = fontSetting.BackColor; + textPrinter.Font = fontSetting.Font; + } + else + { + textPrinter.ForeColor = SystemColors.GrayText; + textPrinter.BackColor = Color.Transparent; + textPrinter.Font = Settings.FontSetting.DefaultFont; + } + textPrinter.PrintTextLine("===="); } public void ReprintAllText() @@ -320,7 +488,7 @@ public void ReprintAllText() textPrinter.ClearText(); PrintLastLog(); foreach (object obj in textBuffer) - ProcessIM(obj); + ProcessIM(obj, false); } public void ClearInternalBuffer() diff --git a/Radegast/Core/PrimExporter.cs b/Radegast/Core/PrimExporter.cs index 7736e27c6..3731fa20b 100644 --- a/Radegast/Core/PrimExporter.cs +++ b/Radegast/Core/PrimExporter.cs @@ -61,7 +61,6 @@ public class PrimExporter GridClient Client; string ExportDirectory; private uint uLocalID; - WindowWrapper MainWindow; public delegate void LogMessageDelegate(string format, params object[] args); public LogMessageDelegate LogMessage; diff --git a/Radegast/Core/PrimImporter.cs b/Radegast/Core/PrimImporter.cs index d4a83712e..28f216f68 100644 --- a/Radegast/Core/PrimImporter.cs +++ b/Radegast/Core/PrimImporter.cs @@ -89,7 +89,6 @@ public Linkset(Primitive rootPrim) uint rootLocalID; ImporterState state = ImporterState.Idle; GridClient Client; - WindowWrapper MainWindow; string ImportDirectory; diff --git a/Radegast/Core/RLV/RLVManager.cs b/Radegast/Core/RLV/RLVManager.cs index 82c00d815..5d7c0304f 100644 --- a/Radegast/Core/RLV/RLVManager.cs +++ b/Radegast/Core/RLV/RLVManager.cs @@ -666,6 +666,8 @@ public bool TryProcessCMD(ChatEventArgs e) case "attach": case "attachoverorreplace": case "attachover": + case "attachall": + case "attachallover": if (rule.Param == "force") { if (!string.IsNullOrEmpty(rule.Option)) @@ -674,14 +676,16 @@ public bool TryProcessCMD(ChatEventArgs e) if (folder != null) { List outfit = new List(); - foreach (var item in folder.Nodes.Values) + if(rule.Behaviour == "attachall" || rule.Behaviour == "attachallover") { - if (CurrentOutfitFolder.CanBeWorn(item.Data)) - { - outfit.Add((InventoryItem)item.Data); - } + GetAllItems(folder, true, ref outfit); } - if (rule.Behaviour == "attachover") + else + { + GetAllItems(folder, false, ref outfit); + } + + if (rule.Behaviour == "attachover" || rule.Behaviour == "attachallover") { instance.COF.AddToOutfit(outfit, false); } @@ -736,24 +740,56 @@ public bool TryProcessCMD(ChatEventArgs e) break; case "findfolder": + case "findfolders": if (int.TryParse(rule.Param, out chan) && chan > 0) { + StringBuilder response = new StringBuilder(); + string[] keywordsArray = rule.Option.Split(new string[] {"&&"}, StringSplitOptions.None); if (keywordsArray.Any()) { - InventoryNode target = FindFolderKeyword(keywordsArray); - if (target != null) + List matching_nodes = FindFoldersKeyword(keywordsArray); + if(matching_nodes.Any()) { - string path = FindFullInventoryPath(target, ""); + if(rule.Behaviour == "findfolder") + { + InventoryNode bestCandidate = null; + int bestCandidateSlashCount = -1; + foreach (var match in matching_nodes) + { + string fullPath = FindFullInventoryPath(match, ""); + int numSlashes = fullPath.Count(ch => ch == '/'); + if(bestCandidate == null || numSlashes > bestCandidateSlashCount) + { + bestCandidateSlashCount = numSlashes; + bestCandidate = match; + } + } - // remove #RLV/ from the path - if (path.Substring(0, 5).ToLower() == @"#rlv/") + string bestCandidatePath = bestCandidate.Data.Name; + if (bestCandidatePath.Substring(0, 5).ToLower() == @"#rlv/") + { + bestCandidatePath = bestCandidatePath.Substring(5); + } + response.Append(bestCandidatePath); + } + else { - path = path.Substring(5); - Respond(chan, path); + StringBuilder sb = new StringBuilder(); + foreach (var node in matching_nodes) + { + string fullPath = FindFullInventoryPath(node, ""); + if (fullPath.Length > 4 && fullPath.Substring(0, 5).ToLower() == @"#rlv/") + { + fullPath = fullPath.Substring(5); + } + response.Append(fullPath + ","); + } } } } + + Respond(chan, response.ToString().TrimEnd(',')); } break; @@ -765,6 +801,24 @@ public bool TryProcessCMD(ChatEventArgs e) return true; } + private void GetAllItems(InventoryNode root, bool recursive, ref List items) + { + foreach (var item in root.Nodes.Values) + { + if (CurrentOutfitFolder.CanBeWorn(item.Data)) + { + items.Add((InventoryItem)item.Data); + } + if(recursive) + { + foreach (var child in item.Nodes.Values) + { + GetAllItems(child, true, ref items); + } + } + } + } + private void Respond(int chan, string msg) { #if DEBUG @@ -896,14 +950,12 @@ public InventoryNode FindFolder(string path) protected InventoryNode FindFolderInternal(InventoryNode currentNode, string currentPath, string desiredPath) { - if (desiredPath.ToLower() == currentPath.ToLower()) + if (desiredPath == currentPath || desiredPath == (currentPath + "/")) { return currentNode; } foreach (var n in currentNode.Nodes.Values) { - if (n.Data.Name.StartsWith(".")) continue; - var res = FindFolderInternal(n, (currentPath == "/" ? currentPath : currentPath + "/") + n.Data.Name.ToLower(), desiredPath); if (res != null) { @@ -913,45 +965,40 @@ protected InventoryNode FindFolderInternal(InventoryNode currentNode, string cur return null; } - public InventoryNode FindFolderKeyword(string[] keywords) + public List FindFoldersKeyword(string[] keywords) { + List matchingNodes = new List(); + var root = RLVRootFolder(); - if (root == null) return null; + if (root != null) + { + FindFoldersKeywordsInternal(root, keywords, new List(), ref matchingNodes); + } - return FindFolderKeywordsInternal (root, keywords); + return matchingNodes; } - protected InventoryNode FindFolderKeywordsInternal(InventoryNode currentNode, string[] keywords) + protected void FindFoldersKeywordsInternal(InventoryNode currentNode, string[] keywords, List currentPathParts, ref List matchingNodes) { - bool mustSkip = false; - foreach(string kw in keywords) - { - if (!mustSkip) - { - if (!currentNode.Data.Name.ToLower().Contains(kw.ToLower())) - { - mustSkip = true; - break; - } - } - } - - if (!mustSkip) + if (currentNode.Data is InventoryFolder && + !currentNode.Data.Name.StartsWith(".") && + !currentNode.Data.Name.StartsWith("~") && + keywords.All(keyword => currentPathParts.Contains(keyword))) { - return currentNode; + matchingNodes.Add(currentNode); } - foreach (var n in currentNode.Nodes.Values) + foreach (var node in currentNode.Nodes.Values) { - if (n.Data.Name.StartsWith(".")) continue; - - var res = FindFolderKeywordsInternal(n, keywords); - if (res != null) + if (node.Data is InventoryFolder) { - return res; + currentPathParts.Add(node.Data.Name.ToLower()); + FindFoldersKeywordsInternal(node, keywords, currentPathParts, ref matchingNodes); + currentPathParts.RemoveAt(currentPathParts.Count - 1); } } - return null; + + return; } public void Clear(UUID id) diff --git a/Radegast/Core/Settings.cs b/Radegast/Core/Settings.cs index 7f0c732c6..58464b761 100644 --- a/Radegast/Core/Settings.cs +++ b/Radegast/Core/Settings.cs @@ -35,6 +35,9 @@ using System.Xml; using OpenMetaverse; using OpenMetaverse.StructuredData; +using System.Drawing; +using System.Web.Script.Serialization; +using System.ComponentModel; namespace Radegast { @@ -46,6 +49,196 @@ public class Settings : IDictionary public delegate void SettingChangedCallback(object sender, SettingsEventArgs e); public event SettingChangedCallback OnSettingChanged; + public static readonly Dictionary DefaultFontSettings = new Dictionary() + { + {"Normal", new FontSetting { + Name = "Normal", + ForeColor = SystemColors.ControlText, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"StatusBlue", new FontSetting { + Name = "StatusBlue", + ForeColor = Color.Blue, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"StatusDarkBlue", new FontSetting { + Name = "StatusDarkBlue", + ForeColor = Color.DarkBlue, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"LindenChat", new FontSetting { + Name = "LindenChat", + ForeColor = Color.DarkGreen, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"ObjectChat", new FontSetting { + Name = "ObjectChat", + ForeColor = Color.DarkCyan, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"StartupTitle", new FontSetting { + Name = "StartupTitle", + ForeColor = SystemColors.ControlText, + BackColor = Color.Transparent, + Font = new Font(FontSetting.DefaultFont, FontStyle.Bold), + }}, + {"Alert", new FontSetting { + Name = "Alert", + ForeColor = Color.DarkRed, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"Error", new FontSetting { + Name = "Error", + ForeColor = Color.Red, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"OwnerSay", new FontSetting { + Name = "OwnerSay", + ForeColor = Color.DarkGoldenrod, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"Timestamp", new FontSetting { + Name = "Timestamp", + ForeColor = SystemColors.GrayText, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"Name", new FontSetting { + Name = "Name", + ForeColor = SystemColors.ControlText, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"Notification", new FontSetting { + Name = "Notification", + ForeColor = SystemColors.ControlText, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"IncomingIM", new FontSetting { + Name = "IncomingIM", + ForeColor = SystemColors.ControlText, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"OutgoingIM", new FontSetting { + Name = "OutgoingIM", + ForeColor = SystemColors.ControlText, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"Emote", new FontSetting { + Name = "Emote", + ForeColor = SystemColors.ControlText, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + {"Self", new FontSetting { + Name = "Self", + ForeColor = SystemColors.ControlText, + BackColor = Color.Transparent, + Font = FontSetting.DefaultFont, + }}, + }; + + public class FontSetting + { + [ScriptIgnoreAttribute] + public static readonly Font DefaultFont = new Font(FontFamily.GenericSansSerif, 8.0f); + + [ScriptIgnoreAttribute] + public Font Font; + + [ScriptIgnoreAttribute] + public Color ForeColor; + + [ScriptIgnoreAttribute] + public Color BackColor; + + + public String Name; + + public string ForeColorString + { + get + { + if (ForeColor != null) + { + return ColorTranslator.ToHtml(ForeColor); + } + else + { + return ColorTranslator.ToHtml(SystemColors.ControlText); + } + } + set + { + ForeColor = ColorTranslator.FromHtml(value); + } + } + + public string BackColorString + { + get + { + if (BackColor != null) + { + return ColorTranslator.ToHtml(BackColor); + } + else + { + return ColorTranslator.ToHtml(SystemColors.ControlText); + } + } + set + { + BackColor = ColorTranslator.FromHtml(value); + } + } + + public string FontString + { + get + { + if (this.Font != null) + { + TypeConverter converter = TypeDescriptor.GetConverter(typeof(Font)); + return converter.ConvertToString(this.Font); + } + else + { + return null; + } + } + set + { + try + { + TypeConverter converter = TypeDescriptor.GetConverter(typeof(Font)); + this.Font = converter.ConvertFromString(value) as Font; + } + catch (Exception) + { + this.Font = DefaultFont; + } + + } + } + + public override string ToString() + { + return Name; + } + } + public Settings(string fileName) { SettingsFile = fileName; diff --git a/Radegast/Core/Tools/Radeproxy.cs b/Radegast/Core/Tools/Radeproxy.cs new file mode 100644 index 000000000..700ca17c3 --- /dev/null +++ b/Radegast/Core/Tools/Radeproxy.cs @@ -0,0 +1,109 @@ +// +// Radegast Metaverse Client +// Copyright (c) 2009-2014, 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. +// + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Net; +using OpenMetaverse; +using System.Windows.Forms; + +namespace Radegast +{ + class RadeProxy + { + public void SetProxy(bool UseProxy, string proxy_url, string port, string username, string password) + { + if (!UseProxy) + { + DisableProxy(); + return; + } + + if (string.IsNullOrEmpty(proxy_url)) + { + UseProxy = false; + Logger.Log("Proxy Error: A proxy URI has not been specified", Helpers.LogLevel.Warning); + } + + if (UseProxy) + { + string purl = proxy_url.Trim(); + + + if (!purl.StartsWith("http://", StringComparison.CurrentCultureIgnoreCase)) + { + purl = @"http://" + purl; + } + + try + { + if (port.Length > 1) + { + purl = purl + ":" + port.Trim(); // + @"/"; + } + + WebProxy proxy = new WebProxy(purl,false); + + if (username.Trim() != "" && password.Trim() != "") + { + proxy.Credentials = new NetworkCredential(username.Trim(), password.Trim()); + } + WebRequest.DefaultWebProxy = proxy; + } + catch (Exception ex) + { + Logger.Log("Proxy: " + ex.Message, Helpers.LogLevel.Error); + MessageBox.Show(ex.Message); + } + } + else + { + try + { + DisableProxy(); + } + catch (Exception ex) + { + Logger.Log("Proxy: " + ex.Message, Helpers.LogLevel.Error); + MessageBox.Show(ex.Message); + } + } + } + + public static void DisableProxy() + { + IWebProxy proxy = new WebProxy(); + proxy.Credentials = CredentialCache.DefaultNetworkCredentials; // null; + WebRequest.DefaultWebProxy = proxy; + return; + } + } +} diff --git a/Radegast/Core/Types/MapControl.cs b/Radegast/Core/Types/MapControl.cs index dedaa2f84..c8ae3d972 100644 --- a/Radegast/Core/Types/MapControl.cs +++ b/Radegast/Core/Types/MapControl.cs @@ -72,6 +72,8 @@ public MapControl(RadegastInstance instance) Instance.ClientChanged += new EventHandler(Instance_ClientChanged); RegisterClientEvents(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void MapControl_Disposed(object sender, EventArgs e) diff --git a/Radegast/Core/Types/RRichTextBox.cs b/Radegast/Core/Types/RRichTextBox.cs index 4f3fc2f29..6688c28a0 100644 --- a/Radegast/Core/Types/RRichTextBox.cs +++ b/Radegast/Core/Types/RRichTextBox.cs @@ -93,6 +93,7 @@ public RRichTextBox() rtfHeader = this.Rtf.Substring(0, this.Rtf.IndexOf('{', 2)) + " "; + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void InitializeComponent() @@ -180,7 +181,7 @@ public void RestoreState(bool saveScrollBars) #region Syntax highligting private string rtfEscaped(string s) { - return s.Replace(@"\", @"\\").Replace("{", @"\{").Replace("}", @"\}").Replace("\n", "\\par\n"); + return RtfUnicode(s.Replace(@"\", @"\\").Replace("{", @"\{").Replace("}", @"\}").Replace("\n", "\\par\n")); } public Color CommentColor = Color.FromArgb(204, 76, 38); diff --git a/Radegast/Core/Types/RadegastContextMenu.cs b/Radegast/Core/Types/RadegastContextMenu.cs index 7e6a1bbef..cd2cfdcb5 100644 --- a/Radegast/Core/Types/RadegastContextMenu.cs +++ b/Radegast/Core/Types/RadegastContextMenu.cs @@ -315,6 +315,11 @@ private void Rad_Menu_Opened(object sender, EventArgs e) private void Rad_Menu_Opening(object sender, CancelEventArgs e) { WriteDebug("Menu_Opening: {0} {1}", sender, e.Cancel); + + if (RadegastInstance.GlobalInstance.GlobalSettings["theme_compatibility_mode"]) + { + RenderMode = ToolStripRenderMode.System; + } e.Cancel = false; if (OnContentMenuOpening != null) { @@ -494,6 +499,11 @@ private void DeregisterItemEvents(ToolStripDropDownItem item) private void Rad_Item_Opening(object sender, EventArgs e) { + if (RadegastInstance.GlobalInstance.GlobalSettings["theme_compatibility_mode"]) + { + RenderMode = ToolStripRenderMode.System; + } + ToolStripDropDownItem stripDropDownItem = sender as ToolStripDropDownItem; if (stripDropDownItem == null) return; SetMenuItemSelected(stripDropDownItem); diff --git a/Radegast/GUI/Consoles/AnimDetail.cs b/Radegast/GUI/Consoles/AnimDetail.cs index c0643780b..e4aa842fb 100644 --- a/Radegast/GUI/Consoles/AnimDetail.cs +++ b/Radegast/GUI/Consoles/AnimDetail.cs @@ -55,6 +55,8 @@ public AnimDetail(RadegastInstance instance, Avatar av, UUID anim, int n) this.av = av; this.anim = anim; this.n = n; + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void AnimDetail_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/AnimTab.cs b/Radegast/GUI/Consoles/AnimTab.cs index 9f10bf298..83480c5bc 100644 --- a/Radegast/GUI/Consoles/AnimTab.cs +++ b/Radegast/GUI/Consoles/AnimTab.cs @@ -55,6 +55,8 @@ public AnimTab(RadegastInstance instance, Avatar av) // Callbacks client.Avatars.AvatarAnimation += new EventHandler(Avatars_AvatarAnimation); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void AnimTab_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/Assets/Guesture.cs b/Radegast/GUI/Consoles/Assets/Guesture.cs index d2988f9dd..8e8ee1cbb 100644 --- a/Radegast/GUI/Consoles/Assets/Guesture.cs +++ b/Radegast/GUI/Consoles/Assets/Guesture.cs @@ -58,6 +58,8 @@ public Guesture(RadegastInstance instance, InventoryGesture gesture) // Start download tlblStatus.Text = "Downloading..."; client.Assets.RequestAsset(gesture.AssetUUID, AssetType.Gesture, true, Assets_OnAssetReceived); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void Guesture_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/Assets/Landmark.cs b/Radegast/GUI/Consoles/Assets/Landmark.cs index 12b41f23b..5fd3d7f92 100644 --- a/Radegast/GUI/Consoles/Assets/Landmark.cs +++ b/Radegast/GUI/Consoles/Assets/Landmark.cs @@ -71,6 +71,8 @@ void Init(RadegastInstance instance) // Callbacks client.Grid.RegionHandleReply += new EventHandler(Grid_RegionHandleReply); client.Parcels.ParcelInfoReply += new EventHandler(Parcels_ParcelInfoReply); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void Landmark_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/Assets/Notecard.cs b/Radegast/GUI/Consoles/Assets/Notecard.cs index 5ec07c927..1599bf1c6 100644 --- a/Radegast/GUI/Consoles/Assets/Notecard.cs +++ b/Radegast/GUI/Consoles/Assets/Notecard.cs @@ -81,6 +81,8 @@ public Notecard(RadegastInstance instance, InventoryNotecard notecard, Primitive client.Assets.RequestInventoryAsset(notecard.AssetUUID, notecard.UUID, prim.ID, prim.OwnerID, notecard.AssetType, true, Assets_OnAssetReceived); } } + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void Notecard_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/Assets/SLImageHandler.cs b/Radegast/GUI/Consoles/Assets/SLImageHandler.cs index db5045ce9..1f54c8652 100644 --- a/Radegast/GUI/Consoles/Assets/SLImageHandler.cs +++ b/Radegast/GUI/Consoles/Assets/SLImageHandler.cs @@ -83,6 +83,8 @@ public override string Text public SLImageHandler() { InitializeComponent(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } public SLImageHandler(RadegastInstance instance, UUID image, string label) @@ -95,6 +97,8 @@ public SLImageHandler(RadegastInstance instance, UUID image, string label, bool this.allowSave = allowSave; InitializeComponent(); Init(instance, image, label); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } public void Init(RadegastInstance instance, UUID image, string label) diff --git a/Radegast/GUI/Consoles/Assets/ScriptEditor.cs b/Radegast/GUI/Consoles/Assets/ScriptEditor.cs index a627d877d..99079bb6e 100644 --- a/Radegast/GUI/Consoles/Assets/ScriptEditor.cs +++ b/Radegast/GUI/Consoles/Assets/ScriptEditor.cs @@ -68,6 +68,7 @@ public ScriptEditor(RadegastInstance instance, InventoryLSL script, Primitive pr this.instance = instance; this.script = script; this.prim = prim; + rtb.SyntaxHighlightEnabled = instance.GlobalSettings["script_syntax_highlight"].AsBoolean(); lblScripStatus.Text = string.Empty; lblScripStatus.TextChanged += (object sender, EventArgs e) => @@ -101,6 +102,8 @@ public ScriptEditor(RadegastInstance instance, InventoryLSL script, Primitive pr rtb.Text = " "; //bugs in control grrrr rtb.SelectionStart = 0; } + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void SscriptEditor_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/AttachmentDetail.cs b/Radegast/GUI/Consoles/AttachmentDetail.cs index 123ddcbdd..017de656c 100644 --- a/Radegast/GUI/Consoles/AttachmentDetail.cs +++ b/Radegast/GUI/Consoles/AttachmentDetail.cs @@ -68,6 +68,8 @@ public AttachmentDetail(RadegastInstance instance, Avatar av, Primitive attachme // Callbacks client.Objects.ObjectProperties += new EventHandler(Objects_ObjectProperties); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void AttachmentDetail_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/AttachmentTab.cs b/Radegast/GUI/Consoles/AttachmentTab.cs index 8589646d5..edffe35ae 100644 --- a/Radegast/GUI/Consoles/AttachmentTab.cs +++ b/Radegast/GUI/Consoles/AttachmentTab.cs @@ -49,7 +49,9 @@ public AttachmentTab(RadegastInstance instance, Avatar iav) InitializeComponent(); AutoScrollPosition = new Point(0, 0); - InitializeComponent(); + InitializeComponent(); // TODO: Was this second initialization intentional...? + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void AttachmentTab_Load(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/AvatarPicker.cs b/Radegast/GUI/Consoles/AvatarPicker.cs index 39bc19285..d005d8c9f 100644 --- a/Radegast/GUI/Consoles/AvatarPicker.cs +++ b/Radegast/GUI/Consoles/AvatarPicker.cs @@ -84,6 +84,8 @@ public AvatarPicker(RadegastInstance instance) string name = instance.Names.Get(nearAvatars[i].ID, nearAvatars[i].Name); lvwNear.Items.Add(new ListViewItem() { Text = nearAvatars[i].Name, Tag = nearAvatars[i].ID }); } + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void AvatarPicker_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/ChatConsole.cs b/Radegast/GUI/Consoles/ChatConsole.cs index e75bc20e9..d211ff3b3 100644 --- a/Radegast/GUI/Consoles/ChatConsole.cs +++ b/Radegast/GUI/Consoles/ChatConsole.cs @@ -71,11 +71,6 @@ public ChatConsole(RadegastInstance instance) this.instance = instance; this.instance.ClientChanged += new EventHandler(instance_ClientChanged); - if (instance.GlobalSettings["chat_font_size"].Type != OSDType.Real) - { - instance.GlobalSettings["chat_font_size"] = OSD.FromReal(cbxInput.Font.Size); - } - instance.GlobalSettings.OnSettingChanged += new Settings.SettingChangedCallback(GlobalSettings_OnSettingChanged); // Callbacks @@ -91,7 +86,7 @@ public ChatConsole(RadegastInstance instance) lvwObjects.ListViewItemSorter = new SorterClass(instance); cbChatType.SelectedIndex = 1; - UpdateFontSize(); + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void RegisterClientEvents(GridClient client) @@ -139,19 +134,8 @@ static public Font ChangeFontSize(Font font, float fontSize) return font; } - void UpdateFontSize() - { - float size = (float)instance.GlobalSettings["chat_font_size"].AsReal(); - if (size < 2f || size > 100f) size = 9f; - cbxInput.Font = ChatConsole.ChangeFontSize(cbxInput.Font, size); - rtbChat.Font = ChatConsole.ChangeFontSize(rtbChat.Font, size); - chatManager.ReprintAllText(); - } - void GlobalSettings_OnSettingChanged(object sender, SettingsEventArgs e) { - if (e.Key == "chat_font_size") - UpdateFontSize(); } public List GetAvatarList() diff --git a/Radegast/GUI/Consoles/ConferenceIMTabWindow.cs b/Radegast/GUI/Consoles/ConferenceIMTabWindow.cs index dabfabd65..b59a70f6a 100644 --- a/Radegast/GUI/Consoles/ConferenceIMTabWindow.cs +++ b/Radegast/GUI/Consoles/ConferenceIMTabWindow.cs @@ -75,7 +75,7 @@ public ConferenceIMTabWindow(RadegastInstance instance, UUID session, string ses client.Self.ChatterBoxAcceptInvite(session); } - UpdateFontSize(); + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void IMTabWindow_Disposed(object sender, EventArgs e) @@ -93,18 +93,8 @@ private void netcom_ClientLoginStatus(object sender, LoginProgressEventArgs e) RefreshControls(); } - void UpdateFontSize() - { - float size = (float)instance.GlobalSettings["chat_font_size"].AsReal(); - cbxInput.Font = ChatConsole.ChangeFontSize(cbxInput.Font, size); - rtbIMText.Font = ChatConsole.ChangeFontSize(rtbIMText.Font, size); - textManager.ReprintAllText(); - } - void GlobalSettings_OnSettingChanged(object sender, SettingsEventArgs e) { - if (e.Key == "chat_font_size") - UpdateFontSize(); } private void netcom_ClientDisconnected(object sender, DisconnectedEventArgs e) diff --git a/Radegast/GUI/Consoles/DebugConsole.cs b/Radegast/GUI/Consoles/DebugConsole.cs index b6743fab6..b15a1844a 100644 --- a/Radegast/GUI/Consoles/DebugConsole.cs +++ b/Radegast/GUI/Consoles/DebugConsole.cs @@ -48,6 +48,8 @@ public DebugConsole(RadegastInstance instance) InitializeComponent(); Disposed += new EventHandler(DebugConsole_Disposed); RadegastAppender.Log += new EventHandler(RadegastAppender_Log); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void DebugConsole_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/ExportCollada.cs b/Radegast/GUI/Consoles/ExportCollada.cs index 60cc3b72e..d95acf9bf 100644 --- a/Radegast/GUI/Consoles/ExportCollada.cs +++ b/Radegast/GUI/Consoles/ExportCollada.cs @@ -65,6 +65,8 @@ public ExportCollada(RadegastInstance instance, Primitive prim) Exporter.Progress += new EventHandler(Exporter_Progress); UpdateInfo(); cbImageType.Text = "TGA"; + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } #endregion diff --git a/Radegast/GUI/Consoles/ExportConsole.cs b/Radegast/GUI/Consoles/ExportConsole.cs index 485dab0e6..004f323e8 100644 --- a/Radegast/GUI/Consoles/ExportConsole.cs +++ b/Radegast/GUI/Consoles/ExportConsole.cs @@ -69,6 +69,8 @@ public ExportConsole(GridClient client, uint localID) Client = client; GatherInfo(); Exporter = new PrimExporter(client); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } #endregion diff --git a/Radegast/GUI/Consoles/FindPeopleConsole.cs b/Radegast/GUI/Consoles/FindPeopleConsole.cs index 4e3e5b189..769216173 100644 --- a/Radegast/GUI/Consoles/FindPeopleConsole.cs +++ b/Radegast/GUI/Consoles/FindPeopleConsole.cs @@ -61,6 +61,8 @@ public FindPeopleConsole(RadegastInstance instance, UUID queryID) // Callbacks client.Directory.DirPeopleReply += new EventHandler(Directory_DirPeopleReply); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void FindPeopleConsole_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/FriendsConsole.cs b/Radegast/GUI/Consoles/FriendsConsole.cs index d5b2ee99b..ab9cf954d 100644 --- a/Radegast/GUI/Consoles/FriendsConsole.cs +++ b/Radegast/GUI/Consoles/FriendsConsole.cs @@ -77,6 +77,8 @@ public FriendsConsole(RadegastInstance instance) client.Friends.FriendNames += new EventHandler(Friends_FriendNames); Load += new EventHandler(FriendsConsole_Load); instance.Names.NameUpdated += new EventHandler(Names_NameUpdated); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void Names_NameUpdated(object sender, UUIDNameReplyEventArgs e) diff --git a/Radegast/GUI/Consoles/GroupDetails.cs b/Radegast/GUI/Consoles/GroupDetails.cs index 5862d4592..83d63d24a 100644 --- a/Radegast/GUI/Consoles/GroupDetails.cs +++ b/Radegast/GUI/Consoles/GroupDetails.cs @@ -120,6 +120,8 @@ public GroupDetails(RadegastInstance instance, Group group) instance.Names.NameUpdated += new EventHandler(Names_NameUpdated); RefreshControlsAvailability(); RefreshGroupInfo(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void GroupDetails_Disposed(object sender, EventArgs e) @@ -508,6 +510,10 @@ void lvwGeneralMembers_RetrieveVirtualItem(object sender, RetrieveVirtualItemEve { item.SubItems.Add(new ListViewItem.ListViewSubItem(item, member.Base.OnlineStatus)); } + else + { + item.SubItems.Add(new ListViewItem.ListViewSubItem(item, "N/A")); + } e.Item = item; } diff --git a/Radegast/GUI/Consoles/GroupIMTabWindow.cs b/Radegast/GUI/Consoles/GroupIMTabWindow.cs index fbaa32e4c..2dbe6f915 100644 --- a/Radegast/GUI/Consoles/GroupIMTabWindow.cs +++ b/Radegast/GUI/Consoles/GroupIMTabWindow.cs @@ -70,8 +70,9 @@ public GroupIMTabWindow(RadegastInstance instance, UUID session, string sessionN { client.Self.RequestJoinGroupChat(session); } - UpdateFontSize(); Load += new EventHandler(GroupIMTabWindow_Load); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void RegisterClientEvents(GridClient client) @@ -120,19 +121,9 @@ private void IMTabWindow_Disposed(object sender, EventArgs e) CleanUp(); } - void UpdateFontSize() - { - float size = (float)instance.GlobalSettings["chat_font_size"].AsReal(); - cbxInput.Font = ChatConsole.ChangeFontSize(cbxInput.Font, size); - rtbIMText.Font = ChatConsole.ChangeFontSize(rtbIMText.Font, size); - textManager.ReprintAllText(); - } - void GlobalSettings_OnSettingChanged(object sender, SettingsEventArgs e) { - if (e.Key == "chat_font_size") - UpdateFontSize(); - else if (e.Key == "display_name_mode") + if (e.Key == "display_name_mode") UpdateParticipantList(); } diff --git a/Radegast/GUI/Consoles/GroupsConsole.cs b/Radegast/GUI/Consoles/GroupsConsole.cs index a1a3c49b3..3cda654cc 100644 --- a/Radegast/GUI/Consoles/GroupsConsole.cs +++ b/Radegast/GUI/Consoles/GroupsConsole.cs @@ -54,6 +54,8 @@ public GroupsConsole(RadegastInstance instance) client.Self.MuteListUpdated += new EventHandler(Self_MuteListUpdated); client.Groups.RequestCurrentGroups(); UpdateDisplay(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void GroupsDialog_Disposed(object sender, EventArgs e) @@ -165,12 +167,22 @@ private void activateBtn_Click(object sender, EventArgs e) private void leaveBtn_Click(object sender, EventArgs e) { - if (listBox1.SelectedItem == null) return; + if (listBox1.SelectedItem == null) + { + return; + } + Group g = (Group)listBox1.SelectedItem; - if (g.ID == UUID.Zero) return; + if (g.ID == UUID.Zero) + { + return; + } - client.Groups.LeaveGroup(g.ID); - listBox1.Items.Remove(g); + if(MessageBox.Show(string.Format("Leave {0}?", g.Name), "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes) + { + client.Groups.LeaveGroup(g.ID); + listBox1.Items.Remove(g); + } } private void imBtn_Click(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/IMTabWindow.cs b/Radegast/GUI/Consoles/IMTabWindow.cs index a51b0e0c7..4591d9595 100644 --- a/Radegast/GUI/Consoles/IMTabWindow.cs +++ b/Radegast/GUI/Consoles/IMTabWindow.cs @@ -63,7 +63,7 @@ public IMTabWindow(RadegastInstance instance, UUID target, UUID session, string AddNetcomEvents(); - UpdateFontSize(); + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void IMTabWindow_Disposed(object sender, EventArgs e) @@ -85,18 +85,8 @@ private void RemoveNetcomEvents() instance.GlobalSettings.OnSettingChanged -= new Settings.SettingChangedCallback(GlobalSettings_OnSettingChanged); } - void UpdateFontSize() - { - float size = (float)instance.GlobalSettings["chat_font_size"].AsReal(); - cbxInput.Font = ChatConsole.ChangeFontSize(cbxInput.Font, size); - rtbIMText.Font = ChatConsole.ChangeFontSize(rtbIMText.Font, size); - textManager.ReprintAllText(); - } - void GlobalSettings_OnSettingChanged(object sender, SettingsEventArgs e) { - if (e.Key == "chat_font_size") - UpdateFontSize(); } private void netcom_ClientLoginStatus(object sender, LoginProgressEventArgs e) diff --git a/Radegast/GUI/Consoles/ImageUploadConsole.cs b/Radegast/GUI/Consoles/ImageUploadConsole.cs index 04159632c..607e31717 100644 --- a/Radegast/GUI/Consoles/ImageUploadConsole.cs +++ b/Radegast/GUI/Consoles/ImageUploadConsole.cs @@ -55,6 +55,8 @@ public partial class ImageUploadConsole : RadegastTabControl public ImageUploadConsole() { InitializeComponent(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } public ImageUploadConsole(RadegastInstance instance) @@ -68,6 +70,8 @@ public ImageUploadConsole(RadegastInstance instance) client.Assets.AssetUploaded += new EventHandler(Assets_AssetUploaded); UpdateButtons(); OriginalCapsTimeout = client.Settings.CAPS_TIMEOUT; + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void ImageUploadConsole_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/ImportConsole.cs b/Radegast/GUI/Consoles/ImportConsole.cs index 0841c3642..86fd871fe 100644 --- a/Radegast/GUI/Consoles/ImportConsole.cs +++ b/Radegast/GUI/Consoles/ImportConsole.cs @@ -73,6 +73,8 @@ public ImportConsole(GridClient client) objectName.Text = ""; primCount.Text = ""; textureCount.Text = ""; + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } #endregion diff --git a/Radegast/GUI/Consoles/Inventory/CurrentOutfitFolder.cs b/Radegast/GUI/Consoles/Inventory/CurrentOutfitFolder.cs index ff42bef8c..28ac5fd7d 100644 --- a/Radegast/GUI/Consoles/Inventory/CurrentOutfitFolder.cs +++ b/Radegast/GUI/Consoles/Inventory/CurrentOutfitFolder.cs @@ -449,8 +449,12 @@ public void RemoveLink(List itemIDs) /// >Inventory item to be detached public void Detach(InventoryItem item) { - Client.Appearance.Detach(item); - RemoveLink(item.UUID); + var realItem = RealInventoryItem(item); + if (Instance.RLV.AllowDetach(realItem)) + { + Client.Appearance.Detach(item); + RemoveLink(item.UUID); + } } public List GetWornAt(WearableType type) diff --git a/Radegast/GUI/Consoles/Inventory/InventoryBackup.cs b/Radegast/GUI/Consoles/Inventory/InventoryBackup.cs index fb042b1b9..686368b6d 100644 --- a/Radegast/GUI/Consoles/Inventory/InventoryBackup.cs +++ b/Radegast/GUI/Consoles/Inventory/InventoryBackup.cs @@ -62,13 +62,17 @@ public InventoryBackup(RadegastInstance instance, UUID rootFolder) { InitializeComponent(); Disposed += new System.EventHandler(InventoryBackup_Disposed); + this.instance = instance; + inv = client.Inventory.Store; rootNode = inv.RootNode; if (inv.Items.ContainsKey(rootFolder) && inv.Items[rootFolder].Data is InventoryFolder) { rootNode = inv.GetNodeFor(rootFolder); } + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void InventoryBackup_Disposed(object sender, System.EventArgs e) diff --git a/Radegast/GUI/Consoles/Inventory/InventoryConsole.cs b/Radegast/GUI/Consoles/Inventory/InventoryConsole.cs index e40c0a479..87faa8f79 100644 --- a/Radegast/GUI/Consoles/Inventory/InventoryConsole.cs +++ b/Radegast/GUI/Consoles/Inventory/InventoryConsole.cs @@ -99,6 +99,8 @@ public InventoryConsole(RadegastInstance instance) invRootNode = AddDir(null, Inventory.RootFolder); UpdateStatus("Reading cache"); Init1(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } public void Init1() @@ -791,7 +793,7 @@ private void StartTraverseNodes() if (QueuedFolders.Count == 0) break; Logger.DebugLog(string.Format("Queued {0} folders for update", QueuedFolders.Count)); - Parallel.ForEach(Math.Min(QueuedFolders.Count, 6), QueuedFolders, folderID => + System.Threading.Tasks.Parallel.ForEach(QueuedFolders, folderID => { bool success = false; diff --git a/Radegast/GUI/Consoles/LoginConsole.cs b/Radegast/GUI/Consoles/LoginConsole.cs index 138606628..2f5296c96 100644 --- a/Radegast/GUI/Consoles/LoginConsole.cs +++ b/Radegast/GUI/Consoles/LoginConsole.cs @@ -66,6 +66,7 @@ public LoginConsole(RadegastInstance instance) Load += new EventHandler(LoginConsole_Load); + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void MainConsole_Disposed(object sender, EventArgs e) @@ -76,8 +77,10 @@ private void MainConsole_Disposed(object sender, EventArgs e) void LoginConsole_Load(object sender, EventArgs e) { - if (instance.PlainColors) + if (!instance.GlobalSettings["theme_compatibility_mode"] && instance.PlainColors) + { panel1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(210)))), ((int)(((byte)(210)))), ((int)(((byte)(225))))); + } cbxLocation.SelectedIndex = 0; cbxUsername.SelectedIndexChanged += cbxUsername_SelectedIndexChanged; @@ -471,9 +474,21 @@ private void BeginLogin() if (netcom.LoginOptions.Grid.Platform != "SecondLife") { instance.Client.Settings.MULTIPLE_SIMS = true; + instance.Client.Settings.HTTP_INVENTORY = !instance.GlobalSettings["disable_http_inventory"]; + } + else + { + // UDP inventory is deprecated as of 2015-03-30 and no longer supported. + // https://community.secondlife.com/t5/Second-Life-Server/Deploy-for-the-week-of-2015-03-30/td-p/2919194 + instance.Client.Settings.HTTP_INVENTORY = true; } - instance.Client.Settings.HTTP_INVENTORY = !instance.GlobalSettings["disable_http_inventory"]; + RadeProxy proxy = new RadeProxy(); + + proxy.SetProxy(instance.GlobalSettings["use_proxy"], instance.GlobalSettings["proxy_url"], instance.GlobalSettings["proxy_port"], instance.GlobalSettings["proxy_user"], instance.GlobalSettings["proxy_password"]); + + + netcom.Login(); SaveConfig(); } diff --git a/Radegast/GUI/Consoles/MapConsole.cs b/Radegast/GUI/Consoles/MapConsole.cs index 779ebb94d..cee49e8d1 100644 --- a/Radegast/GUI/Consoles/MapConsole.cs +++ b/Radegast/GUI/Consoles/MapConsole.cs @@ -69,6 +69,8 @@ public MapConsole(RadegastInstance inst) // Register callbacks RegisterClientEvents(client); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void RegisterClientEvents(GridClient client) diff --git a/Radegast/GUI/Consoles/MasterTab.cs b/Radegast/GUI/Consoles/MasterTab.cs index c589df4cf..6d54bfd8d 100644 --- a/Radegast/GUI/Consoles/MasterTab.cs +++ b/Radegast/GUI/Consoles/MasterTab.cs @@ -72,6 +72,8 @@ public MasterTab(RadegastInstance instance, Avatar avatar) // Callbacks client.Avatars.ViewerEffectPointAt += new EventHandler(Avatars_ViewerEffectPointAt); client.Objects.ObjectProperties += new EventHandler(Objects_ObjectProperties); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void MasterTab_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/MediaConsole.cs b/Radegast/GUI/Consoles/MediaConsole.cs index 64240c72a..5ae3caae1 100644 --- a/Radegast/GUI/Consoles/MediaConsole.cs +++ b/Radegast/GUI/Consoles/MediaConsole.cs @@ -105,6 +105,8 @@ public MediaConsole(RadegastInstance instance) // Network callbacks client.Parcels.ParcelProperties += new EventHandler(Parcels_ParcelProperties); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void MediaConsole_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/MeshUploadConsole.cs b/Radegast/GUI/Consoles/MeshUploadConsole.cs index cad11c626..c7e9bae06 100644 --- a/Radegast/GUI/Consoles/MeshUploadConsole.cs +++ b/Radegast/GUI/Consoles/MeshUploadConsole.cs @@ -53,6 +53,8 @@ public partial class MeshUploadConsole : RadegastTabControl public MeshUploadConsole() { InitializeComponent(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } public MeshUploadConsole(RadegastInstance instance) @@ -64,6 +66,8 @@ public MeshUploadConsole(RadegastInstance instance) instance.Netcom.ClientConnected += new EventHandler(Netcom_ClientConnected); instance.Netcom.ClientDisconnected += new EventHandler(Netcom_ClientDisconnected); UpdateButtons(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void MeshUploadConsole_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/MuteList.cs b/Radegast/GUI/Consoles/MuteList.cs index 39335358d..c1276c3e9 100644 --- a/Radegast/GUI/Consoles/MuteList.cs +++ b/Radegast/GUI/Consoles/MuteList.cs @@ -45,6 +45,8 @@ public partial class MuteList : RadegastTabControl public MuteList() { InitializeComponent(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } public MuteList(RadegastInstance instance) @@ -55,6 +57,8 @@ public MuteList(RadegastInstance instance) RegisterClientEvents(client); instance.ClientChanged += new EventHandler(instance_ClientChanged); RefreshMuteList(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void instance_ClientChanged(object sender, ClientChangedEventArgs e) diff --git a/Radegast/GUI/Consoles/ObjectsConsole.cs b/Radegast/GUI/Consoles/ObjectsConsole.cs index 88a2a85ed..a16c098f7 100644 --- a/Radegast/GUI/Consoles/ObjectsConsole.cs +++ b/Radegast/GUI/Consoles/ObjectsConsole.cs @@ -114,6 +114,8 @@ public ObjectsConsole(RadegastInstance instance) client.Self.MuteListUpdated += new EventHandler(Self_MuteListUpdated); instance.Names.NameUpdated += new EventHandler(Avatars_UUIDNameReply); instance.State.OnWalkStateCanged += new StateManager.WalkStateCanged(State_OnWalkStateCanged); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void frmObjects_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/OutfitTextures.cs b/Radegast/GUI/Consoles/OutfitTextures.cs index 7aa35737d..3999a5746 100644 --- a/Radegast/GUI/Consoles/OutfitTextures.cs +++ b/Radegast/GUI/Consoles/OutfitTextures.cs @@ -46,6 +46,8 @@ public OutfitTextures(RadegastInstance instance, Avatar avatar) this.instance = instance; this.avatar = avatar; + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } public void GetTextures() diff --git a/Radegast/GUI/Consoles/PluginsTab.cs b/Radegast/GUI/Consoles/PluginsTab.cs index 082b84c22..45dbc62c5 100644 --- a/Radegast/GUI/Consoles/PluginsTab.cs +++ b/Radegast/GUI/Consoles/PluginsTab.cs @@ -19,6 +19,8 @@ public PluginsTab(RadegastInstance instance) InitializeComponent(); ListPlugins(); PluginsTab_SizeChanged(this, EventArgs.Empty); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void ListPlugins() diff --git a/Radegast/GUI/Consoles/RegionInfo.cs b/Radegast/GUI/Consoles/RegionInfo.cs index d257ad196..19d99dd6f 100644 --- a/Radegast/GUI/Consoles/RegionInfo.cs +++ b/Radegast/GUI/Consoles/RegionInfo.cs @@ -40,6 +40,8 @@ public RegionInfo(RadegastInstance instance) refresh.Enabled = true; UpdateDisplay(); client.Parcels.RequestDwell(client.Network.CurrentSim, instance.State.Parcel.LocalID); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void RegionInfo_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/SearchConsole.cs b/Radegast/GUI/Consoles/SearchConsole.cs index 2fcf87517..4142c5b31 100644 --- a/Radegast/GUI/Consoles/SearchConsole.cs +++ b/Radegast/GUI/Consoles/SearchConsole.cs @@ -75,6 +75,8 @@ public SearchConsole(RadegastInstance instance) pnlFindPeople.Controls.Add(console); lvwPlaces.ListViewItemSorter = new PlaceSorter(); lvwGroups.ListViewItemSorter = new GroupSorter(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void SearchConsole_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Consoles/TabsConsole.cs b/Radegast/GUI/Consoles/TabsConsole.cs index 0a4ddebf6..f3fc057c0 100644 --- a/Radegast/GUI/Consoles/TabsConsole.cs +++ b/Radegast/GUI/Consoles/TabsConsole.cs @@ -145,6 +145,8 @@ public TabsConsole(RadegastInstance instance) // Callbacks RegisterClientEvents(client); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void RegisterClientEvents(GridClient client) @@ -662,7 +664,7 @@ private void HandleIM(InstantMessageEventArgs e) if (isNew) { - ((IMTabWindow)tab.Control).TextManager.ProcessIM(e); + ((IMTabWindow)tab.Control).TextManager.ProcessIM(e, true); } } @@ -681,7 +683,7 @@ private void HandleConferenceIM(InstantMessageEventArgs e) ConferenceIMTabWindow imTab = AddConferenceIMTab(e.IM.IMSessionID, Utils.BytesToString(e.IM.BinaryBucket)); tabs[e.IM.IMSessionID.ToString()].Highlight(); - imTab.TextManager.ProcessIM(e); + imTab.TextManager.ProcessIM(e, true); if (active != null) { @@ -706,7 +708,7 @@ private void HandleGroupIM(InstantMessageEventArgs e) Control active = FindFocusedControl(instance.MainForm); GroupIMTabWindow imTab = AddGroupIMTab(e.IM.IMSessionID, Utils.BytesToString(e.IM.BinaryBucket)); - imTab.TextManager.ProcessIM(e); + imTab.TextManager.ProcessIM(e, true); tabs[e.IM.IMSessionID.ToString()].Highlight(); if (active != null) diff --git a/Radegast/GUI/Consoles/VoiceConsole.cs b/Radegast/GUI/Consoles/VoiceConsole.cs index c50a5181c..0d52e3680 100644 --- a/Radegast/GUI/Consoles/VoiceConsole.cs +++ b/Radegast/GUI/Consoles/VoiceConsole.cs @@ -85,6 +85,8 @@ public VoiceConsole(RadegastInstance instance) chkVoiceEnable.Checked = config["enabled"].AsBoolean(); if (chkVoiceEnable.Checked) Start(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void Start() diff --git a/Radegast/GUI/Dialogs/About.cs b/Radegast/GUI/Dialogs/About.cs index 42a52f00f..b9f509a3c 100644 --- a/Radegast/GUI/Dialogs/About.cs +++ b/Radegast/GUI/Dialogs/About.cs @@ -39,6 +39,8 @@ public frmAbout(RadegastInstance instance) { InitializeComponent(); txtTitle.Text = Properties.Resources.RadegastTitle + "." + RadegastBuild.CurrentRev; + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void lblHomepage_Click(object sender, System.EventArgs e) diff --git a/Radegast/GUI/Dialogs/BanGroupMember.cs b/Radegast/GUI/Dialogs/BanGroupMember.cs index 8d5a63a36..9f65b66ee 100644 --- a/Radegast/GUI/Dialogs/BanGroupMember.cs +++ b/Radegast/GUI/Dialogs/BanGroupMember.cs @@ -67,6 +67,8 @@ public BanGroupMember(RadegastInstance instance, Group group, GroupDetails paren picker.BringToFront(); netcom.ClientDisconnected += new EventHandler(Netcom_ClientDisconnected); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void picker_SelectionChaged(object sender, EventArgs e) diff --git a/Radegast/GUI/Dialogs/DetachedTab.cs b/Radegast/GUI/Dialogs/DetachedTab.cs index 09bb12102..8eb8a96ed 100644 --- a/Radegast/GUI/Dialogs/DetachedTab.cs +++ b/Radegast/GUI/Dialogs/DetachedTab.cs @@ -71,6 +71,7 @@ public frmDetachedTab(RadegastInstance instance, RadegastTab tab) Owner = instance.MainForm; } + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void Control_TextChanged(object sender, EventArgs e) diff --git a/Radegast/GUI/Dialogs/DisplayNameChange.cs b/Radegast/GUI/Dialogs/DisplayNameChange.cs index bfdce2020..c680b2382 100644 --- a/Radegast/GUI/Dialogs/DisplayNameChange.cs +++ b/Radegast/GUI/Dialogs/DisplayNameChange.cs @@ -49,6 +49,8 @@ public partial class DisplayNameChange : RadegastForm public DisplayNameChange() { InitializeComponent(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } public DisplayNameChange(RadegastInstance inst) @@ -59,6 +61,8 @@ public DisplayNameChange(RadegastInstance inst) AutoSavePosition = true; Client.Self.SetDisplayNameReply += new EventHandler(Self_SetDisplayNameReply); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void DisplayNameChange_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Dialogs/GroupInfo.cs b/Radegast/GUI/Dialogs/GroupInfo.cs index 5c0ef4d98..cb21855ed 100644 --- a/Radegast/GUI/Dialogs/GroupInfo.cs +++ b/Radegast/GUI/Dialogs/GroupInfo.cs @@ -58,6 +58,8 @@ public frmGroupInfo(RadegastInstance instance, Group group) Controls.Add(GroupDetails); Text = group.Name + " - Group information"; instance.Netcom.ClientDisconnected += new System.EventHandler(Netcom_ClientDisconnected); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void frmGroupInfo_Disposed(object sender, System.EventArgs e) diff --git a/Radegast/GUI/Dialogs/GroupInvite.cs b/Radegast/GUI/Dialogs/GroupInvite.cs index 89faae263..23ea408dd 100644 --- a/Radegast/GUI/Dialogs/GroupInvite.cs +++ b/Radegast/GUI/Dialogs/GroupInvite.cs @@ -74,6 +74,8 @@ public GroupInvite(RadegastInstance instance, Group group, Dictionary role in roles) if (role.Key != UUID.Zero) cmbRoles.Items.Add(role.Value); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void picker_SelectionChaged(object sender, EventArgs e) diff --git a/Radegast/GUI/Dialogs/KeyboardShortcuts.cs b/Radegast/GUI/Dialogs/KeyboardShortcuts.cs index 01cf32343..d0c32a305 100644 --- a/Radegast/GUI/Dialogs/KeyboardShortcuts.cs +++ b/Radegast/GUI/Dialogs/KeyboardShortcuts.cs @@ -41,6 +41,8 @@ public frmKeyboardShortcuts(RadegastInstance instance) { InitializeComponent(); this.instance = instance; + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void btnClose_Click(object sender, EventArgs e) diff --git a/Radegast/GUI/Dialogs/MainForm.cs b/Radegast/GUI/Dialogs/MainForm.cs index dbaa599f9..44f3a73bb 100644 --- a/Radegast/GUI/Dialogs/MainForm.cs +++ b/Radegast/GUI/Dialogs/MainForm.cs @@ -145,6 +145,7 @@ public frmMain(RadegastInstance instance) this.instance = instance; this.instance.ClientChanged += new EventHandler(instance_ClientChanged); + netcom.NetcomSync = this; ShowAgentProfile = ShowAgentProfileInternal; @@ -182,6 +183,8 @@ public frmMain(RadegastInstance instance) InitializeStatusTimer(); RefreshWindowTitle(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void RegisterClientEvents(GridClient client) @@ -736,7 +739,7 @@ private void frmMain_Load(object sender, EventArgs e) } StartUpdateCheck(false); - if (instance.PlainColors) + if (!instance.GlobalSettings["theme_compatibility_mode"] && instance.PlainColors) { pnlDialog.BackColor = System.Drawing.Color.FromArgb(120, 220, 255); } diff --git a/Radegast/GUI/Dialogs/MuteResident.cs b/Radegast/GUI/Dialogs/MuteResident.cs index 06488fe7b..eb5c3db7b 100644 --- a/Radegast/GUI/Dialogs/MuteResident.cs +++ b/Radegast/GUI/Dialogs/MuteResident.cs @@ -62,6 +62,8 @@ public MuteResidentForm(RadegastInstance instance) picker.BringToFront(); netcom.ClientDisconnected += new EventHandler(Netcom_ClientDisconnected); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void picker_SelectionChaged(object sender, EventArgs e) diff --git a/Radegast/GUI/Dialogs/Pay.cs b/Radegast/GUI/Dialogs/Pay.cs index 41c2c6723..30f904e7c 100644 --- a/Radegast/GUI/Dialogs/Pay.cs +++ b/Radegast/GUI/Dialogs/Pay.cs @@ -88,6 +88,8 @@ public frmPay(RadegastInstance instance, UUID target, string name, bool isObject { txtAmount.Text = LastPayed.ToString(); } + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void frmPay_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Dialogs/Profile.cs b/Radegast/GUI/Dialogs/Profile.cs index d84ff4c6b..d7f02be38 100644 --- a/Radegast/GUI/Dialogs/Profile.cs +++ b/Radegast/GUI/Dialogs/Profile.cs @@ -116,6 +116,8 @@ public frmProfile(RadegastInstance instance, string fullName, UUID agentID) netcom.ClientDisconnected += new EventHandler(netcom_ClientDisconnected); instance.InventoryClipboardUpdated += new EventHandler(instance_InventoryClipboardUpdated); InitializeProfile(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void frmProfile_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Dialogs/Reconnect.cs b/Radegast/GUI/Dialogs/Reconnect.cs index 2512be271..d9ebe37cd 100644 --- a/Radegast/GUI/Dialogs/Reconnect.cs +++ b/Radegast/GUI/Dialogs/Reconnect.cs @@ -56,6 +56,8 @@ public frmReconnect(RadegastInstance instance, int time) this.instance = instance; ReconnectTime = time; lblAutoReconnect.Text = string.Format("Auto reconnect in {0} seconds.", reconnectTime); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void frmReconnect_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Dialogs/Settings.Designer.cs b/Radegast/GUI/Dialogs/Settings.Designer.cs index 535fce982..4b576b209 100644 --- a/Radegast/GUI/Dialogs/Settings.Designer.cs +++ b/Radegast/GUI/Dialogs/Settings.Designer.cs @@ -68,6 +68,7 @@ private void InitializeComponent() this.cbFriendsHighlight = new System.Windows.Forms.CheckBox(); this.cbTaskBarHighLight = new System.Windows.Forms.CheckBox(); this.cbMisc = new System.Windows.Forms.GroupBox(); + this.cbThemeCompatibilityMode = new System.Windows.Forms.CheckBox(); this.cbConfirmExit = new System.Windows.Forms.CheckBox(); this.txtResolveURITime = new System.Windows.Forms.TextBox(); this.cbResolveURIs = new System.Windows.Forms.CheckBox(); @@ -95,8 +96,6 @@ private void InitializeComponent() this.cbIMTimeStamps = new System.Windows.Forms.CheckBox(); this.cbMUEmotes = new System.Windows.Forms.CheckBox(); this.cbNoTyping = new System.Windows.Forms.CheckBox(); - this.cbFontSize = new System.Windows.Forms.ComboBox(); - this.label1 = new System.Windows.Forms.Label(); this.gbDisplayNames = new System.Windows.Forms.GroupBox(); this.rbDNOnlyDN = new System.Windows.Forms.RadioButton(); this.rbDNDandUsernme = new System.Windows.Forms.RadioButton(); @@ -136,6 +135,38 @@ private void InitializeComponent() this.autoSitUUID = new System.Windows.Forms.TextBox(); this.autoSitName = new System.Windows.Forms.TextBox(); this.autoSitNameLabel = new System.Windows.Forms.Label(); + this.tbpChat = new System.Windows.Forms.TabPage(); + this.btnSave = new System.Windows.Forms.Button(); + this.btnResetFontSettings = new System.Windows.Forms.Button(); + this.lblPreview = new System.Windows.Forms.Label(); + this.cbxItalic = new System.Windows.Forms.CheckBox(); + this.label10 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.cbxBold = new System.Windows.Forms.CheckBox(); + this.lbxColorItems = new System.Windows.Forms.ListBox(); + this.label8 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label6 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.cbxBackground = new System.Windows.Forms.ComboBox(); + this.cbxForeground = new System.Windows.Forms.ComboBox(); + this.cbxFontSize = new System.Windows.Forms.ComboBox(); + this.cbxFont = new System.Windows.Forms.ComboBox(); + this.tabNetwork = new System.Windows.Forms.TabPage(); + this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.label1 = new System.Windows.Forms.Label(); + this.label11 = new System.Windows.Forms.Label(); + this.txtProxyPort = new System.Windows.Forms.TextBox(); + this.label12 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); + this.txtProxyPassword = new System.Windows.Forms.TextBox(); + this.txtProxyUser = new System.Windows.Forms.TextBox(); + this.label14 = new System.Windows.Forms.Label(); + this.label15 = new System.Windows.Forms.Label(); + this.txtProxyURL = new System.Windows.Forms.TextBox(); + this.label16 = new System.Windows.Forms.Label(); + this.ckUseProxy = new System.Windows.Forms.CheckBox(); + this.fontDialog1 = new System.Windows.Forms.FontDialog(); this.tcGraphics.SuspendLayout(); this.tbpGeneral.SuspendLayout(); this.cbHighLight.SuspendLayout(); @@ -151,6 +182,9 @@ private void InitializeComponent() this.pseudoHome.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pseudoHomeTolerance)).BeginInit(); this.autoSit.SuspendLayout(); + this.tbpChat.SuspendLayout(); + this.tabNetwork.SuspendLayout(); + this.groupBox2.SuspendLayout(); this.SuspendLayout(); // // tcGraphics @@ -159,6 +193,8 @@ private void InitializeComponent() this.tcGraphics.Controls.Add(this.tbpAutoResponse); this.tcGraphics.Controls.Add(this.tbpGraphics); this.tcGraphics.Controls.Add(this.tbpBot); + this.tcGraphics.Controls.Add(this.tbpChat); + this.tcGraphics.Controls.Add(this.tabNetwork); this.tcGraphics.Dock = System.Windows.Forms.DockStyle.Fill; this.tcGraphics.Location = new System.Drawing.Point(0, 0); this.tcGraphics.Multiline = true; @@ -248,6 +284,7 @@ private void InitializeComponent() // // cbMisc // + this.cbMisc.Controls.Add(this.cbThemeCompatibilityMode); this.cbMisc.Controls.Add(this.cbConfirmExit); this.cbMisc.Controls.Add(this.txtResolveURITime); this.cbMisc.Controls.Add(this.cbResolveURIs); @@ -270,10 +307,20 @@ private void InitializeComponent() this.cbMisc.Controls.Add(this.cbSyntaxHighlight); this.cbMisc.Location = new System.Drawing.Point(270, 6); this.cbMisc.Name = "cbMisc"; - this.cbMisc.Size = new System.Drawing.Size(236, 385); + this.cbMisc.Size = new System.Drawing.Size(236, 413); this.cbMisc.TabIndex = 2; this.cbMisc.TabStop = false; // + // cbThemeCompatibilityMode + // + this.cbThemeCompatibilityMode.AutoSize = true; + this.cbThemeCompatibilityMode.Location = new System.Drawing.Point(6, 380); + this.cbThemeCompatibilityMode.Name = "cbThemeCompatibilityMode"; + this.cbThemeCompatibilityMode.Size = new System.Drawing.Size(150, 17); + this.cbThemeCompatibilityMode.TabIndex = 22; + this.cbThemeCompatibilityMode.Text = "Theme Compatibility Mode"; + this.cbThemeCompatibilityMode.UseVisualStyleBackColor = true; + // // cbConfirmExit // this.cbConfirmExit.AutoSize = true; @@ -488,8 +535,6 @@ private void InitializeComponent() this.Chat.Controls.Add(this.cbIMTimeStamps); this.Chat.Controls.Add(this.cbMUEmotes); this.Chat.Controls.Add(this.cbNoTyping); - this.Chat.Controls.Add(this.cbFontSize); - this.Chat.Controls.Add(this.label1); this.Chat.Location = new System.Drawing.Point(8, 5); this.Chat.Name = "Chat"; this.Chat.Size = new System.Drawing.Size(256, 169); @@ -500,7 +545,7 @@ private void InitializeComponent() // cbNameLinks // this.cbNameLinks.AutoSize = true; - this.cbNameLinks.Location = new System.Drawing.Point(8, 144); + this.cbNameLinks.Location = new System.Drawing.Point(8, 127); this.cbNameLinks.Name = "cbNameLinks"; this.cbNameLinks.Size = new System.Drawing.Size(110, 17); this.cbNameLinks.TabIndex = 9; @@ -510,7 +555,7 @@ private void InitializeComponent() // cbDisableChatIMLog // this.cbDisableChatIMLog.AutoSize = true; - this.cbDisableChatIMLog.Location = new System.Drawing.Point(8, 121); + this.cbDisableChatIMLog.Location = new System.Drawing.Point(8, 104); this.cbDisableChatIMLog.Name = "cbDisableChatIMLog"; this.cbDisableChatIMLog.Size = new System.Drawing.Size(138, 17); this.cbDisableChatIMLog.TabIndex = 8; @@ -540,7 +585,7 @@ private void InitializeComponent() // cbMUEmotes // this.cbMUEmotes.AutoSize = true; - this.cbMUEmotes.Location = new System.Drawing.Point(8, 78); + this.cbMUEmotes.Location = new System.Drawing.Point(8, 58); this.cbMUEmotes.Name = "cbMUEmotes"; this.cbMUEmotes.Size = new System.Drawing.Size(108, 17); this.cbMUEmotes.TabIndex = 5; @@ -551,7 +596,7 @@ private void InitializeComponent() // cbNoTyping // this.cbNoTyping.AutoSize = true; - this.cbNoTyping.Location = new System.Drawing.Point(8, 98); + this.cbNoTyping.Location = new System.Drawing.Point(8, 81); this.cbNoTyping.Name = "cbNoTyping"; this.cbNoTyping.Size = new System.Drawing.Size(150, 17); this.cbNoTyping.TabIndex = 6; @@ -559,36 +604,6 @@ private void InitializeComponent() this.cbNoTyping.UseVisualStyleBackColor = true; this.cbNoTyping.CheckedChanged += new System.EventHandler(this.cbTrasactChat_CheckedChanged); // - // cbFontSize - // - this.cbFontSize.FormatString = "N2"; - this.cbFontSize.FormattingEnabled = true; - this.cbFontSize.Items.AddRange(new object[] { - "8.25", - "9", - "10", - "12", - "14", - "16", - "20"}); - this.cbFontSize.Location = new System.Drawing.Point(104, 53); - this.cbFontSize.Name = "cbFontSize"; - this.cbFontSize.Size = new System.Drawing.Size(54, 21); - this.cbFontSize.TabIndex = 3; - this.cbFontSize.Text = "8.25"; - this.cbFontSize.SelectedIndexChanged += new System.EventHandler(this.cbFontSize_SelectedIndexChanged); - this.cbFontSize.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cbFontSize_KeyDown); - this.cbFontSize.Leave += new System.EventHandler(this.cbFontSize_Leave); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(26, 56); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(73, 13); - this.label1.TabIndex = 2; - this.label1.Text = "Chat text size:"; - // // gbDisplayNames // this.gbDisplayNames.Controls.Add(this.rbDNOnlyDN); @@ -1034,6 +1049,354 @@ private void InitializeComponent() this.autoSitNameLabel.Text = "Name"; this.autoSitNameLabel.Click += new System.EventHandler(this.autoSitNameLabel_Click); // + // tbpChat + // + this.tbpChat.Controls.Add(this.btnSave); + this.tbpChat.Controls.Add(this.btnResetFontSettings); + this.tbpChat.Controls.Add(this.lblPreview); + this.tbpChat.Controls.Add(this.cbxItalic); + this.tbpChat.Controls.Add(this.label10); + this.tbpChat.Controls.Add(this.label9); + this.tbpChat.Controls.Add(this.cbxBold); + this.tbpChat.Controls.Add(this.lbxColorItems); + this.tbpChat.Controls.Add(this.label8); + this.tbpChat.Controls.Add(this.label7); + this.tbpChat.Controls.Add(this.label6); + this.tbpChat.Controls.Add(this.label5); + this.tbpChat.Controls.Add(this.cbxBackground); + this.tbpChat.Controls.Add(this.cbxForeground); + this.tbpChat.Controls.Add(this.cbxFontSize); + this.tbpChat.Controls.Add(this.cbxFont); + this.tbpChat.Location = new System.Drawing.Point(4, 22); + this.tbpChat.Name = "tbpChat"; + this.tbpChat.Padding = new System.Windows.Forms.Padding(3); + this.tbpChat.Size = new System.Drawing.Size(522, 427); + this.tbpChat.TabIndex = 5; + this.tbpChat.Text = "Chat"; + this.tbpChat.UseVisualStyleBackColor = true; + // + // btnSave + // + this.btnSave.Location = new System.Drawing.Point(338, 290); + this.btnSave.Name = "btnSave"; + this.btnSave.Size = new System.Drawing.Size(49, 23); + this.btnSave.TabIndex = 18; + this.btnSave.Text = "Save"; + this.btnSave.UseVisualStyleBackColor = true; + this.btnSave.Click += new System.EventHandler(this.btnSave_Click); + // + // btnResetFontSettings + // + this.btnResetFontSettings.Location = new System.Drawing.Point(11, 290); + this.btnResetFontSettings.Name = "btnResetFontSettings"; + this.btnResetFontSettings.Size = new System.Drawing.Size(106, 23); + this.btnResetFontSettings.TabIndex = 17; + this.btnResetFontSettings.Text = "Reset All Colors"; + this.btnResetFontSettings.UseVisualStyleBackColor = true; + this.btnResetFontSettings.Click += new System.EventHandler(this.btnResetFontSettings_Click); + // + // lblPreview + // + this.lblPreview.BackColor = System.Drawing.Color.Transparent; + this.lblPreview.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.lblPreview.Location = new System.Drawing.Point(252, 221); + this.lblPreview.Name = "lblPreview"; + this.lblPreview.Size = new System.Drawing.Size(135, 63); + this.lblPreview.TabIndex = 16; + this.lblPreview.Text = "Preview"; + this.lblPreview.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // cbxItalic + // + this.cbxItalic.AutoSize = true; + this.cbxItalic.Location = new System.Drawing.Point(305, 173); + this.cbxItalic.Name = "cbxItalic"; + this.cbxItalic.Size = new System.Drawing.Size(48, 17); + this.cbxItalic.TabIndex = 15; + this.cbxItalic.Text = "Italic"; + this.cbxItalic.UseVisualStyleBackColor = true; + this.cbxItalic.CheckStateChanged += new System.EventHandler(this.cbxItalic_CheckStateChanged); + // + // label10 + // + this.label10.AutoSize = true; + this.label10.Location = new System.Drawing.Point(8, 69); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(35, 13); + this.label10.TabIndex = 14; + this.label10.Text = "Items:"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(249, 204); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(48, 13); + this.label9.TabIndex = 11; + this.label9.Text = "Preview:"; + // + // cbxBold + // + this.cbxBold.AutoSize = true; + this.cbxBold.Location = new System.Drawing.Point(252, 173); + this.cbxBold.Name = "cbxBold"; + this.cbxBold.Size = new System.Drawing.Size(47, 17); + this.cbxBold.TabIndex = 9; + this.cbxBold.Text = "Bold"; + this.cbxBold.UseVisualStyleBackColor = true; + this.cbxBold.CheckStateChanged += new System.EventHandler(this.cbxBold_CheckStateChanged); + // + // lbxColorItems + // + this.lbxColorItems.FormattingEnabled = true; + this.lbxColorItems.Location = new System.Drawing.Point(11, 85); + this.lbxColorItems.Name = "lbxColorItems"; + this.lbxColorItems.Size = new System.Drawing.Size(232, 199); + this.lbxColorItems.TabIndex = 8; + this.lbxColorItems.SelectedIndexChanged += new System.EventHandler(this.lbxColorItems_SelectedIndexChanged); + this.lbxColorItems.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lbxColorItems_MouseDown); + this.lbxColorItems.MouseMove += new System.Windows.Forms.MouseEventHandler(this.lbxColorItems_MouseMove); + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(249, 15); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(30, 13); + this.label8.TabIndex = 7; + this.label8.Text = "Size:"; + // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(8, 15); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(31, 13); + this.label7.TabIndex = 6; + this.label7.Text = "Font:"; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(249, 69); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(64, 13); + this.label6.TabIndex = 5; + this.label6.Text = "Foreground:"; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(249, 120); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(68, 13); + this.label5.TabIndex = 4; + this.label5.Text = "Background:"; + // + // cbxBackground + // + this.cbxBackground.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.cbxBackground.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxBackground.FormattingEnabled = true; + this.cbxBackground.Location = new System.Drawing.Point(252, 136); + this.cbxBackground.Name = "cbxBackground"; + this.cbxBackground.Size = new System.Drawing.Size(135, 21); + this.cbxBackground.TabIndex = 3; + this.cbxBackground.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.cbxForeground_DrawItem); + this.cbxBackground.SelectedIndexChanged += new System.EventHandler(this.SelectedIndexChanged); + // + // cbxForeground + // + this.cbxForeground.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.cbxForeground.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbxForeground.FormattingEnabled = true; + this.cbxForeground.Location = new System.Drawing.Point(252, 85); + this.cbxForeground.Name = "cbxForeground"; + this.cbxForeground.Size = new System.Drawing.Size(135, 21); + this.cbxForeground.TabIndex = 2; + this.cbxForeground.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.cbxForeground_DrawItem); + this.cbxForeground.SelectedIndexChanged += new System.EventHandler(this.SelectedIndexChanged); + // + // cbxFontSize + // + this.cbxFontSize.FormattingEnabled = true; + this.cbxFontSize.Location = new System.Drawing.Point(252, 31); + this.cbxFontSize.Name = "cbxFontSize"; + this.cbxFontSize.Size = new System.Drawing.Size(135, 21); + this.cbxFontSize.TabIndex = 1; + this.cbxFontSize.SelectedIndexChanged += new System.EventHandler(this.SelectedIndexChanged); + // + // cbxFont + // + this.cbxFont.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed; + this.cbxFont.FormattingEnabled = true; + this.cbxFont.ItemHeight = 15; + this.cbxFont.Location = new System.Drawing.Point(11, 31); + this.cbxFont.Name = "cbxFont"; + this.cbxFont.Size = new System.Drawing.Size(232, 21); + this.cbxFont.TabIndex = 0; + this.cbxFont.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.cbxFont_DrawItem); + this.cbxFont.SelectedIndexChanged += new System.EventHandler(this.SelectedIndexChanged); + // + // tabNetwork + // + this.tabNetwork.Controls.Add(this.groupBox2); + this.tabNetwork.Controls.Add(this.ckUseProxy); + this.tabNetwork.Location = new System.Drawing.Point(4, 22); + this.tabNetwork.Name = "tabNetwork"; + this.tabNetwork.Padding = new System.Windows.Forms.Padding(3); + this.tabNetwork.Size = new System.Drawing.Size(522, 427); + this.tabNetwork.TabIndex = 6; + this.tabNetwork.Text = "Network"; + this.tabNetwork.UseVisualStyleBackColor = true; + // + // groupBox2 + // + this.groupBox2.AccessibleName = "Proxy settings panel"; + this.groupBox2.Controls.Add(this.label1); + this.groupBox2.Controls.Add(this.label11); + this.groupBox2.Controls.Add(this.txtProxyPort); + this.groupBox2.Controls.Add(this.label12); + this.groupBox2.Controls.Add(this.label13); + this.groupBox2.Controls.Add(this.txtProxyPassword); + this.groupBox2.Controls.Add(this.txtProxyUser); + this.groupBox2.Controls.Add(this.label14); + this.groupBox2.Controls.Add(this.label15); + this.groupBox2.Controls.Add(this.txtProxyURL); + this.groupBox2.Controls.Add(this.label16); + this.groupBox2.Location = new System.Drawing.Point(20, 41); + this.groupBox2.Name = "groupBox2"; + this.groupBox2.Size = new System.Drawing.Size(494, 205); + this.groupBox2.TabIndex = 2; + this.groupBox2.TabStop = false; + this.groupBox2.Text = "Web Proxy Settings"; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.ForeColor = System.Drawing.Color.Gray; + this.label1.Location = new System.Drawing.Point(76, 102); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(52, 13); + this.label1.TabIndex = 9; + this.label1.Text = "e.g. 8080"; + // + // label11 + // + this.label11.ForeColor = System.Drawing.Color.Gray; + this.label11.Location = new System.Drawing.Point(97, 174); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(235, 28); + this.label11.TabIndex = 4; + this.label11.Text = "Leave username/password blank if not required"; + // + // txtProxyPort + // + this.txtProxyPort.AccessibleName = "Port textbox"; + this.txtProxyPort.BackColor = System.Drawing.Color.WhiteSmoke; + this.txtProxyPort.Location = new System.Drawing.Point(70, 79); + this.txtProxyPort.Name = "txtProxyPort"; + this.txtProxyPort.Size = new System.Drawing.Size(71, 20); + this.txtProxyPort.TabIndex = 1; + this.txtProxyPort.Leave += new System.EventHandler(this.txtProxyPort_Leave); + // + // label12 + // + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(6, 82); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(29, 13); + this.label12.TabIndex = 7; + this.label12.Text = "Port:"; + // + // label13 + // + this.label13.AutoSize = true; + this.label13.ForeColor = System.Drawing.Color.Gray; + this.label13.Location = new System.Drawing.Point(76, 58); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(153, 13); + this.label13.TabIndex = 6; + this.label13.Text = "e.g. http://"; + // + // txtProxyPassword + // + this.txtProxyPassword.AccessibleName = "Password textbox"; + this.txtProxyPassword.BackColor = System.Drawing.Color.WhiteSmoke; + this.txtProxyPassword.Location = new System.Drawing.Point(131, 146); + this.txtProxyPassword.Name = "txtProxyPassword"; + this.txtProxyPassword.Size = new System.Drawing.Size(201, 20); + this.txtProxyPassword.TabIndex = 3; + this.txtProxyPassword.Leave += new System.EventHandler(this.txtProxyPassword_Leave); + // + // txtProxyUser + // + this.txtProxyUser.AccessibleName = "Username textbox"; + this.txtProxyUser.BackColor = System.Drawing.Color.WhiteSmoke; + this.txtProxyUser.Location = new System.Drawing.Point(131, 121); + this.txtProxyUser.Name = "txtProxyUser"; + this.txtProxyUser.Size = new System.Drawing.Size(201, 20); + this.txtProxyUser.TabIndex = 2; + this.txtProxyUser.Leave += new System.EventHandler(this.txtProxyUser_Leave); + // + // label14 + // + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(67, 149); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(56, 13); + this.label14.TabIndex = 3; + this.label14.Text = "Password:"; + // + // label15 + // + this.label15.AutoSize = true; + this.label15.Location = new System.Drawing.Point(67, 124); + this.label15.Name = "label15"; + this.label15.Size = new System.Drawing.Size(58, 13); + this.label15.TabIndex = 2; + this.label15.Text = "Username:"; + // + // txtProxyURL + // + this.txtProxyURL.AccessibleName = "URI textbox"; + this.txtProxyURL.BackColor = System.Drawing.Color.WhiteSmoke; + this.txtProxyURL.Location = new System.Drawing.Point(70, 35); + this.txtProxyURL.Name = "txtProxyURL"; + this.txtProxyURL.Size = new System.Drawing.Size(262, 20); + this.txtProxyURL.TabIndex = 0; + this.txtProxyURL.Leave += new System.EventHandler(this.txtProxyURL_Leave); + // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(6, 38); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(29, 13); + this.label16.TabIndex = 0; + this.label16.Text = "URI:"; + // + // ckUseProxy + // + this.ckUseProxy.AccessibleName = "Use web proxy option"; + this.ckUseProxy.AutoSize = true; + this.ckUseProxy.FlatAppearance.BorderColor = System.Drawing.Color.Silver; + this.ckUseProxy.FlatAppearance.CheckedBackColor = System.Drawing.Color.LightSteelBlue; + this.ckUseProxy.FlatAppearance.MouseOverBackColor = System.Drawing.Color.LightSteelBlue; + this.ckUseProxy.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.ckUseProxy.Location = new System.Drawing.Point(20, 18); + this.ckUseProxy.Name = "ckUseProxy"; + this.ckUseProxy.Size = new System.Drawing.Size(97, 17); + this.ckUseProxy.TabIndex = 1; + this.ckUseProxy.Text = "Use Web Proxy"; + this.ckUseProxy.UseVisualStyleBackColor = true; + this.ckUseProxy.CheckedChanged += new System.EventHandler(this.ckUseProxy_CheckedChanged); + this.ckUseProxy.CheckStateChanged += new System.EventHandler(this.ckUseProxy_CheckStateChanged); + // + // fontDialog1 + // + this.fontDialog1.ShowColor = true; + // // frmSettings // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1067,14 +1430,17 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)(this.pseudoHomeTolerance)).EndInit(); this.autoSit.ResumeLayout(false); this.autoSit.PerformLayout(); + this.tbpChat.ResumeLayout(false); + this.tbpChat.PerformLayout(); + this.tabNetwork.ResumeLayout(false); + this.tabNetwork.PerformLayout(); + this.groupBox2.ResumeLayout(false); + this.groupBox2.PerformLayout(); this.ResumeLayout(false); } #endregion - - public System.Windows.Forms.Label label1; - public System.Windows.Forms.ComboBox cbFontSize; public System.Windows.Forms.TabControl tcGraphics; public System.Windows.Forms.TabPage tbpGeneral; public System.Windows.Forms.CheckBox cbIMTimeStamps; @@ -1150,5 +1516,38 @@ private void InitializeComponent() public System.Windows.Forms.Label label4; public System.Windows.Forms.CheckBox cbResolveURIs; private System.Windows.Forms.CheckBox cbConfirmExit; + private System.Windows.Forms.CheckBox cbThemeCompatibilityMode; + private System.Windows.Forms.TabPage tbpChat; + private System.Windows.Forms.FontDialog fontDialog1; + private System.Windows.Forms.CheckBox cbxItalic; + private System.Windows.Forms.Label label10; + private System.Windows.Forms.Label label9; + private System.Windows.Forms.CheckBox cbxBold; + private System.Windows.Forms.ListBox lbxColorItems; + private System.Windows.Forms.Label label8; + private System.Windows.Forms.Label label7; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.Label label5; + private System.Windows.Forms.ComboBox cbxBackground; + private System.Windows.Forms.ComboBox cbxForeground; + private System.Windows.Forms.ComboBox cbxFontSize; + private System.Windows.Forms.ComboBox cbxFont; + private System.Windows.Forms.Label lblPreview; + private System.Windows.Forms.Button btnSave; + private System.Windows.Forms.Button btnResetFontSettings; + private System.Windows.Forms.TabPage tabNetwork; + private System.Windows.Forms.GroupBox groupBox2; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.TextBox txtProxyPort; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.TextBox txtProxyPassword; + private System.Windows.Forms.TextBox txtProxyUser; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.TextBox txtProxyURL; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.CheckBox ckUseProxy; } } diff --git a/Radegast/GUI/Dialogs/Settings.cs b/Radegast/GUI/Dialogs/Settings.cs index 1d31b2055..83a6b79df 100644 --- a/Radegast/GUI/Dialogs/Settings.cs +++ b/Radegast/GUI/Dialogs/Settings.cs @@ -42,6 +42,7 @@ using OpenMetaverse.StructuredData; using Radegast.Automation; +using System.Web.Script.Serialization; namespace Radegast { @@ -56,6 +57,8 @@ public partial class frmSettings : RadegastForm { private Settings s; private static bool settingInitialized = false; + private Settings.FontSetting currentlySelectedFontSetting = null; + Dictionary chatFontSettings; public static void InitSettigs(Settings s, bool mono) { @@ -144,14 +147,84 @@ public static void InitSettigs(Settings s, bool mono) if (!s.ContainsKey("disable_http_inventory")) { - s["disable_http_inventory"] = mono; + s["disable_http_inventory"] = false; } if (!s.ContainsKey("on_script_question")) { s["on_script_question"] = "Ask"; } - + + if (!s.ContainsKey("use_proxy")) s["use_proxy"] = false; + + if (!s.ContainsKey("proxy_url")) s["proxy_url"] = ""; + if (!s.ContainsKey("proxy_port")) s["proxy_port"] = ""; + if (!s.ContainsKey("proxy_user")) s["proxy_user"] = ""; + if (!s.ContainsKey("proxy_password")) s["proxy_password"] = ""; + } + + private void InitColorSettings() + { + for (int i = 1; i <= 48; i++) + { + cbxFontSize.Items.Add((float)i); + cbxFontSize.Items.Add((float)i + 0.5f); + } + + foreach (var font in System.Drawing.FontFamily.Families) + { + cbxFont.Items.Add(font.Name); + } + + //var colorTypes = typeof(System.Drawing.Color); + //var props = colorTypes.GetProperties(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.DeclaredOnly); + var knownColors = typeof(System.Drawing.KnownColor).GetEnumValues(); + + foreach (var item in knownColors) + { + var color = System.Drawing.Color.FromKnownColor((System.Drawing.KnownColor)item); + cbxForeground.Items.Add(color); + cbxBackground.Items.Add(color); + } + + cbxFont.SelectedItem = SystemFonts.DefaultFont.Name; + cbxFontSize.SelectedItem = SystemFonts.DefaultFont.Size; + cbxBold.Checked = SystemFonts.DefaultFont.Bold; + cbxItalic.Checked = SystemFonts.DefaultFont.Italic; + cbxForeground.SelectedItem = SystemColors.ControlText; + cbxBackground.SelectedItem = SystemColors.Control; + + ReloadFontSettings(); + } + + private void ReloadFontSettings() + { + lbxColorItems.Items.Clear(); + + var chatFontsJson = Instance.GlobalSettings["chat_fonts"]; + if (chatFontsJson.Type != OSDType.Unknown) + { + JavaScriptSerializer serializer = new JavaScriptSerializer(); + Dictionary unpacked = new Dictionary(); + chatFontSettings = serializer.Deserialize>(chatFontsJson); + } + else + { + chatFontSettings = Settings.DefaultFontSettings; + } + + foreach (var item in chatFontSettings) + { + if(item.Value.Name != item.Key) + { + item.Value.Name = item.Key; + } + lbxColorItems.Items.Add(item.Value); + } + if(chatFontSettings.Count > 0) + { + lbxColorItems.SetSelected(0, true); + } } public frmSettings(RadegastInstance instance) @@ -164,6 +237,7 @@ public frmSettings(RadegastInstance instance) InitializeComponent(); AutoSavePosition = true; + InitColorSettings(); s = instance.GlobalSettings; tbpGraphics.Controls.Add(new Radegast.Rendering.GraphicsPreferences(instance)); @@ -207,13 +281,6 @@ public frmSettings(RadegastInstance instance) s["mu_emotes"] = new OSDBoolean(cbMUEmotes.Checked); }; - if (s["chat_font_size"].Type != OSDType.Real) - { - s["chat_font_size"] = OSD.FromReal(((ChatConsole)instance.TabConsole.Tabs["chat"].Control).cbxInput.Font.Size); - } - - cbFontSize.Text = s["chat_font_size"].AsReal().ToString(System.Globalization.CultureInfo.InvariantCulture); - if (!s.ContainsKey("minimize_to_tray")) s["minimize_to_tray"] = OSD.FromBoolean(false); cbMinToTrey.Checked = s["minimize_to_tray"].AsBoolean(); cbMinToTrey.CheckedChanged += (object sender, EventArgs e) => @@ -292,6 +359,12 @@ public frmSettings(RadegastInstance instance) s["confirm_exit"] = cbConfirmExit.Checked; }; + cbThemeCompatibilityMode.Checked = s["theme_compatibility_mode"]; + cbThemeCompatibilityMode.CheckedChanged += (sender, e) => + { + s["theme_compatibility_mode"] = cbThemeCompatibilityMode.Checked; + }; + cbTaskBarHighLight.Checked = s["taskbar_highlight"]; cbTaskBarHighLight.CheckedChanged += (sender, e) => { @@ -355,7 +428,29 @@ public frmSettings(RadegastInstance instance) cbAutoScriptPermission.Text = s["on_script_question"]; + ckUseProxy.Checked = s["use_proxy"]; + + txtProxyURL.Text = s["proxy_url"]; + txtProxyPort.Text = s["proxy_port"]; + txtProxyUser.Text = s["proxy_user"]; + txtProxyPassword.Text = s["proxy_password"]; + + /* + RadeProxy proxy = new RadeProxy(); + + if (ckUseProxy.Checked) + { + proxy.SetProxy(ckUseProxy.Checked, txtProxyURL.Text, txtProxyPort.Text, txtProxyUser.Text, txtProxyPassword.Text); + } + else + { + RadeProxy.DisableProxy(); + } + */ + UpdateEnabled(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void UpdateEnabled() @@ -410,41 +505,6 @@ private void cbTrasactChat_CheckedChanged(object sender, EventArgs e) s["transaction_notification_chat"] = OSD.FromBoolean(cbTrasactChat.Checked); } - private void UpdateFontSize() - { - double f = 8.25; - double existing = s["chat_font_size"].AsReal(); - - if (!double.TryParse(cbFontSize.Text, out f)) - { - cbFontSize.Text = s["chat_font_size"].AsReal().ToString(System.Globalization.CultureInfo.InvariantCulture); - return; - } - - if (Math.Abs(existing - f) > 0.0001f) - s["chat_font_size"] = OSD.FromReal(f); - - } - - private void cbFontSize_SelectedIndexChanged(object sender, EventArgs e) - { - UpdateFontSize(); - } - - private void cbFontSize_KeyDown(object sender, KeyEventArgs e) - { - if (e.KeyCode == Keys.Enter) - { - UpdateFontSize(); - e.Handled = e.SuppressKeyPress = true; - } - } - - private void cbFontSize_Leave(object sender, EventArgs e) - { - UpdateFontSize(); - } - private void rbAutobusy_CheckedChanged(object sender, EventArgs e) { s["auto_response_type"] = (int)AutoResponseType.WhenBusy; @@ -536,6 +596,11 @@ private void cbConfirmExit_CheckedChanged(object sender, EventArgs e) s["confirm_exit"] = OSD.FromBoolean(cbConfirmExit.Checked); } + private void cbThemeCompatibilityMode_CheckedChanged(object sender, EventArgs e) + { + s["theme_compatibility_mode"] = OSD.FromBoolean(cbThemeCompatibilityMode.Checked); + } + #region Auto-Sit private void autoSitPrefsUpdate() @@ -744,5 +809,286 @@ private void cbAutoScriptPermission_SelectedIndexChanged(object sender, EventArg s["on_script_question"] = cbAutoScriptPermission.Text; } + private void cbxForeground_DrawItem(object sender, DrawItemEventArgs e) + { + const int kPreviewPadding = 2; + const int kTextOffset = 15; + + var graphics = e.Graphics; + var bounds = e.Bounds; + + if (e.Index >= 0 && sender is ComboBox) + { + var sourceControl = sender as ComboBox; + var selectedColor = (Color)sourceControl.Items[e.Index]; + if(sourceControl.Items[e.Index] is Color) + { + var brushPreview = new SolidBrush(selectedColor); + + e.DrawBackground(); + + if(e.State == DrawItemState.Selected) + { + graphics.DrawRectangle(SystemPens.Highlight, bounds); + } + + graphics.DrawString(brushPreview.Color.Name, + SystemFonts.DefaultFont, + SystemBrushes.ControlText, + bounds.X + kTextOffset, + bounds.Top + kPreviewPadding); + + graphics.FillRectangle(brushPreview, + bounds.X + kPreviewPadding, + bounds.Y + kPreviewPadding, + bounds.Height - kPreviewPadding, + bounds.Height - kPreviewPadding); + } + } + } + + private void cbxFont_DrawItem(object sender, DrawItemEventArgs e) + { + const int kPreviewFontSize = 8; + + var graphics = e.Graphics; + var bounds = e.Bounds; + + if (e.Index >= 0 && sender is ComboBox) + { + var sourceControl = sender as ComboBox; + var fontName = sourceControl.Items[e.Index].ToString(); + var fontPreview = new Font(fontName, kPreviewFontSize); + + e.DrawBackground(); + + if(e.State == DrawItemState.Selected) + { + graphics.DrawRectangle(SystemPens.Highlight, bounds); + } + else + { + graphics.DrawRectangle(SystemPens.Window, bounds); + } + + graphics.DrawString(fontName, + fontPreview, + SystemBrushes.ControlText, + bounds.X, + bounds.Top); + + } + } + + private Settings.FontSetting GetPreviewFontSettings() + { + float fontSize = SystemFonts.DefaultFont.Size; + string fontName = SystemFonts.DefaultFont.Name; + Color backColor = SystemColors.Window; + Color foreColor = SystemColors.ControlText; + FontStyle style = FontStyle.Regular; + + if(cbxFontSize.SelectedItem is float) + { + fontSize = (float)cbxFontSize.SelectedItem; + } + if(cbxFont.SelectedItem is string) + { + fontName = (string)cbxFont.SelectedItem; + } + if(cbxForeground.SelectedItem is Color) + { + foreColor = (Color)cbxForeground.SelectedItem; + } + if(cbxBackground.SelectedItem is Color) + { + backColor = (Color)cbxBackground.SelectedItem; + } + + if(cbxBold.Checked) + { + style |= FontStyle.Bold; + } + if(cbxItalic.Checked) + { + style |= FontStyle.Italic; + } + + var previewFontSettings = new Settings.FontSetting(){ + Name = string.Empty, + Font = new Font(fontName, fontSize, style), + ForeColor = foreColor, + BackColor = backColor + }; + + return previewFontSettings; + } + + private void UpdatePreview() + { + var previewFontSettings = GetPreviewFontSettings(); + + lblPreview.Font = previewFontSettings.Font; + lblPreview.ForeColor = previewFontSettings.ForeColor; + lblPreview.BackColor = previewFontSettings.BackColor; + } + + private void UpdateSelection(Settings.FontSetting selected) + { + currentlySelectedFontSetting = selected; + cbxFontSize.SelectedItem = selected.Font.Size; + cbxFont.SelectedItem = selected.Font.Name; + cbxForeground.SelectedItem = selected.ForeColor; + cbxBackground.SelectedItem = selected.BackColor; + cbxBold.Checked = selected.Font.Bold; + cbxItalic.Checked = selected.Font.Italic; + } + + private void SaveCurrentFontSetting() + { + if(currentlySelectedFontSetting != null) + { + try + { + var previewFontSettings = GetPreviewFontSettings(); + previewFontSettings.Name = currentlySelectedFontSetting.Name; + + chatFontSettings[currentlySelectedFontSetting.Name] = previewFontSettings; + + JavaScriptSerializer serializer = new JavaScriptSerializer(); + var json = serializer.Serialize(chatFontSettings); + Instance.GlobalSettings["chat_fonts"] = json; + Instance.GlobalSettings.Save(); + + var previousIndex = lbxColorItems.SelectedIndex; + ReloadFontSettings(); + lbxColorItems.SelectedIndex = previousIndex; + } + catch (Exception ex) + { + MessageBox.Show("Failed to save font setting: " + ex.Message); + } + } + } + + private void ResetFontSettings() + { + try + { + JavaScriptSerializer serializer = new JavaScriptSerializer(); + var json = serializer.Serialize(Settings.DefaultFontSettings); + Instance.GlobalSettings["chat_fonts"] = json; + Instance.GlobalSettings.Save(); + ReloadFontSettings(); + } + catch (Exception ex) + { + MessageBox.Show("Failed to reset font settings: " + ex.Message); + } + } + + private void SelectedIndexChanged(object sender, EventArgs e) + { + UpdatePreview(); + } + + private void cbxItalic_CheckStateChanged(object sender, EventArgs e) + { + UpdatePreview(); + } + + private void cbxBold_CheckStateChanged(object sender, EventArgs e) + { + UpdatePreview(); + } + + private void lbxColorItems_SelectedIndexChanged(object sender, EventArgs e) + { + if(sender is ListBox) + { + var sourceListbox = sender as ListBox; + if(sourceListbox.SelectedItem is Settings.FontSetting) + { + var fontSettings = sourceListbox.SelectedItem as Settings.FontSetting; + UpdateSelection(fontSettings); + } + } + } + + private void lbxColorItems_MouseMove(object sender, MouseEventArgs e) + { + if(e.Button != MouseButtons.None) + { + ListBox sourceListbox = sender as ListBox; + if(sourceListbox != null) + { + int itemIndex = sourceListbox.IndexFromPoint(new Point(e.X, e.Y)); + if(itemIndex != -1) + { + var selectedItem = sourceListbox.Items[itemIndex] as Settings.FontSetting; + if(selectedItem != null && selectedItem != currentlySelectedFontSetting) + { + UpdateSelection(selectedItem); + sourceListbox.SelectedIndex = itemIndex; + } + } + } + } + } + + private void lbxColorItems_MouseDown(object sender, MouseEventArgs e) + { + lbxColorItems_MouseMove(sender, e); + } + + private void btnSave_Click(object sender, EventArgs e) + { + SaveCurrentFontSetting(); + } + + private void btnResetFontSettings_Click(object sender, EventArgs e) + { + if(MessageBox.Show("Reset all color settings to the default values?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk) == DialogResult.Yes) + { + ResetFontSettings(); + } + } + + private void ckUseProxy_CheckStateChanged(object sender, EventArgs e) + { + } + + private void txtProxyURL_Leave(object sender, EventArgs e) + { + s["proxy_url"] = txtProxyURL.Text; + } + + private void txtProxyPort_Leave(object sender, EventArgs e) + { + s["proxy_port"] = txtProxyPort.Text; + } + + private void txtProxyUser_Leave(object sender, EventArgs e) + { + s["proxy_user"] = txtProxyUser.Text; + } + + private void txtProxyPassword_Leave(object sender, EventArgs e) + { + s["proxy_password"] = txtProxyPassword.Text; + } + + private void ckUseProxy_CheckedChanged(object sender, EventArgs e) + { + txtProxyURL.Enabled = ckUseProxy.Checked; + txtProxyPort.Enabled = ckUseProxy.Checked; + txtProxyUser.Enabled = ckUseProxy.Checked; + txtProxyPassword.Enabled = ckUseProxy.Checked; + + s["use_proxy"] = OSD.FromBoolean(ckUseProxy.Checked); + + } } + + } diff --git a/Radegast/GUI/Dialogs/Settings.resx b/Radegast/GUI/Dialogs/Settings.resx index 0e98e277f..1f7c74770 100644 --- a/Radegast/GUI/Dialogs/Settings.resx +++ b/Radegast/GUI/Dialogs/Settings.resx @@ -112,12 +112,15 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + 17, 17 + + AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAA diff --git a/Radegast/GUI/GuiHelpers.cs b/Radegast/GUI/GuiHelpers.cs new file mode 100644 index 000000000..bc9971f30 --- /dev/null +++ b/Radegast/GUI/GuiHelpers.cs @@ -0,0 +1,70 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace Radegast.GUI +{ + public static class GuiHelpers + { + public static void ApplyGuiFixes(Object root) + { + try + { + var instance = Radegast.RadegastInstance.GlobalInstance; + if (instance.GlobalSettings["theme_compatibility_mode"]) + { + ApplyThemeCompatibilityModeRecursive(root); + } + } + catch (Exception) + { + // Suppress exceptions that will be raised above in designer mode. + } + + } + + private static void ApplyThemeCompatibilityModeRecursive(Object root) + { + if (root is ToolStrip) + { + var toolstrip = root as ToolStrip; + toolstrip.RenderMode = ToolStripRenderMode.System; + toolstrip.BackColor = System.Drawing.SystemColors.Control; + toolstrip.ForeColor = System.Drawing.SystemColors.ControlText; + toolstrip.BackColor = System.Drawing.Color.Transparent; + + foreach (var item in toolstrip.Items) + { + ApplyThemeCompatibilityModeRecursive(item); + } + } + else if (root is ToolStripDropDownItem) + { + var dropDownItem = root as ToolStripDropDownItem; + dropDownItem.BackColor = System.Drawing.SystemColors.Control; + dropDownItem.ForeColor = System.Drawing.SystemColors.ControlText; + dropDownItem.DropDown.RenderMode = ToolStripRenderMode.System; + dropDownItem.DropDown.BackColor = System.Drawing.SystemColors.Control; + dropDownItem.DropDown.ForeColor = System.Drawing.SystemColors.ControlText; + + foreach (var item in dropDownItem.DropDownItems) + { + ApplyThemeCompatibilityModeRecursive(item); + } + } + else if (root is Control && !(root is ProgressBar)) + { + var control = root as Control; + control.BackColor = System.Drawing.SystemColors.Control; + control.ForeColor = System.Drawing.SystemColors.ControlText; + + foreach (var item in control.Controls) + { + ApplyThemeCompatibilityModeRecursive(item); + } + } + } + } +} diff --git a/Radegast/GUI/Notifications/FriendshipOfferNotification.cs b/Radegast/GUI/Notifications/FriendshipOfferNotification.cs index 4ac9f0281..aeca91df5 100644 --- a/Radegast/GUI/Notifications/FriendshipOfferNotification.cs +++ b/Radegast/GUI/Notifications/FriendshipOfferNotification.cs @@ -60,6 +60,8 @@ public ntfFriendshipOffer(RadegastInstance instance, InstantMessage msg) args.Buttons.Add(btnNo); args.Buttons.Add(btnIgnore); FireNotificationCallback(args); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void btnYes_Click(object sender, EventArgs e) diff --git a/Radegast/GUI/Notifications/GenericNotification.cs b/Radegast/GUI/Notifications/GenericNotification.cs index 1555f584d..36e4b8f71 100644 --- a/Radegast/GUI/Notifications/GenericNotification.cs +++ b/Radegast/GUI/Notifications/GenericNotification.cs @@ -56,6 +56,8 @@ public ntfGeneric(RadegastInstance instance, string msg) args.Text = txtMessage.Text; args.Buttons.Add(btnOk); FireNotificationCallback(args); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void btnOk_Click(object sender, EventArgs e) diff --git a/Radegast/GUI/Notifications/GroupInvitationNotification.cs b/Radegast/GUI/Notifications/GroupInvitationNotification.cs index 33852ce25..7c08f8519 100644 --- a/Radegast/GUI/Notifications/GroupInvitationNotification.cs +++ b/Radegast/GUI/Notifications/GroupInvitationNotification.cs @@ -27,6 +27,8 @@ public ntfGroupInvitation(RadegastInstance instance, InstantMessage msg) args.Text = txtMessage.Text; args.Buttons.Add(btnYes); FireNotificationCallback(args); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void btnYes_Click(object sender, EventArgs e) diff --git a/Radegast/GUI/Notifications/GroupNoticeNotification.cs b/Radegast/GUI/Notifications/GroupNoticeNotification.cs index 27f72dbe3..6fe691768 100644 --- a/Radegast/GUI/Notifications/GroupNoticeNotification.cs +++ b/Radegast/GUI/Notifications/GroupNoticeNotification.cs @@ -97,6 +97,7 @@ public ntfGroupNotice(RadegastInstance instance, InstantMessage msg) client.Groups.RequestGroupProfile(groupID); } + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void ShowNotice() diff --git a/Radegast/GUI/Notifications/InventoryOfferNotification.cs b/Radegast/GUI/Notifications/InventoryOfferNotification.cs index 4dcccea34..03f7b645b 100644 --- a/Radegast/GUI/Notifications/InventoryOfferNotification.cs +++ b/Radegast/GUI/Notifications/InventoryOfferNotification.cs @@ -93,6 +93,8 @@ public ntfInventoryOffer(RadegastInstance instance, InstantMessage msg) { Logger.Log("Wrong format of the item offered", Helpers.LogLevel.Warning, client); } + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void ntfInventoryOffer_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Notifications/LoadURLNotification.cs b/Radegast/GUI/Notifications/LoadURLNotification.cs index ccc42e2e0..26bb3bee1 100644 --- a/Radegast/GUI/Notifications/LoadURLNotification.cs +++ b/Radegast/GUI/Notifications/LoadURLNotification.cs @@ -61,6 +61,8 @@ public ntfLoadURL(RadegastInstance instance, LoadUrlEventArgs e) args.Buttons.Add(btnGoTo); args.Buttons.Add(btnCancel); FireNotificationCallback(args); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void ntfLoadURL_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Notifications/PermissionsNotification.cs b/Radegast/GUI/Notifications/PermissionsNotification.cs index fe10091e1..c97d8bfb9 100644 --- a/Radegast/GUI/Notifications/PermissionsNotification.cs +++ b/Radegast/GUI/Notifications/PermissionsNotification.cs @@ -68,6 +68,8 @@ public ntfPermissions(RadegastInstance instance, Simulator simulator, UUID taskI args.Buttons.Add(btnNo); args.Buttons.Add(btnMute); FireNotificationCallback(args); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void btnYes_Click(object sender, EventArgs e) diff --git a/Radegast/GUI/Notifications/RequestLureNotification.cs b/Radegast/GUI/Notifications/RequestLureNotification.cs index 7f54ea61d..c5e91a30e 100644 --- a/Radegast/GUI/Notifications/RequestLureNotification.cs +++ b/Radegast/GUI/Notifications/RequestLureNotification.cs @@ -58,6 +58,8 @@ public ntfRequestLure(RadegastInstance instance, InstantMessage msg) args.Buttons.Add(btnTeleport); args.Buttons.Add(btnCancel); FireNotificationCallback(args); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void btnTeleport_Click(object sender, EventArgs e) diff --git a/Radegast/GUI/Notifications/ScriptDialog.cs b/Radegast/GUI/Notifications/ScriptDialog.cs index 2ef2aa6e9..470ead62a 100644 --- a/Radegast/GUI/Notifications/ScriptDialog.cs +++ b/Radegast/GUI/Notifications/ScriptDialog.cs @@ -88,6 +88,8 @@ public ntfScriptDialog(RadegastInstance instance, string message, string objectN // Fire off event args.Buttons.Add(ignoreBtn); FireNotificationCallback(args); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void b_Click(object sender, EventArgs e) diff --git a/Radegast/GUI/Notifications/SendLureOffer.cs b/Radegast/GUI/Notifications/SendLureOffer.cs index 59f7e56a6..1a4c1a51d 100644 --- a/Radegast/GUI/Notifications/SendLureOffer.cs +++ b/Radegast/GUI/Notifications/SendLureOffer.cs @@ -61,6 +61,8 @@ public ntfSendLureOffer(RadegastInstance instance, UUID agentID) args.Buttons.Add(btnOffer); args.Buttons.Add(btnCancel); FireNotificationCallback(args); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void btnOffer_Click(object sender, EventArgs e) diff --git a/Radegast/GUI/Notifications/SendLureRequest.cs b/Radegast/GUI/Notifications/SendLureRequest.cs index 37008654c..3494f2b91 100644 --- a/Radegast/GUI/Notifications/SendLureRequest.cs +++ b/Radegast/GUI/Notifications/SendLureRequest.cs @@ -60,6 +60,8 @@ public ntfSendLureRequest(RadegastInstance instance, UUID agentID) args.Buttons.Add(btnRequest); args.Buttons.Add(btnCancel); FireNotificationCallback(args); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void btnTeleport_Click(object sender, EventArgs e) diff --git a/Radegast/GUI/Notifications/TeleportNotification.cs b/Radegast/GUI/Notifications/TeleportNotification.cs index 21c524b04..aa4303126 100644 --- a/Radegast/GUI/Notifications/TeleportNotification.cs +++ b/Radegast/GUI/Notifications/TeleportNotification.cs @@ -58,6 +58,8 @@ public ntfTeleport(RadegastInstance instance, InstantMessage msg) args.Buttons.Add(btnTeleport); args.Buttons.Add(btnCancel); FireNotificationCallback(args); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } private void btnTeleport_Click(object sender, EventArgs e) diff --git a/Radegast/GUI/Rendering/Compat.cs b/Radegast/GUI/Rendering/Compat.cs index 3764961fc..62009bc4d 100644 --- a/Radegast/GUI/Rendering/Compat.cs +++ b/Radegast/GUI/Rendering/Compat.cs @@ -85,7 +85,7 @@ public static int BufferSize(BufferTarget target) } else { - GL.Arb.GetBufferParameter((ArbVertexBufferObject)(int)target, BufferParameterNameArb.BufferSize, out ret); + GL.Arb.GetBufferParameter((BufferTargetArb)(int)target, BufferParameterNameArb.BufferSize, out ret); } return ret; } diff --git a/Radegast/GUI/Rendering/GraphicsPreferences.cs b/Radegast/GUI/Rendering/GraphicsPreferences.cs index 31b8b3c3d..e5d07275f 100644 --- a/Radegast/GUI/Rendering/GraphicsPreferences.cs +++ b/Radegast/GUI/Rendering/GraphicsPreferences.cs @@ -60,6 +60,8 @@ SceneWindow Window public GraphicsPreferences() { InitializeComponent(); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } public GraphicsPreferences(RadegastInstance instance) @@ -81,6 +83,8 @@ public GraphicsPreferences(RadegastInstance instance) cbOcclusionCulling.Checked = Instance.GlobalSettings["rendering_occlusion_culling_enabled2"]; cbShiny.Checked = Instance.GlobalSettings["scene_viewer_shiny"]; cbVBO.Checked = Instance.GlobalSettings["rendering_use_vbo"]; + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void GraphicsPreferences_Disposed(object sender, EventArgs e) diff --git a/Radegast/GUI/Rendering/PrimWorkshop.cs b/Radegast/GUI/Rendering/PrimWorkshop.cs index 2686cd689..b84156aa6 100644 --- a/Radegast/GUI/Rendering/PrimWorkshop.cs +++ b/Radegast/GUI/Rendering/PrimWorkshop.cs @@ -128,6 +128,8 @@ public frmPrimWorkshop(RadegastInstance instance, uint rootLocalID) Client.Objects.TerseObjectUpdate += new EventHandler(Objects_TerseObjectUpdate); Client.Objects.ObjectUpdate += new EventHandler(Objects_ObjectUpdate); Client.Objects.ObjectDataBlockUpdate += new EventHandler(Objects_ObjectDataBlockUpdate); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void frmPrimWorkshop_Disposed(object sender, EventArgs e) @@ -757,7 +759,7 @@ private void RenderObjects(RenderPass pass) GL.TexCoordPointer(2, TexCoordPointerType.Float, 0, data.TexCoords); GL.VertexPointer(3, VertexPointerType.Float, 0, data.Vertices); GL.NormalPointer(NormalPointerType.Float, 0, data.Normals); - GL.DrawElements(BeginMode.Triangles, data.Indices.Length, DrawElementsType.UnsignedShort, data.Indices); + GL.DrawElements(PrimitiveType.Triangles, data.Indices.Length, DrawElementsType.UnsignedShort, data.Indices); } diff --git a/Radegast/GUI/Rendering/RenderAvatar.cs b/Radegast/GUI/Rendering/RenderAvatar.cs index bdcc323be..a30cdbd94 100644 --- a/Radegast/GUI/Rendering/RenderAvatar.cs +++ b/Radegast/GUI/Rendering/RenderAvatar.cs @@ -86,7 +86,7 @@ public class GLMesh : LindenMesh public int teFaceID; public Dictionary _evp = new Dictionary(); - new public class LODMesh : LindenMesh.LODMesh + new public class LODMesh : LindenMesh.ReferenceMesh { public ushort[] Indices; @@ -95,13 +95,13 @@ public override void LoadMesh(string filename) base.LoadMesh(filename); // Generate the index array - Indices = new ushort[_numFaces * 3]; + Indices = new ushort[NumFaces * 3]; int current = 0; - for (int i = 0; i < _numFaces; i++) + for (int i = 0; i < NumFaces; i++) { - Indices[current++] = (ushort)_faces[i].Indices[0]; - Indices[current++] = (ushort)_faces[i].Indices[1]; - Indices[current++] = (ushort)_faces[i].Indices[2]; + Indices[current++] = (ushort)Faces[i].Indices[0]; + Indices[current++] = (ushort)Faces[i].Indices[1]; + Indices[current++] = (ushort)Faces[i].Indices[2]; } } } @@ -515,7 +515,6 @@ public class GLAvatar public VisualParamEx.EparamSex msex; public byte[] VisualAppearanceParameters = new byte[1024]; - bool vpsent = false; static bool lindenMeshesLoaded = false; public GLAvatar() @@ -881,7 +880,6 @@ public void morph(Avatar av) x++; } - vpsent = true; this.skel.mNeedsMeshRebuild = true; // Don't update actual meshes here anymore, we do it every frame because of animation anyway @@ -1642,7 +1640,6 @@ public class Bone private Quaternion mTotalRot; private Vector3 mDeltaPos; - private Quaternion mDeltaRot; public string mParentBone = null; diff --git a/Radegast/GUI/Rendering/RenderPrimitive.cs b/Radegast/GUI/Rendering/RenderPrimitive.cs index 44cf854dc..a8ab82fda 100644 --- a/Radegast/GUI/Rendering/RenderPrimitive.cs +++ b/Radegast/GUI/Rendering/RenderPrimitive.cs @@ -604,7 +604,7 @@ public override void Render(RenderPass pass, int pickingID, SceneWindow scene, f GL.NormalPointer(NormalPointerType.Float, FaceData.VertexSize, (IntPtr)normalPtr); GL.TexCoordPointer(2, TexCoordPointerType.Float, FaceData.VertexSize, (IntPtr)texPtr); GL.VertexPointer(3, VertexPointerType.Float, FaceData.VertexSize, verts); - GL.DrawElements(BeginMode.Triangles, indices.Length, DrawElementsType.UnsignedShort, indices); + GL.DrawElements(PrimitiveType.Triangles, indices.Length, DrawElementsType.UnsignedShort, indices); } } } @@ -618,7 +618,7 @@ public override void Render(RenderPass pass, int pickingID, SceneWindow scene, f GL.TexCoordPointer(2, TexCoordPointerType.Float, FaceData.VertexSize, (IntPtr)(24)); GL.VertexPointer(3, VertexPointerType.Float, FaceData.VertexSize, (IntPtr)(0)); - GL.DrawElements(BeginMode.Triangles, face.Indices.Count, DrawElementsType.UnsignedShort, IntPtr.Zero); + GL.DrawElements(PrimitiveType.Triangles, face.Indices.Count, DrawElementsType.UnsignedShort, IntPtr.Zero); } Compat.BindBuffer(BufferTarget.ArrayBuffer, 0); Compat.BindBuffer(BufferTarget.ElementArrayBuffer, 0); @@ -658,7 +658,7 @@ public override string ToString() { uint id = Prim == null ? 0 : Prim.LocalID; float distance = (float)Math.Sqrt(DistanceSquared); - return string.Format("LocalID: {0}, distance {0.00}", id, distance); + return string.Format("LocalID: {0}, distance {1:0.00}", id, distance); } } } diff --git a/Radegast/GUI/Rendering/RenderTerrain.cs b/Radegast/GUI/Rendering/RenderTerrain.cs index 834bdc34e..3cf4e4b60 100644 --- a/Radegast/GUI/Rendering/RenderTerrain.cs +++ b/Radegast/GUI/Rendering/RenderTerrain.cs @@ -251,7 +251,7 @@ public override void Render(RenderPass pass, int pickingID, SceneWindow scene, f { GL.ColorPointer(4, ColorPointerType.UnsignedByte, ColorVertex.Size, (IntPtr)colorPtr); } - GL.DrawElements(BeginMode.Triangles, terrainIndices.Length, DrawElementsType.UnsignedInt, terrainIndices); + GL.DrawElements(PrimitiveType.Triangles, terrainIndices.Length, DrawElementsType.UnsignedInt, terrainIndices); } } } @@ -301,7 +301,7 @@ public override void Render(RenderPass pass, int pickingID, SceneWindow scene, f } GL.VertexPointer(3, VertexPointerType.Float, ColorVertex.Size, (IntPtr)(0)); - GL.DrawElements(BeginMode.Triangles, terrainIndices.Length, DrawElementsType.UnsignedInt, IntPtr.Zero); + GL.DrawElements(PrimitiveType.Triangles, terrainIndices.Length, DrawElementsType.UnsignedInt, IntPtr.Zero); } Compat.BindBuffer(BufferTarget.ArrayBuffer, 0); diff --git a/Radegast/GUI/Rendering/Rendering.cs b/Radegast/GUI/Rendering/Rendering.cs index 94774f8bb..c474514cb 100644 --- a/Radegast/GUI/Rendering/Rendering.cs +++ b/Radegast/GUI/Rendering/Rendering.cs @@ -211,6 +211,8 @@ public SceneWindow(RadegastInstance instance) Client.Appearance.AppearanceSet += new EventHandler(Appearance_AppearanceSet); Instance.Netcom.ClientDisconnected += new EventHandler(Netcom_ClientDisconnected); Application.Idle += new EventHandler(Application_Idle); + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } void DisposeInternal() @@ -1723,7 +1725,7 @@ private void RenderAvatarsSkeleton(RenderPass pass) GL.MultMatrix(Math3D.CreateSRTMatrix(Vector3.One, av.RenderRotation, av.RenderPosition - avataroffset * av.RenderRotation)); - GL.Begin(BeginMode.Lines); + GL.Begin(PrimitiveType.Lines); GL.Color3(1.0, 0.0, 0.0); @@ -1889,7 +1891,7 @@ private void RenderAvatars(RenderPass pass) GL.VertexPointer(3, VertexPointerType.Float, 0, mesh.RenderData.Vertices); GL.NormalPointer(NormalPointerType.Float, 0, mesh.MorphRenderData.Normals); - GL.DrawElements(BeginMode.Triangles, mesh.RenderData.Indices.Length, DrawElementsType.UnsignedShort, mesh.RenderData.Indices); + GL.DrawElements(PrimitiveType.Triangles, mesh.RenderData.Indices.Length, DrawElementsType.UnsignedShort, mesh.RenderData.Indices); GL.BindTexture(TextureTarget.Texture2D, 0); @@ -2112,7 +2114,7 @@ void RenderSphere(float cx, float cy, float cz, float r, int p) // If the sphere is too small, just render a OpenGL point instead. if (p < 4 || r <= 0) { - GL.Begin(BeginMode.Points); + GL.Begin(PrimitiveType.Points); GL.Vertex3(cx, cy, cz); GL.End(); return; @@ -2123,7 +2125,7 @@ void RenderSphere(float cx, float cy, float cz, float r, int p) theta1 = i * TWOPI / p - PIDIV2; theta2 = (i + 1) * TWOPI / p - PIDIV2; - GL.Begin(BeginMode.TriangleStrip); + GL.Begin(PrimitiveType.TriangleStrip); { for (int j = 0; j <= p; ++j) { @@ -2290,12 +2292,12 @@ void RenderBoundingBox(SceneObject prim) if (RenderSettings.UseVBO && !occludedVBOFailed) { - GL.DrawElements(BeginMode.Quads, RHelp.CubeIndices.Length, DrawElementsType.UnsignedShort, IntPtr.Zero); + GL.DrawElements(PrimitiveType.Quads, RHelp.CubeIndices.Length, DrawElementsType.UnsignedShort, IntPtr.Zero); } else { GL.VertexPointer(3, VertexPointerType.Float, 0, RHelp.CubeVertices); - GL.DrawElements(BeginMode.Quads, RHelp.CubeIndices.Length, DrawElementsType.UnsignedShort, RHelp.CubeIndices); + GL.DrawElements(PrimitiveType.Quads, RHelp.CubeIndices.Length, DrawElementsType.UnsignedShort, RHelp.CubeIndices); } GL.PopMatrix(); } diff --git a/Radegast/GUI/Rendering/RenderingHelpers.cs b/Radegast/GUI/Rendering/RenderingHelpers.cs index 1bce425d5..4d78f8384 100644 --- a/Radegast/GUI/Rendering/RenderingHelpers.cs +++ b/Radegast/GUI/Rendering/RenderingHelpers.cs @@ -627,7 +627,7 @@ public static int GLLoadImage(Bitmap bitmap, bool hasAlpha, bool useMipmap) public static void Draw2DBox(float x, float y, float width, float height, float depth) { - GL.Begin(BeginMode.Quads); + GL.Begin(PrimitiveType.Quads); { GL.TexCoord2(0, 1); GL.Vertex3(x, y, depth); diff --git a/Radegast/GUI/Rendering/Shader.cs b/Radegast/GUI/Rendering/Shader.cs index dc4ddfe39..9a819184d 100644 --- a/Radegast/GUI/Rendering/Shader.cs +++ b/Radegast/GUI/Rendering/Shader.cs @@ -119,7 +119,7 @@ public bool Load(params string[] shaderNames) } GL.LinkProgram(ID); int res; - GL.GetProgram(ID, ProgramParameter.LinkStatus, out res); + GL.GetProgram(ID, GetProgramParameterName.LinkStatus, out res); if (res != 1) { Logger.DebugLog("Linking shader program failed!"); diff --git a/Radegast/GUI/Rendering/Water.cs b/Radegast/GUI/Rendering/Water.cs index 48c6a7c6b..e8fc3789f 100644 --- a/Radegast/GUI/Rendering/Water.cs +++ b/Radegast/GUI/Rendering/Water.cs @@ -236,7 +236,7 @@ public void RenderWater() GL.Uniform4(waterColor, 0.09f, 0.28f, 0.63f, 0.84f); } - GL.Begin(BeginMode.Quads); + GL.Begin(PrimitiveType.Quads); for (float x = -256f * 2; x <= 256 * 2; x += 256f) for (float y = -256f * 2; y <= 256 * 2; y += 256f) DrawWaterQuad(x, y, z); diff --git a/Radegast/Program.cs b/Radegast/Program.cs index 7cfb4278e..c1cd106f8 100644 --- a/Radegast/Program.cs +++ b/Radegast/Program.cs @@ -101,6 +101,8 @@ public static class MainProgram static void RunRadegast(string[] args) { + AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; + // Increase the number of IOCP threads available. Mono defaults to a tragically low number int workerThreads, iocpThreads; ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads); @@ -150,6 +152,13 @@ static void RunRadegast(string[] args) OpenMetaverse.WorkPool.Shutdown(); } + private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) + { + var instance = RadegastInstance.GlobalInstance; + instance.Client.Network.Logout(); + OpenMetaverse.WorkPool.Shutdown(); + } + /// /// The main entry point for the application. /// diff --git a/Radegast/prebuild.exe b/Radegast/prebuild.exe deleted file mode 100755 index f5ec5db4c..000000000 Binary files a/Radegast/prebuild.exe and /dev/null differ diff --git a/Radegast/updatebuildnr.bat b/Radegast/updatebuildnr.bat deleted file mode 100755 index a05f1d5f9..000000000 --- a/Radegast/updatebuildnr.bat +++ /dev/null @@ -1,9 +0,0 @@ -@echo off -FOR /F "tokens=2 skip=4" %%G IN ('svn info --revision HEAD') DO ^ -IF NOT DEFINED REVISION SET REVISION=%%G -rem set /a REVISION=%REVISION% + 1 -echo // Autogenerated: run updatebuildnr.bat/sh to update > RadegastBuild.cs -echo namespace Radegast >> RadegastBuild.cs -echo { >> RadegastBuild.cs -echo public static class RadegastBuild { public static int CurrentRev = %REVISION%; } >> RadegastBuild.cs -echo } >> RadegastBuild.cs diff --git a/build/README.txt b/build/README.txt new file mode 100644 index 000000000..6f58b2ce3 --- /dev/null +++ b/build/README.txt @@ -0,0 +1 @@ +You can find the most current version of premake5 at https://premake.github.io/download.html \ No newline at end of file diff --git a/build/linux/premake5 b/build/linux/premake5 new file mode 100755 index 000000000..59bca8a8a Binary files /dev/null and b/build/linux/premake5 differ diff --git a/build/linux/version.txt b/build/linux/version.txt new file mode 100644 index 000000000..5bea22315 --- /dev/null +++ b/build/linux/version.txt @@ -0,0 +1 @@ +build-7-linux-travis_ci-2016-07-24 diff --git a/build/macosx/premake5 b/build/macosx/premake5 new file mode 100755 index 000000000..1ce41a0e0 Binary files /dev/null and b/build/macosx/premake5 differ diff --git a/build/macosx/version.txt b/build/macosx/version.txt new file mode 100644 index 000000000..5cb89dade --- /dev/null +++ b/build/macosx/version.txt @@ -0,0 +1 @@ +build-7-osx-travis_ci-2016-07-24 diff --git a/build/windows/premake5.exe b/build/windows/premake5.exe new file mode 100755 index 000000000..28bccbcb8 Binary files /dev/null and b/build/windows/premake5.exe differ diff --git a/ci/install.sh b/ci/install.sh new file mode 100755 index 000000000..51da1a0bb --- /dev/null +++ b/ci/install.sh @@ -0,0 +1,11 @@ +#!/bin/bash +echo '// Placeholder for automated build systems to implement their build number.' > Radegast/RadegastBuild.cs +echo 'namespace Radegast ' >> Radegast/RadegastBuild.cs +echo '{ ' >> Radegast/RadegastBuild.cs +echo ' public static class RadegastBuild ' >> Radegast/RadegastBuild.cs +echo ' {' >> Radegast/RadegastBuild.cs +echo ' public const string VersionString = "'$BUILD_MAJOR'.'$BUILD_MINOR'.'$TRAVIS_BUILD_NUMBER'";' >> Radegast/RadegastBuild.cs +echo ' public const string BuildName = "'$GIT_TAG'";' >> Radegast/RadegastBuild.cs +echo ' }' >> Radegast/RadegastBuild.cs +echo '}' >> Radegast/RadegastBuild.cs +./runprebuild.sh diff --git a/libopenmetaverse b/libopenmetaverse index 2d18fb44b..757d6fa26 160000 --- a/libopenmetaverse +++ b/libopenmetaverse @@ -1 +1 @@ -Subproject commit 2d18fb44b872cd0c2c17915dba77607ccd103874 +Subproject commit 757d6fa2626c077646b8b72d9e5ce104d672ddfc diff --git a/plugins/Radegast.Plugin.IRC/Radegast.Plugin.IRC.csproj b/plugins/Radegast.Plugin.IRC/Radegast.Plugin.IRC.csproj deleted file mode 100644 index b17562117..000000000 --- a/plugins/Radegast.Plugin.IRC/Radegast.Plugin.IRC.csproj +++ /dev/null @@ -1,130 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {6D4DFA78-7DA5-4B5F-BE42-67EF949478FC} - Library - Properties - Radegast.Plugin.IRC - Radegast.Plugin.IRC - v4.0 - 512 - - - - - 3.5 - publish\ - true - Disk - false - Foreground - 7 - Days - false - false - true - 0 - 1.0.0.%2a - false - false - true - - - - true - ..\..\bin\ - TRACE;DEBUG;SMARTHREADPOOL_REF;VISUAL_STUDIO - full - x86 - prompt - - - ..\..\bin\ - TRACE;SMARTHREADPOOL_REF;VISUAL_STUDIO - true - pdbonly - x86 - prompt - - - - False - assemblies\Meebey.SmartIrc4net.dll - - - - 3.5 - - - - - 3.5 - - - 3.5 - - - - - - - - - UserControl - - - RelayConsole.cs - - - - - - - - RelayConsole.cs - - - - - {F048B0F0-2A65-4588-A292-9C812FC8F354} - OpenMetaverse.StructuredData - - - {5F087E42-6E20-4F87-BE86-AEBED154FDEB} - OpenMetaverseTypes - - - {1545F87D-D8F6-4CD9-BB01-772389BFBC63} - OpenMetaverse - - - {E6CB0CED-4066-41D3-93BF-F922FEE235F9} - Radegast - - - - - False - .NET Framework 3.5 SP1 Client Profile - false - - - False - .NET Framework 3.5 SP1 - true - - - - - - \ No newline at end of file diff --git a/plugins/Radegast.Plugin.SimpleBuilder/SimpleBuilder.cs b/plugins/Radegast.Plugin.SimpleBuilder/SimpleBuilder.cs index e7ffa6d5a..575ea994b 100644 --- a/plugins/Radegast.Plugin.SimpleBuilder/SimpleBuilder.cs +++ b/plugins/Radegast.Plugin.SimpleBuilder/SimpleBuilder.cs @@ -115,6 +115,8 @@ public SimpleBuilder(RadegastInstance instance, bool unused) RegisterClientEvents(client); selectedPrim = null; + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } /// @@ -425,7 +427,6 @@ private void lstPrims_SelectedIndexChanged(object sender, EventArgs e) private void getScaleFromSelection(){ if (selectedPrim == null) return; - if (selectedPrim.Scale == null) return; scaleX.Value = (Decimal)selectedPrim.Scale.X; scaleY.Value = (Decimal)selectedPrim.Scale.Y; @@ -435,7 +436,6 @@ private void getScaleFromSelection(){ private void getRotFromSelection() { if (selectedPrim == null) return; - if (selectedPrim.Rotation == null) return; rotX.Value = (Decimal)selectedPrim.Rotation.X; rotY.Value = (Decimal)selectedPrim.Rotation.Y; @@ -445,7 +445,6 @@ private void getRotFromSelection() private void getPosFromSelection() { if (selectedPrim == null) return; - if (selectedPrim.Position == null) return; posX.Value = (Decimal)selectedPrim.Position.X; posY.Value = (Decimal)selectedPrim.Position.Y; @@ -454,7 +453,7 @@ private void getPosFromSelection() private void setRotToSelection() { - if (selectedPrim != null && selectedPrim.Rotation != null) + if (selectedPrim != null) { selectedPrim.Rotation.X = (float)rotX.Value; selectedPrim.Rotation.Y = (float)rotY.Value; @@ -466,7 +465,7 @@ private void setRotToSelection() private void setScaleToSelection() { - if (selectedPrim != null && selectedPrim.Scale != null) + if (selectedPrim != null) { selectedPrim.Scale.X = (float)scaleX.Value; selectedPrim.Scale.Y = (float)scaleY.Value; @@ -478,7 +477,7 @@ private void setScaleToSelection() private void setPositionToSelection() { - if (selectedPrim != null && selectedPrim.Position != null) + if (selectedPrim != null) { selectedPrim.Position.X = (float)posX.Value; selectedPrim.Position.Y = (float)posY.Value; diff --git a/plugins/Radegast.Plugin.Speech/RadSpeech/Conversation/Surroundings.cs b/plugins/Radegast.Plugin.Speech/RadSpeech/Conversation/Surroundings.cs index 2126686f9..576bf9b05 100644 --- a/plugins/Radegast.Plugin.Speech/RadSpeech/Conversation/Surroundings.cs +++ b/plugins/Radegast.Plugin.Speech/RadSpeech/Conversation/Surroundings.cs @@ -43,7 +43,6 @@ class Surroundings : Mode private Radegast.ObjectsConsole obTab; public bool Announce { get; set; } private Primitive currentPrim = new Primitive(); - private ListViewItem currentItem ; #region statechange internal Surroundings(PluginControl pc) diff --git a/plugins/Radegast.Plugin.Speech/RadSpeech/GUI/VoiceAssignment.cs b/plugins/Radegast.Plugin.Speech/RadSpeech/GUI/VoiceAssignment.cs index bf48e19c1..4187f6596 100644 --- a/plugins/Radegast.Plugin.Speech/RadSpeech/GUI/VoiceAssignment.cs +++ b/plugins/Radegast.Plugin.Speech/RadSpeech/GUI/VoiceAssignment.cs @@ -65,6 +65,8 @@ public VoiceAssignment( PluginControl pc, string name, UUID id ) } doDemo = true; + + Radegast.GUI.GuiHelpers.ApplyGuiFixes(this); } /// diff --git a/plugins/Radegast.Plugin.Speech/RadSpeech/PluginControl.cs b/plugins/Radegast.Plugin.Speech/RadSpeech/PluginControl.cs index a0c7457a2..98c02a5bd 100644 --- a/plugins/Radegast.Plugin.Speech/RadSpeech/PluginControl.cs +++ b/plugins/Radegast.Plugin.Speech/RadSpeech/PluginControl.cs @@ -51,7 +51,6 @@ public class PluginControl : IRadegastPlugin internal Conversation.Control converse; internal Environment.Control env; internal Sound.Control sound; - internal ToolStripDropDownButton ToolsMenu; private ToolStripMenuItem SpeechButton; internal IRadSpeech osLayer; public OSDMap config; diff --git a/plugins/Radegast.Plugin.Speech/RadSpeech/Sound/FmodSound.cs b/plugins/Radegast.Plugin.Speech/RadSpeech/Sound/FmodSound.cs index 51b9de1ba..8060c5503 100644 --- a/plugins/Radegast.Plugin.Speech/RadSpeech/Sound/FmodSound.cs +++ b/plugins/Radegast.Plugin.Speech/RadSpeech/Sound/FmodSound.cs @@ -47,7 +47,6 @@ class FmodSound : Control { Radegast.Media.Speech speechPlayer; private AutoResetEvent playing; - private bool busy = true; internal FmodSound(PluginControl pc) : base(pc) @@ -61,8 +60,6 @@ internal override void Stop() { if (speechPlayer == null) return; speechPlayer.Stop(); - - busy = false; } /// diff --git a/plugins/Radegast.Plugin.Speech/RadSpeechMac/Assemblies/Monobjc.Cocoa.dll b/plugins/Radegast.Plugin.Speech/RadSpeechMac/assemblies/Monobjc.Cocoa.dll similarity index 100% rename from plugins/Radegast.Plugin.Speech/RadSpeechMac/Assemblies/Monobjc.Cocoa.dll rename to plugins/Radegast.Plugin.Speech/RadSpeechMac/assemblies/Monobjc.Cocoa.dll diff --git a/plugins/Radegast.Plugin.Speech/RadSpeechMac/Assemblies/Monobjc.dll b/plugins/Radegast.Plugin.Speech/RadSpeechMac/assemblies/Monobjc.dll similarity index 100% rename from plugins/Radegast.Plugin.Speech/RadSpeechMac/Assemblies/Monobjc.dll rename to plugins/Radegast.Plugin.Speech/RadSpeechMac/assemblies/Monobjc.dll diff --git a/prebuild.xml b/prebuild.xml deleted file mode 100644 index e616ad883..000000000 --- a/prebuild.xml +++ /dev/null @@ -1,495 +0,0 @@ - - - - - - TRACE;DEBUG;SMARTHREADPOOL_REF - false - false - true - 3 - false - 1591,1574,0419,0618,0414,0169 - bin - true - true - false - x86 - - - - - TRACE;SMARTHREADPOOL_REF - true - false - true - 3 - false - 1591,1574,0419,0618,0414,0169 - bin - true - false - false - x86 - - - - - - - - - ../bin/ - x86 - - - - - ../bin/ - x86 - - - - ../bin/ - - - - - - - - - - - - ../bin/ - x86 - - - - - ../bin/ - x86 - - - - ../bin/ - - - - - - - - - - - - ../bin/ - x86 - - - - - ../bin/ - x86 - - - - ../bin/ - - - - - - - - - - - - - - - - - - - - ../bin/ - x86 - - - - - ../bin/ - x86 - - - - ../bin/ - - - - - - - - - - - - - - - - - - ../bin/ - x86 - - - - - 1591,1574,0419,0618,0414,0169 - ../bin/ - x86 - - - - ../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ../../bin/ - x86 - - - - - 1591,1574,0419,0618,0414,0169 - ../../bin/ - x86 - - - - ../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - ../../bin/ - x86 - - - - - 1591,1574,0419,0618,0414,0169 - ../../bin/ - x86 - - - - ../../bin/ - - - - - - - - - - - - - - - - - - - - - - - ../../bin/ - x86 - - - - - 1591,1574,0419,0618,0414,0169 - ../../bin/ - x86 - - - - ../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - ../../../bin/ - x86 - - - - - ../../../bin/ - x86 - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - ../../../bin/ - x86 - - - - - ../../../bin/ - x86 - - - - ../../../bin/ - - \ - - - - - - - - - - - - - - - - - - - ../../../bin/ - x86 - - - - - ../../../bin/ - x86 - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - ../../../bin/ - x86 - - - - - ../../../bin/ - x86 - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/premake5.lua b/premake5.lua new file mode 100644 index 000000000..bcc18492a --- /dev/null +++ b/premake5.lua @@ -0,0 +1,451 @@ +solution "Radegast" + configurations { "Debug", "Release" } + platforms { "x86" } + dotnetframework "4.5" + language "C#" + warnings "Extra" + disablewarnings {"1591", "1574", "0419", "0618", "0414", "0169"} + buildoptions { "/checked-", "/nostdlib-"} + targetdir "bin" + implibdir "bin" + + configuration "Debug" + defines { "TRACE", "DEBUG", "SMARTHREADPOOL_REF" } + flags { "Symbols" } + optimize "Off" + clr "Unsafe" + + configuration "Release" + defines { "TRACE", "SMARTHREADPOOL_REF" } + optimize "Full" + clr "Unsafe" + + configuration "**.config" + buildaction "Copy" + configuration "**.so" + buildaction "Copy" + configuration "**.xml" + buildaction "Copy" + configuration "**.txt" + buildaction "Copy" + configuration "**.png" + buildaction "Copy" + configuration "**.wav" + buildaction "Copy" + + project "OpenMetaverseTypes" + kind("SharedLib") + location(path.join("libopenmetaverse", "OpenMetaverseTypes")) + namespace("OpenMetaverse") + files { + path.join("%{prj.location}", "**.cs") + } + excludes { + path.join("%{prj.location}", "obj", "**") + } + links { + "System", + "System.Core", + "System.Xml", + } + + project "OpenMetaverse.StructuredData" + kind("SharedLib") + location(path.join("libopenmetaverse", "OpenMetaverse.StructuredData")) + namespace("OpenMetaverse.StructuredData") + files { + path.join("%{prj.location}", "**.cs") + } + excludes { + path.join("%{prj.location}", "obj", "**") + } + dependson { + "OpenMetaverseTypes", + } + links { + "System", + "System.Xml", + "OpenMetaverseTypes", + } + + project "OpenMetaverse" + kind("SharedLib") + location(path.join("libopenmetaverse", "OpenMetaverse")) + namespace("OpenMetaverse") + files { + path.join("%{prj.location}", "**.cs") + } + excludes { + path.join("%{prj.location}", "obj", "**") + } + dependson { + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + } + links { + "System", + "System.Core", + "System.Xml", + "System.Data", + "System.Drawing", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + path.join("libopenmetaverse", "bin", "log4net"), + path.join("libopenmetaverse", "bin", "SmartThreadPool"), + path.join("libopenmetaverse", "bin", "XMLRPC"), + path.join("libopenmetaverse", "bin", "zlib.net"), + } + + project "OpenMetaverse.Rendering.Meshmerizer" + kind("SharedLib") + location(path.join("libopenmetaverse", "OpenMetaverse.Rendering.Meshmerizer")) + namespace("OpenMetaverse.Rendering") + files { + path.join("%{prj.location}", "**.cs") + } + excludes { + path.join("%{prj.location}", "obj", "**") + } + dependson { + "OpenMetaverse", + "OpenMetaverseTypes", + } + links { + "System", + "System.Xml", + "System.Data", + "System.Drawing", + "OpenMetaverse", + "OpenMetaverseTypes", + path.join("libopenmetaverse", "bin", "PrimMesher"), + } + + project "Radegast" + kind("WindowedApp") + location("Radegast") + icon(path.join("%{prj.location}", "radegast.ico")) + files { + path.join("%{prj.location}", "Properties", "**.cs"), + path.join("%{prj.location}", "**.cs"), + path.join("%{prj.location}", "**.resx"), + path.join("%{prj.location}", "openjpeg-dotnet*"), + path.join("%{prj.location}", "*.config"), + path.join("%{prj.location}", "*.so"), + path.join("%{prj.location}", "*.dylib"), + path.join("%{prj.location}", "fmodex.*"), + path.join("%{prj.location}", "*.xml"), + path.join("%{prj.location}", "*.txt"), + path.join("%{prj.location}", "*.png"), + path.join("%{prj.location}", "radegast.nsi"), + path.join("%{prj.location}", "openmetaverse_data", "**"), + path.join("%{prj.location}", "character", "**"), + path.join("%{prj.location}", "shader_data", "**") + } + excludes { + path.join("%{prj.location}", "AssemblyInfo.cs"), + path.join("%{prj.location}", "openmetaverse_data", ".svn", "**"), + path.join("%{prj.location}", "obj", "**") + } + dependson { + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "OpenMetaverse.Rendering.Meshmerizer" + } + links { + "System", + "System.Core", + "System.Data", + "System.Drawing", + "System.Web", + "System.Web.Extensions", + "System.Windows.Forms", + "System.Xml", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "OpenMetaverse.Rendering.Meshmerizer", + path.join("%{prj.location}", "assemblies", "fmodex-dotnet"), + path.join("%{prj.location}", "assemblies", "OpenTK"), + path.join("%{prj.location}", "assemblies", "OpenTK.GLControl"), + path.join("%{prj.location}", "assemblies", "Tools"), + path.join("%{prj.location}", "assemblies", "log4net"), + path.join("%{prj.location}", "assemblies", "CommandLine"), + path.join("%{prj.location}", "assemblies", "XMLRPC"), + } + configuration "**/**.dylib" + buildaction "Copy" + configuration "**/fmodex.*" + buildaction "Copy" + configuration "**/openjpeg-dotnet*" + buildaction "Copy" + configuration "**/radegast.nsi" + buildaction "Copy" + configuration "**/openmetaverse_data/**" + buildaction "Copy" + configuration "**/character/**" + buildaction "Copy" + configuration "**/shader_data/**" + buildaction "Copy" + + project "Radegast.Plugin.Alice" + kind("SharedLib") + location(path.join("plugins", "Radegast.Plugin.Alice")) + files { + path.join("%{prj.location}", "**.cs"), + path.join("%{prj.location}", "Properties", "**.cs"), + path.join("%{prj.location}", "aiml", "**"), + path.join("%{prj.location}", "aiml_config", "**") + } + excludes { + path.join("%{prj.location}", "AssemblyInfo.cs"), + path.join("%{prj.location}", "obj", "**") + } + dependson { + "Radegast", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "Radegast.Plugin.Speech" + } + links { + "System", + "System.Core", + "System.Xml", + "System.Data", + "System.Drawing", + "System.Xml.Linq", + "System.Windows.Forms", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "Radegast.exe", + path.join("%{prj.location}", "assemblies", "AIMLbot"), + } + configuration "**/aiml/**" + buildaction "Copy" + configuration "**/aiml_config/**" + buildaction "Copy" + + project "Radegast.Plugin.SimpleBuilder" + kind("SharedLib") + location(path.join("plugins", "Radegast.Plugin.SimpleBuilder")) + files { + path.join("%{prj.location}", "**.cs"), + path.join("%{prj.location}", "Properties", "**.cs") + } + excludes { + path.join("%{prj.location}", "AssemblyInfo.cs"), + path.join("%{prj.location}", "obj", "**") + } + dependson{ + "Radegast", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData" + } + links { + "System", + "System.Core", + "System.Xml", + "System.Data", + "System.Drawing", + "System.Windows.Forms", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "Radegast", + } + + project "Radegast.Plugin.IRC" + kind("SharedLib") + location(path.join("plugins", "Radegast.Plugin.IRC")) + files { + path.join("%{prj.location}", "**.cs"), + path.join("%{prj.location}", "Properties", "**.cs") + } + excludes { + path.join("%{prj.location}", "AssemblyInfo.cs"), + path.join("%{prj.location}", "obj", "**") + } + dependson{ + "Radegast", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData" + } + links { + "System", + "System.Core", + "System.Xml", + "System.Data", + "System.Drawing", + "System.Windows.Forms", + "System.Xml.Linq", + "System.Data.DataSetExtensions", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "Radegast", + path.join("%{prj.location}", "assemblies", "Meebey.SmartIrc4net") + } + +--[[ + project "Radegast.Plugin.EVOVend" + kind("SharedLib") + location(path.join("plugins", "Radegast.Plugin.EVOVend")) + files { + path.join("%{prj.location}", "**.cs"), + path.join("%{prj.location}", "Properties", "**.cs") + } + excludes { + path.join("%{prj.location}", "AssemblyInfo.cs"), + path.join("%{prj.location}", "obj", "**") + } + dependson{ + "Radegast", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData" + } + links { + "System", + "System.Core", + "System.Xml", + "System.Data", + "System.Drawing", + "System.Windows.Forms", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "Radegast", + } +--]] + + project "Radegast.Plugin.Speech" + kind("SharedLib") + location(path.join("plugins", "Radegast.Plugin.Speech", "RadSpeech")) + files { + path.join("%{prj.location}", "**.cs"), + path.join("%{prj.location}", "**.wav"), + path.join("%{prj.location}", "**.resx"), + } + excludes { + path.join("%{prj.location}", "obj", "**") + } + dependson{ + "Radegast", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData" + } + links { + "System", + "System.Core", + "System.Drawing", + "System.Windows.Forms", + "System.Xml.Linq", + "System.Data.DataSetExtensions", + "System.Data", + "System.Xml", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "Radegast.exe", + "fmodex-dotnet.dll", + } + + project "RadSpeechLin" + kind("SharedLib") + location(path.join("plugins", "Radegast.Plugin.Speech", "RadSpeechLin")) + files { + path.join("%{prj.location}", "**.cs"), + } + excludes { + path.join("%{prj.location}", "obj", "**") + } + dependson { + "Radegast", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "Radegast.Plugin.Speech" + } + links { + "System", + "System.Core", + "System.Xml.Linq", + "System.Data.DataSetExtensions", + "System.Data", + "System.Xml", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "Radegast.exe", + "Radegast.Plugin.Speech", + } + + if os.is("windows") then + project "RadSpeechWin" + kind("SharedLib") + location(path.join("plugins", "Radegast.Plugin.Speech", "RadSpeechWin")) + files { + path.join("%{prj.location}", "**.cs"), + } + excludes { + path.join("%{prj.location}", "obj", "**") + } + dependson { + "Radegast", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "Radegast.Plugin.Speech" + } + links { + "System", + "System.Core", + "System.Speech", + "System.Xml.Linq", + "System.Data.DataSetExtensions", + "System.Data", + "System.Xml", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "Radegast.exe", + "Radegast.Plugin.Speech", + } + end + + project "RadSpeechMac" + kind("SharedLib") + location(path.join("plugins", "Radegast.Plugin.Speech", "RadSpeechMac")) + files { + path.join("%{prj.location}", "**.cs"), + } + excludes { + path.join("%{prj.location}", "obj", "**") + } + dependson { + "Radegast", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "Radegast.Plugin.Speech" + } + links { + "System", + "System.Core", + "System.Xml.Linq", + "System.Data.DataSetExtensions", + "System.Data", + "System.Xml", + "OpenMetaverse", + "OpenMetaverseTypes", + "OpenMetaverse.StructuredData", + "Radegast.exe", + "Radegast.Plugin.Speech", + path.join("%{prj.location}", "assemblies", "Monobjc.Cocoa"), + path.join("%{prj.location}", "assemblies", "Monobjc"), + } diff --git a/runprebuild-nant.sh b/runprebuild-nant.sh deleted file mode 100755 index bb5447de1..000000000 --- a/runprebuild-nant.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -cd `dirname "$0"` -mkdir bin 2>/dev/null -cp Radegast/assemblies/* bin -cp plugins/Radegast.Plugin.Alice/assemblies/*.dll bin - -mono Radegast/prebuild.exe /target nant - -cp -f NullBuild.txt plugins/Radegast.Plugin.Speech/RadSpeechWin/RadSpeechWin.dll.build -cp -f NullBuild.txt plugins/Radegast.Plugin.Speech/RadSpeechMac/RadSpeechMac.dll.build -cp -f NullBuild.txt plugins/Radegast.Plugin.Demo/Radegast.Plugin.Demo.dll.build - -if [ x$1 == xnant ]; then - nant -buildfile:Radegast.build - RES=$? - echo Build Exit Code: $RES - - if [ x$RES != x0 ]; then - exit $RES - fi - - if [ x$2 == xdist ]; then - tar czvf radegast-latest.tgz bin - fi - - exit $RES -fi diff --git a/runprebuild.sh b/runprebuild.sh index e7c0df279..99af8f1ea 100755 --- a/runprebuild.sh +++ b/runprebuild.sh @@ -3,7 +3,11 @@ cd `dirname "$0"` mkdir bin 2>/dev/null -mono Radegast/prebuild.exe /target vs2010 /exclude plug_speech +if [ "$(uname -s)" == "Darwin" ]; then + ./build/macosx/premake5 --os=macosx vs2010 +else + ./build/linux/premake5 --os=linux vs2010 +fi if [ x$1 == xbuild ]; then xbuild /p:Configuration=Release Radegast.sln @@ -17,7 +21,7 @@ if [ x$1 == xbuild ]; then if [ x$2 == xdist ]; then tar czvf radegast-latest.tgz bin fi - + exit $RES else echo "Now run:" diff --git a/runprebuild2010.bat b/runprebuild2010.bat old mode 100755 new mode 100644 index 4efffe1fe..99a248a09 --- a/runprebuild2010.bat +++ b/runprebuild2010.bat @@ -22,7 +22,7 @@ echo ########################################## if not exist bin mkdir bin :: run prebuild to generate solution/project files from prebuild.xml configuration file -Radegast\prebuild.exe /target vs2010 +Build\Windows\Premake5.exe vs2010 :: build compile.bat file based on command line parameters echo @echo off > compile.bat diff --git a/runprebuild2012.bat b/runprebuild2012.bat old mode 100755 new mode 100644 index c532f6139..5e24576ab --- a/runprebuild2012.bat +++ b/runprebuild2012.bat @@ -15,14 +15,14 @@ :: echo ########################################## -echo creating prebuild files for: vs2010 +echo creating prebuild files for: vs2012 echo Parameters: %1 %2 echo ########################################## if not exist bin mkdir bin :: run prebuild to generate solution/project files from prebuild.xml configuration file -Radegast\prebuild.exe /target vs2012 +Build\Windows\Premake5.exe vs2012 :: build compile.bat file based on command line parameters echo @echo off > compile.bat diff --git a/runprebuild2013.bat b/runprebuild2013.bat new file mode 100644 index 000000000..6b71ea026 --- /dev/null +++ b/runprebuild2013.bat @@ -0,0 +1,81 @@ +@echo off +:: +:: Prebuild generator for the Radegast +:: +:: Command Line Options: +:: (none) - create solution/project files and create compile.bat file to build solution +:: msbuild - Create project files, compile solution +:: msbuild runtests - create project files, compile solution, run unit tests +:: msbuild docs - create project files, compile solution, build API documentation +:: msbuild docs dist - Create project files, compile solution, run unit tests, build api documentation, create binary zip +:: - and exe installer +:: +:: nant - Create project files, run nant to compile solution +:: nant runtests - Create project files, run nant to compile solution, run unit tests +:: + +echo ########################################## +echo creating prebuild files for: vs2013 +echo Parameters: %1 %2 +echo ########################################## + +if not exist bin mkdir bin + +:: run prebuild to generate solution/project files from prebuild.xml configuration file +Build\Windows\Premake5.exe vs2013 + +:: build compile.bat file based on command line parameters +echo @echo off > compile.bat +if(.%1)==(.) echo %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\msbuild Radegast.sln >> compile.bat + +if(.%1)==(.msbuild) echo echo ==== COMPILE BEGIN ==== >> compile.bat +if(.%1)==(.msbuild) echo %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Release Radegast.sln >> compile.bat +if(.%1)==(.msbuild) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +if(.%1)==(.nant) echo nant >> compile.bat +if(.%1)==(.nant) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +if(.%3)==(.docs) echo echo ==== GENERATE DOCUMENTATION BEGIN ==== >> compile.bat +if(.%2)==(.docs) echo %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Release docs\Radegast.shfbproj >> compile.bat +if(.%2)==(.docs) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat +if(.%2)==(.docs) echo 7z.exe a -tzip docs\documentation.zip docs\trunk >> compile.bat +if(.%2)==(.docs) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +if(.%2)==(.runtests) echo echo ==== UNIT TESTS BEGIN ==== >> compile.bat +if(.%2)==(.runtests) echo nunit-console bin\Radegast.Tests.dll /exclude:Network /nodots /labels /xml:testresults.xml >> compile.bat + +if(.%2)==(.runtests) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +if not (.%2)==(.dist) goto NODIST +echo echo ==== GENERATE DISTRIBUTION BEGIN ==== >> compile.bat +copy Radegast\radegast.nsi bin +echo del /q Radegast-*-installer.exe >> compile.bat +echo del /q radegast-latest.zip >> compile.bat + +if not exist "%PROGRAMFILES%\NSIS\Unicode\makensis.exe" goto NOUNINSIS +echo "%PROGRAMFILES%\NSIS\Unicode\makensis.exe" bin\radegast.nsi >> compile.bat +goto NONSIS +:NOUNINSIS + +if not exist "%PROGRAMFILES%\NSIS\makensis.exe" goto NONSIS +echo "%PROGRAMFILES%\NSIS\makensis.exe" bin\radegast.nsi >> compile.bat +:NONSIS + +echo cd bin >> compile.bat +echo 7z.exe a -r -tzip ..\radegast-latest.zip *.* >> compile.bat +echo cd .. >> compile.bat + +:NODIST + +echo :SUCCESS >> compile.bat +echo echo Build Successful! >> compile.bat +echo exit /B 0 >> compile.bat +echo :FAIL >> compile.bat +echo echo Build Failed, check log for reason >> compile.bat +echo exit /B 1 >> compile.bat + +:: perform the appropriate action +if(.%1)==(.msbuild) compile.bat +if(.%1)==(.nant) compile.bat +if(.%1)==(.dist) compile.bat + diff --git a/runprebuild2015.bat b/runprebuild2015.bat new file mode 100644 index 000000000..ba39e560a --- /dev/null +++ b/runprebuild2015.bat @@ -0,0 +1,81 @@ +@echo off +:: +:: Prebuild generator for the Radegast +:: +:: Command Line Options: +:: (none) - create solution/project files and create compile.bat file to build solution +:: msbuild - Create project files, compile solution +:: msbuild runtests - create project files, compile solution, run unit tests +:: msbuild docs - create project files, compile solution, build API documentation +:: msbuild docs dist - Create project files, compile solution, run unit tests, build api documentation, create binary zip +:: - and exe installer +:: +:: nant - Create project files, run nant to compile solution +:: nant runtests - Create project files, run nant to compile solution, run unit tests +:: + +echo ########################################## +echo creating prebuild files for: vs2015 +echo Parameters: %1 %2 +echo ########################################## + +if not exist bin mkdir bin + +:: run prebuild to generate solution/project files from prebuild.xml configuration file +Build\Windows\Premake5.exe vs2015 + +:: build compile.bat file based on command line parameters +echo @echo off > compile.bat +if(.%1)==(.) echo %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\msbuild Radegast.sln >> compile.bat + +if(.%1)==(.msbuild) echo echo ==== COMPILE BEGIN ==== >> compile.bat +if(.%1)==(.msbuild) echo %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Release Radegast.sln >> compile.bat +if(.%1)==(.msbuild) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +if(.%1)==(.nant) echo nant >> compile.bat +if(.%1)==(.nant) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +if(.%3)==(.docs) echo echo ==== GENERATE DOCUMENTATION BEGIN ==== >> compile.bat +if(.%2)==(.docs) echo %SystemRoot%\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe /p:Configuration=Release docs\Radegast.shfbproj >> compile.bat +if(.%2)==(.docs) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat +if(.%2)==(.docs) echo 7z.exe a -tzip docs\documentation.zip docs\trunk >> compile.bat +if(.%2)==(.docs) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +if(.%2)==(.runtests) echo echo ==== UNIT TESTS BEGIN ==== >> compile.bat +if(.%2)==(.runtests) echo nunit-console bin\Radegast.Tests.dll /exclude:Network /nodots /labels /xml:testresults.xml >> compile.bat + +if(.%2)==(.runtests) echo IF ERRORLEVEL 1 GOTO FAIL >> compile.bat + +if not (.%2)==(.dist) goto NODIST +echo echo ==== GENERATE DISTRIBUTION BEGIN ==== >> compile.bat +copy Radegast\radegast.nsi bin +echo del /q Radegast-*-installer.exe >> compile.bat +echo del /q radegast-latest.zip >> compile.bat + +if not exist "%PROGRAMFILES%\NSIS\Unicode\makensis.exe" goto NOUNINSIS +echo "%PROGRAMFILES%\NSIS\Unicode\makensis.exe" bin\radegast.nsi >> compile.bat +goto NONSIS +:NOUNINSIS + +if not exist "%PROGRAMFILES%\NSIS\makensis.exe" goto NONSIS +echo "%PROGRAMFILES%\NSIS\makensis.exe" bin\radegast.nsi >> compile.bat +:NONSIS + +echo cd bin >> compile.bat +echo 7z.exe a -r -tzip ..\radegast-latest.zip *.* >> compile.bat +echo cd .. >> compile.bat + +:NODIST + +echo :SUCCESS >> compile.bat +echo echo Build Successful! >> compile.bat +echo exit /B 0 >> compile.bat +echo :FAIL >> compile.bat +echo echo Build Failed, check log for reason >> compile.bat +echo exit /B 1 >> compile.bat + +:: perform the appropriate action +if(.%1)==(.msbuild) compile.bat +if(.%1)==(.nant) compile.bat +if(.%1)==(.dist) compile.bat +