From 63e6582b28377b7f5f187cd951964aaef85702a5 Mon Sep 17 00:00:00 2001 From: jpbruyere Date: Thu, 20 Oct 2016 16:11:40 +0200 Subject: [PATCH] =?utf8?q?first=20test=20with=20color=20in=20property=20ta?= =?utf8?q?b=20from=20CrowIDE=20=09modifi=C3=A9=C2=A0:=20=20=20=20=20=20=20?= =?utf8?q?=20=20CrowIDE/ui/imlEditor.crow=20=09modifi=C3=A9=C2=A0:=20=20?= =?utf8?q?=20=20=20=20=20=20=20Templates/ColorPicker.template=20=09modifi?= =?utf8?q?=C3=A9=C2=A0:=20=20=20=20=20=20=20=20=20Tests/Interfaces/Divers/?= =?utf8?q?colorPicker.crow=20=09modifi=C3=A9=C2=A0:=20=20=20=20=20=20=20?= =?utf8?q?=20=20src/GraphicObjects/ColorPicker.cs=20=09modifi=C3=A9=C2=A0:?= =?utf8?q?=20=20=20=20=20=20=20=20=20src/GraphicObjects/ColorSelector.cs?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- CrowIDE/ui/imlEditor.crow | 21 +++++++- Templates/ColorPicker.template | 1 + Tests/Interfaces/Divers/colorPicker.crow | 5 +- src/GraphicObjects/ColorPicker.cs | 63 +++--------------------- src/GraphicObjects/ColorSelector.cs | 4 +- 5 files changed, 34 insertions(+), 60 deletions(-) diff --git a/CrowIDE/ui/imlEditor.crow b/CrowIDE/ui/imlEditor.crow index 984394f6..d84fa6a8 100644 --- a/CrowIDE/ui/imlEditor.crow +++ b/CrowIDE/ui/imlEditor.crow @@ -72,7 +72,7 @@ -- + @@ -119,6 +119,25 @@ + + + + + diff --git a/Templates/ColorPicker.template b/Templates/ColorPicker.template index 06753f80..4a542631 100755 --- a/Templates/ColorPicker.template +++ b/Templates/ColorPicker.template @@ -4,6 +4,7 @@ diff --git a/Tests/Interfaces/Divers/colorPicker.crow b/Tests/Interfaces/Divers/colorPicker.crow index 724ca4db..add58965 100755 --- a/Tests/Interfaces/Divers/colorPicker.crow +++ b/Tests/Interfaces/Divers/colorPicker.crow @@ -1,2 +1,5 @@  - \ No newline at end of file + + + + \ No newline at end of file diff --git a/src/GraphicObjects/ColorPicker.cs b/src/GraphicObjects/ColorPicker.cs index 12729144..b95fb0e3 100644 --- a/src/GraphicObjects/ColorPicker.cs +++ b/src/GraphicObjects/ColorPicker.cs @@ -30,65 +30,16 @@ namespace Crow { } - Color selectedColor; - float _red, _green, _blue, _alpha; + Fill selectedColor; - [XmlAttributeAttribute()] - public virtual double Red { - get { return selectedColor.R; } - set { - if (selectedColor.R == value) - return; - selectedColor.R = value; - NotifyValueChanged ("Red", selectedColor.R); - NotifyValueChanged ("SelectedColor", new SolidColor(selectedColor)); - } - } - [XmlAttributeAttribute()] - public virtual double Green { - get { return selectedColor.G; } - set { - if (selectedColor.G == value) - return; - selectedColor.G = value; - NotifyValueChanged ("Green", selectedColor.G); - NotifyValueChanged ("SelectedColor", new SolidColor(selectedColor)); - } - } - [XmlAttributeAttribute()] - public virtual double Blue { - get { return selectedColor.B; } - set { - if (selectedColor.B == value) - return; - selectedColor.B = value; - NotifyValueChanged ("Blue", selectedColor.B); - NotifyValueChanged ("SelectedColor", new SolidColor(selectedColor)); - } - } - [XmlAttributeAttribute()] - public virtual double Alpha { - get { return selectedColor.A; } - set { - if (selectedColor.A == value) - return; - selectedColor.A = value; - NotifyValueChanged ("Alpha", selectedColor.A); - NotifyValueChanged ("SelectedColor", new SolidColor(selectedColor)); - } - } - [XmlAttributeAttribute()][DefaultValue("White")] - public virtual SolidColor SelectedColor { + [XmlAttributeAttribute] + public virtual Fill SelectedColor { get { return selectedColor; } - set { - if (selectedColor.Equals(value)) + set { + if (selectedColor == value) return; - selectedColor = value; - NotifyValueChanged ("SelectedColor", new SolidColor(selectedColor)); - NotifyValueChanged ("Alpha", selectedColor.A); - NotifyValueChanged ("Blue", selectedColor.B); - NotifyValueChanged ("Green", selectedColor.G); - NotifyValueChanged ("Red", selectedColor.R); + selectedColor = value; + NotifyValueChanged ("SelectedColor", selectedColor); } } } diff --git a/src/GraphicObjects/ColorSelector.cs b/src/GraphicObjects/ColorSelector.cs index 6db139a5..39db4f25 100644 --- a/src/GraphicObjects/ColorSelector.cs +++ b/src/GraphicObjects/ColorSelector.cs @@ -33,7 +33,7 @@ namespace Crow const double div = 255.0; const double colDiv = 1.0 / div; - Fill selectedColor; + Fill selectedColor = new SolidColor(Color.Red); protected Point mousePos; double h,s,v; @@ -119,7 +119,7 @@ namespace Crow } } - [XmlAttributeAttribute()][DefaultValue("White")] + [XmlAttributeAttribute] public virtual Fill SelectedColor { get { return selectedColor; } set { -- 2.47.3