private void AddButton_Click(object sender, EventArgs e) { if (ColumnListBox.SelectedIndex == -1) { return; } if (KeywordTextbox.Text == "") { MessageBox.Show(Properties.Resources.NotDefinedKeyword, Properties.Resources.DialogTitleWarning, MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } HighlightDefinition newDef = new HighlightDefinition(); newDef.Keyword = KeywordTextbox.Text; newDef.HighlightColor = KeywordTextbox.BackColor; newDef.Jumpable = JumpableCheckbox.Checked; newDef.CaseSensitive = CaseSensitiveCheckBox.Checked; newDef.TargetColumn = GetTargetColumnDefinition(); highlightDefList.Add(newDef); ShowHighlightDefList(); }
private void CaseSensitiveCheckBox_CheckedChanged(object sender, EventArgs e) { HighlightDefinition def = GetTargetHighlightDef(); if (def == null || isBackground) { return; } def.CaseSensitive = CaseSensitiveCheckBox.Checked; }
private void JumpableCheckbox_CheckedChanged(object sender, EventArgs e) { HighlightDefinition def = GetTargetHighlightDef(); if (def == null || isBackground) { return; } def.Jumpable = JumpableCheckbox.Checked; }
private void KeywordTextbox_TextChanged(object sender, EventArgs e) { HighlightDefinition def = GetTargetHighlightDef(); if (def == null || isBackground) { return; } def.Keyword = KeywordTextbox.Text; HighlightListBox.Items[HighlightListBox.SelectedIndex] = KeywordTextbox.Text; }
private void DeleteButton_Click(object sender, EventArgs e) { HighlightDefinition def = GetTargetHighlightDef(); if (def == null) { return; } highlightDefList.Remove(def); ShowHighlightDefList(); }
private void ColorButton_Click(object sender, EventArgs e) { if (HightlightColorDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { KeywordTextbox.BackColor = HightlightColorDialog.Color; HighlightDefinition def = GetTargetHighlightDef(); if (def == null) { return; } def.HighlightColor = KeywordTextbox.BackColor; } }
private void HighlightListBox_SelectedIndexChanged(object sender, EventArgs e) { HighlightDefinition def = GetTargetHighlightDef(); if (def == null) { return; } isBackground = true; KeywordTextbox.Text = def.Keyword; KeywordTextbox.BackColor = def.HighlightColor; JumpableCheckbox.Checked = def.Jumpable; CaseSensitiveCheckBox.Checked = def.CaseSensitive; isBackground = false; }
/// <summary> /// Set hightlight item to specified value /// </summary> /// <param name="key">Highlight keyword</param> /// <param name="val">Target value</param> /// <param name="col">Log column</param> /// <param name="def">Highlight definition</param> private void SetAllHightlightItems(string key, string val, ParsedLogColumn col, HighlightDefinition def) { log.InPrivate(key, val, col); if (key == "") { return; } string tempVal = val; int removedCount = 0; while (true) { if (tempVal.Contains(key)) { int startIndex = tempVal.IndexOf(key); Highlight highlight = new Highlight(); highlight.HighlightDefinition = def; removedCount += startIndex; highlight.StartIndex = removedCount; removedCount += key.Length; highlight.EndIndex = removedCount; col.HighlightList.Add(highlight); tempVal = tempVal.Substring(startIndex + key.Length); } else { break; } } log.OutPrivate(); }