diff --git a/ILSpy/Controls/DockedPane.cs b/ILSpy/Controls/DockedPane.cs index 902ef34b1..6f370ce95 100644 --- a/ILSpy/Controls/DockedPane.cs +++ b/ILSpy/Controls/DockedPane.cs @@ -20,8 +20,6 @@ using System; using System.Windows; using System.Windows.Controls; using System.Windows.Input; -using System.Windows.Markup; -using System.Windows.Media; namespace ICSharpCode.ILSpy.Controls { @@ -75,43 +73,4 @@ namespace ICSharpCode.ILSpy.Controls } } } - - [MarkupExtensionReturnType(typeof(Color))] - class ControlColor : MarkupExtension - { - readonly float val; - - /// - /// Amount of highlight (0..1) - /// - public float Highlight { get; set; } - - /// - /// val: Color value in the range 105..255. - /// - public ControlColor(float val) - { - if (!(val >= 105 && val <= 255)) - throw new ArgumentOutOfRangeException("val"); - this.val = val; - } - - public override object ProvideValue(IServiceProvider serviceProvider) - { - if (val > 227) { - return Interpolate(227, SystemColors.ControlLightColor, 255, SystemColors.ControlLightLightColor); - } else if (val > 160) { - return Interpolate(160, SystemColors.ControlDarkColor, 227, SystemColors.ControlLightColor); - } else { - return Interpolate(105, SystemColors.ControlDarkDarkColor, 160, SystemColors.ControlDarkColor); - } - } - - Color Interpolate(float v1, Color c1, float v2, Color c2) - { - float v = (val - v1) / (v2 - v1); - Color c = c1 * (1 - v) + c2 * v; - return c * (1 - Highlight) + SystemColors.HighlightColor * Highlight; - } - } } diff --git a/ILSpy/Controls/MarkupExtensions.cs b/ILSpy/Controls/MarkupExtensions.cs new file mode 100644 index 000000000..09b185ebb --- /dev/null +++ b/ILSpy/Controls/MarkupExtensions.cs @@ -0,0 +1,64 @@ +// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team +// +// Permission is hereby granted, free of charge, to any person obtaining a copy of this +// software and associated documentation files (the "Software"), to deal in the Software +// without restriction, including without limitation the rights to use, copy, modify, merge, +// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons +// to whom the Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all copies or +// substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, +// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE +// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. + +using System; +using System.Windows; +using System.Windows.Markup; +using System.Windows.Media; + +namespace ICSharpCode.ILSpy.Controls +{ + [MarkupExtensionReturnType(typeof(Color))] + class ControlColor : MarkupExtension + { + readonly float val; + + /// + /// Amount of highlight (0..1) + /// + public float Highlight { get; set; } + + /// + /// val: Color value in the range 105..255. + /// + public ControlColor(float val) + { + if (!(val >= 105 && val <= 255)) + throw new ArgumentOutOfRangeException("val"); + this.val = val; + } + + public override object ProvideValue(IServiceProvider serviceProvider) + { + if (val > 227) { + return Interpolate(227, SystemColors.ControlLightColor, 255, SystemColors.ControlLightLightColor); + } else if (val > 160) { + return Interpolate(160, SystemColors.ControlDarkColor, 227, SystemColors.ControlLightColor); + } else { + return Interpolate(105, SystemColors.ControlDarkDarkColor, 160, SystemColors.ControlDarkColor); + } + } + + Color Interpolate(float v1, Color c1, float v2, Color c2) + { + float v = (val - v1) / (v2 - v1); + Color c = c1 * (1 - v) + c2 * v; + return c * (1 - Highlight) + SystemColors.HighlightColor * Highlight; + } + } +} \ No newline at end of file diff --git a/ILSpy/ILSpy.csproj b/ILSpy/ILSpy.csproj index 20c281acf..a79b21d30 100644 --- a/ILSpy/ILSpy.csproj +++ b/ILSpy/ILSpy.csproj @@ -104,6 +104,7 @@ + ResourceObjectTable.xaml