public void AddTab(string fileName)
        {
            Form.LogWindow.AppendText("\nCreating new material tab...");
            if (TabControl.TabCount > 0)
            {
                TabControl.TabPages.Remove(TabControl.TabPages[TabControl.TabPages.Count - 1]);
            }
            var ruler   = new Ruler();
            var map     = new DocumentMap();
            var textBox = new TextEditorControl();
            var page    = new TabPage();

            Form.LogWindow.AppendText("\nCreate control layout, bounds, and themes..");

            ruler.Dock       = System.Windows.Forms.DockStyle.Top;
            ruler.Target     = textBox;
            ruler.BackColor  = ColorTranslator.FromHtml("#f8f8f8");
            ruler.BackColor2 = ColorTranslator.FromHtml("#f8f8f8");
            ruler.Visible    = false;

            map.Dock                      = System.Windows.Forms.DockStyle.Right;
            map.Target                    = textBox;
            map.Width                     = 100;
            map.BackColor                 = Color.White;
            map.Visible                   = false;
            map.MapBackground             = ColorTranslator.FromHtml("#e3e3e3");
            map.ScrollbarVisible          = false;
            textBox.Dock                  = System.Windows.Forms.DockStyle.Fill;
            textBox.AutoCompleteBrackets  = true;
            textBox.AutoIndent            = true;
            textBox.LeftPadding           = 25;
            textBox.IndentBackColor       = Color.White;
            textBox.ServiceLinesColor     = Color.White;
            textBox.LineNumberColor       = Color.Teal;
            textBox.Font                  = new Font("Consolas", 9);
            textBox.Language              = detectLang(fileName);
            textBox.FoldingIndicatorColor = Color.FromArgb(156, 156, 156);
            if (File.Exists(fileName))
            {
                textBox.OpenFile(fileName);

                Properties.Settings.Default.Recent += fileName + "|";
                Properties.Settings.Default.Save();
            }
            page = new TabPage
            {
                Text = Path.GetFileName(fileName),
                Tag  = fileName
            };
            textBox.AllowSeveralTextStyleDrawing = true;
            textBox.DragEnter += TextBox_DragEnter;
            textBox.DragDrop  += TextBox_DragDrop;
            textBox.AllowDrop  = true;
            FindTextTemplate find = new FindTextTemplate(textBox);

            find.Dock = DockStyle.Top;
            ReplaceTextTemplate replace = new ReplaceTextTemplate(textBox);

            replace.Dock = DockStyle.Top;
            //  page.Controls.Add (find);
            //page.Controls.Add (replace);
            Form.LogWindow.AppendText("\nAdding new themed controls to tabs..");
            page.Controls.Add(ruler);
            page.Controls.Add(map);
            page.Controls.Add(textBox);
            textBox.BringToFront();
            TabControl.TabPages.Add(page);
            Form.LogWindow.AppendText("\nCreating a new instance of new tab button");
            TabControl.TabPages.Add(new TabPage()
            {
                Text = "+"
            });
            TabControl.SelectedTab = page;
            Form.LogWindow.AppendText("\nTab created: [" + fileName + ", TabIndex: " + Convert.ToString(TabControl.TabPages.Count - 1) + "]");
        }