private void AddNavigateToPoint(IWpfTextViewLineCollection textViewLines, SnapshotPoint point, string key)
        {
            _navigateMap[key] = point;

            var resourceDictionary = _editorFormatMap.GetProperties(EasyMotionNavigateFormatDefinition.Name);

            var span   = new SnapshotSpan(point, key.Length);
            var bounds = textViewLines.GetCharacterBounds(point);

            var label = new Label();

            label.Content    = key;
            label.FontFamily = _classificationFormatMap.DefaultTextProperties.Typeface.FontFamily;
            label.FontSize   = 10.0;
            label.Foreground = resourceDictionary.GetForegroundBrush(EasyMotionNavigateFormatDefinition.DefaultForegroundBrush);
            label.Background = resourceDictionary.GetBackgroundBrush(EasyMotionNavigateFormatDefinition.DefaultBackgroundBrush);
            //            textBox.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));


            Canvas.SetTop(label, bounds.TextTop);
            Canvas.SetLeft(label, bounds.Left);
            Canvas.SetZIndex(label, 10);

            _adornmentLayer.AddAdornment(span, _tag, label);
        }
Beispiel #2
0
        private void AddNavigateToPoint(IWpfTextViewLineCollection textViewLines, SnapshotSpan span, string key)
        {
            _navigateMap[key] = span;

            var resourceDictionary = _editorFormatMap.GetProperties(EasyMotionNavigateFormatDefinition.Name);

            var bounds = textViewLines.GetCharacterBounds(span.Start);

            var textBox = new TextBox();

            textBox.Text       = key;
            textBox.FontFamily = _classificationFormatMap.DefaultTextProperties.Typeface.FontFamily;
            textBox.Foreground = resourceDictionary.GetForegroundBrush(EasyMotionNavigateFormatDefinition.DefaultForegroundBrush);
            textBox.Background = resourceDictionary.GetBackgroundBrush(EasyMotionNavigateFormatDefinition.DefaultBackgroundBrush);
            textBox.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

            Canvas.SetTop(textBox, bounds.TextTop);
            Canvas.SetLeft(textBox, bounds.Left);
            Canvas.SetZIndex(textBox, 10);

            _adornmentLayer.AddAdornment(span, _tag, textBox);
        }
        private void AddNavigateToPoint(IWpfTextViewLineCollection textViewLines, SnapshotPoint point, string key)
        {
            _navigateMap[key] = point;

            var resourceDictionary = _editorFormatMap.GetProperties(EasyMotionNavigateFormatDefinition.Name);

            var span = new SnapshotSpan(point, key.Length);
            var bounds = textViewLines.GetCharacterBounds(point);

            var label = new Label();
            label.Content = key;
            label.FontFamily = _classificationFormatMap.DefaultTextProperties.Typeface.FontFamily;
            label.FontSize = 10.0;
            label.Foreground = resourceDictionary.GetForegroundBrush(EasyMotionNavigateFormatDefinition.DefaultForegroundBrush);
            label.Background = resourceDictionary.GetBackgroundBrush(EasyMotionNavigateFormatDefinition.DefaultBackgroundBrush);
            //            textBox.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));

            Canvas.SetTop(label, bounds.TextTop);
            Canvas.SetLeft(label, bounds.Left);
            Canvas.SetZIndex(label, 10);

            _adornmentLayer.AddAdornment(span, _tag, label);
        }