/* * New, Save, Save As, Open */ public void NewFile() { CheckSaveChange(); // Saves the old file if it has any changes TextSplitText TST_temp = new TextSplitText(TST); TST.Empty(); SaveAsFile("New File"); if (saveCancel) { TST = TST_temp; } else { Width = 300; Height = 300; } }
// Opens a new window and loads the .tst file with the given fileName // If the file doesn't exist (e.g. fileName = ""), then it will open the example file public TextSplitShow(string fileName, bool addToFileNames) { InitializeComponent(); FormClosing += new FormClosingEventHandler(TSS_Closing); tTextBox.GotFocus += new EventHandler(tTextBox_GotFocus); tTextBox.LostFocus += new EventHandler(tTextBox_Unfocus); tTextBox.MouseEnter += new EventHandler(tTextBox_MouseEnter); SizeChanged += new EventHandler(TSS_SizeChanged); Resize += new EventHandler(TSS_Resize); saveToolStripMenuItem.Click += new EventHandler(Globals.TSM.saveToolStripMenuItem_Click); saveAsToolStripMenuItem.Click += new EventHandler(Globals.TSM.saveAsToolStripMenuItem_Click); currentSlide = 0; fileLoaded = false; saveChanged = false; this.fileName = fileName; TST = new TextSplitText(); Globals.CurrentWindow = this; Globals.WindowList.Add(this); if (addToFileNames) { Properties.Settings.Default.FileNames.Add(fileName); } serializer = new Serializer(); try { TST = serializer.DeSerializeObject(fileName); FileChangeActions(); } catch (Exception) { this.fileName = "Example"; TST.Empty(); ChangeFilenameSaved(); Globals.UpdateSlideInfo(); Globals.ChangeDisableHK(); Globals.ChangeReadOnly(); } }
// Opens a new window and loads the .tst file with the given fileName // If the file doesn't exist (e.g. fileName = ""), then it will open the example file public TextSplitShow(string fileName, bool addToFileNames) { InitializeComponent(); FormClosing += new FormClosingEventHandler(TSS_Closing); tTextBox.GotFocus += new EventHandler(tTextBox_GotFocus); tTextBox.LostFocus += new EventHandler(tTextBox_Unfocus); tTextBox.MouseEnter += new EventHandler(tTextBox_MouseEnter); SizeChanged += new EventHandler(TSS_SizeChanged); Resize += new EventHandler(TSS_Resize); saveToolStripMenuItem.Click += new EventHandler(Globals.TSM.saveToolStripMenuItem_Click); saveAsToolStripMenuItem.Click += new EventHandler(Globals.TSM.saveAsToolStripMenuItem_Click); currentSlide = 0; fileLoaded = false; saveChanged = false; this.fileName = fileName; TST = new TextSplitText(); Globals.CurrentWindow = this; Globals.WindowList.Add(this); if (addToFileNames) Properties.Settings.Default.FileNames.Add(fileName); serializer = new Serializer(); try { TST = serializer.DeSerializeObject(fileName); FileChangeActions(); } catch (Exception) { this.fileName = "Example"; TST.Empty(); ChangeFilenameSaved(); Globals.UpdateSlideInfo(); Globals.ChangeDisableHK(); Globals.ChangeReadOnly(); } }