]> O.S.I.I.S - jp/crow.git/commitdiff
Spinner styling, ColorPicker SelectedRawColor, config conversion debug, color.resetName
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 2 Jan 2017 23:37:06 +0000 (00:37 +0100)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 2 Jan 2017 23:37:06 +0000 (00:37 +0100)
Default.style
Templates/Spinner.template
src/Colors.cs
src/Configuration.cs
src/GraphicObjects/ColorPicker.cs

index 553be982c176f70cb6932429b03e42cc3d62f440..dc8abd8651d3d0d6099f53c478e4f37fdb4fd59e 100644 (file)
@@ -43,6 +43,9 @@ Splitter {
        Focusable = true;
        Background = DimGray;
 }
+Spinner {
+       Foreground = DimGray;
+}
 TabView {
        CacheEnabled = false;
 }
index 1151fa8d13f4df17f7004a8f887099cf7ce143f2..5d1dd69381443d9f6bd98f86c973dc90d304c3b8 100755 (executable)
@@ -1,8 +1,8 @@
 <?xml version="1.0"?>
 <HorizontalStack MinimumSize="40,10" Name="hstack" Margin="0" Spacing="0">
        <Border BorderWidth="1" Width="80%"  Background="White" 
-               Foreground="DimGray" Margin="0">
-               <Label Foreground="DimGray" Width="Stretched"
+               Foreground="{./Foreground}" Margin="0">
+               <Label Foreground="{./Foreground}" Font="{./Font}" Width="Stretched"
                        Text="{./Value}" TextAlignment="Right" Margin="0"/>
        </Border>
        <VerticalStack MinimumSize="8,10" Width="20%" Height="Stretched" Spacing="0" Margin="0" Background="Red">
index 65a7f03752d321fe73440bdeedadf00b38596893..f55c4187e6d7538d7c5b80c5b18784bde0fcc638 100644 (file)
@@ -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;
index af52eed45787640aea8cdf8ea4ad6c4fe2fd47cb..5e035f14a7ba856b051d48388c440806fd480b85 100644 (file)
@@ -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));
 
index cc8dfac36068be2d8de3c1b453c3fcaffa14d547..57f9610df7c5721f3bd6535391a7f8ae7af36ff1 100644 (file)
@@ -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;