From bae9b85da7089fed1ca5dd7882f4f83b74fa6a34 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Wed, 3 Jun 2020 15:11:28 +0200 Subject: [PATCH] system clipboard support, GroupBox clear color debug --- Crow.sln | 4 ++-- Crow/Crow.csproj | 2 +- Crow/src/Colors.cs | 1 + Crow/src/Fill/SolidColor.cs | 23 +++----------------- Crow/src/Interface.cs | 6 ++++- Samples/common/ui/Interfaces/Divers/all.crow | 2 +- 6 files changed, 13 insertions(+), 25 deletions(-) diff --git a/Crow.sln b/Crow.sln index 933c8e32..a0113386 100644 --- a/Crow.sln +++ b/Crow.sln @@ -8,11 +8,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "global", "global", "{728545 README.md = README.md EndProjectSection EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Crow", "Crow\Crow.csproj", "{C2980F9B-4798-4C05-99E2-E174810F7C7B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Crow", "Crow\Crow.csproj", "{C2980F9B-4798-4C05-99E2-E174810F7C7B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{B2C7855A-2878-47FD-AD32-9A83DB4AB8C6}" ProjectSection(SolutionItems) = preProject - Samples\Directory.Build.props = Samples\Directory.Build.props + Samples\Directory.Build.props = Samples\Directory.Build.props EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HelloWorld", "Samples\HelloWorld\HelloWorld.csproj", "{F535A8AB-CD93-49AB-B1B0-FFF9AE51ED6A}" diff --git a/Crow/Crow.csproj b/Crow/Crow.csproj index 49373244..2cfa12fd 100644 --- a/Crow/Crow.csproj +++ b/Crow/Crow.csproj @@ -38,7 +38,7 @@ - + diff --git a/Crow/src/Colors.cs b/Crow/src/Colors.cs index 8dd772d7..d6435bd1 100644 --- a/Crow/src/Colors.cs +++ b/Crow/src/Colors.cs @@ -234,6 +234,7 @@ namespace Crow }*/ public static implicit operator Color (Colors c) => new Color ((UInt32)c); + public static implicit operator Colors (Color c) => (Colors)c.value; public static bool operator ==(Color a, Color b) => a.Equals (b); public static bool operator != (Color a, Color b) => !a.Equals (b); diff --git a/Crow/src/Fill/SolidColor.cs b/Crow/src/Fill/SolidColor.cs index 0b16b09e..3fb1d452 100644 --- a/Crow/src/Fill/SolidColor.cs +++ b/Crow/src/Fill/SolidColor.cs @@ -69,25 +69,8 @@ namespace Crow { return color.GetHashCode(); } - public override bool Equals (object obj) - => 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; -// } -// public static bool operator !=(SolidColor c, string n) -// { -// return c.color.Name == n ? false : true; -// } -// public static bool operator ==(string n, SolidColor c) -// { -// return c.color.Name == n ? true : false; -// } -// public static bool operator !=(string n, SolidColor c) -// { -// return c.color.Name == n ? false : true; -// } + public override bool Equals (object obj) + => obj is Color c ? color.Equals (c) : obj is Colors cl ? color.Equals(cl) : obj is SolidColor sc && color.Equals (sc.color); public static SolidColor operator *(SolidColor c, Double f) { return new SolidColor(new Color(c.color.R,c.color.G,c.color.B,c.color.A * f)); @@ -100,7 +83,7 @@ namespace Crow { return new SolidColor(new Color(c1.color.R - c2.color.R,c1.color.G - c2.color.G,c1.color.B - c2.color.B,c1.color.A - c2.color.A)); } - #endregion + #endregion public override string ToString() { diff --git a/Crow/src/Interface.cs b/Crow/src/Interface.cs index e11d597b..76858729 100644 --- a/Crow/src/Interface.cs +++ b/Crow/src/Interface.cs @@ -393,7 +393,11 @@ namespace Crow public Queue DiscardQueue; /// Main drawing queue, holding layouted controls public Queue ClippingQueue = new Queue(); - public string Clipboard;//TODO:use object instead for complex copy paste + //TODO:use object instead for complex copy paste + public string Clipboard { + get => Glfw3.GetClipboardString (hWin); + set => Glfw3.SetClipboardString (hWin, value); + } /// each IML and fragments (such as inline Templates) are compiled as a Dynamic Method stored here /// on the first instance creation of a IML item. /// diff --git a/Samples/common/ui/Interfaces/Divers/all.crow b/Samples/common/ui/Interfaces/Divers/all.crow index bb390def..e59d30d5 100644 --- a/Samples/common/ui/Interfaces/Divers/all.crow +++ b/Samples/common/ui/Interfaces/Divers/all.crow @@ -14,7 +14,7 @@ - +