Пример #1
0
        private System.Drawing.Color GetColor(ColorKey colorKey)
        {
#if DEBUG_COLOR_STYLE_OPTIONS
            Debug.WriteLine($"GeneralOptions.GetColor keyName={colorKey.Name}" + (colorKey.IsForeground? "FG":"BG") + $" color={colorMap[colorKey].Color}");
#endif
            return(colorMap[colorKey].Color);
        }
Пример #2
0
        private void SetColor(bool sendNotification, string propertyName, ColorKey colorKey, System.Drawing.Color value)
        {
#if DEBUG_COLOR_STYLE_OPTIONS
            Debug.WriteLine($"GeneralOptions.SetColor keyName={colorKey.Name}" + (colorKey.IsForeground? "FG":"BG") + $" color={value} Notify={sendNotification}");
#endif
            colorMap[colorKey].Color = value;
            if (sendNotification)
            {
                VsSettings.NotiifyInstancesFmtPropertyChanged(propertyName, fromDrawingColor(value));
            }
        }
Пример #3
0
 private static void SaveColor(IVsFontAndColorStorage vsStorage, ColorKey colorKey, System.Drawing.Color color)
 {
     Debug.WriteLine($"GeneralOptions.SaveColoR keyName={colorKey.Name} color={color}");
     ThreadHelper.ThrowIfNotOnUIThread();
     ColorableItemInfo[] arr = new ColorableItemInfo[1];
     ErrorHandler.ThrowOnFailure(vsStorage.GetItem(colorKey.Name, arr));
     if (colorKey.IsForeground)
     {
         arr[0].bForegroundValid = 1;
         arr[0].crForeground     = (uint)ColorTranslator.ToWin32(color);
     }
     else
     {
         arr[0].bBackgroundValid = 1;
         arr[0].crBackground     = (uint)ColorTranslator.ToWin32(color);
     }
     ErrorHandler.ThrowOnFailure(vsStorage.SetItem(colorKey.Name, arr));
 }
Пример #4
0
        private static System.Drawing.Color LoadColor(IServiceProvider Site, IVsFontAndColorStorage vsStorage, ColorKey colorKey)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var arr = new ColorableItemInfo[1];

            ErrorHandler.ThrowOnFailure(vsStorage.GetItem(colorKey.Name, arr));

            var isValid = colorKey.IsForeground ? arr[0].bForegroundValid : arr[0].bBackgroundValid;

            if (isValid == 0)
            {
                throw new Exception();
            }

            var colorRef = colorKey.IsForeground ? arr[0].crForeground : arr[0].crBackground;
            var color    = FromColorRef(Site, vsStorage, colorRef);

            Debug.WriteLine($"GeneralOptions.LoadColoR keyName={colorKey.Name} color={color}");
            return(color);
        }
Пример #5
0
 internal ColorInfo(ColorKey colorKey, System.Drawing.Color color, bool isValid = true)
 {
     ColorKey = colorKey; OriginalColor = color; Color = color; IsValid = isValid;
 }