From 261107dbdf0d7ee4571c6c70788c1760e32ba4b1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Tue, 3 Jan 2017 00:37:06 +0100 Subject: [PATCH] Spinner styling, ColorPicker SelectedRawColor, config conversion debug, color.resetName --- Default.style | 3 +++ Templates/Spinner.template | 4 ++-- src/Colors.cs | 5 ++++- src/Configuration.cs | 2 +- src/GraphicObjects/ColorPicker.cs | 17 +++++++++++++++-- 5 files changed, 25 insertions(+), 6 deletions(-) diff --git a/Default.style b/Default.style index 553be982..dc8abd86 100644 --- a/Default.style +++ b/Default.style @@ -43,6 +43,9 @@ Splitter { Focusable = true; Background = DimGray; } +Spinner { + Foreground = DimGray; +} TabView { CacheEnabled = false; } diff --git a/Templates/Spinner.template b/Templates/Spinner.template index 1151fa8d..5d1dd693 100755 --- a/Templates/Spinner.template +++ b/Templates/Spinner.template @@ -1,8 +1,8 @@ - diff --git a/src/Colors.cs b/src/Colors.cs index 65a7f037..f55c4187 100644 --- a/src/Colors.cs +++ b/src/Colors.cs @@ -142,6 +142,9 @@ namespace Crow { return new Color (this.R, this.G, this.B, _A); } + public void ResetName(){ + Name = ""; + } #region Predefined colors public static readonly Color Transparent = new Color(0, 0, 0, 0, "Transparent"); @@ -1075,7 +1078,7 @@ namespace Crow } public static Color FromHSV(double _h, double _v = 1.0, double _s = 1.0){ Color c = Color.Black; - + c.ResetName (); if (_s == 0) {//HSV from 0 to 1 c.R = _v; c.G = _v; diff --git a/src/Configuration.cs b/src/Configuration.cs index af52eed4..5e035f14 100644 --- a/src/Configuration.cs +++ b/src/Configuration.cs @@ -53,7 +53,7 @@ namespace Crow if (!items.ContainsKey (key)) return default(T); Type type = typeof(T); - MethodInfo miParse = type.GetMethod ("Parse", BindingFlags.Static); + MethodInfo miParse = type.GetMethod ("Parse", new Type[] {typeof(string)}); if (miParse == null) return (T)Convert.ChangeType (items [key], typeof(T)); diff --git a/src/GraphicObjects/ColorPicker.cs b/src/GraphicObjects/ColorPicker.cs index cc8dfac3..57f9610d 100644 --- a/src/GraphicObjects/ColorPicker.cs +++ b/src/GraphicObjects/ColorPicker.cs @@ -131,9 +131,21 @@ namespace Crow hsvFromRGB (); } } - + [XmlAttributeAttribute] + public virtual Color SelectedRawColor { + get { return curColor; } + set { + if (curColor == value) + return; + curColor = value; + notifyCurColorHasChanged (); + notifyRGBAHasChanged (); + hsvFromRGB (); + } + } void notifyCurColorHasChanged(){ NotifyValueChanged ("SelectedColor", SelectedColor); + NotifyValueChanged ("SelectedRawColor", curColor); string n = curColor.ToString (); if (char.IsLetter(n[0])) NotifyValueChanged ("SelectedColorName", n); @@ -154,6 +166,7 @@ namespace Crow } void hsvFromRGB(){ Color c = curColor; + c.ResetName (); double min = Math.Min (c.R, Math.Min (c.G, c.B)); //Min. value of RGB double max = Math.Max (c.R, Math.Max (c.G, c.B)); //Max. value of RGB double diff = max - min; //Delta RGB value @@ -188,7 +201,7 @@ namespace Crow } void rgbFromHSV(){ Color c = Color.Black; - + c.ResetName (); if (s == 0) {//HSV from 0 to 1 c.R = v; c.G = v; -- 2.47.3