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 void TextViewCreated(IWpfTextView textView) { IClassificationType classification = ClassificationRegistry.GetClassificationType(Constants.COLUMN_HIGHLIGHT); IClassificationFormatMap map = //FormatMapService.GetClassificationFormatMap(FontsAndColorsCategories.TextEditorCategory); FormatMapService.GetClassificationFormatMap(textView); textView.Properties.GetOrCreateSingletonProperty( () => { return(new CurrentColumnAdornment(textView, map, classification, Settings)); }); }
public UIElement GenerateGlyph(IWpfTextViewLine line, IGlyphTag tag) { // Ensure a glyph can be drawn for this marker if (tag == null || !(tag is AccentBoxOccurrences)) { return(null); } IEditorFormatMap map = FormatMapService.GetEditorFormatMap(View); ResourceDictionary dict = map.GetProperties(Constants.GLYPH_FORMAT_NAME); System.Windows.Shapes.Ellipse ellipse = new Ellipse(); ellipse.Fill = (SolidColorBrush)dict[EditorFormatDefinition.BackgroundBrushId]; ellipse.StrokeThickness = 2; ellipse.Stroke = (SolidColorBrush)dict[EditorFormatDefinition.ForegroundBrushId]; ellipse.Height = glyphSize; ellipse.Width = glyphSize; return(ellipse); }
/// <summary> /// Creates a tag provider for the specified view and buffer. /// </summary> public ITagger <T> CreateTagger <T>(ITextView textView, ITextBuffer buffer) where T : ITag { Trace(nameof(CreateTagger)); if (textView == null) { throw new ArgumentNullException("textView"); } if (buffer == null) { throw new ArgumentNullException("buffer"); } if (buffer != textView.TextBuffer) { return(null); } var textBlockStyler = MyUtil.GetTextBlockStyler(FormatMapService.GetEditorFormatMap(textView)); // FormatMapService.GetEditorFormatMap("text").GetProperties("Comment")["ForegroundColor"] var scope = new AdornmentTaggerScope { TextBlockStyler = textBlockStyler, WpfTextView = (IWpfTextView)textView }; ITagAggregator <TagData> CreateTagAggregator() { AdornmentTagger.scopeStatic = scope; var value = BufferTagAggregatorFactoryService.CreateTagAggregator <TagData>(textView.TextBuffer); AdornmentTagger.scopeStatic = null; return(value); } return(AdornmentTagger.GetTagger(new Lazy <ITagAggregator <TagData> >(CreateTagAggregator), scope) as ITagger <T>); }
public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin) { if (textViewHost.TextView.Roles.ContainsAny(RejectedRoles)) { return(null); } DTE dte = (DTE)ServiceProvider.GetService(typeof(DTE)); // Hide the real scroll bar IWpfTextViewMargin realScrollBar = containerMargin.GetTextViewMargin(PredefinedMarginNames.VerticalScrollBar) as IWpfTextViewMargin; if (realScrollBar != null) { realScrollBar.VisualElement.MinWidth = 0.0; realScrollBar.VisualElement.Width = 0.0; } IWpfTextView textView = textViewHost.TextView; SimpleScrollBar scrollBar = new SimpleScrollBar( textView, containerMargin, _scrollMapFactory); ProgressiveScroll progressiveScroll = new ProgressiveScroll( containerMargin, textView, _outliningManagerService.GetOutliningManager(textView), _tagAggregatorFactoryService.CreateTagAggregator <ChangeTag>(textView), _tagAggregatorFactoryService.CreateTagAggregator <IVsVisibleTextMarkerTag>(textView), _tagAggregatorFactoryService.CreateTagAggregator <IErrorTag>(textView), dte.Debugger, scrollBar, new ColorSet(FormatMapService.GetEditorFormatMap(textView))); return(progressiveScroll); }
public IClassificationFormatMap GetFormatMap(ITextView textView) { return(FormatMapService.GetClassificationFormatMap(textView)); }