public void CloseTabByTab(TabCodeInfo tabId) { if (tabCodeInfo.Contains(tabId)) { int index = tabCodeInfo.IndexOf(tabId); CloseTab(index); GC.Collect(); } }
private void Explorer_DoubleClick(object sender, EventArgs e) { TreeView treeView = sender as TreeView; TabCodeInfo choosenTab = treeView.SelectedNode.Tag as CodeStudio.TabCodeInfo; if (!Singletones.codeWindow.IsOpened(choosenTab.path)) { Singletones.codeWindow.LoadFileFromExplorer(choosenTab); } }
private void toolStripMenuItem2_Click(object sender, EventArgs e) { if (ClickOnNode) { TabCodeInfo choosenTab = Explorer.SelectedNode.Tag as CodeStudio.TabCodeInfo; if (choosenTab != null) { Singletones.codeWindow.CloseTabByTab(choosenTab); Explorer.SelectedNode.Remove(); } ClickOnNode = false; } }
private void toolStripMenuItem1_Click(object sender, EventArgs e) { if (ClickOnNode) { TabCodeInfo choosenTab = Explorer.SelectedNode.Tag as CodeStudio.TabCodeInfo; if (choosenTab != null) { if (!Singletones.codeWindow.IsOpened(choosenTab.path)) { Singletones.codeWindow.LoadFileFromExplorer(choosenTab); } } ClickOnNode = false; } }
void CrateTabInTAbControl(TabCodeInfo codeInfo) { TabPage tab = new TabPage(); tab.BackColor = Singletones.settings.DefaultBackground; tab.ForeColor = Singletones.settings.DefaultForeground; tab.Controls.Add(codeInfo.tab); tab.Name = tab.Text = codeInfo.name; tabControl.Controls.Add(tab); tab.TextChanged += delegate(object s, System.EventArgs args) { codeInfo.solutionExprorerNode.Text = tab.Text; }; tabControl.SelectedIndex = tabControl.TabCount - 1; }
void CreateTab(string pathArg, CodeTemplateInfo codeTemplateInfo) { if (IsOpened(pathArg)) { return; } TabCodeInfo codeInfo = new TabCodeInfo(pathArg, codeTemplateInfo); codeInfo.tab.TextChanged += delegate(object s, System.EventArgs args) { AddOrRemAsteriksToName(); void AddOrRemAsteriksToName() { if (tabControl.SelectedIndex != -1) { if (tabCodeInfo[tabControl.SelectedIndex].name[tabCodeInfo[tabControl.SelectedIndex].name.Length - 1] != '*') { tabCodeInfo[tabControl.SelectedIndex].name += "*"; tabCodeInfo[tabControl.SelectedIndex].isSaved = false; } } SetTabTextToRichBoxNames(); } }; tabCodeInfo.Add(codeInfo); TreeNode solutionNode = new TreeNode(codeInfo.name) { Tag = codeInfo }; solutionNode.Tag = codeInfo; codeInfo.solutionExprorerNode = solutionNode; CrateTabInTAbControl(codeInfo); tabControl.SelectedIndex = tabControl.TabCount - 1; Singletones.rightWindow.Explorer.Nodes.Add(solutionNode); codeInfo.syntaxChecker?.HighlightText(codeInfo.tab); }
public void LoadFileFromExplorer(TabCodeInfo codeInfo) { tabCodeInfo.Add(codeInfo); CrateTabInTAbControl(codeInfo); }