private void MoveItemDown(object obj) { if (selectedIndex == -1) { return; } lock (this) { Debug.Assert(selectedIndex >= 0, "SelectedIndex must be valid, not -1, for moving."); Debug.Assert( selectedIndex < (Highlighters.Count - 1), "SelectedIndex must be a value less than the max index of the collection."); Debug.Assert( Highlighters.Count > 1, "Can only move an item if there are more than one items in the collection."); var oldIndex = selectedIndex; SelectedIndex = -1; lock (Highlighters) { Highlighters.Swap(oldIndex, oldIndex + 1); } SelectedIndex = oldIndex + 1; } }
public void AddHilighter(string searchString, Color foreColor, Color backColor) { if (Highlighters.Rows.Count == 15) { MessageBox.Show(@"Can only have 15 highlighers active at a time."); return; } if (string.IsNullOrEmpty(searchString)) { return; } var newRow = Highlighters.NewRow(); newRow[HighlightSearch.Attributes.Key.ToString()] = searchString; newRow[HighlightSearch.Attributes.Sample.ToString()] = searchString; newRow[HighlightSearch.Attributes.ForeColor.ToString()] = foreColor; newRow[HighlightSearch.Attributes.BackColor.ToString()] = backColor; Highlighters.Rows.Add(newRow); var lastRow = dgvHighlights.Rows[dgvHighlights.Rows.GetLastRow(DataGridViewElementStates.Visible)]; lastRow.Cells[HighlightSearch.Attributes.Sample.ToString()].Style.ForeColor = foreColor; lastRow.Cells[HighlightSearch.Attributes.Sample.ToString()].Style.BackColor = backColor; lastRow.Cells[HighlightSearch.Attributes.Sample.ToString()].Style.SelectionForeColor = foreColor; lastRow.Cells[HighlightSearch.Attributes.Sample.ToString()].Style.SelectionBackColor = backColor; lblCounter.Text = Highlighters.Rows.Count + @"/15"; txtNewHilight.Text = null; FixGridColumnWidths(dgvHighlights); HilightTab(); }
public ReplaceViewModel() { Highlighters = ThemedHighlightingManager.Instance.HighlightingNames.ToList(); Highlighters.Sort(); Highlighters.Insert(0, "None"); CurrentSyntax = "None"; }
public ReplaceViewModel() { Highlighters = ThemedHighlightingManager.Instance.HighlightingNames.ToList(); Highlighters.Sort(); Highlighters.Insert(0, "None"); CurrentSyntax = "None"; ApplicationFontFamily = GrepSettings.Instance.Get <string>(GrepSettings.Key.ApplicationFontFamily); ReplaceFormFontSize = GrepSettings.Instance.Get <double>(GrepSettings.Key.ReplaceFormFontSize); }
public PreviewViewModel() { Highlighters = ThemedHighlightingManager.Instance.HighlightingNames.ToList(); Highlighters.Sort(); Highlighters.Insert(0, "None"); CurrentSyntax = "None"; PropertyChanged += PreviewViewModel_PropertyChanged; }
private void RemoveHighlighter(object obj) { IRemoveHighlighterService service = new RemoveHighlighterService(); var highlighter = Highlighters.ElementAt(SelectedIndex); Debug.Assert(highlighter != null, "Should not be able to run this if no highlighter is selected!"); service.Remove(highlighter); }
private void EditHighlighter(object obj) { IEditHighlighterService editService = new EditHighlighterService(); var highlighter = Highlighters.ElementAt(SelectedIndex); if (highlighter != null) { editService.Edit(highlighter); } }
public PreviewViewModel() { Highlighters = ThemedHighlightingManager.Instance.HighlightingNames.ToList(); Highlighters.Sort(); Highlighters.Insert(0, "None"); CurrentSyntax = "None"; HighlightsOn = GrepSettings.Instance.Get <bool>(GrepSettings.Key.HighlightMatches); PropertyChanged += PreviewViewModel_PropertyChanged; }
public ReplaceViewModel() { Highlighters = ThemedHighlightingManager.Instance.HighlightingNames.ToList(); Highlighters.Sort(); Highlighters.Insert(0, Resources.Replace_SyntaxNone); CurrentSyntax = Resources.Replace_SyntaxNone; ApplicationFontFamily = GrepSettings.Instance.Get <string>(GrepSettings.Key.ApplicationFontFamily); ReplaceFormFontSize = GrepSettings.Instance.Get <double>(GrepSettings.Key.ReplaceFormFontSize); ResultsFontFamily = GrepSettings.Instance.Get <string>(GrepSettings.Key.ResultsFontFamily); IsFullDialog = GrepSettings.Instance.Get <bool>(GrepSettings.Key.ShowFullReplaceDialog); }
private static int getBorder(Highlighters control) { int border = Preferences.HighlighterBorder; if (control == Highlighters.Parent) { border = Preferences.HighlighterBorderParent; } // else if (control == Highlighters.FirstChild) { // border = Preferences.HighlighterBorderFirstChild; // } return(border); }
private void InitializeHighlighters() { var items = ThemedHighlightingManager.Instance.HighlightingNames.ToList(); items.Sort(); items.Insert(0, Resources.Preview_SyntaxNone); Highlighters.Clear(); foreach (var item in items) { Highlighters.Add(item); } CurrentSyntax = Resources.Preview_SyntaxNone; }
public PreviewViewModel() { Highlighters = ThemedHighlightingManager.Instance.HighlightingNames.ToList(); Highlighters.Sort(); Highlighters.Insert(0, "None"); CurrentSyntax = "None"; HighlightsOn = GrepSettings.Instance.Get <bool>(GrepSettings.Key.HighlightMatches); ApplicationFontFamily = GrepSettings.Instance.Get <string>(GrepSettings.Key.ApplicationFontFamily); MainFormFontSize = GrepSettings.Instance.Get <double>(GrepSettings.Key.MainFormFontSize); PropertyChanged += PreviewViewModel_PropertyChanged; }
private void paintTopSide( Highlighters control, int border, NativeMethods.CursorPoint p, double height, double width, Color?color) // System.Nullable<System.Drawing.Color> color) { topSide = new Side(p.X, p.Y - (border / 2), width, border, control, color); }
private void createHighlighter( double height, double width, double X, double Y, int intHandle, Highlighters control, Color?color) { try { if (height == 0 || width == 0) { return; } int border = getBorder(control); NativeMethods.CursorPoint p = getPoint( X, Y, intHandle); //; paintLeftSide(control, border, p, height, width, color); paintTopSide(control, border, p, height, width, color); paintRightSide(control, border, p, height, width, color); paintBottomSide(control, border, p, height, width, color); /* * if (height != 0 && width != 0) { * * int border = getBorder(control); * NativeMethods.CursorPoint p = * getPoint( * X, * Y, * intHandle);; * * this.paintLeftSide(control, border, p, height, width, color); * this.paintTopSide(control, border, p, height, width, color); * this.paintRightSide(control, border, p, height, width, color); * this.paintBottomSide(control, border, p, height, width, color); * } */ } catch { //(Exception eHighlighter) { } }
public Highlighter( double height, double width, double X, double Y, int intHandle, Highlighters control) { this.disposeSides(); this.createHighlighter( height, width, X, Y, intHandle, control); }
/// <summary> /// Writes the given record to the console and highlights certain parts of the line. /// </summary> /// <param name="record">The record to write to the console.</param> protected void WriteConsoleRecord(string record) { if (!Highlighters.Any()) { return; } // Create base highlighter collection instance var highlights = Highlighters[0].GetHighlights(ref record); // Combine all the other collections with the first for (int i = 1; i < Highlighters.Count; i++) { highlights.AddRange(Highlighters[i].GetHighlights(ref record)); } // Write the record using the highlight colors highlights.Print(); }
public Highlighter( double height, double width, double X, double Y, int intHandle, Highlighters control, Color? color) { disposeSides(); createHighlighter( height, width, X, Y, intHandle, control, color); }
public Highlighter( double height, double width, double X, double Y, int intHandle, Highlighters control, Color?color) { disposeSides(); createHighlighter( height, width, X, Y, intHandle, control, color); }
private void MoveItemUp(object obj) { if (selectedIndex != -1) { lock (this) { Debug.Assert(selectedIndex >= 0, "SelectedIndex must be valid, e.g not -1."); Debug.Assert( Highlighters.Count > 1, "Can not move item unless more than one item in the collection."); int oldIndex = selectedIndex; SelectedIndex = -1; lock (Highlighters) { Highlighters.Swap(oldIndex, oldIndex - 1); } SelectedIndex = oldIndex - 1; } } }
public Highlighter( double height, double width, double X, double Y, int intHandle, Highlighters control, int highlighterNumber, string highlighterData) { createHighlighter( height, width, X, Y, intHandle, control, null); PaintLabel(highlighterNumber, highlighterData); }
public Highlighter( double height, double width, double X, double Y, int intHandle, Highlighters control, // 20130423 System.Nullable<System.Drawing.Color> color) { this.disposeSides(); this.createHighlighter( height, width, X, Y, intHandle, control, // 20130423 color); }
public void Initialise() { Debug.Assert(!Highlighters.Any(), "Should not have any contents at initialisation"); Highlighters.Add(new StandardHighlighter("Trace", true, LogEntryField.Type, MatchMode.Exact, "TRACE", new HighlighterStyle { Background = Colors.LightGray }) as T); Highlighters.Add(new StandardHighlighter("Debug", true, LogEntryField.Type, MatchMode.Exact, "DEBUG", new HighlighterStyle { Background = Colors.LightGreen }) as T); Highlighters.Add(new StandardHighlighter("Info", true, LogEntryField.Type, MatchMode.Exact, "INFO", new HighlighterStyle { Foreground = Colors.White, Background = Colors.Blue }) as T); Highlighters.Add(new StandardHighlighter("Warn", true, LogEntryField.Type, MatchMode.Exact, "WARN", new HighlighterStyle { Background = Colors.Yellow }) as T); Highlighters.Add(new StandardHighlighter("Error", true, LogEntryField.Type, MatchMode.Exact, "ERROR", new HighlighterStyle { Foreground = Colors.White, Background = Colors.Red }) as T); Highlighters.Add(new StandardHighlighter("Fatal", true, LogEntryField.Type, MatchMode.Exact, "FATAL", new HighlighterStyle { Foreground = Colors.Yellow, Background = Colors.Black }) as T); }
private void createHighlighter( double height, double width, double X, double Y, int intHandle, Highlighters control) { try { if (height != 0 && width != 0) { int border = getBorder(control); NativeMethods.CursorPoint p = getPoint( X, Y, intHandle);; this.paintLeftSide(control, border, p, height, width); this.paintTopSide(control, border, p, height, width); this.paintRightSide(control, border, p, height, width); this.paintBottomSide(control, border, p, height, width); } } catch { //(Exception eHighlighter) { } }
public Side( double left, double top, double width, double height, Highlighters control, Color?color) { TopMost = true; FormBorderStyle = FormBorderStyle.FixedToolWindow; Visible = false; Opacity = 0.5; if (null != color) { BackColor = (Color)color; ForeColor = (Color)color; } else { switch (control) { case Highlighters.Parent: BackColor = Preferences.HighlighterColorParent; ForeColor = Preferences.HighlighterColorParent; break; case Highlighters.Element: BackColor = Preferences.HighlighterColor; ForeColor = Preferences.HighlighterColor; break; default: BackColor = Color.FromKnownColor(ExecutionPlan.colorTable[(int)control]); ForeColor = Color.FromKnownColor(ExecutionPlan.colorTable[(int)control]); break; } // else if (control == Highlighters.FirstChild) { // this.BackColor = Preferences.HighlighterColorFirstChild; // this.ForeColor = Preferences.HighlighterColorFirstChild; // } /* * if (control == Highlighters.Parent) { * this.BackColor = Preferences.HighlighterColorParent; * this.ForeColor = Preferences.HighlighterColorParent; * } else if (control == Highlighters.Element) { * this.BackColor = Preferences.HighlighterColor; * this.ForeColor = Preferences.HighlighterColor; * } else { * this.BackColor = Color.FromKnownColor(ExecutionPlan.colorTable[(int)control]); * this.ForeColor = Color.FromKnownColor(ExecutionPlan.colorTable[(int)control]); * } */ } AllowTransparency = true; ControlBox = false; ShowIcon = false; ShowInTaskbar = false; TopLevel = true; UseWaitCursor = false; WindowState = FormWindowState.Normal; Left = (int)left; Top = (int)top; Width = 0; Height = 0; Show(); Hide(); Left = (int)left; Top = (int)top; Width = (int)width; Height = (int)height; Enabled = false; FormBorderStyle = FormBorderStyle.FixedToolWindow; ShowInTaskbar = false; UseWaitCursor = false; Visible = true; Show(); }
public Side( double left, double top, double width, double height, Highlighters control, Color? color) { TopMost = true; FormBorderStyle = FormBorderStyle.FixedToolWindow; Visible = false; Opacity = 0.5; if (null != color) { BackColor = (Color)color; ForeColor = (Color)color; } else { switch (control) { case Highlighters.Parent: BackColor = Preferences.HighlighterColorParent; ForeColor = Preferences.HighlighterColorParent; break; case Highlighters.Element: BackColor = Preferences.HighlighterColor; ForeColor = Preferences.HighlighterColor; break; default: BackColor = Color.FromKnownColor(ExecutionPlan.colorTable[(int)control]); ForeColor = Color.FromKnownColor(ExecutionPlan.colorTable[(int)control]); break; } // else if (control == Highlighters.FirstChild) { // this.BackColor = Preferences.HighlighterColorFirstChild; // this.ForeColor = Preferences.HighlighterColorFirstChild; // } /* if (control == Highlighters.Parent) { this.BackColor = Preferences.HighlighterColorParent; this.ForeColor = Preferences.HighlighterColorParent; } else if (control == Highlighters.Element) { this.BackColor = Preferences.HighlighterColor; this.ForeColor = Preferences.HighlighterColor; } else { this.BackColor = Color.FromKnownColor(ExecutionPlan.colorTable[(int)control]); this.ForeColor = Color.FromKnownColor(ExecutionPlan.colorTable[(int)control]); } */ } AllowTransparency = true; ControlBox = false; ShowIcon = false; ShowInTaskbar = false; TopLevel = true; UseWaitCursor = false; WindowState = FormWindowState.Normal; Left = (int)left; Top = (int)top; Width = 0; Height = 0; Show(); Hide(); Left = (int)left; Top = (int)top; Width = (int)width; Height = (int)height; Enabled = false; FormBorderStyle = FormBorderStyle.FixedToolWindow; ShowInTaskbar = false; UseWaitCursor = false; Visible = true; Show(); }
public IHighlighterStyle IsHighlighted(ILogEntry logEntry) { return(Highlighters.Where(h => h.IsMatch(logEntry)).Select(h => h.Style).FirstOrDefault()); }
private void paintLeftSide( //AutomationElement element, Highlighters control, int border, NativeMethods.CursorPoint p, double height, double width, // 20130423 System.Nullable<System.Drawing.Color> color) { leftSide = new Side(p.X - (border / 2), p.Y, border, height, control, // 20130423 color); }
private void paintRightSide( Highlighters control, int border, NativeMethods.CursorPoint p, double height, double width, // 20130423 System.Nullable<System.Drawing.Color> color) { rightSide = new Side(p.X + width - (border / 2), p.Y, border, height, control, // 20130423 color); }
private void paintBottomSide( Highlighters control, int border, NativeMethods.CursorPoint p, double height, double width, // 20130423 System.Nullable<System.Drawing.Color> color) { bottomSide = new Side(p.X, p.Y + height - (border / 2), width, border, control, // 20130423 color); }
private void paintTopSide( Highlighters control, int border, NativeMethods.CursorPoint p, double height, double width, Color? color) // System.Nullable<System.Drawing.Color> color) { topSide = new Side(p.X, p.Y - (border / 2), width, border, control, color); }
public Side( double left, double top, double width, double height, Highlighters control) { //this.Left = 0; //this.Top = 0; //this.Width = 1; //this.Height = 1; this.TopMost = true; //this.FormBorderStyle = FormBorderStyle.None; this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.Visible = false; this.Opacity = 0.5; if (control == Highlighters.Parent) { this.BackColor = Preferences.HighlighterColorParent; this.ForeColor = Preferences.HighlighterColorParent; } else if (control == Highlighters.Element) { this.BackColor = Preferences.HighlighterColor; this.ForeColor = Preferences.HighlighterColor; } else { this.BackColor = Color.FromKnownColor(ExecutionPlan.colorTable[(int)control]); this.ForeColor = Color.FromKnownColor(ExecutionPlan.colorTable[(int)control]); } // else if (control == Highlighters.FirstChild) { // this.BackColor = Preferences.HighlighterColorFirstChild; // this.ForeColor = Preferences.HighlighterColorFirstChild; // } this.AllowTransparency = true; this.ControlBox = false; this.ShowIcon = false; this.ShowInTaskbar = false; this.TopLevel = true; this.UseWaitCursor = false; this.WindowState = FormWindowState.Normal; // 20130322 this.Left = (int)left; this.Top = (int)top; this.Width = 0; this.Height = 0; this.Show(); this.Hide(); this.Left = (int)left; this.Top = (int)top; this.Width = (int)width; this.Height = (int)height; this.Enabled = false; this.FormBorderStyle = FormBorderStyle.FixedToolWindow; this.ShowInTaskbar = false; this.UseWaitCursor = false; this.Visible = true; this.Show(); }
private void paintBottomSide( Highlighters control, int border, NativeMethods.CursorPoint p, double height, double width) { bottomSide = new Side(p.X, p.Y + height - (border / 2), width, border, control); }
private void paintRightSide( Highlighters control, int border, NativeMethods.CursorPoint p, double height, double width) { rightSide = new Side(p.X + width - (border / 2), p.Y, border, height, control); }
private void paintLeftSide( //AutomationElement element, Highlighters control, int border, NativeMethods.CursorPoint p, double height, double width) { leftSide = new Side(p.X - (border / 2), p.Y, border, height, control); }
private static int getBorder(Highlighters control) { int border = Preferences.HighlighterBorder; if (control == Highlighters.Parent) { border = Preferences.HighlighterBorderParent; } // else if (control == Highlighters.FirstChild) { // border = Preferences.HighlighterBorderFirstChild; // } return border; }