Example #1
0
 public HexCaretLayer(HexCaretImpl hexCaret, HexAdornmentLayer layer, VSTC.IClassificationFormatMap classificationFormatMap, VSTC.IClassificationTypeRegistryService classificationTypeRegistryService)
 {
     if (hexCaret == null)
     {
         throw new ArgumentNullException(nameof(hexCaret));
     }
     if (layer == null)
     {
         throw new ArgumentNullException(nameof(layer));
     }
     if (classificationFormatMap == null)
     {
         throw new ArgumentNullException(nameof(classificationFormatMap));
     }
     if (classificationTypeRegistryService == null)
     {
         throw new ArgumentNullException(nameof(classificationTypeRegistryService));
     }
     overwriteMode = true;
     this.hexCaret = hexCaret;
     this.layer    = layer;
     this.classificationFormatMap    = classificationFormatMap;
     activeCaretClassificationType   = classificationTypeRegistryService.GetClassificationType(CTC.ThemeClassificationTypeNames.HexCaret);
     inactiveCaretClassificationType = classificationTypeRegistryService.GetClassificationType(CTC.ThemeClassificationTypeNames.HexInactiveCaret);
     valuesCaretGeometry             = new CaretGeometry();
     asciiCaretGeometry = new CaretGeometry();
     layer.HexView.Selection.SelectionChanged += Selection_SelectionChanged;
     layer.HexView.VisualElement.AddHandler(GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_GotKeyboardFocus), true);
     layer.HexView.VisualElement.AddHandler(LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_LostKeyboardFocus), true);
     layer.HexView.VisualElement.IsVisibleChanged += VisualElement_IsVisibleChanged;
     classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
     AddAdornment();
 }
Example #2
0
 public TextCaretLayer(TextCaret textCaret, IAdornmentLayer layer, IClassificationFormatMap classificationFormatMap)
 {
     if (textCaret == null)
     {
         throw new ArgumentNullException(nameof(textCaret));
     }
     if (layer == null)
     {
         throw new ArgumentNullException(nameof(layer));
     }
     if (classificationFormatMap == null)
     {
         throw new ArgumentNullException(nameof(classificationFormatMap));
     }
     this.textCaret = textCaret;
     this.layer     = layer;
     this.classificationFormatMap = classificationFormatMap;
     caretGeometry = new CaretGeometry();
     layer.TextView.LayoutChanged += TextView_LayoutChanged;
     layer.TextView.Selection.SelectionChanged += Selection_SelectionChanged;
     layer.TextView.VisualElement.AddHandler(GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_GotKeyboardFocus), true);
     layer.TextView.VisualElement.AddHandler(LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_LostKeyboardFocus), true);
     layer.TextView.VisualElement.IsVisibleChanged += VisualElement_IsVisibleChanged;
     classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
     AddAdornment();
 }
Example #3
0
        void DrawCaret(DrawingContext drawingContext, CaretGeometry caretGeometry, bool isActive)
        {
            var geo = caretGeometry.Geometry;

            if (geo == null)
            {
                return;
            }
            var caretBrush          = isActive ? activeCaretBrush : inactiveCaretBrush;
            var overwriteCaretBrush = isActive ? activeOverwriteCaretBrush : inactiveOverwriteCaretBrush;

            drawingContext.DrawGeometry(caretGeometry.IsOverwriteMode ? overwriteCaretBrush : caretBrush, null, geo);
        }
Example #4
0
		public TextCaretLayer(TextCaret textCaret, IAdornmentLayer layer, IClassificationFormatMap classificationFormatMap) {
			if (textCaret == null)
				throw new ArgumentNullException(nameof(textCaret));
			if (layer == null)
				throw new ArgumentNullException(nameof(layer));
			if (classificationFormatMap == null)
				throw new ArgumentNullException(nameof(classificationFormatMap));
			this.textCaret = textCaret;
			this.layer = layer;
			this.classificationFormatMap = classificationFormatMap;
			caretGeometry = new CaretGeometry();
			layer.TextView.LayoutChanged += TextView_LayoutChanged;
			layer.TextView.Selection.SelectionChanged += Selection_SelectionChanged;
			layer.TextView.VisualElement.AddHandler(GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_GotKeyboardFocus), true);
			layer.TextView.VisualElement.AddHandler(LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_LostKeyboardFocus), true);
			layer.TextView.VisualElement.IsVisibleChanged += VisualElement_IsVisibleChanged;
			classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
			AddAdornment();
		}
Example #5
0
		void DrawCaret(DrawingContext drawingContext, CaretGeometry caretGeometry, bool isActive) {
			var geo = caretGeometry.Geometry;
			if (geo == null)
				return;
			var caretBrush = isActive ? activeCaretBrush : inactiveCaretBrush;
			var overwriteCaretBrush = isActive ? activeOverwriteCaretBrush : inactiveOverwriteCaretBrush;
			drawingContext.DrawGeometry(caretGeometry.IsOverwriteMode ? overwriteCaretBrush : caretBrush, null, geo);
		}
Example #6
0
		public HexCaretLayer(HexCaretImpl hexCaret, HexAdornmentLayer layer, VSTC.IClassificationFormatMap classificationFormatMap, VSTC.IClassificationTypeRegistryService classificationTypeRegistryService) {
			if (hexCaret == null)
				throw new ArgumentNullException(nameof(hexCaret));
			if (layer == null)
				throw new ArgumentNullException(nameof(layer));
			if (classificationFormatMap == null)
				throw new ArgumentNullException(nameof(classificationFormatMap));
			if (classificationTypeRegistryService == null)
				throw new ArgumentNullException(nameof(classificationTypeRegistryService));
			overwriteMode = true;
			this.hexCaret = hexCaret;
			this.layer = layer;
			this.classificationFormatMap = classificationFormatMap;
			activeCaretClassificationType = classificationTypeRegistryService.GetClassificationType(CTC.ThemeClassificationTypeNames.HexCaret);
			inactiveCaretClassificationType = classificationTypeRegistryService.GetClassificationType(CTC.ThemeClassificationTypeNames.HexInactiveCaret);
			valuesCaretGeometry = new CaretGeometry();
			asciiCaretGeometry = new CaretGeometry();
			layer.HexView.Selection.SelectionChanged += Selection_SelectionChanged;
			layer.HexView.VisualElement.AddHandler(GotKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_GotKeyboardFocus), true);
			layer.HexView.VisualElement.AddHandler(LostKeyboardFocusEvent, new KeyboardFocusChangedEventHandler(VisualElement_LostKeyboardFocus), true);
			layer.HexView.VisualElement.IsVisibleChanged += VisualElement_IsVisibleChanged;
			classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
			AddAdornment();
		}