コード例 #1
0
        public TCTab CreateTab(F_Base file = null, string tabNameOverride = "", FileProcessor.EditorTypes overriedEditor = FileProcessor.EditorTypes.NULL)
        {
            string tabName = tabNameOverride;

            if (file != null)
            {
                tabName = (file.FilePath == null) ? file.TempName : System.IO.Path.GetFileNameWithoutExtension(file.FilePath);
                if (tabNameOverride != "")
                {
                    tabName = CalculateTabName(file);
                }
            }

            TabPage TP = new TabPage(tabName);
            TCTab   tc = new TCTab {
                Name = tabName, owner = this, File = file, tabpage = TP
            };

            Tabs.Add(tc);

            //we have made the link between the tab and file, now we need to make the tab exist

            //we need add the correct controls to the tab
            //to put it in tl;dr land, here we see what type of file we are dealing with, and add an editor to the TCTab we made above
            //literally, we just register it inside the TCTab and then add it to it's associated tab page, take a look 0_0
            //tc's ImplementEditor function will automatically assign an editor for the tc based on the TCTab.File.FileType, however you can override it with the func(<param>)
            tc.ImplementEditor(overriedEditor);
            TabContainer.TabPages.Add(TP);
            return(tc);
        }
コード例 #2
0
        /// <summary>
        /// Create a duplicate view of an editor, note, this creates a direct reference, no cloning of data occurs
        /// </summary>
        /// <param name="tabIndex">The Tab ID to make a copy of</param>
        public void CloneTab(int tabIndex)
        {
            TCTab   oldTC = Tabs[tabIndex];
            TabPage TP    = new TabPage(oldTC.tabpage.Name + ":C"); //please do something better than this lol

            Tabs.Add(new TCTab {
                Name = oldTC.Name, owner = this, File = oldTC.File, tabpage = TP, editor = oldTC.editor, isClone = true
            });
            TabContainer.TabPages.Add(TP);
        }