public ImeHighlight(EditorView editorView) { _editorView = editorView; _editorHelper = new SourceEditorViewHelper(_editorView); Color highlightColor = SystemColors.HighlightColor; Color color = Color.FromArgb(0x60, highlightColor.R, highlightColor.G, highlightColor.B); Color color3 = Color.FromArgb(180, (Byte)(highlightColor.R / 3), (Byte)(highlightColor.G / 3), (Byte)(highlightColor.B / 3)); _baseBrush = new SolidColorBrush(color); _blinkBrush = new SolidColorBrush(color3); _provisionalSpan = null; Int32 caretBlinkTime = User32.GetCaretBlinkTime(); if (caretBlinkTime > 0) { _blinkTimer = new Timer((Double)caretBlinkTime); _blinkTimer.AutoReset = true; } base.Visibility = Visibility.Hidden; base.IsVisibleChanged += new DependencyPropertyChangedEventHandler(this.OnThisVisibilityChanged); }
/// <summary> /// Initializes a new instance of the <see cref="TextLineVisual"/> class. /// </summary> /// <exception cref="ArgumentNullException"> /// <para><paramref name="textView"/> is <see langword="null"/>.</para> /// </exception> public TextLineVisual(ITextView textView, IList<TextLine> textLines, TextSpan lineSpan, Int32 newLineLength, IList<Int32> virtualCharacters) { if (textView == null) { throw new ArgumentNullException("textView"); } _textView = textView; _textLines = textLines; _newLineLength = newLineLength; _horizontalOffset = 0; _verticalOffset = 0; _startPoint = new TextPoint(lineSpan.TextBuffer, lineSpan.Start); _length = lineSpan.Length; _transform = new TranslateTransform(this.HorizontalOffset, this.VerticalOffset); base.Transform = _transform; if (virtualCharacters != null) { this.CreateVirtualCharacterLookup(virtualCharacters); } this.ComputeLineProperties(); this.RenderText(); }
/// <summary> /// </summary> public Boolean Intersects(TextSpan span) { if (span.TextBuffer == this.TextBuffer) { return base.Intersects(span); } return false; }
/// <summary> /// Initializes a new instance of the <see cref="TextSpan"/> class. /// </summary> /// <exception cref="ArgumentNullException"><paramref name="span"/> is <see langword="null"/>.</exception> public TextSpan(TextSpan span) : base(span) { if (span == null) { throw new ArgumentNullException("span"); } this.Initialize(span.TextBuffer, span.TrackingMode); }
void ICodeEditor.Select(Int32 start, Int32 length) { TextSpan span = new TextSpan(this.TextBuffer, start, length); this.TextView.Selection.Select(span); }
void ICodeEditor.EnsureSpanVisible(Int32 start, Int32 length) { TextSpan span = new TextSpan(this.TextBuffer, start, length); new TextViewHelper(this.TextView).EnsureSpanVisible(span, 0, 0); }