]> O.S.I.I.S - jp/crow.git/commitdiff
store color as uint32
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 13 May 2020 16:16:02 +0000 (18:16 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Wed, 13 May 2020 16:16:02 +0000 (18:16 +0200)
36 files changed:
Crow.sln
Crow/Crow.csproj
Crow/src/Cairo/CairoHelpers.cs
Crow/src/Colors.cs
Crow/src/Fill/Fill.cs
Crow/src/Fill/Gradient.cs
Crow/src/Fill/SolidColor.cs
Crow/src/IML/CompilerServices.cs
Crow/src/IML/Instantiator.cs
Crow/src/IML/MemberAddress.cs
Crow/src/Interface.cs
Crow/src/Mono.Cairo/CairoDebug.cs
Crow/src/Widgets/Border.cs
Crow/src/Widgets/ColorPicker.cs
Crow/src/Widgets/ColorSlider.cs
Crow/src/Widgets/DirectoryView.cs
Crow/src/Widgets/DockStack.cs
Crow/src/Widgets/DockWindow.cs
Crow/src/Widgets/Group.cs
Crow/src/Widgets/HueSelector.cs
Crow/src/Widgets/Label.cs
Crow/src/Widgets/MenuItem.cs
Crow/src/Widgets/SaturationValueSelector.cs
Crow/src/Widgets/TabItem.cs
Crow/src/Widgets/TabView.cs
Crow/src/Widgets/TemplatedGroup.cs
Crow/src/Widgets/Widget.cs
Crow/src/Widgets/Window.cs
Crow/src/XCursor.cs
Crow/src/debug/DbgLogViewer.cs
PerfTests/PerfTests.csproj [new file with mode: 0644]
PerfTests/Program.cs [new file with mode: 0644]
Samples/BasicTests/BasicTests.cs
Samples/HelloWorld/ui/helloworld.crow
Samples/ShowCase/main.cs
unitTests/unitTests.csproj

index b7b5f9b494e64551df39d86b53d62beb25fde1df..bac0b9b20c63992026dc3a30a74c08ec70b9833e 100644 (file)
--- a/Crow.sln
+++ b/Crow.sln
@@ -23,6 +23,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BasicTests", "Samples\Basic
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "glfw-sharp", "..\..\glfw-sharp\glfw-sharp.csproj", "{A07754EB-1CAF-4D2D-8247-A3B6A46FB943}"
 EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PerfTests", "PerfTests\PerfTests.csproj", "{18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}"
+EndProject
 Global
        GlobalSection(SolutionConfigurationPlatforms) = preSolution
                Debug|Any CPU = Debug|Any CPU
@@ -55,6 +57,10 @@ Global
                {A07754EB-1CAF-4D2D-8247-A3B6A46FB943}.Debug|Any CPU.Build.0 = Debug|Any CPU
                {A07754EB-1CAF-4D2D-8247-A3B6A46FB943}.Release|Any CPU.ActiveCfg = Release|Any CPU
                {A07754EB-1CAF-4D2D-8247-A3B6A46FB943}.Release|Any CPU.Build.0 = Release|Any CPU
+               {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+               {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+               {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+               {18EBB41F-815E-4BF5-B80F-C9E2FAB2993A}.Release|Any CPU.Build.0 = Release|Any CPU
        EndGlobalSection
        GlobalSection(MonoDevelopProperties) = preSolution
                Policies = $0
index fdf4f29dda212278402ef1e4ed51a622dc6e3b1b..bc5594aa34516acbe779161622f6d24512dab801 100644 (file)
        <ItemGroup>
          <ProjectReference Include="..\..\..\glfw-sharp\glfw-sharp.csproj" />
        </ItemGroup>
+       <ItemGroup>
+         <Compile Remove="src\Widgets\ColorPicker2.cs" />
+         <Compile Remove="src\Widgets\ColorSlider.cs" />
+       </ItemGroup>
+       <ItemGroup>
+         <None Include="src\Widgets\ColorPicker2.cs" />
+         <None Include="src\Widgets\ColorSlider.cs" />
+       </ItemGroup>
 </Project>
index 0a5bd21bc29799721fc5b545885c9f7efa598059..d5263df396ef1306e06a34a351a3fd057dd1def8 100644 (file)
@@ -101,13 +101,13 @@ namespace Crow
             gr.Save();
             r.Inflate((int)-width / 2, (int)-width / 2);
             gr.LineWidth = width;
-                       gr.SetSourceColor(Color.White);
+                       gr.SetSourceColor(Colors.White);
             gr.MoveTo(r.BottomLeft);
             gr.LineTo(r.TopLeft);
             gr.LineTo(r.TopRight);
             gr.Stroke();
 
-                       gr.SetSourceColor(Color.DarkGrey);
+                       gr.SetSourceColor(Colors.DarkGrey);
             gr.MoveTo(r.TopRight);
             gr.LineTo(r.BottomRight);
             gr.LineTo(r.BottomLeft);
@@ -120,12 +120,12 @@ namespace Crow
             gr.Save();
             r.Inflate((int)-width / 2, (int)-width / 2);
             gr.LineWidth = width;
-                       gr.SetSourceColor(Color.DarkGrey);
+                       gr.SetSourceColor(Colors.DarkGrey);
             gr.MoveTo(r.BottomLeft);
             gr.LineTo(r.TopLeft);
             gr.LineTo(r.TopRight);
             gr.Stroke();
-                       gr.SetSourceColor(Color.White);
+                       gr.SetSourceColor(Colors.White);
             gr.MoveTo(r.TopRight);
             gr.LineTo(r.BottomRight);
             gr.LineTo(r.BottomLeft);
index 21165cde5f4156c083f1a07f8bf877f900d95285..763aed07b5a6bc3e5bfd22de9832488b960efcf8 100644 (file)
@@ -8,118 +8,231 @@ using System.Linq;
 
 namespace Crow
 {
+       public enum Colors : UInt32
+       {
+               AliceBlue            = 0xF0F8FFFF,
+               AntiqueWhite         = 0xFAEBD7FF,
+               Aqua                 = 0x00FFFFFF,
+               Aquamarine           = 0x7FFFD4FF,
+               Azure                = 0xF0FFFFFF,
+               Beige                = 0xF5F5DCFF,
+               Bisque               = 0xFFE4C4FF,
+               Black                = 0x000000FF,
+               BlanchedAlmond       = 0xFFEBCDFF,
+               Blue                 = 0x0000FFFF,
+               BlueViolet           = 0x8A2BE2FF,
+               Brown                = 0xA52A2AFF,
+               BurlyWood            = 0xDEB887FF,
+               CadetBlue            = 0x5F9EA0FF,
+               Chartreuse           = 0x7FFF00FF,
+               Chocolate            = 0xD2691EFF,
+               Coral                = 0xFF7F50FF,
+               CornflowerBlue       = 0x6495EDFF,
+               Cornsilk             = 0xFFF8DCFF,
+               Crimson              = 0xDC143CFF,
+               Cyan                 = 0x00FFFFFF,
+               DarkBlue             = 0x00008BFF,
+               DarkCyan             = 0x008B8BFF,
+               DarkGoldenRod        = 0xB8860BFF,
+               DarkGrey             = 0xA9A9A9FF,
+               DarkGreen            = 0x006400FF,
+               DarkKhaki            = 0xBDB76BFF,
+               DarkMagenta          = 0x8B008BFF,
+               DarkOliveGreen       = 0x556B2FFF,
+               DarkOrange           = 0xFF8C00FF,
+               DarkOrchid           = 0x9932CCFF,
+               DarkRed              = 0x8B0000FF,
+               DarkSalmon           = 0xE9967AFF,
+               DarkSeaGreen         = 0x8FBC8FFF,
+               DarkSlateBlue        = 0x483D8BFF,
+               DarkSlateGrey        = 0x2F4F4FFF,
+               DarkTurquoise        = 0x00CED1FF,
+               DarkViolet           = 0x9400D3FF,
+               DeepPink             = 0xFF1493FF,
+               DeepSkyBlue          = 0x00BFFFFF,
+               DimGrey              = 0x696969FF,
+               DodgerBlue           = 0x1E90FFFF,
+               FireBrick            = 0xB22222FF,
+               FloralWhite          = 0xFFFAF0FF,
+               ForestGreen          = 0x228B22FF,
+               Fuchsia              = 0xFF00FFFF,
+               Gainsboro            = 0xDCDCDCFF,
+               GhostWhite           = 0xF8F8FFFF,
+               Gold                 = 0xFFD700FF,
+               GoldenRod            = 0xDAA520FF,
+               Grey                 = 0x808080FF,
+               Green                = 0x008000FF,
+               GreenYellow          = 0xADFF2FFF,
+               HoneyDew             = 0xF0FFF0FF,
+               HotPink              = 0xFF69B4FF,
+               IndianRed            = 0xCD5C5CFF,
+               Indigo               = 0x4B0082FF,
+               Ivory                = 0xFFFFF0FF,
+               Jet                  = 0x343434FF,
+               Khaki                = 0xF0E68CFF,
+               Lavender             = 0xE6E6FAFF,
+               LavenderBlush        = 0xFFF0F5FF,
+               LawnGreen            = 0x7CFC00FF,
+               LemonChiffon         = 0xFFFACDFF,
+               LightBlue            = 0xADD8E6FF,
+               LightCoral           = 0xF08080FF,
+               LightCyan            = 0xE0FFFFFF,
+               LightGoldenRodYellow = 0xFAFAD2FF,
+               LightGrey            = 0xD3D3D3FF,
+               LightGreen           = 0x90EE90FF,
+               LightPink            = 0xFFB6C1FF,
+               LightSalmon          = 0xFFA07AFF,
+               LightSeaGreen        = 0x20B2AAFF,
+               LightSkyBlue         = 0x87CEFAFF,
+               LightSlateGrey       = 0x778899FF,
+               LightSteelBlue       = 0xB0C4DEFF,
+               LightYellow          = 0xFFFFE0FF,
+               Lime                 = 0x00FF00FF,
+               LimeGreen            = 0x32CD32FF,
+               Linen                = 0xFAF0E6FF,
+               Magenta              = 0xFF00FFFF,
+               Maroon               = 0x800000FF,
+               MediumAquaMarine     = 0x66CDAAFF,
+               MediumBlue           = 0x0000CDFF,
+               MediumOrchid         = 0xBA55D3FF,
+               MediumPurple         = 0x9370DBFF,
+               MediumSeaGreen       = 0x3CB371FF,
+               MediumSlateBlue      = 0x7B68EEFF,
+               MediumSpringGreen    = 0x00FA9AFF,
+               MediumTurquoise      = 0x48D1CCFF,
+               MediumVioletRed      = 0xC71585FF,
+               MidnightBlue         = 0x191970FF,
+               MintCream            = 0xF5FFFAFF,
+               MistyRose            = 0xFFE4E1FF,
+               Moccasin             = 0xFFE4B5FF,
+               NavajoWhite          = 0xFFDEADFF,
+               Navy                 = 0x000080FF,
+               OldLace              = 0xFDF5E6FF,
+               Olive                = 0x808000FF,
+               OliveDrab            = 0x6B8E23FF,
+               Onyx                 = 0x353839FF,
+               Orange               = 0xFFA500FF,
+               OrangeRed            = 0xFF4500FF,
+               Orchid               = 0xDA70D6FF,
+               PaleGoldenRod        = 0xEEE8AAFF,
+               PaleGreen            = 0x98FB98FF,
+               PaleTurquoise        = 0xAFEEEEFF,
+               PaleVioletRed        = 0xDB7093FF,
+               PapayaWhip           = 0xFFEFD5FF,
+               PeachPuff            = 0xFFDAB9FF,
+               Peru                 = 0xCD853FFF,
+               Pink                 = 0xFFC0CBFF,
+               Plum                 = 0xDDA0DDFF,
+               PowderBlue           = 0xB0E0E6FF,
+               Purple               = 0x800080FF,
+               RebeccaPurple        = 0x663399FF,
+               Red                  = 0xFF0000FF,
+               RosyBrown            = 0xBC8F8FFF,
+               RoyalBlue            = 0x4169E1FF,
+               SaddleBrown          = 0x8B4513FF,
+               Salmon               = 0xFA8072FF,
+               SandyBrown           = 0xF4A460FF,
+               SeaGreen             = 0x2E8B57FF,
+               SeaShell             = 0xFFF5EEFF,
+               Sienna               = 0xA0522DFF,
+               Silver               = 0xC0C0C0FF,
+               SkyBlue              = 0x87CEEBFF,
+               SlateBlue            = 0x6A5ACDFF,
+               SlateGrey            = 0x708090FF,
+               Snow                 = 0xFFFAFAFF,
+               SpringGreen          = 0x00FF7FFF,
+               SteelBlue            = 0x4682B4FF,
+               Tan                  = 0xD2B48CFF,
+               Teal                 = 0x008080FF,
+               Thistle              = 0xD8BFD8FF,
+               Tomato               = 0xFF6347FF,
+               Turquoise            = 0x40E0D0FF,
+               Violet               = 0xEE82EEFF,
+               Wheat                = 0xF5DEB3FF,
+               White                = 0xFFFFFFFF,
+               WhiteSmoke           = 0xF5F5F5FF,
+               Yellow               = 0xFFFF00FF,
+               YellowGreen          = 0x9ACD32FF,
+
+               Transparent                      = 0x00,
+               Clear                = 0x01
+       }
+
        /// <summary>
        /// Universal Color structure
        /// </summary>
-       public struct Color : IEquatable<Color>
+       public struct Color : IEquatable<Color>//, IEquatable<Colors>
     {
                #region CTOR
-               public Color(double _R, double _G, double _B, double _A)
+               public Color(double r, double g, double b, double a)
+               {
+                       value =
+                               (((uint)Math.Round (r * 255.0)) << 24) +
+                               (((uint)Math.Round (g * 255.0)) << 16) +
+                               (((uint)Math.Round (b * 255.0)) << 8) +
+                               (((uint)Math.Round (a * 255.0)));
+               }
+               public Color(uint r, uint g, uint b, uint a)
+               {
+                       value =
+                               ((r & 0xFF) << 24) +
+                               ((g & 0xFF) << 16) +
+                               ((b & 0xFF) << 8) +
+                               ((a & 0xFF));
+               }
+               public Color (byte r, byte g, byte b, byte a)
                {
-                       A = _A.Clamp(0,1);
-                       R = _R.Clamp(0,1);
-                       G = _G.Clamp(0,1);
-                       B = _B.Clamp(0,1);
-                       predefinied = false;
-                       htmlCode = "";
-                       Name = "";
+                       value = ((uint)r << 24) + ((uint)g << 16) + ((uint)b << 8) + a;
                }
-               internal Color(double _R, double _G, double _B, double _A, string _name)
+               public Color (UInt32 rgba)
                {
-                       A = _A;
-                       R = _R;
-                       G = _G;
-                       B = _B;
-                       predefinied = false;
-                       Name = _name;
-                       htmlCode = "";
-                       ColorDic.Add(_name,this);
+                       this.value = rgba;
                }
-               internal Color(int _R, int _G, int _B, string _name, string _code)
+               public Color (Colors color)
                {
-                       A = 1.0;
-                       R = _R / 255.0;
-                       G = _G / 255.0;
-                       B = _B / 255.0;
-                       Name = _name;
-                       htmlCode = _code;
-                       predefinied = true;
-                       ColorDic.Add(_name,this);
+                       this.value = (UInt32)color;
                }
                #endregion
+               //rgba
+               UInt32 value;
 
-               /// <summary>
-               /// color names dictionary
-               /// </summary>
-               public static Dictionary<string, Color> ColorDic = new Dictionary<string, Color>();
+               public uint R {
+                       get => (value & 0xFF000000) >> 24;
+                       set => this.value = (value & 0x000000FF) << 24;
+               }
+               public uint G {
+                       get => (value & 0x00FF0000) >> 16;
+                       set => this.value = (value & 0x000000FF) << 16;
+               }
+               public uint B {
+                       get => (value & 0x0000FF00) >> 8;
+                       set => this.value = (value & 0x000000FF) << 8;
+               }
+               public uint A {
+                       get => (value & 0x000000FF);
+                       set => this.value = (value & 0x000000FF);
+               }
 
-               public string Name;
-               public string htmlCode;
-               internal bool predefinied;
 
-               #region public fields
-        public double A;
-        public double R;
-        public double G;
-               public double B;
-               #endregion
 
-               #region Operators
-        public static implicit operator string(Color c)
-        {
-            return c.ToString();
-        }
-               public static implicit operator Color(string s)
-               {
-                       if (string.IsNullOrEmpty(s))
-                               return White;
-                       Color cc = default(Color);
-                       if (s.StartsWith ("#", StringComparison.Ordinal)) {
-                               cc.R = int.Parse (s.Substring (1, 2), System.Globalization.NumberStyles.HexNumber) / 255.0;
-                               cc.G = int.Parse (s.Substring (3, 2), System.Globalization.NumberStyles.HexNumber) / 255.0;
-                               cc.B = int.Parse (s.Substring (5, 2), System.Globalization.NumberStyles.HexNumber) / 255.0;
-                               if (s.Length > 7)
-                                       cc.A = int.Parse (s.Substring (7, 2), System.Globalization.NumberStyles.HexNumber) / 255.0;
-                               else
-                                       cc.A = 1.0;
-                               return cc;
-                       }
 
-                       if (char.IsLetter(s[0])){
-                               if (ColorDic.ContainsKey (s))
-                                       return ColorDic[s];
-                               throw new Exception ("Unknown color name: " + s);
-                       }
+               /*public string Name;
+               public string htmlCode;
+               internal bool predefinied;*/
 
-                       string[] c = s.Split(new char[] { ',' });
-                                                       
-                       return new Color(
-                               double.Parse(c[0]),
-                               double.Parse(c[1]),
-                               double.Parse(c[2]),
-                               double.Parse(c[3]));
-               }
+               #region Operators
+               /*public static implicit operator string(Color c) => c.ToString();
 
-               public static bool operator ==(Color c, string n)
-               {
-                       return n.StartsWith("#", StringComparison.Ordinal) ?
-                               string.Equals(c.HtmlCode, n, StringComparison.Ordinal) :
-                               string.Equals(c.Name, n, StringComparison.Ordinal);
-               }
-               public static bool operator !=(Color c, string n)
-               {
-                       return n.StartsWith("#", StringComparison.Ordinal) ?
-                               !string.Equals(c.HtmlCode, n, StringComparison.Ordinal) :
-                               !string.Equals(c.Name, n, StringComparison.Ordinal);
-               }
-               public static bool operator ==(string n, Color c)
-               {
-                       return string.Equals (c.Name, n, StringComparison.Ordinal);
-               }
-               public static bool operator !=(string n, Color c)
+               public static implicit operator UInt32 (Color c) => c.value;*/
+
+               /*public static implicit operator Color(string s)
                {
-                       return !string.Equals (c.Name, n, StringComparison.Ordinal);
-               }
+               }*/
+
+               public static implicit operator Color (Colors c) => new Color ((UInt32)c);
+               public static bool operator ==(Color a, Color b) => a.Equals (b);
+               public static bool operator != (Color a, Color b) => !a.Equals (b);
+
                public static Color operator *(Color c, Double f)
                {
                        return new Color(c.R,c.G,c.B,c.A * f);
@@ -185,20 +298,12 @@ namespace Crow
                public double Value => Math.Max (R, Math.Max (G, B));   //Max. value of RGB
 
                public string HtmlCode {
-                       get { 
-                               string tmp = "#" +
-                                       ((int)Math.Round (R * 255.0)).ToString ("X2") +
-                                       ((int)Math.Round (G * 255.0)).ToString ("X2") +
-                                       ((int)Math.Round (B * 255.0)).ToString ("X2");
-                               if (A < 1.0)
-                                       tmp += ((int)Math.Round(A * 255.0)).ToString ("X2");
-                               return tmp;
+                       get {
+                               string tmp = $"#{R:X2}{G:X2}{B:X2}";
+                               return A == 0xFF ? tmp : $"{tmp}{A:X2}";
                        }
                }
-               public float[] floatArray
-               {
-                       get { return new float[]{ (float)R, (float)G, (float)B, (float)A }; }
-               }
+               public float[] floatArray => new float[]{ R / 255f, G / 255f, B / 255f, A / 255f };
                /// <summary>
                /// return a copy of the color with the alpha component modified
                /// </summary>
@@ -208,199 +313,40 @@ namespace Crow
                {
                        return new Color (this.R, this.G, this.B, _A);
                }
-               public void ResetName(){
-                       Name = "";
-                       htmlCode = "";
-                       predefinied = false;
-               }
-
-               #region Predefined colors
-        public static readonly Color Transparent = new Color(0, 0, 0, 0, "Transparent");
-               public static readonly Color Clear = new Color(-1, -1, -1, -1, "Clear");
-               public static readonly Color AliceBlue = new Color(240,248,255,"AliceBlue","#F0F8FF");
-               public static readonly Color AntiqueWhite = new Color(250,235,215,"AntiqueWhite","#FAEBD7");
-               public static readonly Color Aqua = new Color(0,255,255,"Aqua","#00FFFF");
-               public static readonly Color Aquamarine = new Color(127,255,212,"Aquamarine","#7FFFD4");
-               public static readonly Color Azure = new Color(240,255,255,"Azure","#F0FFFF");
-               public static readonly Color Beige = new Color(245,245,220,"Beige","#F5F5DC");
-               public static readonly Color Bisque = new Color(255,228,196,"Bisque","#FFE4C4");
-               public static readonly Color Black = new Color(0,0,0,"Black","#000000");
-               public static readonly Color BlanchedAlmond = new Color(255,235,205,"BlanchedAlmond","#FFEBCD");
-               public static readonly Color Blue = new Color(0,0,255,"Blue","#0000FF");
-               public static readonly Color BlueViolet = new Color(138,43,226,"BlueViolet","#8A2BE2");
-               public static readonly Color Brown = new Color(165,42,42,"Brown","#A52A2A");
-               public static readonly Color BurlyWood = new Color(222,184,135,"BurlyWood","#DEB887");
-               public static readonly Color CadetBlue = new Color(95,158,160,"CadetBlue","#5F9EA0");
-               public static readonly Color Chartreuse = new Color(127,255,0,"Chartreuse","#7FFF00");
-               public static readonly Color Chocolate = new Color(210,105,30,"Chocolate","#D2691E");
-               public static readonly Color Coral = new Color(255,127,80,"Coral","#FF7F50");
-               public static readonly Color CornflowerBlue = new Color(100,149,237,"CornflowerBlue","#6495ED");
-               public static readonly Color Cornsilk = new Color(255,248,220,"Cornsilk","#FFF8DC");
-               public static readonly Color Crimson = new Color(220,20,60,"Crimson","#DC143C");
-               public static readonly Color Cyan = new Color(0,255,255,"Cyan","#00FFFF");
-               public static readonly Color DarkBlue = new Color(0,0,139,"DarkBlue","#00008B");
-               public static readonly Color DarkCyan = new Color(0,139,139,"DarkCyan","#008B8B");
-               public static readonly Color DarkGoldenRod = new Color(184,134,11,"DarkGoldenRod","#B8860B");
-               public static readonly Color DarkGrey = new Color(169,169,169,"DarkGrey","#A9A9A9");
-               public static readonly Color DarkGreen = new Color(0,100,0,"DarkGreen","#006400");
-               public static readonly Color DarkKhaki = new Color(189,183,107,"DarkKhaki","#BDB76B");
-               public static readonly Color DarkMagenta = new Color(139,0,139,"DarkMagenta","#8B008B");
-               public static readonly Color DarkOliveGreen = new Color(85,107,47,"DarkOliveGreen","#556B2F");
-               public static readonly Color DarkOrange = new Color(255,140,0,"DarkOrange","#FF8C00");
-               public static readonly Color DarkOrchid = new Color(153,50,204,"DarkOrchid","#9932CC");
-               public static readonly Color DarkRed = new Color(139,0,0,"DarkRed","#8B0000");
-               public static readonly Color DarkSalmon = new Color(233,150,122,"DarkSalmon","#E9967A");
-               public static readonly Color DarkSeaGreen = new Color(143,188,143,"DarkSeaGreen","#8FBC8F");
-               public static readonly Color DarkSlateBlue = new Color(72,61,139,"DarkSlateBlue","#483D8B");
-               public static readonly Color DarkSlateGrey = new Color(47,79,79,"DarkSlateGrey","#2F4F4F");
-               public static readonly Color DarkTurquoise = new Color(0,206,209,"DarkTurquoise","#00CED1");
-               public static readonly Color DarkViolet = new Color(148,0,211,"DarkViolet","#9400D3");
-               public static readonly Color DeepPink = new Color(255,20,147,"DeepPink","#FF1493");
-               public static readonly Color DeepSkyBlue = new Color(0,191,255,"DeepSkyBlue","#00BFFF");
-               public static readonly Color DimGrey = new Color(105,105,105,"DimGrey","#696969");
-               public static readonly Color DodgerBlue = new Color(30,144,255,"DodgerBlue","#1E90FF");
-               public static readonly Color FireBrick = new Color(178,34,34,"FireBrick","#B22222");
-               public static readonly Color FloralWhite = new Color(255,250,240,"FloralWhite","#FFFAF0");
-               public static readonly Color ForestGreen = new Color(34,139,34,"ForestGreen","#228B22");
-               public static readonly Color Fuchsia = new Color(255,0,255,"Fuchsia","#FF00FF");
-               public static readonly Color Gainsboro = new Color(220,220,220,"Gainsboro","#DCDCDC");
-               public static readonly Color GhostWhite = new Color(248,248,255,"GhostWhite","#F8F8FF");
-               public static readonly Color Gold = new Color(255,215,0,"Gold","#FFD700");
-               public static readonly Color GoldenRod = new Color(218,165,32,"GoldenRod","#DAA520");
-               public static readonly Color Grey = new Color(128,128,128,"Grey","#808080");
-               public static readonly Color Green = new Color(0,128,0,"Green","#008000");
-               public static readonly Color GreenYellow = new Color(173,255,47,"GreenYellow","#ADFF2F");
-               public static readonly Color HoneyDew = new Color(240,255,240,"HoneyDew","#F0FFF0");
-               public static readonly Color HotPink = new Color(255,105,180,"HotPink","#FF69B4");
-               public static readonly Color IndianRed = new Color(205,92,92,"IndianRed","#CD5C5C");
-               public static readonly Color Indigo = new Color(75,0,130,"Indigo","#4B0082");
-               public static readonly Color Ivory = new Color(255,255,240,"Ivory","#FFFFF0");
-               public static readonly Color Jet = new Color(52,52,52,"Jet","#343434");
-               public static readonly Color Khaki = new Color(240,230,140,"Khaki","#F0E68C");
-               public static readonly Color Lavender = new Color(230,230,250,"Lavender","#E6E6FA");
-               public static readonly Color LavenderBlush = new Color(255,240,245,"LavenderBlush","#FFF0F5");
-               public static readonly Color LawnGreen = new Color(124,252,0,"LawnGreen","#7CFC00");
-               public static readonly Color LemonChiffon = new Color(255,250,205,"LemonChiffon","#FFFACD");
-               public static readonly Color LightBlue = new Color(173,216,230,"LightBlue","#ADD8E6");
-               public static readonly Color LightCoral = new Color(240,128,128,"LightCoral","#F08080");
-               public static readonly Color LightCyan = new Color(224,255,255,"LightCyan","#E0FFFF");
-               public static readonly Color LightGoldenRodYellow = new Color(250,250,210,"LightGoldenRodYellow","#FAFAD2");
-               public static readonly Color LightGrey = new Color(211,211,211,"LightGrey","#D3D3D3");
-               public static readonly Color LightGreen = new Color(144,238,144,"LightGreen","#90EE90");
-               public static readonly Color LightPink = new Color(255,182,193,"LightPink","#FFB6C1");
-               public static readonly Color LightSalmon = new Color(255,160,122,"LightSalmon","#FFA07A");
-               public static readonly Color LightSeaGreen = new Color(32,178,170,"LightSeaGreen","#20B2AA");
-               public static readonly Color LightSkyBlue = new Color(135,206,250,"LightSkyBlue","#87CEFA");
-               public static readonly Color LightSlateGrey = new Color(119,136,153,"LightSlateGrey","#778899");
-               public static readonly Color LightSteelBlue = new Color(176,196,222,"LightSteelBlue","#B0C4DE");
-               public static readonly Color LightYellow = new Color(255,255,224,"LightYellow","#FFFFE0");
-               public static readonly Color Lime = new Color(0,255,0,"Lime","#00FF00");
-               public static readonly Color LimeGreen = new Color(50,205,50,"LimeGreen","#32CD32");
-               public static readonly Color Linen = new Color(250,240,230,"Linen","#FAF0E6");
-               public static readonly Color Magenta = new Color(255,0,255,"Magenta","#FF00FF");
-               public static readonly Color Maroon = new Color(128,0,0,"Maroon","#800000");
-               public static readonly Color MediumAquaMarine = new Color(102,205,170,"MediumAquaMarine","#66CDAA");
-               public static readonly Color MediumBlue = new Color(0,0,205,"MediumBlue","#0000CD");
-               public static readonly Color MediumOrchid = new Color(186,85,211,"MediumOrchid","#BA55D3");
-               public static readonly Color MediumPurple = new Color(147,112,219,"MediumPurple","#9370DB");
-               public static readonly Color MediumSeaGreen = new Color(60,179,113,"MediumSeaGreen","#3CB371");
-               public static readonly Color MediumSlateBlue = new Color(123,104,238,"MediumSlateBlue","#7B68EE");
-               public static readonly Color MediumSpringGreen = new Color(0,250,154,"MediumSpringGreen","#00FA9A");
-               public static readonly Color MediumTurquoise = new Color(72,209,204,"MediumTurquoise","#48D1CC");
-               public static readonly Color MediumVioletRed = new Color(199,21,133,"MediumVioletRed","#C71585");
-               public static readonly Color MidnightBlue = new Color(25,25,112,"MidnightBlue","#191970");
-               public static readonly Color MintCream = new Color(245,255,250,"MintCream","#F5FFFA");
-               public static readonly Color MistyRose = new Color(255,228,225,"MistyRose","#FFE4E1");
-               public static readonly Color Moccasin = new Color(255,228,181,"Moccasin","#FFE4B5");
-               public static readonly Color NavajoWhite = new Color(255,222,173,"NavajoWhite","#FFDEAD");
-               public static readonly Color Navy = new Color(0,0,128,"Navy","#000080");
-               public static readonly Color OldLace = new Color(253,245,230,"OldLace","#FDF5E6");
-               public static readonly Color Olive = new Color(128,128,0,"Olive","#808000");
-               public static readonly Color OliveDrab = new Color(107,142,35,"OliveDrab","#6B8E23");
-               public static readonly Color Onyx = new Color(53,56,57,"Onyx","#353839");
-               public static readonly Color Orange = new Color(255,165,0,"Orange","#FFA500");
-               public static readonly Color OrangeRed = new Color(255,69,0,"OrangeRed","#FF4500");
-               public static readonly Color Orchid = new Color(218,112,214,"Orchid","#DA70D6");
-               public static readonly Color PaleGoldenRod = new Color(238,232,170,"PaleGoldenRod","#EEE8AA");
-               public static readonly Color PaleGreen = new Color(152,251,152,"PaleGreen","#98FB98");
-               public static readonly Color PaleTurquoise = new Color(175,238,238,"PaleTurquoise","#AFEEEE");
-               public static readonly Color PaleVioletRed = new Color(219,112,147,"PaleVioletRed","#DB7093");
-               public static readonly Color PapayaWhip = new Color(255,239,213,"PapayaWhip","#FFEFD5");
-               public static readonly Color PeachPuff = new Color(255,218,185,"PeachPuff","#FFDAB9");
-               public static readonly Color Peru = new Color(205,133,63,"Peru","#CD853F");
-               public static readonly Color Pink = new Color(255,192,203,"Pink","#FFC0CB");
-               public static readonly Color Plum = new Color(221,160,221,"Plum","#DDA0DD");
-               public static readonly Color PowderBlue = new Color(176,224,230,"PowderBlue","#B0E0E6");
-               public static readonly Color Purple = new Color(128,0,128,"Purple","#800080");
-               public static readonly Color RebeccaPurple = new Color(102,51,153,"RebeccaPurple","#663399");
-               public static readonly Color Red = new Color(255,0,0,"Red","#FF0000");
-               public static readonly Color RosyBrown = new Color(188,143,143,"RosyBrown","#BC8F8F");
-               public static readonly Color RoyalBlue = new Color(65,105,225,"RoyalBlue","#4169E1");
-               public static readonly Color SaddleBrown = new Color(139,69,19,"SaddleBrown","#8B4513");
-               public static readonly Color Salmon = new Color(250,128,114,"Salmon","#FA8072");
-               public static readonly Color SandyBrown = new Color(244,164,96,"SandyBrown","#F4A460");
-               public static readonly Color SeaGreen = new Color(46,139,87,"SeaGreen","#2E8B57");
-               public static readonly Color SeaShell = new Color(255,245,238,"SeaShell","#FFF5EE");
-               public static readonly Color Sienna = new Color(160,82,45,"Sienna","#A0522D");
-               public static readonly Color Silver = new Color(192,192,192,"Silver","#C0C0C0");
-               public static readonly Color SkyBlue = new Color(135,206,235,"SkyBlue","#87CEEB");
-               public static readonly Color SlateBlue = new Color(106,90,205,"SlateBlue","#6A5ACD");
-               public static readonly Color SlateGrey = new Color(112,128,144,"SlateGrey","#708090");
-               public static readonly Color Snow = new Color(255,250,250,"Snow","#FFFAFA");
-               public static readonly Color SpringGreen = new Color(0,255,127,"SpringGreen","#00FF7F");
-               public static readonly Color SteelBlue = new Color(70,130,180,"SteelBlue","#4682B4");
-               public static readonly Color Tan = new Color(210,180,140,"Tan","#D2B48C");
-               public static readonly Color Teal = new Color(0,128,128,"Teal","#008080");
-               public static readonly Color Thistle = new Color(216,191,216,"Thistle","#D8BFD8");
-               public static readonly Color Tomato = new Color(255,99,71,"Tomato","#FF6347");
-               public static readonly Color Turquoise = new Color(64,224,208,"Turquoise","#40E0D0");
-               public static readonly Color Violet = new Color(238,130,238,"Violet","#EE82EE");
-               public static readonly Color Wheat = new Color(245,222,179,"Wheat","#F5DEB3");
-               public static readonly Color White = new Color(255,255,255,"White","#FFFFFF");
-               public static readonly Color WhiteSmoke = new Color(245,245,245,"WhiteSmoke","#F5F5F5");
-               public static readonly Color Yellow = new Color(255,255,0,"Yellow","#FFFF00");
-               public static readonly Color YellowGreen = new Color(154,205,50,"YellowGreen","#9ACD32");
-
-               #endregion
 
                public override bool Equals (object obj)
                        => obj is Color c && Equals(c);
+               /*public bool Equals (Colors other)
+                       => value == (UInt32)other;*/
+
                public bool Equals (Color other)
-               {
-                       if (predefinied & other.predefinied)
-                               return htmlCode == other.htmlCode;
-                       return A == other.A && R == other.R && G == other.G && B == other.B;
-               }
+                       => value == other.value;
+               
 
                public override int GetHashCode ()
-               {
-                       unchecked // Overflow is fine, just wrap
-                       {
-                               int hash = 17;
-                               // Suitable nullity checks etc, of course :)
-                               hash = hash * 23 + A.GetHashCode ();
-                               hash = hash * 23 + R.GetHashCode ();
-                               hash = hash * 23 + G.GetHashCode ();
-                               hash = hash * 23 + B.GetHashCode ();
-                               return hash;
-                       }
-               }
+                       => value.GetHashCode ();
 
                public override string ToString()
+                       => Enum.IsDefined (typeof (Colors), value) ? ((Colors)value).ToString () : HtmlCode;
+                       
+               public static Color FromIml (string iml)
                {
-                       if (!string.IsNullOrEmpty(Name))
-                               return Name;
-                       if (!string.IsNullOrEmpty (htmlCode))
-                               return htmlCode;
-                       string hc = HtmlCode;
-                       Color pc = ColorDic.Values.FirstOrDefault (c => c.htmlCode == hc);
-                       return pc.predefinied ? pc.Name : hc;
+                       string [] c = iml.Split (new char [] { ',' });
+                       return new Color (
+                               double.Parse (c [0]),
+                               double.Parse (c [1]),
+                               double.Parse (c [2]),
+                               double.Parse (c [3]));
                }
 
-        public static object Parse(string s)
-        {
-            return (Color)s;
-        }
+               public static object Parse(string s)
+                       => (string.IsNullOrEmpty (s)) ? new Color (Colors.White) :
+                               (s.StartsWith ("#", StringComparison.Ordinal)) ? new Color (UInt32.Parse (s.Substring (1), System.Globalization.NumberStyles.HexNumber)) :
+                               (char.IsDigit(s[0])) ? FromIml (s) :
+                               (Enum.TryParse<Colors> (s, out Colors cc)) ? new Color(cc) :
+                               throw new Exception ("Unknown color name: " + s);
+
+
                public static Color FromHSV (double _h, double _v = 1.0, double _s = 1.0, double _alpha = 1.0) {
                        double H = _h * 360;
                        double C = _v * _s;
@@ -421,6 +367,5 @@ namespace Crow
 
                        return new Color (C + m, X + m, m, _alpha);
                }
-
        }
 }
index 6ff2bb7c986294c3de2beb8516ecf2a4777678c8..cb555b07d482e3847a2e1bd054750e1a061a163e 100644 (file)
@@ -33,13 +33,10 @@ namespace Crow
 
                        return new SolidColor((Color)Color.Parse (s));
                }
-               public static implicit operator Color(Fill c){
-                       SolidColor sc = c as SolidColor;
-                       return sc == null ? default : sc.color;
-               }
-               public static implicit operator Fill(Color c){
-                       return new SolidColor (c);
-               }
+               public static implicit operator Color(Fill c) => c is SolidColor sc ? sc.color : default;
+               public static implicit operator Fill (Color c) => new SolidColor (c);
+               public static implicit operator Fill (Colors c) => new SolidColor (c);
+
        }
 }
 
index 0e814843790b3574e36c0045b1a26292398102c0..93f0970be1f737211c15bb23497b3d37b64b656e 100644 (file)
@@ -57,11 +57,11 @@ namespace Crow
 
                                if (parts.Length > 2)
                                        throw new Exception ("too many parameters in color stop: " + s);
-                               
+
                                if (parts.Length == 2)
-                                       return new ColorStop (double.Parse (parts [0]), (Color)parts [1]);
+                                       return new ColorStop (double.Parse (parts [0]), (Color)Color.Parse (parts [1]));
 
-                               return new ColorStop (-1, (Color)parts [0]);
+                               return new ColorStop (-1, Color.FromIml (parts [0]));
                        }
                }
                public Gradient.Type GradientType = Type.Vertical;
@@ -110,7 +110,7 @@ namespace Crow
                public static new object Parse(string s)
                {
                        if (string.IsNullOrEmpty (s))
-                               return Color.White;
+                               return Colors.White;
 
                        Crow.Gradient tmp;
 
index f3e37d2b617e1abfd44d69abf0082a6aaa36a23b..0b16b09e5d69a0de2e691a6ae27b3af1b3a980c2 100644 (file)
@@ -39,7 +39,7 @@ namespace Crow
 {
        public class SolidColor : Fill
     {
-               public Color color = Color.Transparent;
+               public Color color = Colors.Transparent;
                #region CTOR
                public SolidColor(Color c)
                {
@@ -50,11 +50,11 @@ namespace Crow
                #region implemented abstract members of Fill
                public override void SetAsSource (Context ctx, Rectangle bounds = default)
                {
-                       ctx.SetSourceRGBA (color.R, color.G, color.B, color.A);
+                       ctx.SetSourceRGBA (color.R / 255.0, color.G / 255.0, color.B / 255.0, color.A / 255.0);
                }
                public static new object Parse(string s)
                {
-                       return new SolidColor((Color)s);
+                       return new SolidColor((Color)Color.Parse(s));
                }
                #endregion
 
@@ -62,21 +62,16 @@ namespace Crow
         public static implicit operator Color(SolidColor c) => c.color;        
                public static implicit operator SolidColor(Color c) => new SolidColor (c);
 
-               public static bool operator ==(SolidColor left, SolidColor right) => left?.color == right?.color;               
-               public static bool operator !=(SolidColor left, SolidColor right) => left?.color != right?.color;
+               //public static bool operator ==(SolidColor left, SolidColor right) => left?.color == right?.color;             
+               //public static bool operator !=(SolidColor left, SolidColor right) => left?.color != right?.color;
 
                public override int GetHashCode ()
                {
                        return color.GetHashCode();
                }
                public override bool Equals (object obj)
-               {
-                       if (obj is Color)
-                               return color == (Color)obj;
-                       if (obj is SolidColor)
-                               return color == (obj as SolidColor).color;
-                       return false;                   
-               }
+                       => obj is Color c ? color.Equals (c) : obj is SolidColor sc && color.Equals (sc.color);
+
 //             public static bool operator ==(SolidColor c, string n)
 //             {
 //                     return c.color.Name == n ? true : false;
index a66a79c1c4a42249eeca12edae81418d831e43ef..847292eb7c0bbb73e81fa47bbd3f6ff9c2bc0d43 100644 (file)
@@ -269,7 +269,7 @@ namespace Crow.IML
                static MemberInfo getMemberInfoWithReflexion(object instance, string member){
             Type t = instance.GetType();
 #if DEBUG_BINDING_FUNC_CALLS
-                       Console.WriteLine ($"getMemberInfoWithReflexion ({instance},{member}); type:{t}");
+                       System.Diagnostics.Debug.WriteLine ($"getMemberInfoWithReflexion ({instance},{member}); type:{t}");
 #endif
             MemberInfo mi = t.GetMember (member)?.FirstOrDefault();
                        if (mi == null)
@@ -278,7 +278,7 @@ namespace Crow.IML
                }
                static MethodInfo getMethodInfoWithReflexion(object instance, string method){
 #if DEBUG_BINDING_FUNC_CALLS
-            Console.WriteLine ($"getMethodInfoWithReflexion ({instance},{method}); type:{instance.GetType ()}");
+            System.Diagnostics.Debug.WriteLine ($"getMethodInfoWithReflexion ({instance},{method}); type:{instance.GetType ()}");
 #endif
             return instance.GetType ().GetMethod (method, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
                }
@@ -290,7 +290,7 @@ namespace Crow.IML
                /// <param name="destMember">Destination member</param>
                static void setValueWithReflexion(object dest, object value, string destMember){
 #if DEBUG_BINDING_FUNC_CALLS
-            Console.WriteLine ($"setValueWithReflexion (dest:{dest},value:{value},member:{destMember});");
+            System.Diagnostics.Debug.WriteLine ($"setValueWithReflexion (dest:{dest},value:{value},member:{destMember});");
 #endif
             Type destType = null;
                        Type origType = null;
@@ -337,7 +337,7 @@ namespace Crow.IML
                /// </summary>
                static object getValueWithReflexion(object instance, MemberInfo mi){
 #if DEBUG_BINDING_FUNC_CALLS
-            Console.WriteLine ($"getValueWithReflexion ({instance},{mi});");
+            System.Diagnostics.Debug.WriteLine ($"getValueWithReflexion ({instance},{mi});");
 #endif
             object tmp = null;
                        Type dstType = null;
@@ -379,7 +379,7 @@ namespace Crow.IML
                        if (knownExtMethods.ContainsKey (key))
                                return knownExtMethods [key];
 
-                       //Console.WriteLine ($"*** search extension method: {t};{methodName} => key={key}");
+                       //System.Diagnostics.Debug.WriteLine ($"*** search extension method: {t};{methodName} => key={key}");
 
                        MethodInfo mi = null;
                        mi = GetExtensionMethods (Assembly.GetEntryAssembly (), t, methodName);
@@ -983,7 +983,7 @@ namespace Crow.IML
                //get value from member of object
                internal static object getDataTypeAndFetch (object data, string fetchMethod){
                        Type dataType = data.GetType();
-                       //Console.WriteLine ($"get data type and fetch {data}.{fetchMethod}");
+                       //System.Diagnostics.Debug.WriteLine ($"get data type and fetch {data}.{fetchMethod}");
                        MethodInfo miGetDatas = dataType.GetMethod (fetchMethod, new Type[] {});
                        if (miGetDatas == null)
                                miGetDatas = CompilerServices.SearchExtMethod (dataType, fetchMethod);
@@ -1006,7 +1006,7 @@ namespace Crow.IML
                //TODO:memberinfo found here must be cached
                internal static object getValue (Type dataType, object data, string member)
                {
-                       //Console.WriteLine ($"get value: {dataType} ; {data} ; {member}");
+                       //System.Diagnostics.Debug.WriteLine ($"get value: {dataType} ; {data} ; {member}");
 
                        MethodInfo miGetDatas = dataType.GetMethod (member, new Type [] { });
                        if (miGetDatas != null)
index 760b5b1a8c5a4a8a7accb9768fa0889a55df9696..0aa49eb42c9028c237725f08bea3e83270914975 100644 (file)
@@ -977,7 +977,7 @@ namespace Crow.IML {
                void emitDataSourceBindings (IMLContext ctx, BindingDefinition bindingDef, Type dsType)
                {
 #if DEBUG_BINDING_FUNC_CALLS
-                       Console.WriteLine ($"emitDataSourceBindings with data type knows: {bindingDef}");
+                       System.Diagnostics.Debug.WriteLine ($"emitDataSourceBindings with data type knows: {bindingDef}");
 #endif
                        DynamicMethod dm = null;
                        ILGenerator il = null;
@@ -1157,7 +1157,7 @@ namespace Crow.IML {
                public Delegate emitDataSourceBindings (PropertyInfo piSource, BindingDefinition bindingDef){           
 
 #if DEBUG_BINDING_FUNC_CALLS
-                       Console.WriteLine ($"emitDataSourceBindings: {bindingDef}");
+                       System.Diagnostics.Debug.WriteLine ($"emitDataSourceBindings: {bindingDef}");
 #endif
                        DynamicMethod dm = null;
                        ILGenerator il = null;
index a2ef206c32bc6e9714b5156b123390c3396ee2c1..365a1994af0b100c694fe9dad7742d3619adacf0 100644 (file)
@@ -90,7 +90,7 @@ namespace Crow.IML
                bool tryFindMember ()
                {
 #if DEBUG_BINDING_FUNC_CALLS
-            Console.WriteLine ($"tryFindMember ({Address},{member})");
+            System.Diagnostics.Debug.WriteLine ($"tryFindMember ({Address},{member})");
 #endif
                        if (member != null)
                                throw new Exception ("member already found");
index b94458356fd2b41660ea13fb5a5feeb74e59915d..535bc1a878a7446d9cd41d790f03d9aa2ee330a1 100644 (file)
@@ -72,7 +72,7 @@ namespace Crow
                                try {
                                        Assembly.LoadFrom (af);
                                } catch {
-                                       Console.WriteLine ("{0} not loaded as assembly.", af);
+                                       System.Diagnostics.Debug.WriteLine ("{0} not loaded as assembly.", af);
                                }
                        }
 
@@ -524,7 +524,7 @@ namespace Crow
                                        throw new Exception ($"Assembly '{assemblyName}' not found for ressource '{path}'.");
                                stream = a.GetManifestResourceStream (resId);
                                /*foreach (var s in a.GetManifestResourceNames()) {
-                                       Console.WriteLine (s);
+                                       System.Diagnostics.Debug.WriteLine (s);
                                }*/
                                if (stream == null)
                                        throw new Exception ("Resource not found: " + path);
@@ -890,7 +890,7 @@ namespace Crow
                                                        ctx.Restore ();
                                                        DirtyRect += new Rectangle (DragImageX, DragImageY, DragImageWidth, DragImageHeight);
                                                        IsDirty = true;
-                                                       //Console.WriteLine ("dragimage drawn: {0},{1}", DragImageX, DragImageY);
+                                                       //System.Diagnostics.Debug.WriteLine ("dragimage drawn: {0},{1}", DragImageX, DragImageY);
                                                }
                                        }
 
@@ -1155,7 +1155,7 @@ namespace Crow
 
                                currentCursor?.Dispose ();
                                currentCursor = createCursor (cursor);
-                               Console.WriteLine ($"cursor=>{cursor}");
+                               System.Diagnostics.Debug.WriteLine ($"cursor=>{cursor}");
                                currentCursor.Set (hWin);
                                //MouseCursorChanged.Raise (this,new MouseCursorChangedEventArgs(cursor));
                        }
index faff93386b1db4a8720acd294b814b58f66778a8..a669d84195b2bf8a43d16138d105ebfb536660d6 100644 (file)
@@ -62,15 +62,15 @@ namespace Crow.Cairo {
                                return;
 
                        if (!disposing) {
-                               Console.Error.WriteLine ("{0} is leaking, programmer is missing a call to Dispose", typeof(T).FullName);
+                               System.Diagnostics.Debug.WriteLine ("{0} is leaking, programmer is missing a call to Dispose", typeof(T).FullName);
                                if (Enabled) {
                                        string val;
                                        if (traces.TryGetValue (obj, out val)) {
-                                               Console.Error.WriteLine ("Allocated from:");
-                                               Console.Error.WriteLine (val);
+                                               System.Diagnostics.Debug.WriteLine ("Allocated from:");
+                                               System.Diagnostics.Debug.WriteLine (val);
                                        }
                                } else {
-                                       Console.Error.WriteLine ("Set MONO_CAIRO_DEBUG_DISPOSE to track allocation traces");
+                                       System.Diagnostics.Debug.WriteLine ("Set MONO_CAIRO_DEBUG_DISPOSE to track allocation traces");
                                }
                        }
 
index b9d7e333bf907522f29756b9c7b1980daea2649e..104daac610300f63765f7dc5956dabc7e8a5b62d 100644 (file)
@@ -54,8 +54,8 @@ namespace Crow
                #region private fields
                int _borderWidth;
                BorderStyle _borderStyle;
-               Fill raisedColor = Color.Grey;
-               Fill sunkenColor = Color.DimGrey;
+               Fill raisedColor = Colors.Grey;
+               Fill sunkenColor = Colors.DimGrey;
                #endregion
 
                #region public properties
index e137a35a8dd704404b8a6188caa1bf7761067bba..ff9a7a65134225bb68bdca8ef4e1a77d44016866 100644 (file)
@@ -26,14 +26,14 @@ namespace Crow
                public virtual Color CurrentColor {
                        get => currentColor;
                        set {
-                               if (currentColor == value)
+                               if (currentColor.Equals(value))
                                        return;
                                currentColor = value;
                                NotifyValueChanged ("CurrentColor", currentColor);
                        }
                }
 
-               public IList<Color> ColorList => Color.ColorDic.Values.OrderBy (c => c.Hue).ToList ();
+               //public IList<Color> ColorList => Enum.GetValues (typeof (Color)).ToList<Color> ();// Colors. ColorDic.Values.OrderBy (c => c.Hue).ToList ();
        }
 }
 
index cec120c8578dae9201184622e447cd5fe6294262..01e20a47eb57de6feeeaa86f2b5eb8350852d423 100644 (file)
@@ -24,7 +24,7 @@ namespace Crow
                Orientation orientation;
                CursorType cursorType = CursorType.Pentagone;
                ColorComponent component;
-               Color currentColor = Color.Black;
+               Color currentColor = Colors.Black;
                double currentValue = -1;//force notify for property less binding 'CurrentValue'
 
                [DefaultValue (Orientation.Horizontal)]
index b0217896860608152b97b3d777a5aad8896aa538..ae24e9f575554b0b6b124cc22e9e24a36b34cc8b 100644 (file)
@@ -120,7 +120,7 @@ namespace Crow
                                                fi.ToArray() :
                                                fi.Where(f=>!f.Attributes.HasFlag (FileAttributes.Hidden)).ToArray();
                                } catch (Exception ex) {
-                                       Console.WriteLine (ex.ToString ());
+                                       System.Diagnostics.Debug.WriteLine (ex.ToString ());
                                        return null;
                                }
                        }
index a52c7f6e9c0e9cb77d7ed58dabcffb498e61d439..0e8c980238b6602f927307f69c4193e90bbe9477 100644 (file)
@@ -285,7 +285,7 @@ namespace Crow
                        int vTreshold = (int)(r.Height * dockThresh);
                        int hTreshold = (int)(r.Width * dockThresh);
 
-                       Console.WriteLine ("Docking {0} as {2} in {1}", dw.Name, activeStack.Name, dw.DockingPosition);
+                       System.Diagnostics.Debug.WriteLine ("Docking {0} as {2} in {1}", dw.Name, activeStack.Name, dw.DockingPosition);
                        switch (dw.DockingPosition) {
                        case Alignment.Top:                                             
                                dw.Height = vTreshold;
@@ -321,7 +321,7 @@ namespace Crow
                public void Undock (DockWindow dw){                     
                        int idx = Children.IndexOf(dw);
 
-                       Console.WriteLine ("undocking child index: {0} ; name={1}; pos:{2} ; childcount:{3}",idx, dw.Name, dw.DockingPosition, Children.Count);
+                       System.Diagnostics.Debug.WriteLine ("undocking child index: {0} ; name={1}; pos:{2} ; childcount:{3}",idx, dw.Name, dw.DockingPosition, Children.Count);
 
                        RemoveChild(dw);
 
index 0dd19ea91fdd9b5f38ae2039b2d296ac6460af2a..1c2f95a55a310c90c2a0748cf78aa7efb750f43e 100644 (file)
@@ -90,7 +90,7 @@ namespace Crow
                public bool CheckUndock (Point mousePos) {
                        //if (DockingPosition == Alignment.Center)
                        //      return false;
-                       Console.WriteLine ($"{mousePos.X},{mousePos.Y}");
+                       System.Diagnostics.Debug.WriteLine ($"{mousePos.X},{mousePos.Y}");
                        if (Math.Abs (mousePos.X - undockingMousePosOrig.X) < undockThreshold ||
                            Math.Abs (mousePos.X - undockingMousePosOrig.X) < undockThreshold)
                                return false;
index 0a4b964c9a36678d7587c62a7864c6a5e552d7be..365679b2d58758e86b4d5dc6dc398b8c66c58d0e 100644 (file)
@@ -68,7 +68,7 @@ namespace Crow
                public virtual void AddChild(Widget g){
 #if DEBUG
                        if (disposed) {
-                               Console.WriteLine ($"AddChild ({g}) in disposed Widget: {this}\n{System.Environment.StackTrace}");
+                               System.Diagnostics.Debug.WriteLine ($"AddChild ({g}) in disposed Widget: {this}\n{System.Environment.StackTrace}");
                                return;
                        }
 #endif
@@ -117,7 +117,7 @@ namespace Crow
                public virtual void InsertChild (int idx, Widget g) {
 #if DEBUG
                        if (disposed) {
-                               Console.WriteLine ($"InsertChild ({idx},{g}) in disposed Widget: {this}\n{System.Environment.StackTrace}");
+                               System.Diagnostics.Debug.WriteLine ($"InsertChild ({idx},{g}) in disposed Widget: {this}\n{System.Environment.StackTrace}");
                                return;
                        }
 #endif
index eb00a048b5e6924a7be9e9fae6cb2aacaaa7d58b..851b1bf81f1042b1909121bd7f443d61e5dab7ec 100644 (file)
@@ -131,10 +131,10 @@ namespace Crow
                                break;                  
                        }
 
-                       gr.SetSourceColor (Color.Black);
+                       gr.SetSourceColor (Colors.Black);
                        gr.LineWidth = 2.0;
                        gr.StrokePreserve ();
-                       gr.SetSourceColor (Color.White);
+                       gr.SetSourceColor (Colors.White);
                        gr.LineWidth = 1.0;
                        gr.Stroke ();
                }
index 071c993b40037363848fd6cba15799bf98405593..4c22e3a156778c326980a4788e3ff682209175a9 100644 (file)
@@ -66,7 +66,7 @@ namespace Crow {
                public virtual Color SelectionBackground {
                        get { return selBackground; }
                        set {
-                               if (value == selBackground)
+                               if (selBackground == value)
                                        return;
                                selBackground = value;
                                NotifyValueChanged ("SelectionBackground", selBackground);
@@ -77,7 +77,7 @@ namespace Crow {
                public virtual Color SelectionForeground {
                        get { return selForeground; }
                        set {
-                               if (value == selForeground)
+                               if (selForeground == value)
                                        return;
                                selForeground = value;
                                NotifyValueChanged ("SelectionForeground", selForeground);
index abc9d114e4454980dada13465d7de5fe24bf32ba..fe8cfe954aa4af4d028c89e462db3045dc7ae32e 100644 (file)
@@ -186,7 +186,7 @@ namespace Crow
                        MenuItem tmp = LogicalParent as MenuItem;
                        while (tmp != null) {
                                tmp.IsOpened = false;
-                               tmp.Background = Color.Transparent;
+                               tmp.Background = Colors.Transparent;
                                tmp.AutomaticOpening = false;
                                tmp = tmp.LogicalParent as MenuItem;
                        }
index 779a6de69e8e8c9ff32ada26db6a1b9d546b078c..d202503fac04aac1c1b9882bd846df16168a7e93 100644 (file)
@@ -92,10 +92,10 @@ namespace Crow
 
 
                        gr.Arc (mousePos.X, mousePos.Y, 3.5, 0, Math.PI * 2.0);
-                       gr.SetSourceColor (Color.Black);
+                       gr.SetSourceColor (Colors.Black);
                        gr.LineWidth = 2.0;
                        gr.StrokePreserve ();
-                       gr.SetSourceColor (Color.White);
+                       gr.SetSourceColor (Colors.White);
                        gr.LineWidth = 1.0;
                        gr.Stroke ();
                }
index 9fac1fc744ddc28d8bb45441ba0cb15b0cd99461..df06cc92750aa868040199f42cee17983146eec7 100644 (file)
@@ -25,7 +25,7 @@ namespace Crow
                int tabOffset;
                bool isSelected;
                //Measure tabThickness;
-               Fill selectedBackground = Color.Transparent;
+               Fill selectedBackground = Colors.Transparent;
                #endregion
 
                #region TemplatedControl overrides
index aa690e8c7d46088fa9c2e8fdc8ab4bc3a0b4f765..d48cbfc013cc4089da171e12afef99c4c4be6f93 100644 (file)
@@ -191,7 +191,7 @@ namespace Crow
                                else
                                        adjustedTab = -1;
 
-                               //Console.WriteLine ("tabspace: {0} tw:{1}", tabSpace, tabWidth);
+                               //System.Diagnostics.Debug.WriteLine ("tabspace: {0} tw:{1}", tabSpace, tabWidth);
 
                                childrenRWLock.EnterReadLock();
                                TabItem[] tabItms = Children.Cast<TabItem>().OrderBy (t=>t.ViewIndex).ToArray();
@@ -205,7 +205,7 @@ namespace Crow
                                        tabItms [i].NotifyValueChanged ("TabWidth", TabWidth);
                                        if (!tabItms [i].IsDragged) {
                                                tabItms [i].TabOffset = curOffset;
-                                               //Console.WriteLine ("offset: {0}=>{1}", tabItms [i].Name, tabItms [i].TabOffset);
+                                               //System.Diagnostics.Debug.WriteLine ("offset: {0}=>{1}", tabItms [i].Name, tabItms [i].TabOffset);
                                        }
                                        if (Orientation == Orientation.Horizontal) {
                                                curOffset += tabSpace;
index da2c1f87e526b0f2475d79d5a83dd739972d99de..478c99b5bf49e2bad0b94dfac5c7f2bedd4f1a45 100644 (file)
@@ -141,8 +141,8 @@ namespace Crow {
                                        return;
 
                                if (selColoring && _selectedIndex >= 0 && Items.Count > _selectedIndex) {
-                                       Items[_selectedIndex].Foreground = Color.Transparent;
-                                       Items[_selectedIndex].Background = Color.Transparent;
+                                       Items[_selectedIndex].Foreground = Colors.Transparent;
+                                       Items[_selectedIndex].Background = Colors.Transparent;
                                }
 
                                _selectedIndex = value;
@@ -344,7 +344,7 @@ namespace Crow {
                        /*} catch (Exception ex) {
                                if (Monitor.IsEntered (IFace.LayoutMutex))
                                        Monitor.Exit (IFace.LayoutMutex);
-                               Console.WriteLine ("loading thread aborted: " + ex.ToString());
+                               System.Diagnostics.Debug.WriteLine ("loading thread aborted: " + ex.ToString());
                        }*/
 
                }
index 418bb5b65db303dd4c5a112e1d2f539ba5df03e6..bfd6114dfbe1e9c7f1b927d468ba22db77bf0a72 100644 (file)
@@ -55,14 +55,14 @@ namespace Crow
 
                internal void design_add_style_location (string memberName, string path, int line, int col) {                   
                        if (design_style_locations.ContainsKey(memberName)){
-                               Console.WriteLine ("default value localtion already set for {0}{1}.{2}", this.GetType().Name, this.design_id, memberName);
+                               System.Diagnostics.Debug.WriteLine ("default value localtion already set for {0}{1}.{2}", this.GetType().Name, this.design_id, memberName);
                                return;
                        }
                        design_style_locations.Add(memberName, new FileLocation(path,line,col));
                }
 //             internal void design_add_iml_location (string memberName, string path, int line, int col) {
 //                     if (design_iml_locations.ContainsKey(memberName)){
-//                             Console.WriteLine ("IML value localtion already set for {0}{1}.{2}", this.GetType().Name, this.design_id, memberName);
+//                             System.Diagnostics.Debug.WriteLine ("IML value localtion already set for {0}{1}.{2}", this.GetType().Name, this.design_id, memberName);
 //                             return;
 //                     }
 //                     design_iml_locations.Add(memberName, new FileLocation(path,line,col));
@@ -155,7 +155,7 @@ namespace Crow
 
                        if (disposing) {
                                #if DEBUG_DISPOSE
-                               Console.WriteLine ("Disposing: {0}", this.ToString());
+                               System.Diagnostics.Debug.WriteLine ("Disposing: {0}", this.ToString());
                                //if ()
                                //throw new Exception("Trying to dispose an object queued for Redraw: " + this.ToString());
                                #endif
@@ -256,8 +256,8 @@ namespace Crow
                ILayoutable logicalParent;
                ILayoutable parent;
                string name;
-               Fill background = Color.Transparent;
-               Fill foreground = Color.White;
+               Fill background = Colors.Transparent;
+               Fill foreground = Colors.White;
                Font font = "sans, 10";
                protected Measure width, height;
                int left, top;
@@ -779,10 +779,8 @@ namespace Crow
                                background = value;
                                NotifyValueChanged ("Background", background);
                                RegisterForRedraw ();
-                               if (background is SolidColor) {
-                                       if ((background as SolidColor).Equals (Color.Clear))
-                                               clearBackground = true;
-                               }
+                               if (background is SolidColor sc && sc.Equals (Colors.Clear))
+                                       clearBackground = true;                         
                        }
                }
                /// <summary>
@@ -1411,7 +1409,7 @@ namespace Crow
                {
 #if DEBUG
                        if (disposed) {
-                               Console.WriteLine ($"RegisterForGraphicUpdate for disposed Widget: {this}\n{System.Environment.StackTrace}");
+                               System.Diagnostics.Debug.WriteLine ($"RegisterForGraphicUpdate for disposed Widget: {this}\n{System.Environment.StackTrace}");
                                return;
                        }
 #endif
@@ -1427,7 +1425,7 @@ namespace Crow
                {
 #if DEBUG
                        if (disposed) {
-                               Console.WriteLine ($"RegisterForRedraw for disposed Widget: {this}\n{System.Environment.StackTrace}");
+                               System.Diagnostics.Debug.WriteLine ($"RegisterForRedraw for disposed Widget: {this}\n{System.Environment.StackTrace}");
                                return;
                        }
 #endif
@@ -1453,7 +1451,7 @@ namespace Crow
                public virtual void RegisterForLayouting(LayoutingType layoutType){
 #if DEBUG
                        if (disposed) {
-                               Console.WriteLine ($"RegisterForLayouting({layoutType}) for disposed Widget: {this}\n{System.Environment.StackTrace}");
+                               System.Diagnostics.Debug.WriteLine ($"RegisterForLayouting({layoutType}) for disposed Widget: {this}\n{System.Environment.StackTrace}");
                                return;
                        }
 #endif
@@ -1755,16 +1753,16 @@ namespace Crow
 #if DEBUG
                                Console.ForegroundColor = ConsoleColor.Red;
                                if (disposed)
-                                       Console.WriteLine ($"Paint disposed widget: {this}");
+                                       System.Diagnostics.Debug.WriteLine ($"Paint disposed widget: {this}");
                                Console.ForegroundColor = ConsoleColor.DarkRed;
                                if (Slot.Height < 0 || Slot.Width < 0)
-                                       Console.WriteLine ($"Paint slot invalid ({Slot}): {this}");
+                                       System.Diagnostics.Debug.WriteLine ($"Paint slot invalid ({Slot}): {this}");
                                Console.ForegroundColor = ConsoleColor.DarkMagenta;
                                if (parent == null)
-                                       Console.WriteLine ($"Paint with parent == null: {this}");
+                                       System.Diagnostics.Debug.WriteLine ($"Paint with parent == null: {this}");
                                Console.ForegroundColor = ConsoleColor.Magenta;
                                if (!isVisible)
-                                       Console.WriteLine ($"Paint invisible widget: {this}");
+                                       System.Diagnostics.Debug.WriteLine ($"Paint invisible widget: {this}");
                                Console.ForegroundColor = ConsoleColor.Gray;
 #endif
                                return; 
index 1952f972a6eb5c7f7632ef0254939250afe96f35..21d5cf82b76c56790927b6d3dd20781fae33ce0f 100644 (file)
@@ -31,8 +31,8 @@ namespace Crow
                bool modal;
                protected bool hoverBorder = false;
                bool alwaysOnTop = false;
-               Fill titleBarBackground = Color.SteelBlue;
-               Fill titleBarForeground = Color.White;
+               Fill titleBarBackground = Colors.SteelBlue;
+               Fill titleBarForeground = Colors.White;
 
                Rectangle savedBounds;
                bool _minimized = false;
index ddd3bca0407a614e0342f6d5916b06068283a05a..e6eb46364dc7c12662547c08b86192c260e82da1 100644 (file)
@@ -121,7 +121,7 @@ namespace Crow
                                tmp.data [i * 4 + 2] = sr.ReadByte ();
                                tmp.data [i * 4 + 3] = sr.ReadByte ();
 
-                               //Console.WriteLine ($"{tmp.data [i * 4 + 3],2:X} {tmp.data [i * 4 + 0],2:X} {tmp.data [i * 4 + 1],2:X} {tmp.data [i * 4 + 2],2:X}");
+                               //System.Diagnostics.Debug.WriteLine ($"{tmp.data [i * 4 + 3],2:X} {tmp.data [i * 4 + 0],2:X} {tmp.data [i * 4 + 1],2:X} {tmp.data [i * 4 + 2],2:X}");
                        }
                        //tmp.data = sr.ReadBytes((int)(tmp.Width * tmp.Height * 4));
                        /*using(Stream fs = new FileStream($"/tmp/test.bin_{tmp.Width}", FileMode.Create))
index dad155c7c4bdf68867a08af004b89c82bb038b4d..baca16bec69aafbae5d86a803b89665a4a468c32 100644 (file)
@@ -174,7 +174,7 @@ namespace Crow
                        else {
                                DbgGo go = objs.Where (o => o.instanceNum == evt.data.objInstanceNum).FirstOrDefault ();
                                if (go == null)
-                                       Console.WriteLine ("Unknown instance: " + evt.data.objInstanceNum);
+                                       System.Diagnostics.Debug.WriteLine ("Unknown instance: " + evt.data.objInstanceNum);
                                else
                                        go.events.Add (evt);                                            
                        }
diff --git a/PerfTests/PerfTests.csproj b/PerfTests/PerfTests.csproj
new file mode 100644 (file)
index 0000000..bb30620
--- /dev/null
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project Sdk="Microsoft.NET.Sdk">
+       <PropertyGroup>
+               <TargetFrameworks>net472</TargetFrameworks>
+               <OutputType>Exe</OutputType>
+               <ReleaseVersion>0.8.0</ReleaseVersion>
+       </PropertyGroup>
+       <ItemGroup>
+         <ProjectReference Include="..\Crow\Crow.csproj" />
+       </ItemGroup>
+       
+       <ItemGroup>
+               <None Include="$(SolutionDir)Samples\common\ui\Interfaces\**\*.*">
+                       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+                       <Link>Interfaces\%(RecursiveDir)%(Filename)%(Extension)</Link>
+               </None>
+               <EmbeddedResource Include="$(SolutionDir)Samples\common\ui\templates\**\*.*">
+                       <LogicalName>ui.%(Filename)%(Extension)</LogicalName>
+                       <Link>Templates\%(Filename)%(Extension)</Link>
+               </EmbeddedResource>
+               <EmbeddedResource Include="$(SolutionDir)Samples\common\samples.style" />
+               <EmbeddedResource Include="$(SolutionDir)Samples\common\ui\images\**\*.*">
+                       <LogicalName>images.%(Filename)%(Extension)</LogicalName>
+                       <Link>Images\%(Filename)%(Extension)</Link>
+               </EmbeddedResource>
+               <EmbeddedResource Include="$(SolutionDir)Samples\common\ui\Icons\*.*">
+                       <LogicalName>Icons.%(Filename)%(Extension)</LogicalName>
+                       <Link>Icons\%(Filename)%(Extension)</Link>
+               </EmbeddedResource>
+       </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/PerfTests/Program.cs b/PerfTests/Program.cs
new file mode 100644 (file)
index 0000000..e97014d
--- /dev/null
@@ -0,0 +1,80 @@
+// Copyright (c) 2013-2020  Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using System;
+using System.CodeDom.Compiler;
+using System.Diagnostics;
+using System.IO;
+using Crow;
+
+namespace PerfTests
+{
+       class TestInterface : Interface
+       {
+               public TestInterface (int width = 800, int height = 600)
+                       : base (width, height, false, false)
+               {
+                       surf = new Crow.Cairo.ImageSurface (Crow.Cairo.Format.Argb32, ClientRectangle.Width, ClientRectangle.Height);
+                       Init ();
+               }
+
+               long Test (string path, out long min, out long max, int count = 10)
+               {
+                       min = long.MaxValue;
+                       max = long.MinValue;
+
+                       long total = 0;
+
+                       Stopwatch sw = new Stopwatch ();
+
+                       for (int i = 0; i < count; i++) {
+                               sw.Restart ();
+
+
+                               Load (path);
+                               while (LayoutingQueue.Count > 0)
+                                       Update ();
+
+                               sw.Stop ();
+
+                               if (sw.ElapsedTicks < min)
+                                       min = sw.ElapsedMilliseconds;
+                               if (sw.ElapsedTicks > max)
+                                       max = sw.ElapsedMilliseconds;
+                               total += sw.ElapsedMilliseconds;
+
+                       }
+
+                       return total / count;
+               }
+
+               void testDir (string dirPath, int level = 0)
+               {
+                       Console.WriteLine ($"{new string (' ', level * 4)}-{dirPath}");
+                       level++;
+
+                       foreach (string d in Directory.GetDirectories (dirPath)) 
+                               testDir (d, level);
+
+                       foreach (string f in Directory.GetFiles (dirPath)) {
+                               try {
+                                       long mean = Test (f, out long min, out long max);
+                                       Console.WriteLine ($"{new string (' ', level * 4)}{ Path.GetFileName (f),-30}: {min,5} |{mean,5} |{max,5}");
+                               } catch (Exception ex) {
+                                       Console.ForegroundColor = ConsoleColor.Red;
+                                       Console.WriteLine ($"{ex.Message}");
+                                       Console.ResetColor ();
+                               }
+                       }
+               }
+
+
+               public static void Main (string [] args)
+               {
+                       //IndentedTextWriter w = new IndentedTextWriter()
+                       using (TestInterface iface = new TestInterface ()) {
+                               iface.testDir ("Interfaces");
+                       }
+               }
+       }
+}
index 05bc0435a1c8d72badd2019c5899ca2a72f4aed9..2fdc50ba100271fd034b9aecee78dbd8a94b16cf 100644 (file)
@@ -75,7 +75,7 @@ namespace tests
                                        idx++;
                                        break;
                                case Key.F1:
-                                       TestList.Add ("new string");
+                                       //TestList.Add ("new string");
                                        NotifyValueChanged ("TestList", TestList);
                                        break;
                                case Key.F4:
@@ -223,9 +223,9 @@ namespace tests
                        }
                }
 
-               List<Color> testList = Color.ColorDic.Values//.OrderBy(c=>c.Hue)
+               List<Color> testList = null; //Color.ColorDic.Values//.OrderBy(c=>c.Hue)
                                                                                                        //.ThenBy(c=>c.Value).ThenBy(c=>c.Saturation)
-                       .ToList ();
+                       //.ToList ();
                public List<Color> TestList {
                        set {
                                testList = value;
@@ -259,7 +259,7 @@ namespace tests
                void OnClear (object sender, MouseButtonEventArgs e) => TestList = null;
 
                void OnLoadList (object sender, MouseButtonEventArgs e) => TestList =
-                       Color.ColorDic.Values.OrderBy (c => c.Hue).ToList ();
+                       null; //Color.ColorDic.Values.OrderBy (c => c.Hue).ToList ();
 
                void command1 ()
                {
index 2d7a3176d431025225cf74169ffa32772c0239df..2f65ac1d4f28b6877cd71fb89b96af4195296235 100644 (file)
@@ -1,6 +1,6 @@
 <?xml version="1.0"?>
-<Window Width="200" Height="200">
-       <TextBox Text="Hello World" Background="Blue"/>
-</Window>
+<Container Margin="10" Background="Jet">
+       <!--<Widget Width="200" Height="200" Background="Blue"/>-->
+</Container>
 
 
index 8a91a89437b2fe714134174d18c7dcc309eb1908..7650fb970363e9f4a6add9576f231c1785170d70 100644 (file)
@@ -169,7 +169,7 @@ namespace tests
                        }
                        get { return List2; }
                }
-               IList<Color> testList = Color.ColorDic.Values.OrderBy(c=>c.Hue).ThenBy(c=>c.Value).ToList ();
+               IList<Color> testList = null;// Enum.GetValues (typeof (Colors)).Cast<Color> ().ToList (); // Color.ColorDic.Values.OrderBy(c=>c.Hue).ThenBy(c=>c.Value).ToList ();
                public IList<Color> TestList {
                        set {
                                testList = value;
@@ -202,7 +202,7 @@ namespace tests
 
                void OnClear (object sender, MouseButtonEventArgs e) => TestList = null;
 
-               void OnLoadList (object sender, MouseButtonEventArgs e) => TestList = Color.ColorDic.Values.ToList ();
+               void OnLoadList (object sender, MouseButtonEventArgs e) => TestList = Enum.GetValues (typeof (Colors)).Cast<Color> ().ToList ();
 
        }
 
index 0d0eefe15b4e822f582e551ccb39bd9be6b6d7d8..c3d6dc97b7644228c65b4732331e499540c51138 100644 (file)
@@ -10,6 +10,7 @@
          <PackageReference Include="NUnit" Version="3.12.0" />
          <PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
          <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
+         <PackageReference Include="NUnit.ConsoleRunner" Version="3.11.1" />
        </ItemGroup>
        <ItemGroup>
          <ProjectReference Include="..\Crow\Crow.csproj" />