Author: alanmc
Date: 2007-08-23 18:14:40 -0400 (Thu, 23 Aug 2007)
New Revision: 84764
Modified:
trunk/lunareclipse/ChangeLog
trunk/lunareclipse/Properties/PropertyManager.cs
trunk/lunareclipse/View/MainWindow.cs
Log:
* View/MainWindow.cs, Properties/PropertyManager.cs: Added handling for
Points and Brushes
Modified: trunk/lunareclipse/ChangeLog
===================================================================
--- trunk/lunareclipse/ChangeLog 2007-08-23 22:08:48 UTC (rev 84763)
+++ trunk/lunareclipse/ChangeLog 2007-08-23 22:14:40 UTC (rev 84764)
@@ -1,5 +1,10 @@
2007-08-23 Alan McGovern <[EMAIL PROTECTED]>
+ * View/MainWindow.cs, Properties/PropertyManager.cs: Added handling for
+ Points and Brushes
+
+2007-08-23 Alan McGovern <[EMAIL PROTECTED]>
+
* Controller/UndoActions/UndoGroup.cs: I need the explicit
implementation
too.
* Model/StoryboardManager.cs: Fixed the remaining buglets due to special
Modified: trunk/lunareclipse/Properties/PropertyManager.cs
===================================================================
--- trunk/lunareclipse/Properties/PropertyManager.cs 2007-08-23 22:08:48 UTC
(rev 84763)
+++ trunk/lunareclipse/Properties/PropertyManager.cs 2007-08-23 22:14:40 UTC
(rev 84764)
@@ -104,6 +104,11 @@
info.Add(Canvas.LeftProperty, new
PropertyInfo(ReflectionHelper.GetData(Canvas.LeftProperty),
PropertyType.Double, true, false));
info.Add(Canvas.TopProperty, new
PropertyInfo(ReflectionHelper.GetData(Canvas.TopProperty), PropertyType.Double,
true, false));
info.Add(Canvas.ZIndexProperty, new
PropertyInfo(ReflectionHelper.GetData(Canvas.ZIndexProperty),
PropertyType.Integer, false, false));
+
+ info.Add(UIElement.RenderTransformOriginProperty, new
PropertyInfo(ReflectionHelper.GetData(Canvas.RenderTransformOriginProperty),
PropertyType.Point));
+ info.Add(Shape.FillProperty, new
PropertyInfo(ReflectionHelper.GetData(Shape.FillProperty), PropertyType.Brush));
+ info.Add(Shape.StrokeProperty, new
PropertyInfo(ReflectionHelper.GetData(Shape.StrokeProperty),
PropertyType.Brush));
+ info.Add(Canvas.BackgroundProperty, new
PropertyInfo(ReflectionHelper.GetData(Canvas.BackgroundProperty),
PropertyType.Brush));
}
private void UpdateProperties()
Modified: trunk/lunareclipse/View/MainWindow.cs
===================================================================
--- trunk/lunareclipse/View/MainWindow.cs 2007-08-23 22:08:48 UTC (rev
84763)
+++ trunk/lunareclipse/View/MainWindow.cs 2007-08-23 22:14:40 UTC (rev
84764)
@@ -265,6 +265,14 @@
b.PackEnd(new Entry());
break;
+ case PropertyType.Point:
+ b.PackEnd(CreatePointPropertyWidget(o, info));
+ break;
+
+ case PropertyType.Brush:
+ b.PackEnd(CreateBrushPropertyWidget(o, info));
+ break;
+
default:
b.PackEnd(new Label(string.Format("Unsupported:
{0}", info.Type)));
break;
@@ -273,6 +281,56 @@
return b;
}
+ private Widget CreateBrushPropertyWidget(DependencyObject o,
PropertyInfo info)
+ {
+ Entry e = new Entry();
+ e.Changed += delegate {
+ uint val;
+ if(!uint.TryParse(e.Text,
System.Globalization.NumberStyles.HexNumber, null, out val))
+ val = 0x555555;
+
+ Color c = Color.FromArgb((byte)(val>>24),
(byte)(val>>16), (byte)(val>>8), (byte)val);
+ Console.WriteLine(c.ToString());
+ o.SetValue<Brush>(info.PropertyData.Property,
new SolidColorBrush(c));
+ };
+ return e;
+ }
+
+ private Widget CreatePointPropertyWidget(DependencyObject o,
PropertyInfo info)
+ {
+ VBox b = new VBox(true, 0);
+ HBox h = new HBox(true, 0);
+ h.Add(new Label("X"));
+ Adjustment adj = new Adjustment (0.0, 0, 1, 0.01, 0.1,
1.0);
+ Point p = (Point)o.GetValue(info.PropertyData.Property);
+
+ SpinButton spinner = new SpinButton(adj, 1.0, 2);
+ spinner.Numeric = true;
+ spinner.Value = p.X;
+ spinner.Changed += delegate(object sender, EventArgs e)
{
+ Point point =
(Point)o.GetValue(info.PropertyData.Property);
+ point.X = ((SpinButton)sender).Value;
+ o.SetValue<Point>(info.PropertyData.Property,
point);
+ };
+ h.Add(spinner);
+ b.Add(h);
+
+ h = new HBox(true, 0);
+ h.Add(new Label("Y"));
+ adj = new Adjustment (0.0, 0, 1, 0.01, 0.1, 1.0);
+ spinner = new SpinButton(adj, 1.0, 2);
+ spinner.Numeric = true;
+ spinner.Value = p.Y;
+ spinner.Changed += delegate (object sender, EventArgs
e) {
+ Point point =
(Point)o.GetValue(info.PropertyData.Property);
+ point.Y = ((SpinButton)sender).Value;
+ o.SetValue<Point>(info.PropertyData.Property,
point);
+ };
+ h.Add(spinner);
+ b.Add(h);
+ return b;
+ }
+
private Widget CreateEnumPropertyWidget(DependencyObject o,
PropertyInfo info, Type type)
{
string[] names = Enum.GetNames(type);
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches