예제 #1
0
        internal static void AdjustFontSize(IServiceProvider serviceProvider, Guid category, short change)
        {
            IVsFontAndColorStorage   storage   = (IVsFontAndColorStorage)serviceProvider.GetService(typeof(SVsFontAndColorStorage));
            IVsFontAndColorUtilities utilities = storage as IVsFontAndColorUtilities;

            LOGFONTW[] pLOGFONT = new LOGFONTW[1];
            FontInfo[] pInfo    = new FontInfo[1];

            ErrorHandler.ThrowOnFailure(storage.OpenCategory(category, (uint)(__FCSTORAGEFLAGS.FCSF_LOADDEFAULTS | __FCSTORAGEFLAGS.FCSF_PROPAGATECHANGES)));
            try
            {
                if (!ErrorHandler.Succeeded(storage.GetFont(pLOGFONT, pInfo)))
                {
                    return;
                }

                pInfo[0].wPointSize = checked ((ushort)(pInfo[0].wPointSize + change));
                ErrorHandler.ThrowOnFailure(storage.SetFont(pInfo));
                ErrorHandler.ThrowOnFailure(utilities.FreeFontInfo(pInfo));
            }
            finally
            {
                storage.CloseCategory();
            }
        }
 public ColorStorage(IServiceProvider provider)
 {
     Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
     Shell     = (IVsUIShell2)provider.GetService(typeof(SVsUIShell));
     Storage   = (IVsFontAndColorStorage)provider.GetService(typeof(SVsFontAndColorStorage));
     Utilities = (IVsFontAndColorUtilities)Storage;
 }
예제 #3
0
        protected ClassificationColorManager(IServiceProvider serviceProvider)
        {
            fontAndColorStorage   = serviceProvider.GetService(typeof(SVsFontAndColorStorage)) as IVsFontAndColorStorage;
            fontAndColorUtilities = serviceProvider.GetService(typeof(SVsFontAndColorStorage)) as IVsFontAndColorUtilities;

            // Initialize theme engine
            themeEngine = new VisualStudioThemeEngine(serviceProvider);
            themeEngine.OnThemeChanged += themeEngine_OnThemeChanged;
        }
 public TextInformationManager(IServiceProvider serviceProvider, IComponentModel componentModel)
 {
     this.serviceProvider = serviceProvider;
     this.componentModel = componentModel;
     fontAndColorStorage = (IVsFontAndColorStorage) serviceProvider.GetService(typeof (SVsFontAndColorStorage));
     fontAndColorUtilities = fontAndColorStorage as IVsFontAndColorUtilities;
     fontAndColorCache = (IVsFontAndColorCacheManager)serviceProvider.GetService(typeof(SVsFontAndColorCacheManager));
     textManager = (IVsTextManager) serviceProvider.GetService(typeof (SVsTextManager));
     editorAdaptersFactoryService = componentModel.GetService<IVsEditorAdaptersFactoryService>();
     textStructureNavigatorSelectorService = componentModel.GetService<ITextStructureNavigatorSelectorService>();
     classicationFormatMapService = componentModel.GetService<IClassificationFormatMapService>();
     classificationAggregatorService = componentModel.GetService<IClassifierAggregatorService>();
 }
예제 #5
0
 public ColorStorage(IServiceProvider provider)
 {
     Shell     = (IVsUIShell2)provider.GetService(typeof(SVsUIShell));
     Storage   = (IVsFontAndColorStorage)provider.GetService(typeof(SVsFontAndColorStorage));
     Utilities = (IVsFontAndColorUtilities)Storage;
 }
 public FontAndColorsHelper()
 {
     fncStorage = (IVsFontAndColorStorage)Package.GetGlobalService(typeof(SVsFontAndColorStorage));
     fncUtils   = (IVsFontAndColorUtilities)Package.GetGlobalService(typeof(SVsFontAndColorStorage));
 }