Exemple #1
0
        void InitializeBrushes(out Brush brush, out Brush overwriteBrush, VSTC.IClassificationType classificationType)
        {
            var props = classificationFormatMap.GetTextProperties(classificationType);

            if (!props.BackgroundBrushEmpty)
            {
                brush = props.BackgroundBrush;
            }
            else
            {
                Debug.Assert(!classificationFormatMap.DefaultTextProperties.ForegroundBrushEmpty);
                brush = classificationFormatMap.DefaultTextProperties.ForegroundBrush;
                if (classificationFormatMap.DefaultTextProperties.ForegroundBrushEmpty)
                {
                    brush = Brushes.Black;
                }
            }
            if (brush.CanFreeze)
            {
                brush.Freeze();
            }

            overwriteBrush         = brush.Clone();
            overwriteBrush.Opacity = 0.5;
            if (overwriteBrush.CanFreeze)
            {
                overwriteBrush.Freeze();
            }
        }
Exemple #2
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();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="classificationType">Classification type</param>
 public HexClassificationTag(VSTC.IClassificationType classificationType)
 {
     if (classificationType == null)
     {
         throw new ArgumentNullException(nameof(classificationType));
     }
     ClassificationType = classificationType;
 }
Exemple #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="span">Span</param>
 /// <param name="classification">Classification type</param>
 public HexClassificationSpan(VST.Span span, VSTC.IClassificationType classification)
 {
     if (classification == null)
     {
         throw new ArgumentNullException(nameof(classification));
     }
     Span = span;
     ClassificationType = classification;
 }
Exemple #5
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="classificationType">Classification type</param>
 public HexClassificationTag(VSTC.IClassificationType classificationType) => ClassificationType = classificationType ?? throw new ArgumentNullException(nameof(classificationType));
Exemple #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();
		}
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="classificationType">Classification type</param>
		public HexClassificationTag(VSTC.IClassificationType classificationType) {
			if (classificationType == null)
				throw new ArgumentNullException(nameof(classificationType));
			ClassificationType = classificationType;
		}
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="span">Span</param>
		/// <param name="classification">Classification type</param>
		public HexClassificationSpan(VST.Span span, VSTC.IClassificationType classification) {
			if (classification == null)
				throw new ArgumentNullException(nameof(classification));
			Span = span;
			ClassificationType = classification;
		}