Ejemplo n.º 1
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;
 }
Ejemplo n.º 2
0
 public HexSelectionLayer(HexSelectionImpl hexSelection, HexAdornmentLayer layer, VSTC.IEditorFormatMap editorFormatMap)
 {
     if (hexSelection == null)
     {
         throw new ArgumentNullException(nameof(hexSelection));
     }
     if (layer == null)
     {
         throw new ArgumentNullException(nameof(layer));
     }
     if (editorFormatMap == null)
     {
         throw new ArgumentNullException(nameof(editorFormatMap));
     }
     markerElementRemovedCallBack = (tag, element) => OnMarkerElementRemoved();
     this.hexSelection            = hexSelection;
     this.layer           = layer;
     this.editorFormatMap = editorFormatMap;
     hexSelection.HexView.Options.OptionChanged += Options_OptionChanged;
     hexSelection.SelectionChanged        += HexSelection_SelectionChanged;
     hexSelection.HexView.LayoutChanged   += HexView_LayoutChanged;
     editorFormatMap.FormatMappingChanged += EditorFormatMap_FormatMappingChanged;
     UpdateUseReducedOpacityForHighContrastOption();
     UpdateBackgroundBrush();
 }
Ejemplo n.º 3
0
 public CurrentLineHighlighter(WpfHexView wpfHexView, VSTC.IEditorFormatMap editorFormatMap)
 {
     this.wpfHexView                   = wpfHexView ?? throw new ArgumentNullException(nameof(wpfHexView));
     this.editorFormatMap              = editorFormatMap ?? throw new ArgumentNullException(nameof(editorFormatMap));
     currentLineHighlighterElement     = new CurrentLineHighlighterElement();
     wpfHexView.Closed                += WpfHexView_Closed;
     wpfHexView.Options.OptionChanged += Options_OptionChanged;
     UpdateEnableState();
 }
Ejemplo n.º 4
0
 public HexSelectionLayer(HexSelectionImpl hexSelection, HexAdornmentLayer layer, VSTC.IEditorFormatMap editorFormatMap)
 {
     markerElementRemovedCallBack = (tag, element) => OnMarkerElementRemoved();
     this.hexSelection            = hexSelection ?? throw new ArgumentNullException(nameof(hexSelection));
     this.layer           = layer ?? throw new ArgumentNullException(nameof(layer));
     this.editorFormatMap = editorFormatMap ?? throw new ArgumentNullException(nameof(editorFormatMap));
     hexSelection.HexView.Options.OptionChanged += Options_OptionChanged;
     hexSelection.SelectionChanged        += HexSelection_SelectionChanged;
     hexSelection.HexView.LayoutChanged   += HexView_LayoutChanged;
     editorFormatMap.FormatMappingChanged += EditorFormatMap_FormatMappingChanged;
     UpdateBackgroundBrush();
 }
Ejemplo n.º 5
0
		public CurrentLineHighlighter(WpfHexView wpfHexView, VSTC.IEditorFormatMap editorFormatMap) {
			if (wpfHexView == null)
				throw new ArgumentNullException(nameof(wpfHexView));
			if (editorFormatMap == null)
				throw new ArgumentNullException(nameof(editorFormatMap));
			this.wpfHexView = wpfHexView;
			this.editorFormatMap = editorFormatMap;
			currentLineHighlighterElement = new CurrentLineHighlighterElement();
			wpfHexView.Closed += WpfHexView_Closed;
			wpfHexView.Options.OptionChanged += Options_OptionChanged;
			UpdateEnableState();
		}
Ejemplo n.º 6
0
#pragma warning restore CS0169

        public ColumnLineSeparatorService(WpfHexView wpfHexView, HexEditorFormatMapService editorFormatMapService)
        {
            if (editorFormatMapService == null)
            {
                throw new ArgumentNullException(nameof(editorFormatMapService));
            }
            lineElements       = new List <LineElement>();
            this.wpfHexView    = wpfHexView ?? throw new ArgumentNullException(nameof(wpfHexView));
            editorFormatMap    = editorFormatMapService.GetEditorFormatMap(wpfHexView);
            wpfHexView.Closed += WpfHexView_Closed;
            wpfHexView.Options.OptionChanged += Options_OptionChanged;
            UpdateEnabled();
        }
Ejemplo n.º 7
0
#pragma warning restore 0169

        public ActiveColumnHighlighterService(WpfHexView wpfHexView, HexEditorFormatMapService editorFormatMapService)
        {
            if (editorFormatMapService == null)
            {
                throw new ArgumentNullException(nameof(editorFormatMapService));
            }
            rectangleElements  = new List <RectangleElement>();
            this.wpfHexView    = wpfHexView ?? throw new ArgumentNullException(nameof(wpfHexView));
            editorFormatMap    = editorFormatMapService.GetEditorFormatMap(wpfHexView);
            wpfHexView.Closed += WpfHexView_Closed;
            wpfHexView.Options.OptionChanged += Options_OptionChanged;
            UpdateEnabled();
        }
Ejemplo n.º 8
0
 void Initialize()
 {
     if (mouseProcessorCollection != null)
     {
         return;
     }
     iconCanvas = new Canvas {
         Background = Brushes.Transparent
     };
     canvas.Children.Add(iconCanvas);
     mouseProcessorCollection = new HexMouseProcessorCollection(VisualElement, null, new DefaultHexMouseProcessor(), CreateMouseProcessors(), null);
     lineInfos       = new Dictionary <object, LineInfo>();
     tagAggregator   = viewTagAggregatorFactoryService.CreateTagAggregator <HexGlyphTag>(wpfHexViewHost.HexView);
     editorFormatMap = editorFormatMapService.GetEditorFormatMap(wpfHexViewHost.HexView);
     InitializeGlyphFactories();
 }
Ejemplo n.º 9
0
		public HexSelectionLayer(HexSelectionImpl hexSelection, HexAdornmentLayer layer, VSTC.IEditorFormatMap editorFormatMap) {
			if (hexSelection == null)
				throw new ArgumentNullException(nameof(hexSelection));
			if (layer == null)
				throw new ArgumentNullException(nameof(layer));
			if (editorFormatMap == null)
				throw new ArgumentNullException(nameof(editorFormatMap));
			markerElementRemovedCallBack = (tag, element) => OnMarkerElementRemoved();
			this.hexSelection = hexSelection;
			this.layer = layer;
			this.editorFormatMap = editorFormatMap;
			hexSelection.HexView.Options.OptionChanged += Options_OptionChanged;
			hexSelection.SelectionChanged += TextSelection_SelectionChanged;
			hexSelection.HexView.LayoutChanged += TextView_LayoutChanged;
			editorFormatMap.FormatMappingChanged += EditorFormatMap_FormatMappingChanged;
			UpdateUseReducedOpacityForHighContrastOption();
			UpdateBackgroundBrush();
		}
Ejemplo n.º 10
0
#pragma warning restore 0169

		public WpfHexViewImpl(HexBuffer buffer, VSTE.ITextViewRoleSet roles, VSTE.IEditorOptions parentOptions, HexEditorOptionsFactoryService hexEditorOptionsFactoryService, ICommandService commandService, FormattedHexSourceFactoryService formattedHexSourceFactoryService, HexViewClassifierAggregatorService hexViewClassifierAggregatorService, HexAndAdornmentSequencerFactoryService hexAndAdornmentSequencerFactoryService, HexBufferLineFormatterFactoryService bufferLineProviderFactoryService, HexClassificationFormatMapService classificationFormatMapService, HexEditorFormatMapService editorFormatMapService, HexAdornmentLayerDefinitionService adornmentLayerDefinitionService, HexLineTransformProviderService lineTransformProviderService, HexSpaceReservationStackProvider spaceReservationStackProvider, Lazy<WpfHexViewCreationListener, IDeferrableTextViewRoleMetadata>[] wpfHexViewCreationListeners, VSTC.IClassificationTypeRegistryService classificationTypeRegistryService, Lazy<HexCursorProviderFactory, ITextViewRoleMetadata>[] hexCursorProviderFactories) {
			if (buffer == null)
				throw new ArgumentNullException(nameof(buffer));
			if (roles == null)
				throw new ArgumentNullException(nameof(roles));
			if (parentOptions == null)
				throw new ArgumentNullException(nameof(parentOptions));
			if (hexEditorOptionsFactoryService == null)
				throw new ArgumentNullException(nameof(hexEditorOptionsFactoryService));
			if (commandService == null)
				throw new ArgumentNullException(nameof(commandService));
			if (formattedHexSourceFactoryService == null)
				throw new ArgumentNullException(nameof(formattedHexSourceFactoryService));
			if (hexViewClassifierAggregatorService == null)
				throw new ArgumentNullException(nameof(hexViewClassifierAggregatorService));
			if (hexAndAdornmentSequencerFactoryService == null)
				throw new ArgumentNullException(nameof(hexAndAdornmentSequencerFactoryService));
			if (bufferLineProviderFactoryService == null)
				throw new ArgumentNullException(nameof(bufferLineProviderFactoryService));
			if (classificationFormatMapService == null)
				throw new ArgumentNullException(nameof(classificationFormatMapService));
			if (editorFormatMapService == null)
				throw new ArgumentNullException(nameof(editorFormatMapService));
			if (adornmentLayerDefinitionService == null)
				throw new ArgumentNullException(nameof(adornmentLayerDefinitionService));
			if (lineTransformProviderService == null)
				throw new ArgumentNullException(nameof(lineTransformProviderService));
			if (spaceReservationStackProvider == null)
				throw new ArgumentNullException(nameof(spaceReservationStackProvider));
			if (wpfHexViewCreationListeners == null)
				throw new ArgumentNullException(nameof(wpfHexViewCreationListeners));
			if (classificationTypeRegistryService == null)
				throw new ArgumentNullException(nameof(classificationTypeRegistryService));
			if (hexCursorProviderFactories == null)
				throw new ArgumentNullException(nameof(hexCursorProviderFactories));
			canvas = new HexViewCanvas(this);
			Buffer = buffer;
			thisHexLineTransformSource = new MyHexLineTransformSource(this);
			this.bufferLineProviderFactoryService = bufferLineProviderFactoryService;
			mouseHoverHelper = new MouseHoverHelper(this);
			physicalLineCache = new PhysicalLineCache(32);
			visiblePhysicalLines = new List<PhysicalLine>();
			invalidatedRegions = new List<HexBufferSpan>();
			this.formattedHexSourceFactoryService = formattedHexSourceFactoryService;
			zoomLevel = VSTE.ZoomConstants.DefaultZoom;
			DsImage.SetZoom(VisualElement, zoomLevel / 100);
			this.adornmentLayerDefinitionService = adornmentLayerDefinitionService;
			this.lineTransformProviderService = lineTransformProviderService;
			this.wpfHexViewCreationListeners = wpfHexViewCreationListeners.Where(a => roles.ContainsAny(a.Metadata.TextViewRoles)).ToArray();
			recreateLineTransformProvider = true;
			normalAdornmentLayerCollection = new HexAdornmentLayerCollection(this, HexLayerKind.Normal);
			overlayAdornmentLayerCollection = new HexAdornmentLayerCollection(this, HexLayerKind.Overlay);
			underlayAdornmentLayerCollection = new HexAdornmentLayerCollection(this, HexLayerKind.Underlay);
			canvas.IsVisibleChanged += WpfHexView_IsVisibleChanged;
			Roles = roles;
			Options = hexEditorOptionsFactoryService.GetOptions(this);
			Options.Parent = parentOptions;
			ViewScroller = new HexViewScrollerImpl(this);
			hasKeyboardFocus = canvas.IsKeyboardFocusWithin;
			oldViewState = new HexViewState(this);
			aggregateClassifier = hexViewClassifierAggregatorService.GetClassifier(this);
			hexAndAdornmentSequencer = hexAndAdornmentSequencerFactoryService.Create(this);
			classificationFormatMap = classificationFormatMapService.GetClassificationFormatMap(this);
			editorFormatMap = editorFormatMapService.GetEditorFormatMap(this);
			spaceReservationStack = spaceReservationStackProvider.Create(this);

			textLayer = new TextLayer(GetAdornmentLayer(PredefinedHexAdornmentLayers.Text));
			HexSelection = new HexSelectionImpl(this, GetAdornmentLayer(PredefinedHexAdornmentLayers.Selection), editorFormatMap);
			HexCaret = new HexCaretImpl(this, GetAdornmentLayer(PredefinedHexAdornmentLayers.Caret), classificationFormatMap, classificationTypeRegistryService);

			canvas.Children.Add(underlayAdornmentLayerCollection);
			canvas.Children.Add(normalAdornmentLayerCollection);
			canvas.Children.Add(overlayAdornmentLayerCollection);
			canvas.Focusable = true;
			canvas.FocusVisualStyle = null;
			InitializeOptions();

			Options.OptionChanged += EditorOptions_OptionChanged;
			Buffer.ChangedLowPriority += HexBuffer_ChangedLowPriority;
			Buffer.BufferSpanInvalidated += Buffer_BufferSpanInvalidated;
			aggregateClassifier.ClassificationChanged += AggregateClassifier_ClassificationChanged;
			hexAndAdornmentSequencer.SequenceChanged += HexAndAdornmentSequencer_SequenceChanged;
			classificationFormatMap.ClassificationFormatMappingChanged += ClassificationFormatMap_ClassificationFormatMappingChanged;
			editorFormatMap.FormatMappingChanged += EditorFormatMap_FormatMappingChanged;
			spaceReservationStack.GotAggregateFocus += SpaceReservationStack_GotAggregateFocus;
			spaceReservationStack.LostAggregateFocus += SpaceReservationStack_LostAggregateFocus;

			UpdateBackground();
			CreateFormattedLineSource(ViewportWidth);
			var dummy = BufferLines;
			HexSelection.Initialize();
			HexCaret.Initialize();
			InitializeZoom();
			UpdateRemoveExtraTextLineVerticalPixels();

			if (Roles.Contains(PredefinedHexViewRoles.Interactive))
				RegisteredCommandElement = commandService.Register(VisualElement, this);
			else
				RegisteredCommandElement = TE.NullRegisteredCommandElement.Instance;

			hexCursorProviderInfoCollection = new HexCursorProviderInfoCollection(CreateCursorProviders(hexCursorProviderFactories), Cursors.IBeam);
			hexCursorProviderInfoCollection.CursorChanged += HexCursorProviderInfoCollection_CursorChanged;
			canvas.Cursor = hexCursorProviderInfoCollection.Cursor;

			NotifyHexViewCreated();
		}
Ejemplo n.º 11
0
#pragma warning restore 0169

		public ColumnLineSeparatorService(WpfHexView wpfHexView, HexEditorFormatMapService editorFormatMapService) {
			if (wpfHexView == null)
				throw new ArgumentNullException(nameof(wpfHexView));
			if (editorFormatMapService == null)
				throw new ArgumentNullException(nameof(editorFormatMapService));
			lineElements = new List<LineElement>();
			this.wpfHexView = wpfHexView;
			editorFormatMap = editorFormatMapService.GetEditorFormatMap(wpfHexView);
			wpfHexView.Closed += WpfHexView_Closed;
			wpfHexView.Options.OptionChanged += Options_OptionChanged;
			UpdateEnabled();
		}
Ejemplo n.º 12
0
#pragma warning restore 0169

		public ActiveColumnHighlighterService(WpfHexView wpfHexView, HexEditorFormatMapService editorFormatMapService) {
			if (wpfHexView == null)
				throw new ArgumentNullException(nameof(wpfHexView));
			if (editorFormatMapService == null)
				throw new ArgumentNullException(nameof(editorFormatMapService));
			rectangleElements = new List<RectangleElement>();
			this.wpfHexView = wpfHexView;
			editorFormatMap = editorFormatMapService.GetEditorFormatMap(wpfHexView);
			wpfHexView.Closed += WpfHexView_Closed;
			wpfHexView.Options.OptionChanged += Options_OptionChanged;
			UpdateEnabled();
		}
Ejemplo n.º 13
0
		void Initialize() {
			if (mouseProcessorCollection != null)
				return;
			iconCanvas = new Canvas { Background = Brushes.Transparent };
			canvas.Children.Add(iconCanvas);
			mouseProcessorCollection = new HexMouseProcessorCollection(VisualElement, null, new DefaultHexMouseProcessor(), CreateMouseProcessors(), null);
			lineInfos = new Dictionary<object, LineInfo>();
			tagAggregator = viewTagAggregatorFactoryService.CreateTagAggregator<HexGlyphTag>(wpfHexViewHost.HexView);
			editorFormatMap = editorFormatMapService.GetEditorFormatMap(wpfHexViewHost.HexView);
			InitializeGlyphFactories();
		}
Ejemplo n.º 14
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;
 }
Ejemplo n.º 15
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;
		}