/// <summary> /// Gets how text marked with specified ID should be decorated. /// </summary> /// <param name="markingID">The ID of the marking.</param> /// <returns>TextDecoration object associated with specified ID, or null.</returns> /// <exception cref="System.ArgumentOutOfRangeException"> /// Parameter <paramref name="markingID"/> is out of valid range. /// </exception> /// <exception cref="System.ArgumentException"> /// Parameter <paramref name="markingID"/> is not registered to Marking class. /// </exception> /// <seealso cref="Sgry.Azuki.ColorScheme.GetMarkingDecorations(int[])">ColorScheme.GetMarkingDecorations(int[]) method</seealso> /// <seealso cref="Sgry.Azuki.ColorScheme.GetMarkingDecorations(uint)">ColorScheme.GetMarkingDecorations(uint) method</seealso> /// <seealso cref="Sgry.Azuki.ColorScheme.SetMarkingDecoration">ColorScheme.SetMarkingDecoration method</seealso> public TextDecoration GetMarkingDecoration(int markingID) { if (Marking.GetMarkingInfo(markingID) == null) { throw new ArgumentException("Specified markingID is not registered. (markingID:" + markingID + ")", "markingID"); } return(_MarkingDecorations[markingID]); }
/// <summary> /// Creates a new instance. /// </summary> /// <param name="markingID"> /// The marking ID to be marked for each found matching patterns. /// </param> /// <param name="patternToBeWatched"> /// The pattern to be watched and to be marked with '<paramref name="markingID"/>.' /// </param> /// <exception cref="System.ArgumentException"> /// Parameter '<paramref name="markingID"/>' is invalid or not registered. /// </exception> public WatchPattern(int markingID, Regex patternToBeWatched) { if (Marking.GetMarkingInfo(markingID) == null) { throw new ArgumentException("Specified marking ID (" + markingID + ") is" + " not registered.", "markingID"); } MarkingID = markingID; Pattern = patternToBeWatched; }
/// <summary> /// Sets how text parts marked with specified ID should be decorated. /// </summary> /// <param name="markingID">The marking ID.</param> /// <param name="decoration"> /// TextDecoration object to be associated with <paramref name="markingID"/>. /// If null was specified, TextDecoration.None will be used internally. /// </param> /// <seealso cref="Sgry.Azuki.ColorScheme.GetMarkingDecoration">ColorScheme.GetMarkingDecoration method</seealso> /// <seealso cref="Sgry.Azuki.ColorScheme.GetMarkingDecorations(uint)">ColorScheme.GetMarkingDecorations(uint) method</seealso> /// <seealso cref="Sgry.Azuki.ColorScheme.GetMarkingDecorations(int[])">ColorScheme.GetMarkingDecorations(int[]) method</seealso> public void SetMarkingDecoration(int markingID, TextDecoration decoration) { if (Marking.GetMarkingInfo(markingID) == null) { throw new ArgumentException("Specified marking ID is not registered. (markingID:" + markingID + ")", "markingID"); } if (decoration == null) { decoration = TextDecoration.None; } _MarkingDecorations[markingID] = decoration; }
public void ResetCursorGraphic(Point?cursorScreenPos) { // check state bool onLineNumberArea = false; bool onHRulerArea = false; bool onSelectedText = false; MouseCursor?cursorType = null; if (cursorScreenPos != null) { int index; if (cursorScreenPos.Value.X < View.XofLeftMargin) { onLineNumberArea = true; } else if (cursorScreenPos.Value.Y < View.YofTopMargin) { onHRulerArea = true; } else if (Document.RectSelectRanges == null) { var virPos = cursorScreenPos.Value; View.ScreenToVirtual(ref virPos); index = View.GetIndexFromVirPos(virPos); onSelectedText = Document.SelectionManager.IsInSelection(index); if (onSelectedText == false) { foreach (int id in Document.GetMarkingsAt(index)) { var info = Marking.GetMarkingInfo(id); if (info.MouseCursor != MouseCursor.IBeam) { cursorType = info.MouseCursor; } } } } } // set cursor graphic if (_MouseDragEditing) { _UI.SetCursorGraphic(MouseCursor.DragAndDrop); } else if (_UI.SelectionMode == TextDataType.Rectangle || onLineNumberArea || onHRulerArea || onSelectedText) { _UI.SetCursorGraphic(MouseCursor.Arrow); } else if (cursorType.HasValue) { _UI.SetCursorGraphic(cursorType.Value); } else { _UI.SetCursorGraphic(MouseCursor.IBeam); } }