Пример #1
0
        /// <summary>
        /// Called when the behavior is being detached from its
        /// <see cref="Behavior{T}.AssociatedObject"/>, but before it has actually occurred.
        /// </summary>
        protected override void OnDetaching()
        {
            _markerRenderer.Markers = null;
            AssociatedObject.TextArea.TextView.BackgroundRenderers.Remove(_markerRenderer);
            _markerRenderer = null;

            base.OnDetaching();
        }
Пример #2
0
        public DelegatePointMarker(MarkerRenderer renderCallback)
        {
            if (renderCallback == null)
            {
                throw new ArgumentNullException("renderCallback");
            }

            RenderCallback = renderCallback;
        }
Пример #3
0
        /// <summary>
        /// Called after the behavior is attached to an <see cref="Behavior{T}.AssociatedObject"/>.
        /// </summary>
        protected override void OnAttached()
        {
            base.OnAttached();

            _markerRenderer = new MarkerRenderer(AssociatedObject.TextArea.TextView)
            {
                Markers = Markers
            };
            AssociatedObject.TextArea.TextView.BackgroundRenderers.Add(_markerRenderer);
        }
Пример #4
0
        /// <summary>
        /// Called in the constructor of <see cref="TextEditor"/>.
        /// </summary>
        private void Initialize()
        {
            // ----- Bracket markers
            _bracketMarkerRenderer = new MarkerRenderer(TextArea.TextView)
            {
                Markers = new TextSegmentCollection <Marker>()
            };
            _bracketMarkerRenderer.Markers.CollectionChanged += (s, e) => TextArea.TextView.InvalidateLayer(_bracketMarkerRenderer.Layer);
            TextArea.TextView.BackgroundRenderers.Add(_bracketMarkerRenderer);

            // ----- Bracket highlighting
            TextArea.Caret.PositionChanged += (s, e) => UpdateBracketHighlighting();

            // ----- Formatting
            TextArea.TextEntered += OnTextEntered;

            // ----- Add command bindings
            CommandBindings.Add(new CommandBinding(AvalonEditCommands.PasteMultiple, OnPasteMultiple, CanPasteMultiple));
            CommandBindings.Add(new CommandBinding(AvalonEditCommands.Comment, (s, e) => CommentSelection(), CanCommentSelection));
            CommandBindings.Add(new CommandBinding(AvalonEditCommands.Uncomment, (s, e) => UncommentSelection(), CanCommentSelection));
            CommandBindings.Add(new CommandBinding(AvalonEditCommands.ToggleAllFolds, (s, e) => ToggleAllFoldings(), CanToggleFold));
            CommandBindings.Add(new CommandBinding(AvalonEditCommands.ToggleFold, (s, e) => ToggleCurrentFolding(), CanToggleFold));
            CommandBindings.Add(new CommandBinding(AvalonEditCommands.SyntaxHighlighting, (s, e) => SyntaxHighlighting = e.Parameter as IHighlightingDefinition));
        }
Пример #5
0
 public static PointMarker FromRenderer(MarkerRenderer renderer)
 {
     return new DelegatePointMarker(renderer);
 }
		public DelegatePointMarker(MarkerRenderer renderCallback) {
			if (renderCallback == null)
				throw new ArgumentNullException("renderCallback");
	
			RenderCallback = renderCallback;
		}
Пример #7
0
 public static PointMarker FromRenderer(MarkerRenderer renderer)
 {
     return(new DelegatePointMarker(renderer));
 }