Пример #1
0
		public HexSelectionImpl(WpfHexView hexView, HexAdornmentLayer selectionLayer, VSTC.IEditorFormatMap editorFormatMap) {
			if (hexView == null)
				throw new ArgumentNullException(nameof(hexView));
			if (selectionLayer == null)
				throw new ArgumentNullException(nameof(selectionLayer));
			if (editorFormatMap == null)
				throw new ArgumentNullException(nameof(editorFormatMap));
			HexView = hexView;
			HexView.GotAggregateFocus += HexView_GotAggregateFocus;
			HexView.LostAggregateFocus += HexView_LostAggregateFocus;
			hexSelectionLayer = new HexSelectionLayer(this, selectionLayer, editorFormatMap);
			ActivationTracksFocus = true;
		}
Пример #2
0
		public HexMarkerService(WpfHexView wpfHexView, HexTagAggregator<HexMarkerTag> tagAggregator, VSTC.IEditorFormatMap editorFormatMap, IThemeService themeService) {
			if (wpfHexView == null)
				throw new ArgumentNullException(nameof(wpfHexView));
			if (tagAggregator == null)
				throw new ArgumentNullException(nameof(tagAggregator));
			if (editorFormatMap == null)
				throw new ArgumentNullException(nameof(editorFormatMap));
			if (themeService == null)
				throw new ArgumentNullException(nameof(themeService));
			this.wpfHexView = wpfHexView;
			this.tagAggregator = tagAggregator;
			this.editorFormatMap = editorFormatMap;
			this.themeService = themeService;
			textMarkerAdornmentLayer = wpfHexView.GetAdornmentLayer(PredefinedHexAdornmentLayers.TextMarker);
			negativeTextMarkerAdornmentLayer = wpfHexView.GetAdornmentLayer(PredefinedHexAdornmentLayers.NegativeTextMarker);
			markerElements = new List<MarkerElement>();
			useReducedOpacityForHighContrast = wpfHexView.Options.GetOptionValue(DefaultWpfHexViewOptions.UseReducedOpacityForHighContrastOptionId);
			onRemovedDelegate = OnRemoved;
			wpfHexView.Closed += WpfHexView_Closed;
			wpfHexView.LayoutChanged += WpfHexView_LayoutChanged;
			wpfHexView.Options.OptionChanged += Options_OptionChanged;
			tagAggregator.BatchedTagsChanged += TagAggregator_BatchedTagsChanged;
			editorFormatMap.FormatMappingChanged += EditorFormatMap_FormatMappingChanged;
		}
Пример #3
0
		void EditorFormatMap_FormatMappingChanged(object sender, VSTC.FormatItemsEventArgs e) {
			if (markerElements.Count == 0)
				return;

			bool refresh = false;
			if (e.ChangedItems.Count > 50)
				refresh = true;
			if (!refresh) {
				var hash = new HashSet<string>(StringComparer.Ordinal);
				foreach (var elem in markerElements)
					hash.Add(elem.Type);
				foreach (var s in e.ChangedItems) {
					if (hash.Contains(s)) {
						refresh = true;
						break;
					}
				}
			}

			if (refresh)
				RefreshExistingMarkers();
		}
Пример #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;
		}