Exemple #1
0
        public TextLayer(TextView parent, TextDocument textDocument) : base(parent)
        {
            Document = textDocument;

            elementGenerators = new ObserveAddRemoveCollection <VisualLineElementGenerator>(ElementGenerator_Added, ElementGenerator_Removed);
            lineTransformers  = new ObserveAddRemoveCollection <IVisualLineTransformer>(LineTransformer_Added, LineTransformer_Removed);

            heightTree = new HeightTree(textDocument, Skin.DefaultFont.Size);
            lines      = new Dictionary <DocumentLine, VisualLine>();

            GlobalTextRunProperties = new TextRunProperties {
                Foreground = Color.Black
            };

            lineTransformers = new ObserveAddRemoveCollection <IVisualLineTransformer>(LineTransformer_Added, LineTransformer_Removed);

            HighlightingDefinition = HighlightingManager.DefaultHighlightingManager.Instance.GetDefinition("C#");

            var colorizer = new HighlightingColorizer(highlightingDefinition.MainRuleSet);

            lineTransformers.Add(colorizer);

            weakLineTracker = WeakLineTracker.Register(textDocument, this);

            RebuildDocument();
        }
 /// <summary>
 /// Creates a new TextAreaInputHandler.
 /// </summary>
 public TextAreaInputHandler(TextArea textArea)
 {
     TextArea = textArea ?? throw new ArgumentNullException(nameof(textArea));
     _commandBindings = new ObserveAddRemoveCollection<RoutedCommandBinding>(CommandBinding_Added, CommandBinding_Removed);
     _keyBindings = new List<KeyBinding>();
     _nestedInputHandlers = new ObserveAddRemoveCollection<ITextAreaInputHandler>(NestedInputHandler_Added, NestedInputHandler_Removed);
 }
		/// <summary>
		/// Creates a new TextAreaInputHandler.
		/// </summary>
		public TextAreaInputHandler(TextArea textArea)
		{
			if (textArea == null)
				throw new ArgumentNullException("textArea");
			this.textArea = textArea;
			commandBindings = new ObserveAddRemoveCollection<CommandBinding>(CommandBinding_Added, CommandBinding_Removed);
			inputBindings = new ObserveAddRemoveCollection<InputBinding>(InputBinding_Added, InputBinding_Removed);
			nestedInputHandlers = new ObserveAddRemoveCollection<ITextAreaInputHandler>(NestedInputHandler_Added, NestedInputHandler_Removed);
		}
 /// <summary>
 /// Creates a new TextAreaInputHandler.
 /// </summary>
 public TextAreaInputHandler(TextArea textArea)
 {
     if (textArea == null)
     {
         throw new ArgumentNullException("textArea");
     }
     this.textArea       = textArea;
     commandBindings     = new ObserveAddRemoveCollection <CommandBinding>(CommandBinding_Added, CommandBinding_Removed);
     inputBindings       = new ObserveAddRemoveCollection <InputBinding>(InputBinding_Added, InputBinding_Removed);
     nestedInputHandlers = new ObserveAddRemoveCollection <ITextAreaInputHandler>(NestedInputHandler_Added, NestedInputHandler_Removed);
 }
Exemple #5
0
        public TextLayer(TextView parent, TextDocument textDocument)
            : base(parent)
        {
            Document = textDocument;

            elementGenerators = new ObserveAddRemoveCollection<VisualLineElementGenerator>(ElementGenerator_Added, ElementGenerator_Removed);
            lineTransformers = new ObserveAddRemoveCollection<IVisualLineTransformer>(LineTransformer_Added, LineTransformer_Removed);

            heightTree = new HeightTree(textDocument, 16); //TODO Skin.DefaultFont.Size
            lines = new Dictionary<DocumentLine, VisualLine>();

            GlobalTextRunProperties = new TextRunProperties { Foreground = Color.Black};

            lineTransformers = new ObserveAddRemoveCollection<IVisualLineTransformer>(LineTransformer_Added,LineTransformer_Removed);

            HighlightingDefinition = HighlightingManager.DefaultHighlightingManager.Instance.GetDefinition("C#");

            var colorizer = new HighlightingColorizer(highlightingDefinition.MainRuleSet);
            lineTransformers.Add(colorizer);

            weakLineTracker = WeakLineTracker.Register(textDocument, this);

            RebuildDocument();
        }