From: Latif Khalifa Date: Tue, 4 Mar 2014 16:33:02 +0000 (+0100) Subject: Added option to disable speech for objects, inventory and friends X-Git-Tag: 2.16~9 X-Git-Url: http://git.osdn.net/view?p=radegast%2Fradegast.git;a=commitdiff_plain;h=896b94d8043e2fc1f4f8b921d9fe07e2527b7935 Added option to disable speech for objects, inventory and friends --- diff --git a/Radegast/RadegastBuild.cs b/Radegast/RadegastBuild.cs index b01bb33..22f2669 100644 --- a/Radegast/RadegastBuild.cs +++ b/Radegast/RadegastBuild.cs @@ -1,5 +1,5 @@ // Autogenerated: run updatebuildnr.bat/sh to update namespace Radegast { - public static class RadegastBuild { public static int CurrentRev = 1404; } + public static class RadegastBuild { public static int CurrentRev = 1408; } } diff --git a/plugins/Radegast.Plugin.Speech/RadSpeech/Conversation/Control.cs b/plugins/Radegast.Plugin.Speech/RadSpeech/Conversation/Control.cs index e136c5a..ad58a8c 100644 --- a/plugins/Radegast.Plugin.Speech/RadSpeech/Conversation/Control.cs +++ b/plugins/Radegast.Plugin.Speech/RadSpeech/Conversation/Control.cs @@ -48,7 +48,7 @@ namespace RadegastSpeech.Conversation { // Initialize the index to conversations and the list of pending interruptions. interruptions = new LinkedList(); - conversations = new Dictionary(); + conversations = new Dictionary(); } internal override void Start() @@ -70,8 +70,8 @@ namespace RadegastSpeech.Conversation // Automatically handle notifications (blue dialogs) Notification.OnNotificationDisplayed += new Notification.NotificationCallback(OnNotificationDisplayed); -// Notification.OnNotificationClosed += -// new Notification.NotificationCallback(OnNotificationClosed); + // Notification.OnNotificationClosed += + // new Notification.NotificationCallback(OnNotificationClosed); // Announce connect and disconnect. control.instance.Netcom.ClientConnected += @@ -162,7 +162,7 @@ namespace RadegastSpeech.Conversation Talker.SayMore("Connecting to region"); return; - case LoginStatus.Success: + case LoginStatus.Success: LoginName = control.instance.Netcom.LoginOptions.FullName; //Talker.SayMore("Logged in as " + LoginName); //if (friends != null) @@ -193,8 +193,10 @@ namespace RadegastSpeech.Conversation { System.Windows.Forms.Control sTabControl = Tab.Control; - if (sTabControl is InventoryConsole) + if (sTabControl is InventoryConsole && control.config["enabled_for_inventory"]) + { SelectConversation(inventory); + } else if (sTabControl is ChatConsole) { if (chat == null) @@ -205,10 +207,14 @@ namespace RadegastSpeech.Conversation } SelectConversation(chat); } - else if (sTabControl is FriendsConsole) + else if (sTabControl is FriendsConsole && control.config["enabled_for_friends"]) + { SelectConversation(friends); + } else if (sTabControl is VoiceConsole) + { SelectConversation(voice); + } else if (sTabControl is GroupIMTabWindow) { GroupIMTabWindow tab = (GroupIMTabWindow)sTabControl; @@ -225,7 +231,7 @@ namespace RadegastSpeech.Conversation IMTabWindow tab = (IMTabWindow)sTabControl; SelectConversation(tab.TargetName); } - else if (sTabControl is ObjectsConsole) + else if (sTabControl is ObjectsConsole && control.config["enabled_for_objects"]) { SelectConversation(surroundings); } @@ -249,17 +255,23 @@ namespace RadegastSpeech.Conversation Mode newConv = null; // Create a conversation on first appearance of its tab. - if (sTabControl is InventoryConsole) + if (sTabControl is InventoryConsole && control.config["enabled_for_inventory"]) + { newConv = inventory = new Closet(control); + } else if (sTabControl is ChatConsole) { if (chat != null) return; newConv = chat = new Chat(control); } - else if (sTabControl is FriendsConsole) + else if (sTabControl is FriendsConsole && control.config["enabled_for_friends"]) + { newConv = friends = new Friends(control); + } else if (sTabControl is VoiceConsole) + { newConv = voice = new Voice(control); + } else if (sTabControl is GroupIMTabWindow) { GroupIMTabWindow tab = (GroupIMTabWindow)sTabControl; @@ -278,7 +290,7 @@ namespace RadegastSpeech.Conversation AddConversation(new SingleIMSession(control, tab.TargetName, tab.TargetId, tab.SessionId)); return; } - else if (sTabControl is ObjectsConsole) + else if (sTabControl is ObjectsConsole && control.config["enabled_for_objects"]) { surroundings = new Surroundings(control); AddConversation(surroundings); @@ -405,7 +417,7 @@ namespace RadegastSpeech.Conversation /// /// Finish an interruption and resume normal conversation /// - internal void FinishInterruption( Mode m ) + internal void FinishInterruption(Mode m) { lock (interruptions) { @@ -427,7 +439,7 @@ namespace RadegastSpeech.Conversation } } } - + private void Network_ClientConnected(object sender, EventArgs e) { Talker.Say("You are connected.", Talk.BeepType.Good); @@ -528,7 +540,7 @@ namespace RadegastSpeech.Conversation } return true; } - + /// /// Dispatch recognized text to appropriate conversation. /// @@ -547,7 +559,7 @@ namespace RadegastSpeech.Conversation { if (c == null) { - Talker.Say("Trying to start non-existant conversation", Talk.BeepType.Bad ); + Logger.Log("Trying to start non-existant conversation", Helpers.LogLevel.Warning); return; } // Avoid multiple starts. @@ -645,11 +657,11 @@ namespace RadegastSpeech.Conversation internal void ChangeFocus(Mode toThis) { currentMode = toThis; - if (currentMode != null) + if (currentMode != null) currentMode.Start(); } - + /// /// Event handler for new blue dialog boxes. /// @@ -657,7 +669,7 @@ namespace RadegastSpeech.Conversation /// void OnNotificationDisplayed(object sender, NotificationEventArgs e) { - AddInterruption(new Conversation.BlueMenu(control,e)); + AddInterruption(new Conversation.BlueMenu(control, e)); } /// diff --git a/plugins/Radegast.Plugin.Speech/RadSpeech/PluginControl.cs b/plugins/Radegast.Plugin.Speech/RadSpeech/PluginControl.cs index 3e9e264..a0c7457 100644 --- a/plugins/Radegast.Plugin.Speech/RadSpeech/PluginControl.cs +++ b/plugins/Radegast.Plugin.Speech/RadSpeech/PluginControl.cs @@ -79,6 +79,21 @@ namespace RadegastSpeech instance.GlobalSettings["plugin.speech"] = config; } + if (!config.ContainsKey("enabled_for_inventory")) + { + config["enabled_for_inventory"] = true; + } + + if (!config.ContainsKey("enabled_for_objects")) + { + config["enabled_for_objects"] = true; + } + + if (!config.ContainsKey("enabled_for_friends")) + { + config["enabled_for_friends"] = true; + } + OSDMap props = (OSDMap)config["properties"]; if (props["voice_speed"] == "") { @@ -112,7 +127,7 @@ namespace RadegastSpeech ToolStripMenuItem slowButton = new ToolStripMenuItem("Slow"); slowButton.Name = "slow"; if (props["voice_speed"] == "slow") slowButton.Checked = true; - + ToolStripMenuItem mediumButton = new ToolStripMenuItem("Medium"); if (props["voice_speed"] == "medium") mediumButton.Checked = true; mediumButton.Name = "medium"; @@ -161,6 +176,53 @@ namespace RadegastSpeech SpeechButton.DropDownItems.Add(new ToolStripSeparator()); + // Enable / disable for inventory tab + { + ToolStripMenuItem button = new ToolStripMenuItem("Inventory", null, (sender, e) => + { + var me = (ToolStripMenuItem)sender; + me.Checked = !me.Checked; + config["enabled_for_inventory"] = me.Checked; + }); + button.Name = "speech_for_inventory"; + button.AccessibleName = "Speech for inventory"; + button.Checked = config["enabled_for_inventory"].AsBoolean(); + + SpeechButton.DropDownItems.Add(button); + } + + // Enable / disable for objects tab + { + ToolStripMenuItem button = new ToolStripMenuItem("Objects", null, (sender, e) => + { + var me = (ToolStripMenuItem)sender; + me.Checked = !me.Checked; + config["enabled_for_objects"] = me.Checked; + }); + button.Name = "speech_for_objects"; + button.AccessibleName = "Speech for objects"; + button.Checked = config["enabled_for_objects"].AsBoolean(); + + SpeechButton.DropDownItems.Add(button); + } + + // Enable / disable for friends tab + { + ToolStripMenuItem button = new ToolStripMenuItem("Friends", null, (sender, e) => + { + var me = (ToolStripMenuItem)sender; + me.Checked = !me.Checked; + config["enabled_for_friends"] = me.Checked; + }); + button.Name = "speech_for_friends"; + button.AccessibleName = "Speech for friends"; + button.Checked = config["enabled_for_friends"].AsBoolean(); + + SpeechButton.DropDownItems.Add(button); + } + + SpeechButton.DropDownItems.Add(new ToolStripSeparator()); + // 3D Sound sub menu { ToolStripMenuItem button = new ToolStripMenuItem("3D Sound", null, (sender, e) =>