예제 #1
0
        public static Brush Get_Background_Color()
        {
            try
            {
                DTE dte = Package.GetGlobalService(typeof(SDTE)) as DTE;
                EnvDTE.Properties propertiesList = dte.get_Properties("FontsAndColors", "TextEditor");
                Property          prop           = propertiesList.Item("FontsAndColorsItems");

                FontsAndColorsItems fci = (FontsAndColorsItems)prop.Object;

                for (int i = 1; i < fci.Count; ++i)
                {
                    ColorableItems ci = fci.Item(i);
                    if (ci.Name.Equals("PLAIN TEXT", StringComparison.OrdinalIgnoreCase))
                    {
                        return(new SolidColorBrush(ConvertColor(System.Drawing.ColorTranslator.FromOle((int)ci.Background))));
                    }
                }
            }
            catch (Exception e)
            {
                AsmDudeToolsStatic.Output_ERROR("AsmDudeToolsStatic:Get_Background_Color " + e.Message);
            }
            AsmDudeToolsStatic.Output_WARNING("AsmDudeToolsStatic:Get_Background_Color: could not retrieve text color");
            return(new SolidColorBrush(Colors.Gray));
        }
예제 #2
0
        public static System.Windows.Media.Color GetForegroundColourOf(FontsAndColorsItems faci, string item)
        {
            Int32 oleColor = System.Convert.ToInt32(faci.Item(item).Foreground);

            System.Drawing.Color       sdColor   = System.Drawing.ColorTranslator.FromOle(oleColor);
            System.Windows.Media.Color foreColor = System.Windows.Media.Color.FromArgb(sdColor.A, sdColor.R, sdColor.G, sdColor.B);
            return(foreColor);
        }
예제 #3
0
        private void ExtractUIColorSettingsFromFontsAndColors(FontsAndColorsItems colors, UISettings settings)
        {
            ColorableItems item;

            item = colors.Item("Error");
            if (null == item)
            {
                item = colors.Item("Compiler Error");
            }
            settings.ErrorForegroundColor = GetConsoleColor(item.Foreground, settings.ErrorForegroundColor);
            settings.ErrorBackgroundColor = GetConsoleColor(item.Background, settings.ErrorBackgroundColor);

            item = colors.Item("Warning");
            if (null == item)
            {
                item = colors.Item("Compiler Warning");
            }
            settings.WarningForegroundColor = GetConsoleColor(item.Foreground, settings.WarningForegroundColor);
            settings.WarningBackgroundColor = GetConsoleColor(item.Background, settings.WarningBackgroundColor);

            item = colors.Item("String");
            settings.DebugForegroundColor = GetConsoleColor(item.Foreground, settings.DebugForegroundColor);
            settings.DebugBackgroundColor = GetConsoleColor(item.Background, settings.DebugBackgroundColor);

            item = colors.Item("Comment");
            settings.VerboseForegroundColor = GetConsoleColor(item.Foreground, settings.VerboseForegroundColor);
            settings.VerboseBackgroundColor = GetConsoleColor(item.Background, settings.VerboseBackgroundColor);
        }
예제 #4
0
        public EditorFontAndColors()
        {
            FontFamily         = "Consolas";
            FontSize           = 10.0f;
            FontBold           = false;
            ForeColor          = Color.Black;
            BackColor          = Color.White;
            HighlightFontBold  = false;
            HighlightForeColor = Color.White;
            HighlightBackColor = Color.Blue;

            try
            {
                DTE        dte   = (DTE)Package.GetGlobalService(typeof(DTE));
                Properties props = dte.Properties["FontsAndColors", "TextEditor"];

                FontsAndColorsItems fac = (FontsAndColorsItems)props.Item("FontsAndColorsItems").Object;

                ColorableItems colors = fac.Item("Plain Text");

                FontFamily = props.Item("FontFamily").Value.ToString();
                FontSize   = (short)props.Item("FontSize").Value;
                FontBold   = colors.Bold;
                ForeColor  = ColorTranslator.FromOle((int)colors.Foreground);
                BackColor  = ColorTranslator.FromOle((int)colors.Background);

                colors = fac.Item("Selected Text");

                HighlightFontBold  = colors.Bold;
                HighlightForeColor = ColorTranslator.FromOle((int)colors.Foreground);
                HighlightBackColor = ColorTranslator.FromOle((int)colors.Background);
            }
            catch (Exception ex)
            {
                Trace.WriteLine("Error loading text editor font and colors");
                Trace.WriteLine(ex.ToString());
            }
        }
        public void Item_GetPlainTextItem_ReturnsColorableItems()
        {
            CreateFontsAndColorItems();
            AddDefaultTextAndBackgroundColorToRules();

            ColorableItems colorableItems = items.Item("Plain Text");
            string         name           = colorableItems.Name;

            Assert.AreEqual("Plain Text", name);
        }
예제 #6
0
        public static async Task <Brush> GetBackgroundColorAsync()
        {
            if (!ThreadHelper.CheckAccess())
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
            }

            DTE        dte            = Package.GetGlobalService(typeof(SDTE)) as DTE;
            Properties propertiesList = dte.get_Properties("FontsAndColors", "TextEditor");
            Property   prop           = propertiesList.Item("FontsAndColorsItems");

            FontsAndColorsItems fci = (FontsAndColorsItems)prop.Object;

            for (int i = 1; i < fci.Count; ++i)
            {
                ColorableItems ci = fci.Item(i);
                if (ci.Name.Equals("PLAIN TEXT", StringComparison.OrdinalIgnoreCase))
                {
                    return(new SolidColorBrush(ConvertColor(System.Drawing.ColorTranslator.FromOle((int)ci.Background))));
                }
            }
            Output_WARNING("AsmDudeToolsStatic:Get_Background_Color: could not retrieve text color");
            return(new SolidColorBrush(Colors.Gray));
        }
예제 #7
0
 public static bool GetBoldednessOf(FontsAndColorsItems faci, string item)
 {
     return(faci.Item(item).Bold);
 }
예제 #8
0
	    private void ExtractUIColorSettingsFromFontsAndColors(FontsAndColorsItems colors, UISettings settings)
	    {
	        ColorableItems item;
	        item = colors.Item("Error");
	        if (null == item)
	        {
	            item = colors.Item("Compiler Error");
	        }
	        settings.ErrorForegroundColor = GetConsoleColor(item.Foreground, settings.ErrorForegroundColor);
	        settings.ErrorBackgroundColor = GetConsoleColor(item.Background, settings.ErrorBackgroundColor);

	        item = colors.Item("Warning");
	        if (null == item)
	        {
	            item = colors.Item("Compiler Warning");
	        }
	        settings.WarningForegroundColor = GetConsoleColor(item.Foreground, settings.WarningForegroundColor);
	        settings.WarningBackgroundColor = GetConsoleColor(item.Background, settings.WarningBackgroundColor);

	        item = colors.Item("String");
	        settings.DebugForegroundColor = GetConsoleColor(item.Foreground, settings.DebugForegroundColor);
	        settings.DebugBackgroundColor = GetConsoleColor(item.Background, settings.DebugBackgroundColor);

	        item = colors.Item("Comment");
	        settings.VerboseForegroundColor = GetConsoleColor(item.Foreground, settings.VerboseForegroundColor);
	        settings.VerboseBackgroundColor = GetConsoleColor(item.Background, settings.VerboseBackgroundColor);
	    }
예제 #9
0
        public Color GetBuiltIn(String classificationName)
        {
            var colorItem = _fontsAndColorsItems.Item(classificationName);

            return(ColorTranslator.FromWin32((int)colorItem.Foreground));
        }