public IWpfTextViewMargin CreateMargin(IWpfTextViewHost view_host, IWpfTextViewMargin container_margin) { IWpfTextView text_view = view_host.TextView; try { Utils.VSVersion = Assembly.GetCallingAssembly().GetName().Version.Major.ToString(); } catch { } if (!PresenceSent) { PresenceSent = true; MonitoringService.SendPresense(); } if (!SettingsLoaded) { ReadSettings(OptionsService.GlobalOptions); } RemoveVerticalScrollBar(container_margin); var navigator = TextStructureNavigatorService.GetTextStructureNavigator(text_view.TextBuffer); var format = FormatMapService.GetEditorFormatMap(text_view); var tagger = HighlightWordTagger.Instance(text_view, format, TextSearchService, navigator); var marks_enumerator = new MarksEnumerator(AggregatorFactoryService, text_view); var change_enumerator = new ChangeEnumerator(AggregatorFactoryService, text_view); var words_enumerator = new HighlightedWordsEnumerator(text_view, tagger); return(new RockMargin(text_view, marks_enumerator, change_enumerator, words_enumerator, tagger)); }
public RockMargin( IWpfTextView view, MarksEnumerator marks, ChangeEnumerator changes, HighlightedWordsEnumerator highlights, HighlightWordTagger tagger) { _view = view; _marks = marks; _changes = changes; _highlights = highlights; _tagger = tagger; _track = new Track(view, this); _render = new TrackRender(_view, _track, _marks, _changes, _highlights); this.Width = _view.Options.GetOptionValue(OptionsKeys.Width); this.ClipToBounds = true; this.Background = Utils.CreateBrush(_view.Options.GetOptionValue(OptionsKeys.BackgroundColor)); view.Options.OptionChanged += OnOptionChanged; view.LayoutChanged += OnTextViewLayoutChanged; view.ZoomLevelChanged += OnViewStateChanged; highlights.WordsChanged += OnWordHighlightsChanged; marks.MarksChanged += OnMarksChanged; changes.ChangesChanged += OnChangesChanged; this.SizeChanged += OnViewStateChanged; this.MouseRightButtonDown += this.OnMouseRightButtonDown; this.MouseLeftButtonDown += this.OnMouseLeftButtonDown; this.MouseLeftButtonUp += this.OnMouseLeftButtonUp; this.MouseMove += this.OnMouseMove; _render.Visuals.ForEach(delegate(Visual v) { AddVisualChild(v); }); }
public static HighlightWordTagger Instance(IWpfTextView view, IEditorFormatMap format, ITextSearchService searcher, ITextStructureNavigator navigator) { if (!_instances.ContainsKey(view)) { _instances[view] = new HighlightWordTagger(view, format, searcher, navigator); } return(_instances[view]); }
public ITagger <T> CreateTagger <T>(ITextView view, ITextBuffer buffer) where T : ITag { // provide highlighting only on the top buffer if (view.TextBuffer != buffer) { return(null); } var navigator = TextStructureNavigatorService.GetTextStructureNavigator(buffer); var format = FormatMapService.GetEditorFormatMap(view); return(HighlightWordTagger.Instance(view as IWpfTextView, format, TextSearchService, navigator) as ITagger <T>); }
public HighlightedWordsEnumerator(IWpfTextView view, HighlightWordTagger tagger) { _view = view; _tagger = tagger; _tagger.TagsChanged += OnTagsChanged; }