/*********************************************************************/ /// <summary> /// /// </summary> private void SaveFileAs() { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { SaveFileDialog saveFile = new SaveFileDialog(); saveFile.Filter = "S-Record Files|*.s19;*.mhx|All Files (*.*)|*.*"; saveFile.FilterIndex = 1; saveFile.RestoreDirectory = true; saveFile.ShowDialog(); if (saveFile.FileNames.Length > 0) { if (activeDoc.SaveFileAs(saveFile.FileNames[0])) { activeDoc.Text = activeDoc.ActiveFile; } else { MessageBox.Show("Error saving file!", "Save Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void goToTopToolStripMenuItem_Click(object sender, EventArgs e) { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { activeDoc.GoToLine(0); } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void checkS19ToolStripMenuItem_Click(object sender, EventArgs e) { /* get the active S19 open record and perform the check */ SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { InstantTimer t = new InstantTimer(); activeDoc.CheckFile(); //SRecordizer.LogIt(LogView.LogType.Info, "Checked " + activeDoc.Text + " Ok! (Time = " + t.Stop() + " ms)"); } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void asciiSearchBox_KeyPress(object sender, KeyPressEventArgs e) { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { if (e.KeyChar == '\r') { activeDoc.SearchAscii(asciiSearchBox.Text); } } }
/*********************************************************************/ /// <summary> /// /// </summary> private void SaveFile() { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { if (!activeDoc.SaveFile()) { MessageBox.Show("Error saving file!", "Save Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void deleteRowTsButton_Click(object sender, EventArgs e) { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { activeDoc.DeleteRow(); } else { SystemSounds.Beep.Play(); } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void insertAboveTsButton_Click(object sender, EventArgs e) { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { activeDoc.InsertRowAbove(); } else { SystemSounds.Beep.Play(); } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void clearRowColorsTsButton_Click(object sender, EventArgs e) { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { activeDoc.ClearHighlighting(); } else { SystemSounds.Beep.Play(); } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void filterTsButton_Click(object sender, EventArgs e) { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { SystemSounds.Asterisk.Play(); } else { SystemSounds.Beep.Play(); } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void jumpToTopTsButton_Click(object sender, EventArgs e) { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { activeDoc.GoToLine(0); } else { SystemSounds.Beep.Play(); } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnByteSpacing_Click(object sender, EventArgs e) { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { activeDoc.ToggleDataByteSpacing(); } else { SystemSounds.Beep.Play(); } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void addressBox_KeyPress(object sender, KeyPressEventArgs e) { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { if (e.KeyChar == '\r') { int addr = System.Convert.ToInt32(addressBox.Text, 16); activeDoc.GoToAddress(addr); addressBox.Visible = false; } } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lineNumberBox_KeyPress(object sender, KeyPressEventArgs e) { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { if (e.KeyChar == '\r') { try { int num = System.Convert.ToInt32(lineNumberBox.Text); activeDoc.GoToLine(num); lineNumberBox.Visible = false; } catch { ExceptionTrap.Trap("Error with line number entered!"); } } } }
/*********************************************************************/ /// <summary> /// Opens a selected S19 file and starts the parsing for it /// </summary> void OpenSrecordFile() { OpenFileDialog openFiles = new OpenFileDialog(); openFiles.Filter = "S-Record Files|*.s19;*.mhx|All Files (*.*)|*.*"; openFiles.FilterIndex = 1; openFiles.Multiselect = true; openFiles.RestoreDirectory = true; openFiles.ShowDialog(); if (openFiles.FileNames.Length > 0) { foreach (string filename in openFiles.FileNames) { SRecordView pane = new SRecordView(filename, false); pane.Show(dockPanel); _SRecPanes.Add(pane); _OpenDocCounter++; } } }
/*********************************************************************/ /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void asciiTsButton_Click(object sender, EventArgs e) { SRecordView activeDoc = (SRecordView)dockPanel.ActiveDocument; if (activeDoc != null) { activeDoc.ToggleAscii(); if (findTsButton.Visible == true) { findTsButton.Visible = false; //asciiSearchBox.Visible = false; } else { findTsButton.Visible = true; //asciiSearchBox.Visible = true; } } else { SystemSounds.Beep.Play(); } }