aboutsummaryrefslogtreecommitdiffstatsci
path: root/src
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2017-01-03 00:37:06 +0100
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2017-01-03 00:37:06 +0100
commit261107dbdf0d7ee4571c6c70788c1760e32ba4b1 (patch)
tree42491f69270bb0aed7e0c7c8e8a0d175585422c8 /src
parentca2044c913d034889dc50e57d8b1acaa9bde2a35 (diff)
Spinner styling, ColorPicker SelectedRawColor, config conversion debug, color.resetName
Diffstat (limited to 'src')
-rw-r--r--src/Colors.cs5
-rw-r--r--src/Configuration.cs2
-rw-r--r--src/GraphicObjects/ColorPicker.cs17
3 files changed, 20 insertions, 4 deletions
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;