Minimum = "0";
Maximum = "1";
SmallIncrement = "0.01";
+ Decimals = "-1";
}
TxtInFileDialog {
Margine = "1";
</HorizontalStack>
<HorizontalStack Height="Fit">
<Label Text="H" Width="Fit"/>
- <Spinner Style="HSVSpinner" Value="{²./H}" Width="40" />
+ <Spinner Style="ColorSpinner" Value="{²./H}" Width="40" />
</HorizontalStack>
<HorizontalStack Height="Fit">
<Label Text="S" Width="Fit"/>
- <Spinner Style="HSVSpinner" Value="{²./S}" Width="40" />
+ <Spinner Style="ColorSpinner" Value="{²./S}" Width="40" />
</HorizontalStack>
<HorizontalStack Height="Fit">
<Label Text="V" Width="Fit"/>
- <Spinner Style="HSVSpinner" Value="{²./V}" Width="40" />
+ <Spinner Style="ColorSpinner" Value="{²./V}" Width="40" />
</HorizontalStack>
</VerticalStack>
</HorizontalStack>
//testFiles = new string [] { @"Interfaces/Divers/welcome.crow" };
//testFiles = new string [] { @"Interfaces/Divers/0.crow" };
//testFiles = new string [] { @"Interfaces/Divers/testIMLContainer.crow" };
- testFiles = new string [] { @"Interfaces/TemplatedContainer/testTabView.crow" };
+ //testFiles = new string [] { @"Interfaces/TemplatedContainer/testTabView.crow" };
//testFiles = new string [] { @"Interfaces/TemplatedContainer/testTreeView.crow" };
- //testFiles = new string [] { @"Interfaces/Divers/colorPicker.crow" };
+ testFiles = new string [] { @"Interfaces/Divers/colorPicker.crow" };
// testFiles = new string[] { @"Interfaces/TemplatedControl/testItemTemplateTag.crow" };
testFiles = testFiles.Concat (Directory.GetFiles (@"Interfaces/GraphicObject", "*.crow")).ToArray ();
<?xml version="1.0"?>
<VerticalStack>
<ColorPicker SelectedColor="{²../go.Background}" Name="colorPicker" Background="DimGray" Margin="5" Fit="True" />
- <GraphicObject Name="go" Width="100" Height="60" Background="DarkBlue"/>
+ <GraphicObject Name="go" Width="100" Height="60" Background="Yellow"/>
<GraphicObject Name="go" Width="100" Height="60" Background="{../colorPicker.SelectedColor}"/>
<Label Text="{../colorPicker.SelectedColor}"/>
</VerticalStack>
\ No newline at end of file
Color curColor;
double h,s,v;
- [XmlAttributeAttribute()]
public virtual double R {
get { return Math.Round(curColor.R * div); }
set {
notifyCurColorHasChanged ();
}
}
- [XmlAttributeAttribute()]
public virtual double G {
get { return Math.Round(curColor.G * div); }
set {
hsvFromRGB ();
}
}
- [XmlAttributeAttribute()]
public virtual double B {
get { return Math.Round(curColor.B * div); }
set {
hsvFromRGB ();
}
}
- [XmlAttributeAttribute()]
public virtual double A {
get { return Math.Round(curColor.A * div); }
set {
hsvFromRGB ();
}
}
- [XmlAttributeAttribute()]
public virtual double H {
- get { return Math.Round (h, 3); }
+ get { return Math.Round(h * div); }
set {
if (H == value)
return;
- h = value;
+ h = value * colDiv;
NotifyValueChanged ("H", H);
rgbFromHSV ();
}
}
- [XmlAttributeAttribute()]
public virtual double S {
- get { return Math.Round (s, 2); }
+ get { return Math.Round(s * div); }
set {
- if (s == value)
+ if (S == value)
return;
- s = value;
+ s = value * colDiv;
NotifyValueChanged ("S", S);
rgbFromHSV ();
}
}
- [XmlAttributeAttribute()]
public virtual double V {
- get { return Math.Round (v, 2); }
+ get { return Math.Round(v * div); }
set {
- if (v == value)
+ if (V == value)
return;
- v = value;
+ v = value * colDiv;
NotifyValueChanged ("V", V);
rgbFromHSV ();
}
}
-
- [XmlAttributeAttribute]
public virtual Fill SelectedColor {
get { return new SolidColor(curColor); }
set {
hsvFromRGB ();
}
}
- [XmlAttributeAttribute]
public virtual Color SelectedRawColor {
get { return curColor; }
set {
notifyHSVHasChanged ();
}
void rgbFromHSV(){
- curColor = Color.FromHSV (h, v, s, curColor.A);
+ curColor = Color.FromHSV (h , v, s, curColor.A);
notifyCurColorHasChanged ();
notifyRGBAHasChanged ();
}
[DesignCategory ("Divers")]
public virtual string Name {
get {
- return string.IsNullOrEmpty(name) ? design_id : name;
+ return string.IsNullOrEmpty(name) ? this.GetType().Name + design_id : name;
}
set {
if (Name == value)
Orientation _orientation;
double hue;
+ const double div = 255.0;
+ const double colDiv = 1.0 / div;
[XmlAttributeAttribute][DefaultValue(Orientation.Horizontal)]
public virtual Orientation Orientation
}
[XmlAttributeAttribute()]
public virtual double Hue {
- get { return hue; }
+ get { return Math.Round(hue * div); }
set {
- if (hue == value)
+ if (Hue == value)
return;
- hue = value;
+ hue = value * colDiv;
notifyHueChanged ();
updateMousePosFromHue ();
RegisterForRedraw ();
mousePos.Y = (int)Math.Floor(hue * (double)ClientRectangle.Height);
}
void notifyHueChanged(){
- NotifyValueChanged ("Hue", hue);
+ NotifyValueChanged ("Hue", Hue);
NotifyValueChanged ("HueColor", new SolidColor (Color.FromHSV (hue)));
}
}
else
_actualValue = value;
- _actualValue = Math.Round (_actualValue, _decimals);
+ if (_decimals >= 0)
+ _actualValue = Math.Round (_actualValue, _decimals);
NotifyValueChanged("Value", _actualValue);
RegisterForGraphicUpdate();
{
}
+ const double div = 255.0;
+ const double colDiv = 1.0 / div;
double v, s;
[XmlAttributeAttribute()]
public virtual double V {
- get { return v; }
+ get { return Math.Round(v * div); }
set {
- if (v == value)
+ if (S == value)
return;
- v = value;
- NotifyValueChanged ("V", v);
+ v = value * colDiv;
+ NotifyValueChanged ("V", V);
mousePos.Y = (int)Math.Floor((1.0-v) * (double)ClientRectangle.Height);
RegisterForRedraw ();
}
[XmlAttributeAttribute()]
public virtual double S {
- get { return s; }
+ get { return Math.Round(s * div); }
set {
- if (s == value)
+ if (S == value)
return;
- s = value;
- NotifyValueChanged ("S", s);
+ s = value * colDiv;
+ NotifyValueChanged ("S", S);
mousePos.X = (int)Math.Floor(s * (double)ClientRectangle.Width);
RegisterForRedraw ();
Rectangle cb = ClientRectangle;
s = (double)mousePos.X / (double)cb.Width;
v = 1.0 - (double)mousePos.Y / (double)cb.Height;
- NotifyValueChanged ("S", s);
- NotifyValueChanged ("V", v);
+ NotifyValueChanged ("S", S);
+ NotifyValueChanged ("V", V);
RegisterForRedraw ();
}