Exemplo n.º 1
0
        public FormWindow(IceTabPage tab)
        {
            //used to hold each tab in MDI
            InitializeComponent();

            this.Controls.Add(tab);
            tab.Dock = DockStyle.Fill;
            dockedControl = tab;

            this.menuStrip.Visible = false;

            ToolStripMenuItemTB trackBar = new ToolStripMenuItemTB();
            trackBar.ValueChanged += new EventHandler(TrackBar_ValueChanged);
            viewToolStripMenuItem.DropDownItems.Add(trackBar);

            this.Activated += new EventHandler(OnActivated);
            this.Resize += new EventHandler(OnResize);
            this.Move += new EventHandler(OnMove);

            this.MouseDown += new MouseEventHandler(FormWindow_MouseDown);
            dockedControl.MouseDown+=new MouseEventHandler(FormWindow_MouseDown);

            this.FormClosing += new FormClosingEventHandler(OnFormClosing);

            if (tab.WindowStyle == IceTabPage.WindowType.Console)
                this.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("console.png").GetHicon());
            else if (tab.WindowStyle == IceTabPage.WindowType.Channel)
                this.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("channel.png").GetHicon());
            else if (tab.WindowStyle == IceTabPage.WindowType.Query)
                this.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("new-query.ico").GetHicon());
            else if (tab.WindowStyle == IceTabPage.WindowType.ChannelList)
                this.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("channellist.png").GetHicon());
            else //for the rest
                this.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("window-icon.ico").GetHicon());
        }
Exemplo n.º 2
0
        internal void BringFront(IceTabPage page)
        {
            if (page.Parent != null)
            {
                if (page.Parent.GetType() == typeof(FormWindow))
                {
                    ((FormWindow)page.Parent).SelectTabActivate = false;
                    page.Parent.BringToFront();
                }
                else
                {
                    page.BringToFront();
                }
            }
            else
            {
                page.BringToFront();
            }

            _selectedIndex = page.TabIndex;

            FormMain.Instance.ServerTree.Invalidate();

            _previousTab = _currentTab;

            if (_previousTab.WindowStyle != IceTabPage.WindowType.Console)
            {
                if (_previousTab.TextWindow != null)
                {
                    _previousTab.TextWindow.resetUnreadMarker();
                }
            }

            _currentTab = page;
        }
Exemplo n.º 3
0
        private void OnActivated(object sender, EventArgs e)
        {
            FormMain.Instance.ChannelBar.SelectTab(dockedControl);

            if (this.Text == "Console")
            {
                //dont do anything, or ya get the BUGZ!
            }
            else
            {
                FormMain.Instance.ServerTree.SelectTab(dockedControl, false);
            }

            //set the tabindex to 0
            dockedControl.TabIndex = 0;

            //set the rest to 1
            foreach (FormWindow child in FormMain.Instance.MdiChildren)
            {
                if (child != this)
                {
                    IceTabPage tab = child.DockedControl;
                    tab.TabIndex = 1;
                }
            }

            if (dockedControl.Detached)
            {
                dockedControl.InputPanel.FocusTextBox();
            }
            else
            {
                FormMain.Instance.FocusInputBox();
            }
        }
Exemplo n.º 4
0
        private void OnActivated(object sender, EventArgs e)
        {
            //System.Diagnostics.Debug.WriteLine("Form Window OnActivated:" + this.Visible);
            try
            {
                FormMain.Instance.ChannelBar.SelectTab(dockedControl);
                if (dockedControl.WindowStyle == IceTabPage.WindowType.Query)
                {
                    if (dockedControl.Connection.ServerSetting.IAL.ContainsKey(dockedControl.TabCaption))
                    {
                        this.UIThread(delegate
                        {
                            this.Text = dockedControl.TabCaption + " (" + ((InternalAddressList)dockedControl.Connection.ServerSetting.IAL[dockedControl.TabCaption]).Host + ") {" + dockedControl.Connection.ServerSetting.NetworkName + "}";
                        });
                    }
                }

                if (this.Text == "Console")
                {
                    //dont do anything, or ya get the BUGZ!
                    // FormMain.Instance.ServerTree.SelectTab(dockedControl, true);
                }
                else
                {
                    FormMain.Instance.ServerTree.SelectTab(dockedControl, false);
                }


                //set the tabindex to 0
                dockedControl.TabIndex = 0;

                //set the rest to 1
                foreach (FormWindow child in FormMain.Instance.MdiChildren)
                {
                    if (child != this)
                    {
                        IceTabPage tab = child.DockedControl;
                        tab.TabIndex = 1;
                    }
                }


                if (dockedControl.Detached)
                {
                    dockedControl.InputPanel.FocusTextBox();
                }
                else
                {
                    FormMain.Instance.FocusInputBox();
                }
            }
            catch (Exception ex)
            {
                FormMain.Instance.WriteErrorFile(FormMain.Instance.InputPanel.CurrentConnection, "Activate FormWindow Error:", ex);
            }
        }
Exemplo n.º 5
0
        internal void AddTabPage(IceTabPage page)
        {
            page.Dock = DockStyle.Fill;
            page.Location = new Point(0, 1);

            if (!this.Controls.Contains(page))
                this.Controls.Add(page);

            _previousTab = _currentTab;
            _currentTab = page;
        }
Exemplo n.º 6
0
        internal void AddTabPage(IceTabPage page)
        {
            page.Dock     = DockStyle.Fill;
            page.Location = new Point(0, 1);

            if (!this.Controls.Contains(page))
            {
                this.Controls.Add(page);
            }

            _previousTab = _currentTab;
            _currentTab  = page;
        }
Exemplo n.º 7
0
        public FormWindow(IceTabPage tab)
        {
            //used to hold each tab in MDI
            InitializeComponent();

            this.Controls.Add(tab);
            tab.Dock      = DockStyle.Fill;
            dockedControl = tab;

            this.menuStrip.Visible = false;

            ToolStripMenuItemTB trackBar = new ToolStripMenuItemTB();

            trackBar.ValueChanged += new EventHandler(TrackBar_ValueChanged);
            viewToolStripMenuItem.DropDownItems.Add(trackBar);

            this.Activated += new EventHandler(OnActivated);
            this.Resize    += new EventHandler(OnResize);
            this.Move      += new EventHandler(OnMove);

            this.MouseDown          += new MouseEventHandler(FormWindow_MouseDown);
            dockedControl.MouseDown += new MouseEventHandler(FormWindow_MouseDown);

            this.FormClosing += new FormClosingEventHandler(OnFormClosing);

            if (tab.WindowStyle == IceTabPage.WindowType.Console)
            {
                this.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("console.png").GetHicon());
            }
            else if (tab.WindowStyle == IceTabPage.WindowType.Channel)
            {
                this.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("channel.png").GetHicon());
            }
            else if (tab.WindowStyle == IceTabPage.WindowType.Query)
            {
                this.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("query.png").GetHicon());
            }
            else if (tab.WindowStyle == IceTabPage.WindowType.ChannelList)
            {
                this.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("channellist.png").GetHicon());
            }
            else //for the rest
            {
                this.Icon = System.Drawing.Icon.FromHandle(StaticMethods.LoadResourceImage("window-icon.ico").GetHicon());
            }
        }
Exemplo n.º 8
0
        internal void BringFront(IceTabPage page)
        {
            try
            {
                if (page.Parent != null)
                {
                    if (page.Parent.GetType() == typeof(FormWindow))
                    {
                        ((FormWindow)page.Parent).SelectTabActivate = false;
                        page.Parent.BringToFront();
                    }
                    else
                    {
                        // it is breaking here in Mono!
                        //page.BringToFront();
                        FormMain.Instance.TabMain.Controls.SetChildIndex(page, 0);
                    }
                }
                else
                {
                    page.BringToFront();
                }

                _selectedIndex = page.TabIndex;

                FormMain.Instance.ServerTree.Invalidate();

                _previousTab = _currentTab;

                if (_previousTab.WindowStyle != IceTabPage.WindowType.Console)
                {
                    if (_previousTab.TextWindow != null)
                    {
                        _previousTab.TextWindow.resetUnreadMarker();
                    }
                }

                _currentTab = page;
            }
            catch (Exception ex)
            {
                FormMain.Instance.WriteErrorFile(FormMain.Instance.InputPanel.CurrentConnection, "TabMain BringtoFront2 Error:", ex);
            }
        }
Exemplo n.º 9
0
        private void OnControlRemoved(object sender, ControlEventArgs e)
        {
            if (e.Control is IceTabPage)
            {
                if (((IceTabPage)e.Control).DockedForm == false)
                {
                    ((IceTabPage)e.Control).Dispose();
                }
            }
            else if (e.Control is IceTabPageDCCFile)
            {
                if (((IceTabPageDCCFile)e.Control).DockedForm == false)
                {
                    ((IceTabPageDCCFile)e.Control).Dispose();
                }
            }

            foreach (IceTabPage page in this.Controls)
            {
                if (this.Controls.GetChildIndex(page) == 0)
                {
                    //this is the current
                    System.Diagnostics.Debug.WriteLine("Current Index - 0:" + page.TabCaption);
                    _currentTab = page;
                }

                if (this.Controls.GetChildIndex(page) == 1)
                {
                    _previousTab = page;
                }
            }

            //redraw
            FormMain.Instance.ServerTree.SelectTab(_currentTab, false);
            FormMain.Instance.ChannelBar.SelectTab(_currentTab);
            FormMain.Instance.ServerTree.Invalidate();
        }
Exemplo n.º 10
0
 internal bool WindowExists(IRCConnection connection, string windowName, IceTabPage.WindowType windowType)
 {
     foreach (IceTabPage t in this._TabPages)
     {
         if (t.Connection == null)
         {
             if (t.WindowStyle == IceTabPage.WindowType.DCCFile)
             {
                 if (t.TabCaption.ToLower() == windowName.ToLower())
                     return true;
             }
         }
         else if (t.Connection == connection)
         {
             if (t.WindowStyle == windowType)
             {
                 if (t.TabCaption.ToLower() == windowName.ToLower())
                     return true;
             }
         }
     }
     return false;
 }
Exemplo n.º 11
0
        /// <summary>
        /// Create a Default Tab for showing Welcome Information
        /// </summary>
        private void CreateDefaultConsoleWindow()
        {
            IceTabPage p = new IceTabPage(IceTabPage.WindowType.Console, "Console", this);
            p.AddConsoleTab(iceChatLanguage.consoleTabWelcome);

            mainTabControl.AddTabPage(p);
            mainTabControl.BringFront(p);

            mainChannelBar.AddTabPage(ref p);

            //get the window size if set
            ChannelSetting cs = ChannelSettings.FindChannel("Console", "");
            if (cs != null)
            {
                p.WindowLocation = cs.WindowLocation;
                p.WindowSize = cs.WindowSize;
                p.PinnedTab = cs.PinnedTab;
            }

            WindowMessage(null, "Console", "\x000304Welcome to " + ProgramID + " " + VersionID + " - Build " + BuildNumber, "", false);
            WindowMessage(null, "Console", "\x000304Come to \x00030,4#icechat\x0003 on \x00030,2irc://irc.freenode.net/icechat\x0003 if you wish to help with this project", "", true);
            WindowMessage(null, "Console", "\x000304Visit our facebook page at http://www.facebook.com/Monody","", true);
            WindowMessage(null, "Console", "\x000304Visit our wiki page at http://wiki.icechat.net", "", true);
            WindowMessage(null, "Console", "\x000304-", "", true);
        }
Exemplo n.º 12
0
        /// <summary>
        /// Remove a Tab Window from the Main Tab Control
        /// </summary>
        /// <param name="connection">Which Connection it is for</param>
        /// <param name="channel">The Channel/Query Window Name</param>
        internal void RemoveWindow(IRCConnection connection, string windowCaption, IceTabPage.WindowType windowType)
        {
            if (!this.IsHandleCreated && !this.IsDisposed) return;

            this.Invoke((MethodInvoker)delegate()
            {
                IceTabPage t = GetWindow(connection, windowCaption, IceTabPage.WindowType.Channel);
                if (t != null)
                {
                    //System.Diagnostics.Debug.WriteLine("remove:" + t.Parent.Name);
                    if (t.Parent != null && t.Parent.GetType() == typeof(FormWindow))
                    {
                        //System.Diagnostics.Debug.WriteLine("Remove Channel Window:" + t.TabCaption);
                        //save the channel position?
                        if (IceChatOptions.SaveWindowPosition == true)
                        {
                            //System.Diagnostics.Debug.WriteLine("closing/saving channel:" + this.Location);

                            ChannelSetting cs = ChannelSettings.FindChannel(((FormWindow)t.Parent).DockedControl.TabCaption, ((FormWindow)t.Parent).DockedControl.Connection.ServerSetting.NetworkName);
                            if (cs != null)
                            {
                                cs.WindowLocation = ((FormWindow)t.Parent).Location;
                                if (((FormWindow)t.Parent).WindowState == FormWindowState.Normal)
                                    cs.WindowSize = ((FormWindow)t.Parent).Size;
                            }
                            else
                            {
                                ChannelSetting cs1 = new ChannelSetting();
                                cs1.ChannelName = ((FormWindow)t.Parent).DockedControl.TabCaption;
                                cs1.NetworkName = ((FormWindow)t.Parent).DockedControl.Connection.ServerSetting.NetworkName;
                                cs1.WindowLocation = ((FormWindow)t.Parent).Location;
                                if (((FormWindow)t.Parent).WindowState == FormWindowState.Normal)
                                    cs1.WindowSize = ((FormWindow)t.Parent).Size;

                                this.channelSettings.AddChannel(cs1);
                            }

                            SaveChannelSettings();
                        }

                        ((FormWindow)t.Parent).DisableActivate();
                        ((FormWindow)t.Parent).DisableResize();
                        ((FormWindow)t.Parent).Close();
                    }
                    ChannelBar.TabPages.Remove(t);
                    if (mainTabControl.Controls.Count == 0)
                        this.serverTree.Invalidate();
                    else
                        mainTabControl.Controls.Remove(t);

                    return;
                }

                IceTabPage c = GetWindow(connection, windowCaption, IceTabPage.WindowType.Query);
                if (c != null)
                {
                    if (c.Parent != null && c.Parent.GetType() == typeof(FormWindow))
                    {
                        ((FormWindow)c.Parent).DisableActivate();
                        ((FormWindow)c.Parent).DisableResize();
                        ((FormWindow)c.Parent).Close();
                    }

                    ChannelBar.TabPages.Remove(c);
                    if (mainTabControl.Controls.Count == 0)
                        this.serverTree.Invalidate();
                    else
                        mainTabControl.Controls.Remove(c);
                    return;
                }

                IceTabPage dcc = GetWindow(connection, windowCaption, IceTabPage.WindowType.DCCChat);
                if (dcc != null)
                {
                    if (dcc.Parent != null &&  dcc.Parent.GetType() == typeof(FormWindow))
                    {
                        ((FormWindow)dcc.Parent).DisableActivate();
                        ((FormWindow)dcc.Parent).DisableResize();
                        ((FormWindow)dcc.Parent).Close();
                    }
                    ChannelBar.TabPages.Remove(dcc);
                    if (mainTabControl.Controls.Count == 0)
                        this.serverTree.Invalidate();
                    else
                        mainTabControl.Controls.Remove(dcc);
                    return;
                }

                IceTabPage cl = GetWindow(connection, "", IceTabPage.WindowType.ChannelList);
                if (cl != null)
                {
                    if (cl.Parent != null && cl.Parent.GetType() == typeof(FormWindow))
                    {
                        ((FormWindow)cl.Parent).DisableActivate();
                        ((FormWindow)cl.Parent).DisableResize();
                        ((FormWindow)cl.Parent).Close();
                    }

                    ChannelBar.TabPages.Remove(cl);
                    if (mainTabControl.Controls.Count == 0)
                        this.serverTree.Invalidate();
                    else
                        mainTabControl.Controls.Remove(cl);
                    return;
                }

                if (windowType == IceTabPage.WindowType.Debug)
                {
                    IceTabPage de = GetWindow(null, "Debug", IceTabPage.WindowType.Debug);
                    if (de != null)
                    {

                        if (de.Parent != null && de.Parent.GetType() == typeof(FormWindow))
                        {
                            ((FormWindow)de.Parent).DisableActivate();
                            ((FormWindow)de.Parent).DisableResize();
                            ((FormWindow)de.Parent).Close();
                        }

                        ChannelBar.TabPages.Remove(de);
                        if (mainTabControl.Controls.Count == 0)
                            this.serverTree.Invalidate();
                        else
                            mainTabControl.Controls.Remove(de);
                        return;
                    }
                }

                IceTabPage wi = GetWindow(null, windowCaption, IceTabPage.WindowType.Window);
                if (wi != null)
                {
                    if (wi.Parent != null && wi.Parent.GetType() == typeof(FormWindow))
                    {
                        ((FormWindow)wi.Parent).DisableActivate();
                        ((FormWindow)wi.Parent).DisableResize();
                        ((FormWindow)wi.Parent).Close();
                    }
                    ChannelBar.TabPages.Remove(wi);
                    if (mainTabControl.Controls.Count == 0)
                        this.serverTree.Invalidate();
                    else
                        mainTabControl.Controls.Remove(wi);
                    return;
                }

                IceTabPage df = GetWindow(null, windowCaption, IceTabPage.WindowType.DCCFile);
                if (df != null)
                {
                    if (df.Parent != null && df.Parent.GetType() == typeof(FormWindow))
                    {
                        ((FormWindow)df.Parent).DisableActivate();
                        ((FormWindow)df.Parent).DisableResize();
                        ((FormWindow)df.Parent).Close();
                    }
                    ChannelBar.TabPages.Remove(df);
                    if (mainTabControl.Controls.Count == 0)
                        this.serverTree.Invalidate();
                    else
                        mainTabControl.Controls.Remove(df);
                    return;
                }
            });
        }
Exemplo n.º 13
0
        private void OnMouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                //show the proper popup menu according to what kind of tab
                if (GetTabPage(_selectedIndex).WindowStyle == IceTabPage.WindowType.Console)
                {
                    //console tab
                    _popupMenu.ItemClicked -= new ToolStripItemClickedEventHandler(OnPopupMenu_ItemClicked);
                    _popupMenu.Items.Clear();

                    if (GetTabPage(_selectedIndex).PinnedTab)
                        _popupMenu.Items.Add(NewMenuItem("Unpin Tab","/unpin $1"));
                    else
                        _popupMenu.Items.Add(NewMenuItem("Pin Tab", "/pin $1"));

                    _popupMenu.Items.Add(new ToolStripSeparator());

                    _popupMenu.Items.Add(NewMenuItem("Clear", "/clear $1"));
                    _popupMenu.Items.Add(NewMenuItem("Clear All", "/clear all console"));
                    _popupMenu.Items.Add(new ToolStripSeparator());
                    _popupMenu.Items.Add(NewMenuItem("Quit Server", "//quit"));
                    _popupMenu.Items.Add(NewMenuItem("Auto Join", "/autojoin"));
                    _popupMenu.Items.Add(NewMenuItem("Auto Perform", "/autoperform"));

                    AddPopupMenu("Console", _popupMenu);

                    //add dynamic menu items
                    if (_parent != null && _parent.LoadedPlugins != null)
                    {
                        foreach (Plugin p in _parent.LoadedPlugins)
                        {
                            IceChatPlugin ipc = p as IceChatPlugin;
                            if (ipc != null)
                            {
                                if (ipc.plugin.Enabled == true)
                                {
                                    ToolStripItem[] popServer = ipc.plugin.AddServerPopups();
                                    if (popServer != null && popServer.Length > 0)
                                    {
                                        _popupMenu.Items.AddRange(popServer);
                                    }
                                }
                            }
                        }
                    }

                    _popupMenu.ItemClicked += new ToolStripItemClickedEventHandler(OnPopupMenu_ItemClicked);
                    _popupMenu.Show(this, e.Location);
                }
                else
                {

                    if (GetTabPage(_selectedIndex).WindowStyle == IceTabPage.WindowType.Channel)
                    {
                        _popupMenu.ItemClicked -= new ToolStripItemClickedEventHandler(OnPopupMenu_ItemClicked);
                        _popupMenu.Items.Clear();

                        if (GetTabPage(_selectedIndex).PinnedTab)
                            _popupMenu.Items.Add(NewMenuItem("Unpin Tab", "/unpin $1"));
                        else
                            _popupMenu.Items.Add(NewMenuItem("Pin Tab", "/pin $1"));

                        if (GetTabPage(_selectedIndex).Detached)
                            _popupMenu.Items.Add(NewMenuItem("Attach Tab", "/attach"));
                        else
                            _popupMenu.Items.Add(NewMenuItem("Detach Tab", "/detach"));

                        _popupMenu.Items.Add(new ToolStripSeparator());

                        _popupMenu.Items.Add(NewMenuItem("Clear Window", "/clear $1"));
                        _popupMenu.Items.Add(NewMenuItem("Close Channel", "/part $1"));
                        _popupMenu.Items.Add(NewMenuItem("Rejoin Channel", "/hop $1"));
                        _popupMenu.Items.Add(NewMenuItem("Toggle Autojoin Channel", "/autojoin $1"));
                        _popupMenu.Items.Add(NewMenuItem("Channel Information", "/chaninfo $1"));
                        _popupMenu.Items.Add(NewMenuItem("Change Font", "/font $1"));

                        ToolStripMenuItem colorMode = new ToolStripMenuItem("No Color Mode");
                        colorMode.Tag = "/colormode $1";
                        colorMode.Checked = GetTabPage(_selectedIndex).TextWindow.NoColorMode;

                        ToolStripMenuItem log = new ToolStripMenuItem("Logging");
                        ToolStripMenuItem openLog = new ToolStripMenuItem("Open Log Folder");
                        openLog.Tag = "/run " + GetTabPage(_selectedIndex).TextWindow.LogFileLocation;
                        ToolStripMenuItem disableLog = new ToolStripMenuItem("Disable Logging");
                        disableLog.Tag = "/logging $1";

                        //add a way to disable channel log reload
                        log.DropDownItems.Add(openLog);
                        log.DropDownItems.Add(disableLog);

                        ToolStripMenuItem events = new ToolStripMenuItem("Events");
                        ToolStripMenuItem disableFlash = new ToolStripMenuItem("Disable Flashing");
                        disableFlash.Tag = "/flashing $1";
                        disableFlash.Checked = GetTabPage(_selectedIndex).EventOverLoad;

                        ToolStripMenuItem disableSounds = new ToolStripMenuItem("Disable Sounds");
                        disableSounds.Tag = "/sounds $1";
                        disableSounds.Checked = GetTabPage(_selectedIndex).DisableSounds;

                        events.DropDownItems.Add(disableFlash);
                        events.DropDownItems.Add(disableSounds);

                        colorMode.Click += new EventHandler(OnPopupExtraMenuClick);
                        disableSounds.Click += new EventHandler(OnPopupExtraMenuClick);
                        disableFlash.Click += new EventHandler(OnPopupExtraMenuClick);
                        disableLog.Click += new EventHandler(OnPopupExtraMenuClick);
                        openLog.Click += new EventHandler(OnPopupExtraMenuClick);

                        _popupMenu.Items.Add(colorMode);
                        _popupMenu.Items.Add(log);
                        _popupMenu.Items.Add(events);

                        //add dynamic menu items
                        if (_parent != null && _parent.LoadedPlugins != null)
                         {
                            foreach (Plugin p in _parent.LoadedPlugins)
                            {
                                IceChatPlugin ipc = p as IceChatPlugin;
                                if (ipc != null)
                                {
                                    if (ipc.plugin.Enabled == true)
                                    {
                                        ToolStripItem[] popChan = ipc.plugin.AddChannelPopups();
                                        if (popChan != null && popChan.Length > 0)
                                        {
                                            _popupMenu.Items.AddRange(popChan);
                                        }
                                    }
                                }
                            }
                         }

                         //add then channel popup menu
                         AddPopupMenu("Channel", _popupMenu);

                        _popupMenu.ItemClicked += new ToolStripItemClickedEventHandler(OnPopupMenu_ItemClicked);
                        _popupMenu.Show(this, e.Location);

                    }
                    else if (GetTabPage(_selectedIndex).WindowStyle == IceTabPage.WindowType.Query)
                    {
                        _popupMenu.ItemClicked -= new ToolStripItemClickedEventHandler(OnPopupMenu_ItemClicked);
                        _popupMenu.Items.Clear();

                        if (GetTabPage(_selectedIndex).PinnedTab)
                            _popupMenu.Items.Add(NewMenuItem("Unpin Tab", "/unpin $1"));
                        else
                            _popupMenu.Items.Add(NewMenuItem("Pin Tab", "/pin $1"));

                        if (GetTabPage(_selectedIndex).Detached)
                            _popupMenu.Items.Add(NewMenuItem("Attach Tab", "/attach"));
                        else
                            _popupMenu.Items.Add(NewMenuItem("Detach Tab", "/detach"));

                        _popupMenu.Items.Add(new ToolStripSeparator());

                        _popupMenu.Items.Add(NewMenuItem("Clear Query", "/clear $1"));
                        _popupMenu.Items.Add(NewMenuItem("Close Query", "/part $1"));
                        _popupMenu.Items.Add(NewMenuItem("User Information", "/userinfo $1"));
                        _popupMenu.Items.Add(NewMenuItem("Silence User", "/silence +$1"));

                        if (_parent != null && _parent.LoadedPlugins != null)
                        {
                            foreach (Plugin p in _parent.LoadedPlugins)
                            {
                                IceChatPlugin ipc = p as IceChatPlugin;
                                if (ipc != null)
                                {
                                    if (ipc.plugin.Enabled == true)
                                    {
                                        ToolStripItem[] popServer = ipc.plugin.AddQueryPopups();
                                        if (popServer != null && popServer.Length > 0)
                                        {
                                            _popupMenu.Items.AddRange(popServer);
                                        }
                                    }
                                }
                            }
                        }

                        //add then channel popup menu
                        AddPopupMenu("Query", _popupMenu);

                        _popupMenu.ItemClicked += new ToolStripItemClickedEventHandler(OnPopupMenu_ItemClicked);
                        _popupMenu.Show(this, e.Location);
                    }
                    else if (GetTabPage(_selectedIndex).WindowStyle == IceTabPage.WindowType.ChannelList)
                    {
                        _popupMenu.ItemClicked -= new ToolStripItemClickedEventHandler(OnPopupMenu_ItemClicked);
                        _popupMenu.Items.Clear();
                        _popupMenu = ChannelListPopupMenu();
                        _popupMenu.ItemClicked += new ToolStripItemClickedEventHandler(OnPopupMenu_ItemClicked);
                        _popupMenu.Show(this, e.Location);
                    }
                    else if (GetTabPage(_selectedIndex).WindowStyle == IceTabPage.WindowType.DCCChat)
                    {
                        _popupMenu.ItemClicked -= new ToolStripItemClickedEventHandler(OnPopupMenu_ItemClicked);
                        _popupMenu.Items.Clear();
                        _popupMenu = DCCChatPopupMenu();
                        _popupMenu.ItemClicked += new ToolStripItemClickedEventHandler(OnPopupMenu_ItemClicked);
                        _popupMenu.Show(this, e.Location);
                    }
                    else if (GetTabPage(_selectedIndex).WindowStyle == IceTabPage.WindowType.Window || GetTabPage(_selectedIndex).WindowStyle == IceTabPage.WindowType.Debug)
                    {
                        _popupMenu.ItemClicked -= new ToolStripItemClickedEventHandler(OnPopupMenu_ItemClicked);
                        _popupMenu.Items.Clear();

                        if (GetTabPage(_selectedIndex).PinnedTab)
                            _popupMenu.Items.Add(NewMenuItem("Unpin Tab", "/unpin $1"));
                        else
                            _popupMenu.Items.Add(NewMenuItem("Pin Tab", "/pin $1"));

                        if (GetTabPage(_selectedIndex).Detached)
                            _popupMenu.Items.Add(NewMenuItem("Attach Tab", "/attach"));
                        else
                            _popupMenu.Items.Add(NewMenuItem("Detach Tab", "/detach"));

                        _popupMenu.Items.Add(new ToolStripSeparator());

                        _popupMenu.Items.Add(NewMenuItem("Clear Window", "/clear $1"));
                        _popupMenu.Items.Add(NewMenuItem("Close Window", "/close $1"));

                        if (GetTabPage(_selectedIndex).WindowStyle == IceTabPage.WindowType.Debug)
                        {
                            _popupMenu.Items.Add(new ToolStripSeparator());

                            //add extra items
                            foreach (IRCConnection c in _parent.ServerTree.ServerConnections.Values)
                            {
                                if (c.IsConnected)
                                {
                                    ToolStripMenuItem t = new ToolStripMenuItem();
                                    if (c.ServerSetting.RealServerName.Length > 0)
                                        t.Text = c.ServerSetting.RealServerName;
                                    else
                                        t.Text = c.ServerSetting.ServerName;

                                    if (c.ShowDebug)
                                    {
                                        t.Tag = "/debug disable " + +c.ServerSetting.ID;
                                        t.Checked = true;
                                        _popupMenu.Items.Add(t);
                                    }
                                    else
                                    {
                                        t.Tag = "/debug enable " + +c.ServerSetting.ID;
                                        _popupMenu.Items.Add(t);
                                    }
                                }
                            }
                        }
                        _popupMenu.ItemClicked += new ToolStripItemClickedEventHandler(OnPopupMenu_ItemClicked);
                        _popupMenu.Show(this, e.Location);
                    }
                }
            }

            _dragTab = null;
            _parent.FocusInputBox();
        }
Exemplo n.º 14
0
        public Logging(IceTabPage tabPage)
        {
            this._tabPage = tabPage;

            CreateStandardLog();
        }
Exemplo n.º 15
0
        private void SwapTabPages(IceTabPage drag, IceTabPage hover)
        {
            int Index1 = _TabPages.IndexOf(drag);
            int Index2 = _TabPages.IndexOf(hover);

            if (Index1 == Index2) return;

            _TabPages.Remove(drag);
            _TabPages.Insert(Index2, drag);
        }
Exemplo n.º 16
0
        internal void BringFront(IceTabPage page)
        {
            if (page.Parent != null)
            {
                if (page.Parent.GetType() == typeof(FormWindow))
                {
                    ((FormWindow)page.Parent).SelectTabActivate = false;
                    page.Parent.BringToFront();
                }
                else
                {
                    page.BringToFront();
                }
            }
            else
            {
                page.BringToFront();
            }

            _selectedIndex = page.TabIndex;

            FormMain.Instance.ServerTree.Invalidate();

            _previousTab = _currentTab;

            if (_previousTab.WindowStyle != IceTabPage.WindowType.Console)
               if (_previousTab.TextWindow != null)
                   _previousTab.TextWindow.resetUnreadMarker();

            _currentTab = page;
        }
Exemplo n.º 17
0
 internal void AddTabPage(ref IceTabPage page)
 {
     this._TabPages.Add(page);
 }
Exemplo n.º 18
0
        private void OnControlRemoved(object sender, ControlEventArgs e)
        {
            if (e.Control is IceTabPage)
            {
                if (((IceTabPage)e.Control).DockedForm == false)
                    ((IceTabPage)e.Control).Dispose();

            }
            else if (e.Control is IceTabPageDCCFile)
            {
                if (((IceTabPageDCCFile)e.Control).DockedForm == false)
                    ((IceTabPageDCCFile)e.Control).Dispose();
            }

            foreach (IceTabPage page in this.Controls)
            {
                if (this.Controls.GetChildIndex(page) == 0)
                {
                    //this is the current
                    System.Diagnostics.Debug.WriteLine("Index - 0:" + page.TabCaption);
                    _currentTab = page;
                }

                if (this.Controls.GetChildIndex(page) == 1)
                    _previousTab = page;
            }

            //redraw
            FormMain.Instance.ChannelBar.SelectTab(_currentTab);
            FormMain.Instance.ServerTree.SelectTab(_currentTab, false);
            FormMain.Instance.ServerTree.Invalidate();
        }
Exemplo n.º 19
0
 /// <summary>
 /// Gets a Tab Window
 /// </summary>
 /// <param name="connection">Which Connection to use</param>
 /// <param name="name">Name of the Window</param>
 /// <param name="windowType">The Window Type</param>
 /// <returns></returns>
 internal IceTabPage GetWindow(IRCConnection connection, string sCaption, IceTabPage.WindowType windowType)
 {
     foreach (IceTabPage t in mainChannelBar.TabPages)
     {
         if (t.TabCaption.ToLower() == sCaption.ToLower() && t.WindowStyle == windowType)
         {
             if (t.Connection == null && windowType == IceTabPage.WindowType.DCCFile)
                 return t;
             else if (t.Connection == null && windowType == IceTabPage.WindowType.Debug)
                 return t;
             else if (t.Connection == connection)
                 return t;
         }
         else if (t.WindowStyle == windowType && windowType == IceTabPage.WindowType.ChannelList)
         {
             return t;
         }
     }
     return null;
 }
Exemplo n.º 20
0
        public FormChannelInfo(IceTabPage Channel)
        {
            InitializeComponent();
            this.FormClosing       += new FormClosingEventHandler(OnFormClosing);
            this.Load              += new EventHandler(OnLoad);
            this.textTopic.KeyDown += new KeyEventHandler(textTopic_KeyDown);

            this.channel        = Channel;
            this.textTopic.Text = channel.ChannelTopic.Replace("&#x3;", ((char)3).ToString());
            this.topic          = textTopic.Text;

            this.Text = channel.TabCaption + " [" + channel.ChannelModes + "]  {" + channel.Connection.ServerSetting.RealServerName + "}";
            this.channel.HasChannelInfo  = true;
            this.channel.ChannelInfoForm = this;

            buttonRemoveBan.Enabled = false;

            User u = channel.GetNick(channel.Connection.ServerSetting.CurrentNickName);

            if (u != null && u.Level != null)
            {
                for (int y = 0; y < u.Level.Length; y++)
                {
                    if (u.Level[y])
                    {
                        if (channel.Connection.ServerSetting.StatusModes[0][y] == 'q')
                        {
                            buttonRemoveBan.Enabled = true;
                        }
                        else if (channel.Connection.ServerSetting.StatusModes[0][y] == 'a')
                        {
                            buttonRemoveBan.Enabled = true;
                        }
                        else if (channel.Connection.ServerSetting.StatusModes[0][y] == 'o')
                        {
                            buttonRemoveBan.Enabled = true;
                        }
                        else if (channel.Connection.ServerSetting.StatusModes[0][y] == 'h')
                        {
                            buttonRemoveBan.Enabled = true;
                        }
                    }
                }
            }

            //parse out the modes
            foreach (IceTabPage.channelMode cm in channel.ChannelModesHash.Values)
            {
                switch (cm.mode)
                {
                case 'n':
                    checkModen.Checked = true;
                    modeN = true;
                    break;

                case 't':
                    checkModet.Checked = true;
                    modeT = true;
                    break;

                case 's':
                    checkModes.Checked = true;
                    modeS = true;
                    break;

                case 'i':
                    checkModei.Checked = true;
                    modeI = true;
                    break;

                case 'm':
                    checkModem.Checked = true;
                    modeM = true;
                    break;

                case 'l':
                    checkModel.Checked = true;
                    modeL             = true;
                    textMaxUsers.Text = cm.param;
                    break;

                case 'k':
                    checkModek.Checked = true;
                    modeK = true;
                    textChannelKey.Text = cm.param;
                    break;
                }
            }

            ApplyLanguage();
        }
Exemplo n.º 21
0
        internal void DrawTab(Graphics g, IceTabPage tabPage, int nIndex)
        {
            try
            {
                Rectangle recBounds = _tabSizeRects[nIndex];
                Rectangle tabTextArea = _tabTextRects[nIndex];

                Brush brBack;
                Point[] pt;

                bool bSelected = (this._selectedIndex == nIndex);
                bool bHovered = (this._hoveredIndex == nIndex);

                if (bSelected)
                    brBack = new LinearGradientBrush(recBounds, IrcColor.colors[_parent.IceChatColors.TabBarCurrentBG1], IrcColor.colors[_parent.IceChatColors.TabBarCurrentBG2], 90);
                else if (bHovered)
                    brBack = new LinearGradientBrush(recBounds, IrcColor.colors[_parent.IceChatColors.TabBarHoverBG1], IrcColor.colors[_parent.IceChatColors.TabBarHoverBG2], 90);
                else
                    brBack = new LinearGradientBrush(recBounds, IrcColor.colors[_parent.IceChatColors.TabBarOtherBG1], IrcColor.colors[_parent.IceChatColors.TabBarOtherBG2], 90);

                pt = new Point[7];
                pt[0] = new Point(recBounds.Left + 1, recBounds.Bottom);
                if (bSelected)
                {
                    pt[1] = new Point(recBounds.Left + 1, recBounds.Top + 3);
                    pt[2] = new Point(recBounds.Left + 4, recBounds.Top);
                    pt[3] = new Point(recBounds.Right - 4, recBounds.Top);
                    pt[4] = new Point(recBounds.Right - 1, recBounds.Top + 3);
                }
                else
                {
                    pt[1] = new Point(recBounds.Left + 1, recBounds.Top + 6);
                    pt[2] = new Point(recBounds.Left + 4, recBounds.Top + 3);
                    pt[3] = new Point(recBounds.Right - 4, recBounds.Top + 3);
                    pt[4] = new Point(recBounds.Right - 1, recBounds.Top + 6);
                }
                pt[5] = new Point(recBounds.Right - 1, recBounds.Bottom);
                pt[6] = new Point(recBounds.Left + 1, recBounds.Bottom);

                //paint the background
                if (!tabPage.PinnedTab)
                {
                    g.FillPolygon(brBack, pt);
                    // draw the border around the control
                    g.DrawPolygon(new Pen(Color.Black, 1), pt);
                }

                Image img = null;

                switch (tabPage.WindowStyle)
                {
                    case IceTabPage.WindowType.Console:
                        img = StaticMethods.LoadResourceImage("console.png");
                        break;
                    case IceTabPage.WindowType.Channel:
                        img = StaticMethods.LoadResourceImage("channel.png");
                        break;
                    case IceTabPage.WindowType.Query:
                    case IceTabPage.WindowType.DCCChat:
                        img = StaticMethods.LoadResourceImage("new-query.ico");
                        break;
                    case IceTabPage.WindowType.ChannelList:
                        img = StaticMethods.LoadResourceImage("channellist.png");
                        break;
                    case IceTabPage.WindowType.Window:
                    case IceTabPage.WindowType.Debug:
                        img = StaticMethods.LoadResourceImage("window-icon.ico");
                        break;
                    default:
                        img = StaticMethods.LoadResourceImage("window-icon.ico");
                        break;

                }

                StringFormat stringFormat = new StringFormat();
                stringFormat.Alignment = StringAlignment.Near;
                stringFormat.LineAlignment = StringAlignment.Center;

                Brush br = null;

                //get the tab text color
                if (bSelected)
                {
                    if (tabPage.PinnedTab)
                        br = brBack;
                    else
                        br = new SolidBrush(IrcColor.colors[_parent.IceChatColors.TabBarCurrent]);

                    tabPage.LastMessageType = FormMain.ServerMessageType.Default;
                }
                else
                {
                    switch (tabPage.LastMessageType)
                    {
                        case FormMain.ServerMessageType.JoinChannel:
                            br = new SolidBrush(IrcColor.colors[_parent.IceChatColors.TabBarChannelJoin]);
                            break;
                        case FormMain.ServerMessageType.PartChannel:
                            br = new SolidBrush(IrcColor.colors[_parent.IceChatColors.TabBarChannelPart]);
                            break;
                        case FormMain.ServerMessageType.Message:
                            br = new SolidBrush(IrcColor.colors[_parent.IceChatColors.TabBarNewMessage]);
                            break;
                        case FormMain.ServerMessageType.Action:
                            br = new SolidBrush(IrcColor.colors[_parent.IceChatColors.TabBarNewAction]);
                            break;
                        case FormMain.ServerMessageType.QuitServer:
                            br = new SolidBrush(IrcColor.colors[_parent.IceChatColors.TabBarServerQuit]);
                            break;
                        case FormMain.ServerMessageType.ServerMessage:
                            br = new SolidBrush(IrcColor.colors[_parent.IceChatColors.TabBarServerMessage]);
                            break;
                        case FormMain.ServerMessageType.ServerNotice:
                            br = new SolidBrush(IrcColor.colors[_parent.IceChatColors.TabBarServerNotice]);
                            break;
                        case FormMain.ServerMessageType.BuddyNotice:
                            br = new SolidBrush(IrcColor.colors[_parent.IceChatColors.TabBarBuddyNotice]);
                            break;
                        case FormMain.ServerMessageType.Other:
                            br = new SolidBrush(IrcColor.colors[_parent.IceChatColors.TabBarOtherMessage]);
                            break;
                        default:
                            if (tabPage.PinnedTab)
                                br = brBack;
                            else
                                br = new SolidBrush(IrcColor.colors[_parent.IceChatColors.TabBarDefault]);
                            break;
                    }
                }
                if (!tabPage.PinnedTab)
                {
                    if (tabPage.WindowStyle != IceTabPage.WindowType.Console)
                    {
                        if (tabPage.WindowStyle != IceTabPage.WindowType.ChannelList)
                            g.DrawString(tabPage.TabCaption, _tabFont, br, tabTextArea, stringFormat);
                        else
                            g.DrawString(tabPage.TabCaption + "(" + tabPage.TotalChannels + ")", _tabFont, br, tabTextArea, stringFormat);

                    }
                    else
                    {
                        g.DrawString(_parent.IceChatLanguage.consoleTabTitle, _tabFont, br, tabTextArea, stringFormat);
                    }
                }
                else
                {
                    //pinned tab
                    g.FillPolygon(br, pt);
                    // draw the border around the control
                    g.DrawPolygon(new Pen(Color.Black, 1), pt);
                }

                brBack.Dispose();
                br.Dispose();

                //draw the icon last now
                Rectangle rimage = new Rectangle(recBounds.X, recBounds.Y, img.Width, img.Height);

                int imgY = ((recBounds.Bottom - recBounds.Top) - img.Height) / 2;
                int imgX = 4;
                if (tabPage.PinnedTab)
                    imgX = 6;

                tabPage.FlashValue = _flashValue;

                if (bSelected)
                {
                    //set the image in the verical center of the tab
                    rimage.Offset(imgX, imgY);
                    g.DrawImage(img, rimage);

                    //disable flashing, since it is the current page
                    tabPage.FlashTab = false;
                }
                else
                {
                    rimage.Offset(imgX, imgY + 2);
                    if (tabPage.FlashTab == true)
                    {
                        if (tabPage.FlashValue == 1)
                            g.DrawImage(img, rimage);
                    }
                    else
                        g.DrawImage(img, rimage);
                }
            }
            catch (Exception) { }
        }
Exemplo n.º 22
0
        internal void SelectTab(IceTabPage page)
        {
            _parent.TabMain.BringFront(page);

            for (int i = 0; i < _TabPages.Count; i++)
            {
                if (_TabPages[i] == page)
                {
                    SelectedIndex = i;

                    //for single row.. scroll into view. if needed
                    checkTabLocation(i);

                    this.Invalidate();
                    break;
                }
            }
        }
Exemplo n.º 23
0
 internal void InsertTabPage(int index, ref IceTabPage page)
 {
     this._TabPages.Insert(index, page);
 }
Exemplo n.º 24
0
        private void OnMouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left && singleRow && showScrollItems)
            {
                //check if we have clicked next or previous
                if (e.X >= (this.Width - 44))
                {
                    if (e.X > (this.Width - 22))
                    {
                        //right/next button
                        if (_selectedIndex == _TabPages.Count-1)
                            return;

                        _selectedIndex++;
                        SelectTab(GetTabPage(_selectedIndex));
                    }
                    else
                    {
                        //left/prev button
                        //what position are we
                        if (_selectedIndex == 0)
                            return; //no need to scroll left -all the way there

                        _selectedIndex--;
                        SelectTab(GetTabPage(_selectedIndex));
                    }

                    TabEventArgs te = new TabEventArgs();
                    te.IsHandled = false;
                    SelectedIndexChanged(this, te);

                    return;
                }
            }

            _dragStartPosition = new Point(e.X, e.Y);
            _dragTab = setSelectedByClickLocation(e.Location);

            if (e.Button == MouseButtons.Middle)
            {
                if (_dragTab != null)
                {
                    if (this.OnTabClosed != null)
                        OnTabClosed(SelectedIndex);
                }
            }
        }
Exemplo n.º 25
0
        private void OnMouseMove(object sender, MouseEventArgs e)
        {
            if (_tabSizeRects.Count == 0)
                return;

            int i = 0;

            try
            {

                if (singleRow && showScrollItems)
                {
                    //check if we are over next or previous buttons
                    if (e.X >= (this.Width - 44))
                    {
                        _hoveredIndex = -1;
                        if (e.X > (this.Width - 22))
                        {
                            //right/next button
                            rightButtonHover = true;
                            leftButtonHover = false;
                        }
                        else
                        {
                            //left/prev button
                            rightButtonHover = false;
                            leftButtonHover = true;
                        }

                        this.Invalidate();
                        return;
                    }
                    rightButtonHover = false;
                    leftButtonHover = false;
                }

                //show the tooltip
                if (e.Button == MouseButtons.Left)
                {
                    Rectangle r = new Rectangle(_dragStartPosition, Size.Empty);

                    r.Inflate(SystemInformation.DragSize);

                    if (_dragTab != null)
                    {
                        if (!r.Contains(e.X, e.Y))
                        {
                            IceTabPage hover_Tab = HoverTab(e.Location);
                            if (hover_Tab != null)
                            {
                                SwapTabPages(_dragTab, hover_Tab);
                                _dragTab = setSelectedByClickLocation(e.Location);
                                this.Invalidate();
                            }
                        }
                    }

                    _dragStartPosition = Point.Empty;
                    return;
                }

                if (e.Y < _tabSizeRects[0].Y + 3 || e.Y > _tabSizeRects[_tabSizeRects.Count - 1].Y + _tabSizeRects[0].Height)
                {
                    _hoveredIndex = -1;
                    this.Invalidate();
                    return;
                }

                int iHoveredIndexBeforeClick = _hoveredIndex;

                for (i = 0; i < _tabSizeRects.Count; i++)
                {
                    Rectangle rectTab = _tabSizeRects[i];
                    if ((e.X > rectTab.X && e.X < (rectTab.X + rectTab.Width)) && (e.Y > rectTab.Y && e.Y < (rectTab.Y + rectTab.Height)))
                    {
                        if (this._hoveredIndex != i)
                            this._hoveredIndex = i;

                        //show the tooltip
                        if (toolTipTab != i)
                        {
                            if (_TabPages[i].WindowStyle == IceTabPage.WindowType.Channel)
                            {
                                toolTip.ToolTipTitle = "Channel Information";
                                toolTip.SetToolTip(this, _TabPages[i].TabCaption + " {" + _TabPages[i].Nicks.Count + "} " + "[" + _TabPages[i].ChannelModes + "] {" + _TabPages[i].Connection.ServerSetting.NetworkName + "}");
                            }
                            else if (_TabPages[i].WindowStyle == IceTabPage.WindowType.Query || _TabPages[i].WindowStyle == IceTabPage.WindowType.DCCChat)
                            {
                                toolTip.ToolTipTitle = "User Information";
                                toolTip.SetToolTip(this, _TabPages[i].TabCaption);
                            }
                            else if (_TabPages[i].WindowStyle == IceTabPage.WindowType.Debug || _TabPages[i].WindowStyle == IceTabPage.WindowType.Window || _TabPages[i].WindowStyle == IceTabPage.WindowType.ChannelList || _TabPages[i].WindowStyle == IceTabPage.WindowType.DCCFile)
                            {
                                toolTip.ToolTipTitle = "";
                                toolTip.SetToolTip(this, _TabPages[i].TabCaption);
                            }
                            else if (_TabPages[i].WindowStyle == IceTabPage.WindowType.Console)
                            {
                                int x = 0;
                                foreach (IRCConnection c in _parent.ServerTree.ServerConnections.Values)
                                {
                                    if (c.IsConnected)
                                    {
                                        x++;
                                    }
                                }
                                toolTip.ToolTipTitle = "Console";
                                toolTip.SetToolTip(this, x.ToString() + " servers connected");
                            }

                            toolTipTab = i;
                        }

                        break;
                    }
                }

                if (_hoveredIndex == iHoveredIndexBeforeClick)
                    return;

                this.Invalidate();
            }
            catch (Exception)
            {
                //_parent.WriteErrorFile(_parent.InputPanel.CurrentConnection, "ChannelBar MouseMove:" + e.Y + ":" + e.X + ":i=" + i + ":HoverIndex=" + _hoveredIndex + ":TabRectCount=" + _tabSizeRects.Count + ":TabCount=" + _TabPages.Count + ":" + ex.Message, ex);
            }
        }
Exemplo n.º 26
0
        public Logging(IceTabPage tabPage)
        {
            this._tabPage = tabPage;

            CreateStandardLog();
        }
Exemplo n.º 27
0
        /// <summary>
        /// Add a new Tab Window to the Main Tab Control
        /// </summary>
        /// <param name="connection">Which Connection it came from</param>
        /// <param name="windowName">Window Name of the New Tab</param>
        /// <param name="windowType">Window Type of the New Tab</param>
        internal IceTabPage AddWindow(IRCConnection connection, string windowName, IceTabPage.WindowType windowType)
        {
            if (this.InvokeRequired)
            {
                AddWindowDelegate a = new AddWindowDelegate(AddWindow);
                return (IceTabPage)this.Invoke(a, new object[] { connection, windowName, windowType });
            }
            else
            {
                try
                {
                    IceTabPage page;

                    if (windowType == IceTabPage.WindowType.DCCFile)
                        page = new IceTabPageDCCFile(IceTabPage.WindowType.DCCFile, windowName, this);
                    else
                    {
                        page = new IceTabPage(windowType, windowName, this);
                        page.Connection = connection;
                    }

                    if (page.WindowStyle == IceTabPage.WindowType.Channel)
                    {
                        page.TextWindow.Font = new Font(iceChatFonts.FontSettings[1].FontName, iceChatFonts.FontSettings[1].FontSize);
                        page.ResizeTopicFont(iceChatFonts.FontSettings[1].FontName, iceChatFonts.FontSettings[1].FontSize);
                        //send the message
                        string msg = GetMessageFormat("Self Channel Join");

                        msg = msg.Replace("$nick", connection.ServerSetting.CurrentNickName).Replace("$channel", windowName);
                        if (connection.ServerSetting.LocalIP != null && connection.ServerSetting.LocalIP.ToString().Length > 0)
                            msg = msg.Replace("$host", connection.ServerSetting.IdentName + "@" + connection.ServerSetting.LocalIP.ToString());
                        else
                            msg = msg.Replace("$host", connection.ServerSetting.CurrentNickName);

                        if (iceChatOptions.LogChannel && page.LoggingDisable == false)
                        {
                            page.TextWindow.SetLogFile(iceChatOptions.LogReload);
                        }

                        page.TextWindow.AppendText(msg, "");
                    }
                    else if (page.WindowStyle == IceTabPage.WindowType.Query)
                    {
                        page.TextWindow.Font = new Font(iceChatFonts.FontSettings[2].FontName, iceChatFonts.FontSettings[2].FontSize);
                        if (iceChatOptions.LogQuery)
                            page.TextWindow.SetLogFile(false);
                    }
                    else if (page.WindowStyle == IceTabPage.WindowType.Debug)
                    {
                        page.TextWindow.NoColorMode = true;
                        page.TextWindow.Font = new Font(iceChatFonts.FontSettings[0].FontName, iceChatFonts.FontSettings[0].FontSize);
                        page.TextWindow.SetLogFile(false);
                        page.TextWindow.SetDebugWindow();
                    }
                    else if (page.WindowStyle == IceTabPage.WindowType.Window)
                    {
                        page.TextWindow.Font = new Font(iceChatFonts.FontSettings[0].FontName, iceChatFonts.FontSettings[0].FontSize);
                        if (iceChatOptions.LogWindow)
                            page.TextWindow.SetLogFile(false);
                    }
                    else if (page.WindowStyle == IceTabPage.WindowType.ChannelList)
                    {
                        page.ChannelList.Font = new Font(iceChatFonts.FontSettings[1].FontName, iceChatFonts.FontSettings[1].FontSize);
                    }

                    //find the last window index for this connection
                    int index = 0;

                    if (page.WindowStyle == IceTabPage.WindowType.Channel || page.WindowStyle == IceTabPage.WindowType.Query || page.WindowStyle == IceTabPage.WindowType.DCCChat || page.WindowStyle == IceTabPage.WindowType.DCCFile)
                    {
                        for (int i = 1; i < mainChannelBar.TabPages.Count; i++)
                        {
                            if (mainChannelBar.TabPages[i].Connection == connection)
                                index = i + 1;
                        }
                    }

                    if (index == 0)
                    {
                        if (mainTabControl.windowedMode == true)
                        {
                            page.DockedForm = true;

                            FormWindow fw = new FormWindow(page);
                            fw.Text = page.TabCaption;
                            if (windowType == IceTabPage.WindowType.Channel || windowType == IceTabPage.WindowType.Query)
                                fw.Text += " {" + connection.ServerSetting.NetworkName + "}";
                            fw.MdiParent = this;
                            fw.Show();

                        }
                        else
                        {
                            page.DockedForm = false;

                            mainTabControl.AddTabPage(page);
                        }

                        mainChannelBar.AddTabPage(ref page);
                    }
                    else
                    {
                        if (mainTabControl.windowedMode == true)
                        {
                            page.DockedForm = true;

                            FormWindow fw = new FormWindow(page);
                            fw.Text = page.TabCaption;
                            if (windowType == IceTabPage.WindowType.Channel || windowType == IceTabPage.WindowType.Query)
                                fw.Text += " {" + connection.ServerSetting.NetworkName + "}";
                            fw.MdiParent = this;
                            fw.Show();
                        }
                        else
                        {
                            page.DockedForm = false;

                            mainTabControl.AddTabPage(page);
                        }
                        mainChannelBar.InsertTabPage(index, ref page);
                    }

                    if (page.WindowStyle == IceTabPage.WindowType.Channel || page.WindowStyle == IceTabPage.WindowType.Query)
                    {
                        page.ChannelSettings(page.Connection.ServerSetting.NetworkName, !mainTabControl.Visible);
                        page.TextWindow.ScrollToBottom();
                    }

                    if (page.WindowStyle == IceTabPage.WindowType.Debug)
                    {
                        ChannelSetting cs = ChannelSettings.FindChannel("Debug","");
                        if (cs != null)
                        {
                            page.PinnedTab = cs.PinnedTab;
                            page.WindowLocation = cs.WindowLocation;
                            page.WindowSize = cs.WindowSize;
                        }
                    }

                    if (page.WindowStyle == IceTabPage.WindowType.Query && !iceChatOptions.NewQueryForegound)
                    {
                        mainChannelBar.SelectTab(mainChannelBar.CurrentTab);
                        serverTree.SelectTab(mainChannelBar.CurrentTab, false);
                    }
                    else if (page.WindowStyle == IceTabPage.WindowType.Window)
                    {
                        ChannelSetting cs = ChannelSettings.FindChannel(page.TabCaption, "");
                        if (cs != null)
                        {
                            page.PinnedTab = cs.PinnedTab;
                            page.WindowLocation = cs.WindowLocation;
                            page.WindowSize = cs.WindowSize;
                        }

                        mainChannelBar.Invalidate();
                        serverTree.Invalidate();
                    }
                    else
                    {
                        mainChannelBar.SelectTab(page);
                        nickList.CurrentWindow = page;
                        serverTree.SelectTab(page, false);
                    }

                    if (page.WindowStyle == IceTabPage.WindowType.Query && iceChatOptions.WhoisNewQuery == true)
                    {
                        //dont do a whois IF userinfo window is open
                        if (!OnUserInfoWindowExists(page.Connection, page.TabCaption))
                            ParseOutGoingCommand(page.Connection, "/whois " + page.TabCaption + " " + page.TabCaption);
                    }

                    PluginArgs args = new PluginArgs(page.TextWindow, page.TabCaption, "", "", "");
                    args.Extra = page.WindowStyle.ToString();
                    args.Connection = connection;

                    foreach (Plugin p in loadedPlugins)
                    {
                        IceChatPlugin ipc = p as IceChatPlugin;
                        if (ipc != null)
                        {
                            if (ipc.plugin.Enabled == true)
                                ipc.plugin.NewWindow(args);
                        }
                    }

                    return page;
                }
                catch (Exception e)
                {
                    System.Diagnostics.Debug.WriteLine(e.Source + ":" + e.StackTrace);
                }
                return null;
            }
        }