From: jpbruyere Date: Thu, 20 Oct 2016 14:11:40 +0000 (+0200) Subject: first test with color in property tab from CrowIDE X-Git-Tag: v0.5.1~28^2~17 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=63e6582b28377b7f5f187cd951964aaef85702a5;p=jp%2Fcrow.git first test with color in property tab from CrowIDE modifié : CrowIDE/ui/imlEditor.crow modifié : Templates/ColorPicker.template modifié : Tests/Interfaces/Divers/colorPicker.crow modifié : src/GraphicObjects/ColorPicker.cs modifié : src/GraphicObjects/ColorSelector.cs --- 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 {