public BackgroundColorVisualManager(IWpfTextView view, ITagAggregator<IClassificationTag> aggregator, IClassificationFormatMap formatMap, IVsFontsAndColorsInformationService fcService, IVsEditorAdaptersFactoryService adaptersService) { _view = view; _layer = view.GetAdornmentLayer("BackgroundColorFix"); _aggregator = aggregator; _formatMap = formatMap; _fcService = fcService; _adaptersService = adaptersService; _view.LayoutChanged += OnLayoutChanged; // Here are the hacks for making the normal classification background go away: _formatMap.ClassificationFormatMappingChanged += (sender, args) => { if (!_inUpdate && _view != null && !_view.IsClosed) { _view.VisualElement.Dispatcher.BeginInvoke(new Action(FixFormatMap)); } }; _view.VisualElement.Dispatcher.BeginInvoke(new Action(FixFormatMap)); }
public BackgroundColorVisualManager(IWpfTextView view, ITagAggregator <IClassificationTag> aggregator, IClassificationFormatMap formatMap, IVsFontsAndColorsInformationService fcService, IVsEditorAdaptersFactoryService adaptersService) { _view = view; _layer = view.GetAdornmentLayer("BackgroundColorFix"); _aggregator = aggregator; _formatMap = formatMap; _fcService = fcService; _adaptersService = adaptersService; _view.LayoutChanged += OnLayoutChanged; // Here are the hacks for making the normal classification background go away: _formatMap.ClassificationFormatMappingChanged += (sender, args) => { if (!_inUpdate && _view != null && !_view.IsClosed) { _view.VisualElement.Dispatcher.BeginInvoke(new Action(FixFormatMap)); } }; _view.VisualElement.Dispatcher.BeginInvoke(new Action(FixFormatMap)); }
private static IVsFontsAndColorsInformation TryGetFontAndColorInfo(IVsFontsAndColorsInformationService service) { var guidTextFileType = new Guid(2184822468u, 61063, 4560, 140, 152, 0, 192, 79, 194, 171, 34); var fonts = new FontsAndColorsCategory( guidTextFileType, DefGuidList.guidTextEditorFontCategory, DefGuidList.guidTextEditorFontCategory); return(service?.GetFontAndColorInformation(fonts)); }
public CodeGazeAdornment( IWpfTextView textView, IVsFontsAndColorsInformationService fontColorService, IVsEditorAdaptersFactoryService adaptersService) { this.textView = textView; this.fontColorService = fontColorService; this.adaptersService = adaptersService; this.layer = this.textView.GetAdornmentLayer(nameof(CodeGazeAdornment)); this.textView.LayoutChanged += HandleTextViewLayoutChanged; }
public static void Initialize(IEditorFormatMapService editorFormatMapService, IVsFontsAndColorsInformationService vsFontsAndColorsInformationService) { if (IsInitialized) { throw new InvalidOperationException($"{nameof(VsSettings)} class is already initialized."); } IsInitialized = true; DefaultForegroundBrush.Freeze(); DefaultBackgroundBrush.Freeze(); VsSettings.editorFormatMapService = editorFormatMapService; VsSettings.vsFontsAndColorsInformationService = vsFontsAndColorsInformationService; }
private static Font LoadTextEditorFont(IVsFontsAndColorsInformationService vsFontsAndColorsInformationService) { try { //OMG! Isn't there any better way? var guidDefaultFileType = new Guid(2184822468u, 61063, 4560, 140, 152, 0, 192, 79, 194, 171, 34); //from Microsoft.VisualStudio.Editor.Implementation.ImplGuidList var info = vsFontsAndColorsInformationService.GetFontAndColorInformation(new FontsAndColorsCategory( guidDefaultFileType, DefGuidList.guidTextEditorFontCategory, DefGuidList.guidTextEditorFontCategory)); //info.Updated - event does not work. Don't know why :( var preferences = info.GetFontAndColorPreferences(); return(Font.FromHfont(preferences.hRegularViewFont)); } catch { return(SystemFonts.DefaultFont); } }