protected override bool ProcessKeyPreview(ref System.Windows.Forms.Message m) { const int WM_CHAR = 0x102; const int WM_SYSCHAR = 0x106; const int WM_SYSKEYDOWN = 0x104; //const int WM_SYSKEYUP = 0x105; const int WM_IME_CHAR = 0x286; KeyEventArgs e = null; if ((m.Msg != WM_CHAR) && (m.Msg != WM_SYSCHAR) && (m.Msg != WM_IME_CHAR)) { e = new KeyEventArgs(((Keys)((int)((long)m.WParam))) | ModifierKeys); if ((m.Msg == WM_KEYDOWN) || (m.Msg == WM_SYSKEYDOWN)) { TrappedKeyDown(e); } if (e.SuppressKeyPress) { tab.tabs["chat"].Select(); METAboltTab stab = tab.GetTab(toName); stab.Close(); } if (e.Handled) { return(e.Handled); } } return(base.ProcessKeyPreview(ref m)); }
internal Chat(PluginControl pc) : base(pc) { // We want to process incoming chat control.instance.Client.Self.ChatFromSimulator += new EventHandler <ChatEventArgs>(OnChat); control.instance.Client.Self.AlertMessage += new EventHandler <AlertMessageEventArgs>(OnAlertMessage); METAbolt.METAboltTab chatTab = control.instance.TabConsole.Tabs["chat"]; METAbolt.ChatConsole chatscreen = (METAbolt.ChatConsole)chatTab.Control; nearby = chatscreen.lvwObjects; nearby.SelectedIndexChanged += new EventHandler(nearby_SelectedIndexChanged); nearby.GotFocus += new EventHandler(nearby_GotFocus); chatscreen.ChatInputText.GotFocus += new EventHandler(cbxInput_GotFocus); Title = "chat"; // Make a recognition grammar to improve accuracy. Listener.CreateGrammar("chat", new string[] { MUTE_OBJECTS, UNMUTE_OBJECTS }); }
private void tab_TabSelected(object sender, EventArgs e) { METAboltTab tab = (METAboltTab)sender; if (selectedTab != null && selectedTab != tab) { selectedTab.Deselect(); } selectedTab = tab; tbtnCloseTab.Enabled = !tab.Merged && (tab.AllowClose || tab.AllowHide); if (owner != null) { owner.AcceptButton = tab.DefaultControlButton; } if (OnTabSelected != null) { try { OnTabSelected(this, new TabEventArgs(selectedTab)); } catch (Exception) { } } }
public List <METAboltTab> GetOtherTabs() { List <METAboltTab> otherTabs = new List <METAboltTab>(); foreach (ToolStripItem item in tstTabs.Items) { if (item.Tag == null) { continue; } if ((ToolStripItem)item == selectedTab.Button) { continue; } METAboltTab tab = tabs[item.Tag.ToString()]; if (!tab.AllowMerge) { continue; } if (tab.Merged) { continue; } otherTabs.Add(tab); } return(otherTabs); }
public METAboltTab Split() { if (!allowMerge) { return(null); } if (!merged) { return(null); } METAboltTab returnTab = mergedTab; mergedTab = null; returnTab.mergedTab = null; SplitContainer container = (SplitContainer)control; control = container.Panel1.Controls[0]; returnTab.Control = container.Panel2.Controls[0]; merged = returnTab.merged = false; this.Label = originalLabel; OnTabSplit(EventArgs.Empty); return(returnTab); }
private void HandleGroupIM(InstantMessageEventArgs e) { // Ignore group IM from a muted group if (null != client.Self.MuteList.Find(me => me.Type == MuteType.Group && (me.ID == e.IM.IMSessionID || me.ID == e.IM.FromAgentID))) { return; } if (TabExists(e.IM.IMSessionID.ToString())) { METAboltTab tab = tabs[e.IM.IMSessionID.ToString()]; tab.Highlight(); return; } instance.MediaManager.PlayUISound(UISounds.IM); Control active = FindFocusedControl(instance.MainForm); GroupIMTabWindow imTab = AddGroupIMTab(e.IM.IMSessionID, Utils.BytesToString(e.IM.BinaryBucket)); imTab.TextManager.ProcessIM(e); tabs[e.IM.IMSessionID.ToString()].Highlight(); if (active != null) { active.Focus(); } }
public METAboltTab AddTab(string name, string label, Control control) { // WORKAROUND: one should never add tab that alrady exists // but under some weird conditions disconnect/connect // fire in the wrong order if (TabExists(name)) { Logger.Log("Force closing tab '" + name + "'", Helpers.LogLevel.Warning, client); ForceCloseTab(name); } control.Visible = false; control.Dock = DockStyle.Fill; toolStripContainer1.ContentPanel.Controls.Add(control); ToolStripButton button = (ToolStripButton)tstTabs.Items.Add(label); button.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; button.Image = null; button.AutoToolTip = false; button.Tag = name.ToLower(); button.AllowDrop = true; button.Click += new EventHandler(TabButtonClick); METAboltTab tab = new METAboltTab(instance, button, control, name.ToLower(), label); if (control is METAboltTabControl) { ((METAboltTabControl)control).METAboltTab = tab; } tab.TabAttached += new EventHandler(tab_TabAttached); tab.TabDetached += new EventHandler(tab_TabDetached); tab.TabSelected += new EventHandler(tab_TabSelected); tab.TabClosed += new EventHandler(tab_TabClosed); tab.TabHidden += new EventHandler(tab_TabHidden); tabs.Add(name.ToLower(), tab); if (OnTabAdded != null) { try { OnTabAdded(this, new TabEventArgs(tab)); } catch (Exception) { } } button.MouseDown += (msender, margs) => { if (margs.Button == MouseButtons.Middle) { if (tab.AllowClose) { tab.Close(); } else if (tab.AllowHide) { tab.Hide(); } } }; return(tab); }
private void imBtn_Click(object sender, EventArgs e) { if (listBox1.SelectedItem == null) { return; } Group g = (Group)listBox1.SelectedItem; if (g.ID == UUID.Zero) { return; } if (!instance.TabConsole.TabExists(g.ID.ToString())) { instance.MediaManager.PlayUISound(UISounds.IMWindow); instance.TabConsole.AddGroupIMTab(g.ID, g.Name); instance.TabConsole.Tabs[g.ID.ToString()].Highlight(); instance.TabConsole.Tabs[g.ID.ToString()].Select(); } else { METAboltTab t = instance.TabConsole.Tabs[g.ID.ToString()]; t.Select(); } }
private void TabButtonClick(object sender, EventArgs e) { ToolStripButton button = (ToolStripButton)sender; METAboltTab tab = tabs[button.Tag.ToString()]; tab.Select(); }
public MasterTab AddMSTab(Avatar avatar) { MasterTab msTab = new MasterTab(instance, avatar); METAboltTab tab = AddTab("MS: " + avatar.Name, "MS: " + avatar.Name, msTab); return(msTab); }
public AnimTab AddAnimTab(Avatar avatar) { AnimTab animTab = new AnimTab(instance, avatar); METAboltTab tab = AddTab("Anim: " + avatar.Name, "Anim: " + avatar.Name, animTab); return(animTab); }
private void tab_TabDetached(object sender, EventArgs e) { METAboltTab tab = (METAboltTab)sender; frmDetachedTab form = (frmDetachedTab)tab.Owner; form.ReattachStrip = tstTabs; form.ReattachContainer = toolStripContainer1.ContentPanel; }
public OutfitTextures AddOTTab(Avatar avatar) { OutfitTextures otTab = new OutfitTextures(instance, avatar); METAboltTab tab = AddTab("OT: " + avatar.Name, "OT: " + avatar.Name, otTab); otTab.GetTextures(); return(otTab); }
void tab_TabHidden(object sender, EventArgs e) { METAboltTab tab = (METAboltTab)sender; if (selectedTab != null && selectedTab == tab) { tab.Deselect(); SelectDefaultTab(); } }
public void RemoveTabEntry(METAboltTab tab) { if (tstTabs.Items.Contains(tab.Button)) { tstTabs.Items.Remove(tab.Button); } tab.Button.Dispose(); tabs.Remove(tab.Name); }
public IMTabWindow AddIMTab(UUID target, UUID session, string targetName) { IMTabWindow imTab = new IMTabWindow(instance, target, session, targetName); METAboltTab tab = AddTab(session.ToString(), "IM: " + targetName, imTab); imTab.SelectIMInput(); return(imTab); }
public GroupIMTabWindow AddGroupIMTab(UUID session, string name) { GroupIMTabWindow imTab = new GroupIMTabWindow(instance, session, name); METAboltTab tab = AddTab(session.ToString(), name, imTab); imTab.SelectIMInput(); return(imTab); }
private void InitializeChatTab() { chatConsole = new ChatConsole(instance); mainChatManger = chatConsole.ChatManager; METAboltTab tab = AddTab("chat", "Chat", chatConsole); tab.AllowClose = false; tab.AllowDetach = false; tab.AllowHide = false; }
private void tmnuDetachTab_Click(object sender, EventArgs e) { if (!selectedTab.AllowDetach) { return; } METAboltTab tab = selectedTab; SelectDefaultTab(); tab.Detach(instance); }
public void SplitTab(METAboltTab tab) { METAboltTab otherTab = tab.Split(); if (otherTab == null) { return; } toolStripContainer1.ContentPanel.Controls.Add(tab.Control); toolStripContainer1.ContentPanel.Controls.Add(otherTab.Control); tabs.Remove(otherTab.Name); AddTab(otherTab); }
public frmDetachedTab(METAboltInstance instance, METAboltTab tab) { InitializeComponent(); this.instance = instance; this.tab = tab; this.Controls.Add(tab.Control); tab.Control.BringToFront(); AddTabEvents(); this.Text = tab.Label + " (tab) - METAbolt"; ApplyConfig(this.instance.Config.CurrentConfig); this.instance.Config.ConfigApplied += new EventHandler <ConfigAppliedEventArgs>(Config_ConfigApplied); }
public frmDetachedTab(METAboltInstance instance, METAboltTab tab) { InitializeComponent(); this.instance = instance; this.tab = tab; this.Controls.Add(tab.Control); tab.Control.BringToFront(); AddTabEvents(); this.Text = tab.Label + " (tab) - METAbolt"; ApplyConfig(this.instance.Config.CurrentConfig); this.instance.Config.ConfigApplied += new EventHandler<ConfigAppliedEventArgs>(Config_ConfigApplied); }
private void MergeItemClick(object sender, EventArgs e) { ToolStripItem item = (ToolStripItem)sender; METAboltTab tab = tabs[item.Tag.ToString()]; selectedTab.MergeWith(tab); SplitContainer container = (SplitContainer)selectedTab.Control; toolStripContainer1.ContentPanel.Controls.Add(container); selectedTab.Select(); RemoveTabEntry(tab); tabs.Add(tab.Name, selectedTab); }
private void HandleIM(InstantMessageEventArgs e) { bool isNew = ShowIMTab(e.IM.FromAgentID, e.IM.FromAgentName, false); if (!TabExists(e.IM.IMSessionID.ToString())) { return; // this should now exist. sanity check anyway } METAboltTab tab = tabs[e.IM.IMSessionID.ToString()]; tab.Highlight(); if (isNew) { ((IMTabWindow)tab.Control).TextManager.ProcessIM(e); } }
private void tbtnCloseTab_Click(object sender, EventArgs e) { METAboltTab tab = selectedTab; if (tab.Merged) { return; } else if (tab.AllowClose) { tab.Close(); } else if (tab.AllowHide) { tab.Hide(); } }
public void InitializeMainTab() { if (TabExists("login")) { ForceCloseTab("login"); } LoginConsole loginConsole = new LoginConsole(instance); METAboltTab tab = AddTab("login", "Login", loginConsole); tab.AllowClose = false; tab.AllowDetach = false; tab.AllowMerge = false; tab.AllowHide = false; loginConsole.RegisterTab(tab); }
private void ForceCloseTab(string name) { if (!TabExists(name)) { return; } METAboltTab tab = tabs[name]; if (tab.Merged) { SplitTab(tab); } tab.AllowClose = true; tab.Close(); tab = null; }
public void AddTab(METAboltTab tab) { ToolStripButton button = (ToolStripButton)tstTabs.Items.Add(tab.Label); button.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; button.Image = null; button.AutoToolTip = false; button.Tag = tab.Name; button.Click += new EventHandler(TabButtonClick); tab.Button = button; tabs.Add(tab.Name, tab); if (OnTabAdded != null) { try { OnTabAdded(this, new TabEventArgs(tab)); } catch (Exception) { } } }
/// <summary> /// Create Tabs that only make sense when connected /// </summary> private void InitializeOnlineTabs() { METAboltTab tab = AddTab("friends", "Friends", new FriendsConsole(instance)); tab.AllowClose = false; tab.AllowDetach = true; tab.Visible = false; tab = AddTab("groups", "Groups", new GroupsConsole(instance)); tab.AllowClose = false; tab.AllowDetach = true; tab.Visible = false; // Ugly workaround for a mono bug InventoryConsole inv = new InventoryConsole(instance); if (instance.MonoRuntime) { inv.invTree.Scrollable = false; } tab = AddTab("inventory", "Inventory", inv); if (instance.MonoRuntime) { inv.invTree.Scrollable = true; } tab.AllowClose = false; tab.AllowDetach = true; tab.Visible = false; tab = AddTab("search", "Search", new SearchConsole(instance)); tab.AllowClose = false; tab.AllowDetach = true; tab.Visible = false; tab = AddTab("map", "Map", new MapConsole(instance)); tab.AllowClose = false; tab.AllowDetach = true; tab.Visible = false; tab = AddTab("voice", "Voice", new VoiceConsole(instance)); tab.AllowClose = false; tab.AllowDetach = true; tab.Visible = false; }
private void tab_TabClosed(object sender, EventArgs e) { METAboltTab tab = (METAboltTab)sender; if (selectedTab != null && selectedTab == tab && tab.Name != "chat") { tab.Deselect(); SelectDefaultTab(); } tabs.Remove(tab.Name); if (OnTabRemoved != null) { try { OnTabRemoved(this, new TabEventArgs(tab)); } catch (Exception) { } } tab = null; }
public void Dispose() { control.instance.Client.Self.ChatFromSimulator -= new EventHandler <ChatEventArgs>(OnChat); control.instance.Client.Self.AlertMessage -= new EventHandler <AlertMessageEventArgs>(OnAlertMessage); if (control.instance.TabConsole != null && control.instance.TabConsole.TabExists("chat")) { METAbolt.METAboltTab chatTab = control.instance.TabConsole.Tabs["chat"]; METAbolt.ChatConsole chatscreen = (METAbolt.ChatConsole)chatTab.Control; nearby = chatscreen.lvwObjects; nearby.SelectedIndexChanged -= new EventHandler(nearby_SelectedIndexChanged); nearby.GotFocus -= new EventHandler(nearby_GotFocus); chatscreen.ChatInputText.GotFocus -= new EventHandler(cbxInput_GotFocus); } nearby = null; }
public void SplitTab(METAboltTab tab) { METAboltTab otherTab = tab.Split(); if (otherTab == null) return; toolStripContainer1.ContentPanel.Controls.Add(tab.Control); toolStripContainer1.ContentPanel.Controls.Add(otherTab.Control); if (tabs.ContainsKey(tab.Name)) { tabs.Remove(otherTab.Name); } AddTab(otherTab); }
public void RemoveTabEntry(METAboltTab tab) { tab.Button.Dispose(); if (tabs.ContainsKey(tab.Name)) { tabs.Remove(tab.Name); } }
public METAboltTab AddTab(string name, string label, Control control) { ToolStripButton button = (ToolStripButton)tstTabs.Items.Add("&"+label); button.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; button.Image = null; button.AutoToolTip = false; button.Tag = name.ToLower(CultureInfo.CurrentCulture); button.Click += new EventHandler(TabButtonClick); METAboltTab tab = new METAboltTab(button, control, name.ToLower(CultureInfo.CurrentCulture), label); tab.TabAttached += new EventHandler(tab_TabAttached); tab.TabDetached += new EventHandler(tab_TabDetached); tab.TabSelected += new EventHandler(tab_TabSelected); tab.TabClosed += new EventHandler(tab_TabClosed); if (!tabs.ContainsKey(tab.Name)) { tabs.Add(name.ToLower(CultureInfo.CurrentCulture), tab); } //ToolStripItem item = new ToolStripSeparator(); //tstTabs.Items.Add(item); return tab; }
public void AddTab(METAboltTab tab) { ToolStripButton button = (ToolStripButton)tstTabs.Items.Add(tab.Label); button.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText; button.Image = null; button.AutoToolTip = false; button.Tag = tab.Name; button.Click += new EventHandler(TabButtonClick); tab.Button = button; if (!tabs.ContainsKey(tab.Name)) { tabs.Add(tab.Name, tab); } }
private void tab_TabSelected(object sender, EventArgs e) { METAboltTab tab = (METAboltTab)sender; if (selectedTab != null && selectedTab != tab) { selectedTab.Deselect(); } selectedTab = tab; tbtnCloseTab.Enabled = tab.AllowClose; owner.AcceptButton = tab.DefaultControlButton; }
public void RegisterTab(METAboltTab tab) { tab.DefaultControlButton = btnLogin; }
public void MergeWith(METAboltTab tab) { if (!allowMerge) return; if (merged) return; SplitContainer container = new SplitContainer(); container.Dock = DockStyle.Fill; container.BorderStyle = BorderStyle.Fixed3D; container.SplitterDistance = container.Width / 2; container.Panel1.Controls.Add(control); container.Panel2.Controls.Add(tab.Control); control.Visible = true; tab.Control.Visible = true; control = container; tab.Control = container; mergedTab = tab; tab.mergedTab = this; originalLabel = label; tab.originalLabel = tab.label; this.Label = label + "+" + tab.Label; merged = tab.merged = true; OnTabMerged(EventArgs.Empty); }
public METAboltTab Split() { if (!allowMerge) return null; if (!merged) return null; METAboltTab returnTab = mergedTab; mergedTab = null; returnTab.mergedTab = null; SplitContainer container = (SplitContainer)control; control = container.Panel1.Controls[0]; returnTab.Control = container.Panel2.Controls[0]; merged = returnTab.merged = false; this.Label = originalLabel; OnTabSplit(EventArgs.Empty); return returnTab; }