private void OnOpenFile() { if (openFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { System.IO.StreamReader openFile = new System.IO.StreamReader(openFileDialog1.FileName); FileEditor newFileEditor = new FileEditor(tabControl, openFileDialog1.FileName, openFileDialog1.SafeFileName, openFile.ReadToEnd()); if (currentFileEditor.IsNew() && (!currentFileEditor.IsDirty())) { int currentTabIndex = tabControl.SelectedIndex; currentFileEditor = newFileEditor; fileEditors[currentTabIndex] = newFileEditor; tabControl.SelectedTab.Text = openFileDialog1.SafeFileName; tabControl.SelectedTab.Controls.Clear(); tabControl.SelectedTab.Controls.Add(currentFileEditor.GetScintilla()); } else { TabPage newTab = new TabPage(openFileDialog1.SafeFileName); tabControl.TabPages.Add(newTab); currentFileEditor = newFileEditor; fileEditors.Add(newFileEditor); newTab.Controls.Add(currentFileEditor.GetScintilla()); tabControl.SelectTab(fileEditors.Count - 1); } openFile.Close(); } }
private void OnNewWindow() { currentFileEditor = null; fileEditors = new ArrayList(); tabControl = new TabControl(); tabControl.Name = "tabControl"; tabControl.Selected += TabControl_Selected; tabControl.MouseUp += TabControl_MouseUp; menuStrip1.Dock = DockStyle.Top; tabControl.Dock = DockStyle.Fill; splitContainer1.Panel1.Controls.Add(tabControl); splitContainer1.Panel1.Controls.Add(menuStrip1); //Fixed the problem <- Can this line be avoided splitContainer2.Panel1.Controls.Add(tabControl); splitContainer2.Panel1.Controls.Add(menuStrip1); mnu = new ContextMenu(); mnuClose = new MenuItem("Close"); mnuClose.Click += new EventHandler(MnuClose_Click); mnu.MenuItems.AddRange(new MenuItem[] { mnuClose }); uploadButton.Enabled = false; stepButton.Enabled = false; breakPoints = new ArrayList(); if (!File.Exists(lastSessionName)) { OnNewFile(); } else { using (StreamReader reader = new StreamReader(lastSessionName)) { string line; while ((line = reader.ReadLine()) != null) { if (line.Equals("new tab")) { currentFileEditor = new FileEditor(tabControl); fileEditors.Add(currentFileEditor); TabPage newTab = new TabPage(currentFileEditor.ShortName()); tabControl.Controls.Add(newTab); newTab.Controls.Add(currentFileEditor.GetScintilla()); } else { if (File.Exists(line)) { currentFileEditor = new FileEditor(tabControl, line, line.Substring(line.LastIndexOf("\\") + 1), File.ReadAllText(line)); fileEditors.Add(currentFileEditor); TabPage newTab = new TabPage(currentFileEditor.ShortName()); tabControl.Controls.Add(newTab); newTab.Controls.Add(currentFileEditor.GetScintilla()); } } } } } port = 3002; Client client = new Client(address, port, this); }
private void OnNewFile() { currentFileEditor = new FileEditor(tabControl); fileEditors.Add(currentFileEditor); TabPage newTab = new TabPage(currentFileEditor.ShortName()); tabControl.TabPages.Add(newTab); newTab.Controls.Add(currentFileEditor.GetScintilla()); tabControl.SelectTab(fileEditors.Count - 1); }
private void OnNewWindow() { currentFileEditor = null; fileEditors = new ArrayList(); tabControl = new TabControl(); tabControl.Name = "tabControl"; tabControl.Selected += TabControl_Selected; tabControl.MouseUp += TabControl_MouseUp; menuStrip1.Dock = DockStyle.Top; tabControl.Dock = DockStyle.Fill; splitContainer1.Panel1.Controls.Add(tabControl); splitContainer1.Panel1.Controls.Add(menuStrip1); //Fixed the problem <- Can this line be avoided splitContainer2.Panel1.Controls.Add(tabControl); splitContainer2.Panel1.Controls.Add(menuStrip1); mnu = new ContextMenu(); mnuClose = new MenuItem("Close"); mnuClose.Click += new EventHandler(MnuClose_Click); mnu.MenuItems.AddRange(new MenuItem[] { mnuClose }); uploadButton.Enabled = false; stepButton.Enabled = false; breakPoints = new ArrayList(); if (!File.Exists (lastSessionName)) OnNewFile (); else { using (StreamReader reader = new StreamReader (lastSessionName)) { string line; while ((line = reader.ReadLine ()) != null) { if (line.Equals ("new tab")) { currentFileEditor = new FileEditor (tabControl); fileEditors.Add (currentFileEditor); TabPage newTab = new TabPage (currentFileEditor.ShortName ()); tabControl.Controls.Add (newTab); newTab.Controls.Add (currentFileEditor.GetScintilla ()); } else { if (File.Exists (line)) { currentFileEditor = new FileEditor (tabControl, line, line.Substring (line.LastIndexOf ("\\") + 1), File.ReadAllText (line)); fileEditors.Add (currentFileEditor); TabPage newTab = new TabPage (currentFileEditor.ShortName ()); tabControl.Controls.Add (newTab); newTab.Controls.Add (currentFileEditor.GetScintilla ()); } } } } } port = 3002; Client client = new Client(address, port, this); }
private void OnNewFile() { currentFileEditor = new FileEditor (tabControl); fileEditors.Add (currentFileEditor); TabPage newTab = new TabPage (currentFileEditor.ShortName ()); tabControl.TabPages.Add (newTab); newTab.Controls.Add (currentFileEditor.GetScintilla ()); tabControl.SelectTab (fileEditors.Count - 1); }