Esempio n. 1
0
 GlyphTextViewMarkerService(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextView wpfTextView)
 {
     if (glyphTextMarkerServiceImpl == null)
     {
         throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl));
     }
     if (wpfTextView == null)
     {
         throw new ArgumentNullException(nameof(wpfTextView));
     }
     this.onRemovedDelegate          = OnRemoved;
     this.glyphTextMarkerServiceImpl = glyphTextMarkerServiceImpl;
     this.TextView                                    = wpfTextView;
     this.markerLayer                                 = wpfTextView.GetAdornmentLayer(PredefinedDnSpyAdornmentLayers.GlyphTextMarker);
     this.markerAndSpanCollection                     = new MarkerAndSpanCollection();
     this.markerElements                              = new List <MarkerElement>();
     this.editorFormatMap                             = glyphTextMarkerServiceImpl.EditorFormatMapService.GetEditorFormatMap(wpfTextView);
     this.glyphTextViewMarkerGlyphTagTagger           = GlyphTextViewMarkerGlyphTagger.GetOrCreate(this);
     this.glyphTextViewMarkerGlyphTextMarkerTagTagger = GlyphTextViewMarkerGlyphTextMarkerTagger.GetOrCreate(this);
     this.glyphTextViewMarkerClassificationTagTagger  = GlyphTextViewMarkerClassificationTagger.GetOrCreate(this);
     this.useReducedOpacityForHighContrast            = wpfTextView.Options.GetOptionValue(DefaultWpfViewOptions.UseReducedOpacityForHighContrastOptionId);
     wpfTextView.Closed                              += WpfTextView_Closed;
     wpfTextView.LayoutChanged                       += WpfTextView_LayoutChanged;
     wpfTextView.Options.OptionChanged               += Options_OptionChanged;
     glyphTextMarkerServiceImpl.MarkerAdded          += GlyphTextMarkerServiceImpl_MarkerAdded;
     glyphTextMarkerServiceImpl.MarkerRemoved        += GlyphTextMarkerServiceImpl_MarkerRemoved;
     glyphTextMarkerServiceImpl.MarkersRemoved       += GlyphTextMarkerServiceImpl_MarkersRemoved;
     editorFormatMap.FormatMappingChanged            += EditorFormatMap_FormatMappingChanged;
 }
		public GlyphTextMarkerServiceMouseProcessor(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin) {
			if (glyphTextMarkerServiceImpl == null)
				throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl));
			if (wpfTextViewHost == null)
				throw new ArgumentNullException(nameof(wpfTextViewHost));
			if (margin == null)
				throw new ArgumentNullException(nameof(margin));
			glyphTextViewMarkerService = GlyphTextViewMarkerService.GetOrCreate(glyphTextMarkerServiceImpl, wpfTextViewHost.TextView);
			this.wpfTextViewHost = wpfTextViewHost;
			this.margin = margin;
			toolTipDispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal, margin.VisualElement.Dispatcher);
			popup = new Popup { AllowsTransparency = true };

			var list = new List<IGlyphTextMarkerMouseProcessor>();
			foreach (var lazy in glyphTextMarkerServiceImpl.GlyphTextMarkerMouseProcessorProviders) {
				if (lazy.Metadata.TextViewRoles != null && !wpfTextViewHost.TextView.Roles.ContainsAny(lazy.Metadata.TextViewRoles))
					continue;
				var mouseProcessor = lazy.Value.GetAssociatedMouseProcessor(wpfTextViewHost, margin);
				if (mouseProcessor != null)
					list.Add(mouseProcessor);
			}
			glyphTextMarkerMouseProcessors = list.ToArray();
			wpfTextViewHost.TextView.Closed += TextView_Closed;
			wpfTextViewHost.TextView.LayoutChanged += TextView_LayoutChanged;
			toolTipDispatcherTimer.Tick += ToolTipDispatcherTimer_Tick;
			popup.Closed += Popup_Closed;
			glyphTextViewMarkerService.AddGlyphTextMarkerListener(this);
		}
        public GlyphTextMarkerServiceMouseProcessor(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextViewHost wpfTextViewHost, IWpfTextViewMargin margin)
        {
            if (glyphTextMarkerServiceImpl == null)
            {
                throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl));
            }
            if (wpfTextViewHost == null)
            {
                throw new ArgumentNullException(nameof(wpfTextViewHost));
            }
            if (margin == null)
            {
                throw new ArgumentNullException(nameof(margin));
            }
            this.glyphTextViewMarkerService = GlyphTextViewMarkerService.GetOrCreate(glyphTextMarkerServiceImpl, wpfTextViewHost.TextView);
            this.wpfTextViewHost            = wpfTextViewHost;
            this.margin = margin;
            this.toolTipDispatcherTimer = new DispatcherTimer(DispatcherPriority.Normal, margin.VisualElement.Dispatcher);
            this.popup = new Popup {
                AllowsTransparency = true
            };

            var list = new List <IGlyphTextMarkerMouseProcessor>();

            foreach (var lazy in glyphTextMarkerServiceImpl.GlyphTextMarkerMouseProcessorProviders)
            {
                if (lazy.Metadata.TextViewRoles != null && !wpfTextViewHost.TextView.Roles.ContainsAny(lazy.Metadata.TextViewRoles))
                {
                    continue;
                }
                var mouseProcessor = lazy.Value.GetAssociatedMouseProcessor(wpfTextViewHost, margin);
                if (mouseProcessor != null)
                {
                    list.Add(mouseProcessor);
                }
            }
            this.glyphTextMarkerMouseProcessors     = list.ToArray();
            wpfTextViewHost.TextView.Closed        += TextView_Closed;
            wpfTextViewHost.TextView.LayoutChanged += TextView_LayoutChanged;
            toolTipDispatcherTimer.Tick            += ToolTipDispatcherTimer_Tick;
            popup.Closed += Popup_Closed;
            glyphTextViewMarkerService.AddGlyphTextMarkerListener(this);
        }
Esempio n. 4
0
 public static GlyphTextViewMarkerService GetOrCreate(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextView wpfTextView)
 {
     if (glyphTextMarkerServiceImpl == null)
     {
         throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl));
     }
     if (wpfTextView == null)
     {
         throw new ArgumentNullException(nameof(wpfTextView));
     }
     if (wpfTextView.TextBuffer.Properties.TryGetProperty(typeof(GlyphTextViewMarkerService), out GlyphTextViewMarkerService service))
     {
         return(service);
     }
     service = new GlyphTextViewMarkerService(glyphTextMarkerServiceImpl, wpfTextView);
     wpfTextView.TextBuffer.Properties.AddProperty(typeof(GlyphTextViewMarkerService), service);
     service.Initialize();
     return(service);
 }
 GlyphTextViewMarkerGlyphTextMarkerTaggerProvider(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl) => this.glyphTextMarkerServiceImpl = glyphTextMarkerServiceImpl;
 GlyphTextMarkerServiceMouseProcessorProvider(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl) => this.glyphTextMarkerServiceImpl = glyphTextMarkerServiceImpl;
 GlyphTextMarkerContextMenuHandlerProvider(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl) => this.glyphTextMarkerServiceImpl = glyphTextMarkerServiceImpl;
 GlyphTextViewMarkerClassificationTaggerProvider(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl)
 {
     this.glyphTextMarkerServiceImpl = glyphTextMarkerServiceImpl;
 }
		GlyphTextMarkerServiceMouseProcessorProvider(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl) {
			this.glyphTextMarkerServiceImpl = glyphTextMarkerServiceImpl;
		}
		GlyphTextMarkerContextMenuHandlerProvider(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl) {
			this.glyphTextMarkerServiceImpl = glyphTextMarkerServiceImpl;
		}
 GlyphTextViewMarkerGlyphFactoryProvider(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl)
 {
     this.glyphTextMarkerServiceImpl = glyphTextMarkerServiceImpl;
 }
		public static GlyphTextViewMarkerService GetOrCreate(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextView wpfTextView) {
			if (glyphTextMarkerServiceImpl == null)
				throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl));
			if (wpfTextView == null)
				throw new ArgumentNullException(nameof(wpfTextView));
			GlyphTextViewMarkerService service;
			if (wpfTextView.TextBuffer.Properties.TryGetProperty(typeof(GlyphTextViewMarkerService), out service))
				return service;
			service = new GlyphTextViewMarkerService(glyphTextMarkerServiceImpl, wpfTextView);
			wpfTextView.TextBuffer.Properties.AddProperty(typeof(GlyphTextViewMarkerService), service);
			service.Initialize();
			return service;
		}
		GlyphTextViewMarkerService(IGlyphTextMarkerServiceImpl glyphTextMarkerServiceImpl, IWpfTextView wpfTextView) {
			if (glyphTextMarkerServiceImpl == null)
				throw new ArgumentNullException(nameof(glyphTextMarkerServiceImpl));
			if (wpfTextView == null)
				throw new ArgumentNullException(nameof(wpfTextView));
			onRemovedDelegate = OnRemoved;
			this.glyphTextMarkerServiceImpl = glyphTextMarkerServiceImpl;
			TextView = wpfTextView;
			markerLayer = wpfTextView.GetAdornmentLayer(PredefinedDsAdornmentLayers.GlyphTextMarker);
			markerAndSpanCollection = new MarkerAndSpanCollection(this);
			markerElements = new List<MarkerElement>();
			editorFormatMap = glyphTextMarkerServiceImpl.EditorFormatMapService.GetEditorFormatMap(wpfTextView);
			glyphTextViewMarkerGlyphTagTagger = GlyphTextViewMarkerGlyphTagger.GetOrCreate(this);
			glyphTextViewMarkerGlyphTextMarkerTagTagger = GlyphTextViewMarkerGlyphTextMarkerTagger.GetOrCreate(this);
			glyphTextViewMarkerClassificationTagTagger = GlyphTextViewMarkerClassificationTagger.GetOrCreate(this);
			useReducedOpacityForHighContrast = wpfTextView.Options.GetOptionValue(DefaultWpfViewOptions.UseReducedOpacityForHighContrastOptionId);
			wpfTextView.Closed += WpfTextView_Closed;
			wpfTextView.LayoutChanged += WpfTextView_LayoutChanged;
			wpfTextView.Options.OptionChanged += Options_OptionChanged;
			glyphTextMarkerServiceImpl.MarkerAdded += GlyphTextMarkerServiceImpl_MarkerAdded;
			glyphTextMarkerServiceImpl.MarkerRemoved += GlyphTextMarkerServiceImpl_MarkerRemoved;
			glyphTextMarkerServiceImpl.MarkersRemoved += GlyphTextMarkerServiceImpl_MarkersRemoved;
			editorFormatMap.FormatMappingChanged += EditorFormatMap_FormatMappingChanged;
		}