示例#1
0
		GlyphMarginProvider(IMenuService menuService, HexViewTagAggregatorFactoryService viewTagAggregatorFactoryService, HexEditorFormatMapService editorFormatMapService, [ImportMany] IEnumerable<Lazy<HexGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata>> glyphMouseProcessorProviders, [ImportMany] IEnumerable<Lazy<HexGlyphFactoryProvider, IGlyphMetadata>> glyphFactoryProviders, HexMarginContextMenuService marginContextMenuHandlerProviderService) {
			this.menuService = menuService;
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
			this.editorFormatMapService = editorFormatMapService;
			this.glyphMouseProcessorProviders = VSUTIL.Orderer.Order(glyphMouseProcessorProviders).ToArray();
			this.glyphFactoryProviders = VSUTIL.Orderer.Order(glyphFactoryProviders).ToArray();
			this.marginContextMenuHandlerProviderService = marginContextMenuHandlerProviderService;
		}
示例#2
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();
		}
		HexEditorFactoryServiceImpl(HexEditorOptionsFactoryService hexEditorOptionsFactoryService, ICommandService commandService, [ImportMany] IEnumerable<Lazy<WpfHexViewCreationListener, IDeferrableTextViewRoleMetadata>> wpfHexViewCreationListeners, [ImportMany] IEnumerable<Lazy<HexEditorFactoryServiceListener>> hexEditorFactoryServiceListeners, FormattedHexSourceFactoryService formattedHexSourceFactoryService, HexViewClassifierAggregatorService hexViewClassifierAggregatorService, HexAndAdornmentSequencerFactoryService hexAndAdornmentSequencerFactoryService, HexClassificationFormatMapService classificationFormatMapService, HexEditorFormatMapService editorFormatMapService, HexAdornmentLayerDefinitionService adornmentLayerDefinitionService, HexLineTransformProviderService lineTransformProviderService, WpfHexViewMarginProviderCollectionProvider wpfHexViewMarginProviderCollectionProvider, IMenuService menuService, HexEditorOperationsFactoryService editorOperationsFactoryService, HexSpaceReservationStackProvider spaceReservationStackProvider, HexBufferLineProviderFactoryService hexBufferLineProviderFactoryService, VSTC.IClassificationTypeRegistryService classificationTypeRegistryService) {
			this.hexEditorOptionsFactoryService = hexEditorOptionsFactoryService;
			this.commandService = commandService;
			this.wpfHexViewCreationListeners = wpfHexViewCreationListeners.ToArray();
			this.hexEditorFactoryServiceListeners = hexEditorFactoryServiceListeners.ToArray();
			this.formattedHexSourceFactoryService = formattedHexSourceFactoryService;
			this.hexViewClassifierAggregatorService = hexViewClassifierAggregatorService;
			this.hexAndAdornmentSequencerFactoryService = hexAndAdornmentSequencerFactoryService;
			this.classificationFormatMapService = classificationFormatMapService;
			this.editorFormatMapService = editorFormatMapService;
			this.adornmentLayerDefinitionService = adornmentLayerDefinitionService;
			this.lineTransformProviderService = lineTransformProviderService;
			this.wpfHexViewMarginProviderCollectionProvider = wpfHexViewMarginProviderCollectionProvider;
			this.menuService = menuService;
			this.editorOperationsFactoryService = editorOperationsFactoryService;
			this.spaceReservationStackProvider = spaceReservationStackProvider;
			this.hexBufferLineProviderFactoryService = hexBufferLineProviderFactoryService;
			this.classificationTypeRegistryService = classificationTypeRegistryService;
		}
示例#4
0
		ColumnLineSeparatorServiceProviderImpl(HexEditorFormatMapService editorFormatMapService) {
			this.editorFormatMapService = editorFormatMapService;
		}
示例#5
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();
		}
		ActiveColumnHighlighterServiceProviderImpl(HexEditorFormatMapService editorFormatMapService) {
			this.editorFormatMapService = editorFormatMapService;
		}
#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();
		}
示例#8
0
		public HexGlyphMargin(IMenuService menuService, WpfHexViewHost wpfHexViewHost, HexViewTagAggregatorFactoryService viewTagAggregatorFactoryService, HexEditorFormatMapService editorFormatMapService, Lazy<HexGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata>[] glyphMouseProcessorProviders, Lazy<HexGlyphFactoryProvider, IGlyphMetadata>[] glyphFactoryProviders, HexMarginContextMenuService marginContextMenuHandlerProviderService) {
			if (menuService == null)
				throw new ArgumentNullException(nameof(menuService));
			if (wpfHexViewHost == null)
				throw new ArgumentNullException(nameof(wpfHexViewHost));
			if (viewTagAggregatorFactoryService == null)
				throw new ArgumentNullException(nameof(viewTagAggregatorFactoryService));
			if (editorFormatMapService == null)
				throw new ArgumentNullException(nameof(editorFormatMapService));
			if (glyphMouseProcessorProviders == null)
				throw new ArgumentNullException(nameof(glyphMouseProcessorProviders));
			if (glyphFactoryProviders == null)
				throw new ArgumentNullException(nameof(glyphFactoryProviders));
			canvas = new Canvas();
			glyphFactories = new Dictionary<Type, GlyphFactoryInfo>();
			childCanvases = Array.Empty<Canvas>();
			this.wpfHexViewHost = wpfHexViewHost;
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
			this.editorFormatMapService = editorFormatMapService;
			lazyGlyphMouseProcessorProviders = glyphMouseProcessorProviders;
			lazyGlyphFactoryProviders = glyphFactoryProviders;

			var binding = new Binding {
				Path = new PropertyPath(Panel.BackgroundProperty),
				Source = canvas,
			};
			canvas.SetBinding(DsImage.BackgroundBrushProperty, binding);

			wpfHexViewHost.HexView.Options.OptionChanged += Options_OptionChanged;
			wpfHexViewHost.HexView.ZoomLevelChanged += HexView_ZoomLevelChanged;
			canvas.IsVisibleChanged += GlyphMargin_IsVisibleChanged;
			UpdateVisibility();
			canvas.Width = MARGIN_WIDTH;
			canvas.ClipToBounds = true;
			menuService.InitializeContextMenu(VisualElement, new Guid(MenuConstants.GUIDOBJ_GLYPHMARGIN_GUID), marginContextMenuHandlerProviderService.Create(wpfHexViewHost, this, PredefinedHexMarginNames.Glyph), null, new Guid(MenuConstants.GLYPHMARGIN_GUID));
		}
		CurrentLineHighlighterWpfHexViewCreationListener(HexEditorFormatMapService editorFormatMapService) {
			this.editorFormatMapService = editorFormatMapService;
		}
示例#10
0
		HexMarkerServiceWpfHexViewCreationListener(HexViewTagAggregatorFactoryService viewTagAggregatorFactoryService, HexEditorFormatMapService editorFormatMapService, IThemeService themeService) {
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
			this.editorFormatMapService = editorFormatMapService;
			this.themeService = themeService;
		}