aboutsummaryrefslogtreecommitdiffstatsci
diff options
context:
space:
mode:
authorjpbruyere <jp.bruyere@hotmail.com>2016-10-20 16:11:40 +0200
committerjpbruyere <jp.bruyere@hotmail.com>2016-10-20 16:11:40 +0200
commitff60a4fffde7d44b914f3418ffadf541325ed91a (patch)
treeeb681db9fa4a9ac72128a053dbe0df5860ccffe3
parent8dd3844dcb3487197996a8cc1ae2326fdc1aa60c (diff)
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
-rwxr-xr-xTemplates/ColorPicker.template1
-rwxr-xr-xTests/Interfaces/Divers/colorPicker.crow5
-rw-r--r--src/GraphicObjects/ColorPicker.cs63
-rw-r--r--src/GraphicObjects/ColorSelector.cs4
4 files changed, 14 insertions, 59 deletions
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 @@
<HorizontalStack Spacing="0">
<VerticalStack Margin="10">
<SaturationValueSelector Focusable="true" Name="colorSelector" Margin="0" Width="140" Height="140" Background="DimGray"
+ SelectedColor="{²./SelectedColor}"
Foreground="{../hueSelector.SelectedColor}"/>
<HueSelector Focusable="true" Name="hueSelector" Margin="0" Width="140" Height="20" Background="DimGray"/>
</VerticalStack>
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 @@
<?xml version="1.0"?>
-<ColorPicker Background="Onyx" Margin="5" Fit="True" Foreground="White"/> \ No newline at end of file
+<VerticalStack>
+ <ColorPicker SelectedColor="Red" Name="colorPicker" Background="Onyx" Margin="5" Fit="True" />
+ <GraphicObject Width="100" Height="60" Background="{../colorPicker.SelectedColor}"/>
+</VerticalStack> \ 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 {