コード例 #1
0
ファイル: GlyphMargin.cs プロジェクト: manojdjoshi/dnSpy
		GlyphMarginProvider(IMenuService menuService, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, [ImportMany] IEnumerable<Lazy<IGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata>> glyphMouseProcessorProviders, [ImportMany] IEnumerable<Lazy<IGlyphFactoryProvider, IGlyphMetadata>> glyphFactoryProviders, IMarginContextMenuService marginContextMenuHandlerProviderService) {
			this.menuService = menuService;
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
			this.editorFormatMapService = editorFormatMapService;
			this.glyphMouseProcessorProviders = Orderer.Order(glyphMouseProcessorProviders).ToArray();
			this.glyphFactoryProviders = Orderer.Order(glyphFactoryProviders).ToArray();
			this.marginContextMenuHandlerProviderService = marginContextMenuHandlerProviderService;
		}
コード例 #2
0
 GlyphMarginProvider(IMenuService menuService, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, [ImportMany] IEnumerable <Lazy <IGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata> > glyphMouseProcessorProviders, [ImportMany] IEnumerable <Lazy <IGlyphFactoryProvider, IGlyphMetadata> > glyphFactoryProviders, IMarginContextMenuService marginContextMenuHandlerProviderService)
 {
     this.menuService = menuService;
     this.viewTagAggregatorFactoryService         = viewTagAggregatorFactoryService;
     this.editorFormatMapService                  = editorFormatMapService;
     this.glyphMouseProcessorProviders            = Orderer.Order(glyphMouseProcessorProviders).ToArray();
     this.glyphFactoryProviders                   = Orderer.Order(glyphFactoryProviders).ToArray();
     this.marginContextMenuHandlerProviderService = marginContextMenuHandlerProviderService;
 }
コード例 #3
0
        public GlyphMargin(IMenuService menuService, IWpfTextViewHost wpfTextViewHost, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, Lazy <IGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata>[] glyphMouseProcessorProviders, Lazy <IGlyphFactoryProvider, IGlyphMetadata>[] glyphFactoryProviders, IMarginContextMenuService marginContextMenuHandlerProviderService)
        {
            if (menuService is null)
            {
                throw new ArgumentNullException(nameof(menuService));
            }
            glyphFactories       = new Dictionary <Type, GlyphFactoryInfo>();
            childCanvases        = Array.Empty <Canvas>();
            this.wpfTextViewHost = wpfTextViewHost ?? throw new ArgumentNullException(nameof(wpfTextViewHost));
            this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService ?? throw new ArgumentNullException(nameof(viewTagAggregatorFactoryService));
            this.editorFormatMapService          = editorFormatMapService ?? throw new ArgumentNullException(nameof(editorFormatMapService));
            lazyGlyphMouseProcessorProviders     = glyphMouseProcessorProviders ?? throw new ArgumentNullException(nameof(glyphMouseProcessorProviders));
            lazyGlyphFactoryProviders            = glyphFactoryProviders ?? throw new ArgumentNullException(nameof(glyphFactoryProviders));

            var binding = new Binding {
                Path   = new PropertyPath(BackgroundProperty),
                Source = this,
            };

            SetBinding(DsImage.BackgroundBrushProperty, binding);

            wpfTextViewHost.TextView.Options.OptionChanged += Options_OptionChanged;
            wpfTextViewHost.TextView.ZoomLevelChanged      += TextView_ZoomLevelChanged;
            IsVisibleChanged += GlyphMargin_IsVisibleChanged;
            UpdateVisibility();
            Width        = MARGIN_WIDTH;
            ClipToBounds = true;
            menuService.InitializeContextMenu(VisualElement, new Guid(MenuConstants.GUIDOBJ_GLYPHMARGIN_GUID), marginContextMenuHandlerProviderService.Create(wpfTextViewHost, this, PredefinedMarginNames.Glyph), null, new Guid(MenuConstants.GLYPHMARGIN_GUID));
        }
コード例 #4
0
ファイル: GlyphMargin.cs プロジェクト: manojdjoshi/dnSpy
		public GlyphMargin(IMenuService menuService, IWpfTextViewHost wpfTextViewHost, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, Lazy<IGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata>[] glyphMouseProcessorProviders, Lazy<IGlyphFactoryProvider, IGlyphMetadata>[] glyphFactoryProviders, IMarginContextMenuService marginContextMenuHandlerProviderService) {
			if (menuService == null)
				throw new ArgumentNullException(nameof(menuService));
			if (wpfTextViewHost == null)
				throw new ArgumentNullException(nameof(wpfTextViewHost));
			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));
			glyphFactories = new Dictionary<Type, GlyphFactoryInfo>();
			childCanvases = Array.Empty<Canvas>();
			this.wpfTextViewHost = wpfTextViewHost;
			this.viewTagAggregatorFactoryService = viewTagAggregatorFactoryService;
			this.editorFormatMapService = editorFormatMapService;
			lazyGlyphMouseProcessorProviders = glyphMouseProcessorProviders;
			lazyGlyphFactoryProviders = glyphFactoryProviders;

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

			wpfTextViewHost.TextView.Options.OptionChanged += Options_OptionChanged;
			wpfTextViewHost.TextView.ZoomLevelChanged += TextView_ZoomLevelChanged;
			IsVisibleChanged += GlyphMargin_IsVisibleChanged;
			UpdateVisibility();
			Width = MARGIN_WIDTH;
			ClipToBounds = true;
			menuService.InitializeContextMenu(VisualElement, new Guid(MenuConstants.GUIDOBJ_GLYPHMARGIN_GUID), marginContextMenuHandlerProviderService.Create(wpfTextViewHost, this, PredefinedMarginNames.Glyph), null, new Guid(MenuConstants.GLYPHMARGIN_GUID));
		}
コード例 #5
0
 public GlyphMargin(IMenuManager menuManager, IWpfTextViewHost wpfTextViewHost, IViewTagAggregatorFactoryService viewTagAggregatorFactoryService, IEditorFormatMapService editorFormatMapService, Lazy <IGlyphMouseProcessorProvider, IGlyphMouseProcessorProviderMetadata>[] glyphMouseProcessorProviders, Lazy <IGlyphFactoryProvider, IGlyphMetadata>[] glyphFactoryProviders, IMarginContextMenuService marginContextMenuHandlerProviderService)
 {
     if (menuManager == null)
     {
         throw new ArgumentNullException(nameof(menuManager));
     }
     if (wpfTextViewHost == null)
     {
         throw new ArgumentNullException(nameof(wpfTextViewHost));
     }
     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));
     }
     this.wpfTextViewHost = wpfTextViewHost;
     this.viewTagAggregatorFactoryService            = viewTagAggregatorFactoryService;
     this.editorFormatMapService                     = editorFormatMapService;
     this.lazyGlyphMouseProcessorProviders           = glyphMouseProcessorProviders;
     this.lazyGlyphFactoryProviders                  = glyphFactoryProviders;
     wpfTextViewHost.TextView.Options.OptionChanged += Options_OptionChanged;
     wpfTextViewHost.TextView.ZoomLevelChanged      += TextView_ZoomLevelChanged;
     IsVisibleChanged += GlyphMargin_IsVisibleChanged;
     UpdateVisibility();
     Width        = MARGIN_WIDTH;
     ClipToBounds = true;
     menuManager.InitializeContextMenu(VisualElement, new Guid(MenuConstants.GUIDOBJ_GLYPHMARGIN_GUID), marginContextMenuHandlerProviderService.Create(wpfTextViewHost, this, PredefinedMarginNames.Glyph), null, new Guid(MenuConstants.GLYPHMARGIN_GUID));
 }