Beispiel #1
0
 private void RemoveTranslation(TranslationAdornment a)
 {
     a.DetachRequest();
     Translations.Remove(a);
     _layer.RemoveAdornment(a);
     if (Equals(_translationAdornmentFocused, a))
     {
         _translationAdornmentFocused = null;
     }
     InvalidateState();
 }
Beispiel #2
0
        private void RenderTranslation(TranslationAdornment translation)
        {
            var span = translation.Span.GetSpan(_view.TextSnapshot);
            var g    = _view.TextViewLines.GetMarkerGeometry(span);

            if (g != null)
            {
                translation.Margin = new Thickness(g.Bounds.BottomLeft.X, g.Bounds.BottomLeft.Y, 0, 0);
                _layer.AddAdornment(span, null, translation);
            }
        }
 public void AddTranslation(SnapshotSpan span, TranslationRequest request)
 {
     var viewportSize = new Size(_view.ViewportWidth, _view.ViewportHeight);
     ClearTranslations();
     var a = new TranslationAdornment(span, request, viewportSize);
     Translations.Add(a);
     a.AdornmentClosed += OnTranslationClosed;
     RenderTranslation(a);
     InvalidateState();
     a.Focus();
     _translationAdornmentFocused = a;
 }
Beispiel #4
0
        public void AddTranslation(SnapshotSpan span, TranslationRequest request)
        {
            var viewportSize = new Size(_view.ViewportWidth, _view.ViewportHeight);

            ClearTranslations();
            var a = new TranslationAdornment(span, request, viewportSize);

            Translations.Add(a);
            a.AdornmentClosed += OnTranslationClosed;
            RenderTranslation(a);
            InvalidateState();
            a.Focus();
            _translationAdornmentFocused = a;
        }
Beispiel #5
0
        public bool HandleMouseRightButton(MouseButtonEventArgs e)
        {
            if (!m_adorned)
            {
                return(false);
            }

            var translationAdornment = e.Source as TranslationAdornment;

            if (translationAdornment != null)
            {
                _translationAdornmentFocused = translationAdornment;
                return(true);
            }

            ClearTranslations();

            return(false);
        }
        private void RenderTranslation(TranslationAdornment translation)
        {
            var span = translation.Span.GetSpan(_view.TextSnapshot);
            var g = _view.TextViewLines.GetMarkerGeometry(span);

            if (g != null)
            {
                translation.Margin = new Thickness(g.Bounds.BottomLeft.X, g.Bounds.BottomLeft.Y, 0, 0);
                _layer.AddAdornment(span, null, translation);
            }
        }
 private void RemoveTranslation(TranslationAdornment a)
 {
     a.DetachRequest();
     Translations.Remove(a);
     _layer.RemoveAdornment(a);
     if (Equals(_translationAdornmentFocused, a))
         _translationAdornmentFocused = null;
     InvalidateState();
 }
        public bool HandleMouseRightButton(MouseButtonEventArgs e)
        {
            if (!m_adorned)
                return false;

            var translationAdornment = e.Source as TranslationAdornment;
            if (translationAdornment != null)
            {
                _translationAdornmentFocused = translationAdornment;
                return true;
            }

            ClearTranslations();

            return false;
        }