Exemple #1
0
 public void UpdateTextViews()
 {
     if (LeftTextView != null && RightTextView != null)
     {
         CanvasRoot.Invalidate();
     }
 }
Exemple #2
0
        public DiffMapScrollControl()
        {
            this.InitializeComponent();

            CanvasRoot.SizeChanged += (s, e) =>
            {
                CanvasRoot.Invalidate();
            };
        }
Exemple #3
0
        public TextControl()
        {
            this.InitializeComponent();

            _textFormat = new CanvasTextFormat
            {
                FontFamily   = "Consolas",
                FontSize     = 12,
                WordWrapping = CanvasWordWrapping.NoWrap
            };

            CanvasRoot.CreateResources += (s, e) =>
            {
                _defaultForegroundBrush = new CanvasSolidColorBrush(s, _defaultForegroundColor);
                _addedForegroundBrush   = new CanvasSolidColorBrush(s, _addedForegroundColor);
                _removedForegroundBrush = new CanvasSolidColorBrush(s, _removedForegroundColor);

                var stops = new CanvasGradientStop[4]
                {
                    new CanvasGradientStop {
                        Color = _defaultBackgroundColor, Position = 0
                    },
                    new CanvasGradientStop {
                        Color = _defaultBackgroundColor, Position = 0.5f
                    },
                    new CanvasGradientStop {
                        Color = _nullBackgroundColor, Position = 0.5f
                    },
                    new CanvasGradientStop {
                        Color = _nullBackgroundColor, Position = 1
                    }
                };

                _nullBrush = new CanvasLinearGradientBrush(s, stops, CanvasEdgeBehavior.Mirror, CanvasAlphaMode.Premultiplied)
                {
                    StartPoint = new System.Numerics.Vector2(0, 0),
                    EndPoint   = new System.Numerics.Vector2(4, 4)
                };
            };

            CanvasRoot.SizeChanged += (s, e) =>
            {
                CanvasRoot.Invalidate();
            };
        }
Exemple #4
0
        internal void UpdateText()
        {
            if (Text == null)
            {
                return;
            }

            CanvasRoot.Height = Text.LineCount * LineHeight;
            CanvasRoot.Invalidate();

            GutterRoot.Text = this.Text;
            GutterRoot.UpdateHeight(CanvasRoot.Height);

            if (DiffMap != null)
            {
                DiffMap.UpdateTextViews();
            }

            Text.ScrollToLineRequested -= Text_ScrollToLineRequested;
            Text.ScrollToLineRequested += Text_ScrollToLineRequested;
        }
Exemple #5
0
        public GutterControl()
        {
            this.InitializeComponent();

            _textFormat = new CanvasTextFormat
            {
                FontFamily          = "Consolas",
                FontSize            = 12,
                WordWrapping        = CanvasWordWrapping.NoWrap,
                HorizontalAlignment = CanvasHorizontalAlignment.Right
            };

            CanvasRoot.CreateResources += (s, e) =>
            {
                _defaultForegroundBrush = new CanvasSolidColorBrush(s, _defaultForegroundColor);
            };

            CanvasRoot.SizeChanged += (s, e) =>
            {
                CanvasRoot.Invalidate();
            };
        }
Exemple #6
0
 public void UpdateHeight(double height)
 {
     CanvasRoot.Height = height;
     CanvasRoot.Invalidate();
 }
Exemple #7
0
 internal void UpdateText()
 {
     CanvasRoot.Invalidate();
 }