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; }
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)); }