Author: miguel
Date: 2007-06-10 01:38:36 -0400 (Sun, 10 Jun 2007)
New Revision: 79108

Modified:
   trunk/olive/class/agclr/System.Windows.Shapes/ChangeLog
   trunk/olive/class/agclr/System.Windows.Shapes/Line.cs
   trunk/olive/class/agclr/System.Windows.Shapes/Shape.cs
   trunk/olive/class/agclr/System.Windows/ChangeLog
   trunk/olive/class/agclr/System.Windows/DependencyObject.cs
Log:
2007-06-10  Miguel de Icaza  <[EMAIL PROTECTED]>

        * Line.cs: Register properties properly

2007-06-10  Miguel de Icaza  <[EMAIL PROTECTED]>

        * DependencyObject.cs: Add support for marshalling arrays of
        doubles. 




Modified: trunk/olive/class/agclr/System.Windows/ChangeLog
===================================================================
--- trunk/olive/class/agclr/System.Windows/ChangeLog    2007-06-10 05:37:50 UTC 
(rev 79107)
+++ trunk/olive/class/agclr/System.Windows/ChangeLog    2007-06-10 05:38:36 UTC 
(rev 79108)
@@ -1,3 +1,8 @@
+2007-06-10  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * DependencyObject.cs: Add support for marshalling arrays of
+       doubles. 
+
 2007-06-09  Miguel de Icaza  <[EMAIL PROTECTED]>
 
        * DependencyObject.cs (SetValue): Also consider class hierarchy,

Modified: trunk/olive/class/agclr/System.Windows/DependencyObject.cs
===================================================================
--- trunk/olive/class/agclr/System.Windows/DependencyObject.cs  2007-06-10 
05:37:50 UTC (rev 79107)
+++ trunk/olive/class/agclr/System.Windows/DependencyObject.cs  2007-06-10 
05:38:36 UTC (rev 79108)
@@ -183,9 +183,11 @@
                                throw new ArgumentNullException ("property");
                        
                        IntPtr x = NativeMethods.dependency_object_get_value 
(native, property.native);
-
-                       if (x == IntPtr.Zero)
+                       if (x == IntPtr.Zero){
+                               Console.WriteLine ("Found null for object {0}, 
with property {1}");
+                               
                                return null;
+                       }
 
                        Kind k;
                        unsafe {
@@ -257,15 +259,20 @@
                                        if (dov.native == IntPtr.Zero)
                                                throw new Exception 
(String.Format (
                                                        "Object {0} has not set 
its native property", dov.GetType()));
-                                       
 
                                        //
                                        // Keep track of this object, so we 
know how to map it
-                                       // on the way out.
+                                       // if it comes back. 
                                        //
                                        objects [dov.native] = dov;
+                                       value.k = dov.GetKind ();
+                                       if (value.k == Kind.DEPENDENCY_OBJECT){
+                                               throw new 
NotImplementedException (
+                                                  String.Format ("Class {0} 
does not implement GetKind", dov));
+                                       }
+
                                        *((IntPtr *) p) = dov.native;
-                               } if (v is int){
+                               } else if (v is int){
                                        value.k = Kind.INT32;
                                        *((int *) p) = (int) v;
                                } else if (v is bool){
@@ -289,20 +296,26 @@
                                        Marshal.WriteByte (result, 
bytes.Length, 0);
 
                                        *((IntPtr *) p) = result;
-                               } else if (v is DependencyObject){
-                                       DependencyObject x = v as 
DependencyObject;
+                               } else if (v is double []){
+                                       double [] dv = (double []) v;
+
+                                       value.k = Kind.DOUBLE_ARRAY;
+                                       IntPtr result = Marshal.AllocHGlobal (8 
+ sizeof (double) * dv.Length);
+                                       int *ip = (int *) result;
+                                       ip [0] = dv.Length;
+                                       ip [1] = 1;  // refcount;
+                                       double *dp = (double *) ip;
+                                       dp++;
+                                       foreach (double d in dv)
+                                               *dp++ = d;
                                        
-                                       value.k = x.GetKind ();
-                                       if (value.k == Kind.DEPENDENCY_OBJECT){
-                                               throw new 
NotImplementedException (
-                                                  String.Format ("Class {0} 
does not implement GetKind", x));
-                                       }
-                                       *((IntPtr *) p) = x.native;
+                                       *((IntPtr *) p) = result;
                                } else if (v is Color){
                                        value = 
NativeMethods.value_color_from_argb (((Color) v).argb);
-                               } else
+                               } else {
                                        throw new NotImplementedException (
                                                String.Format ("Do not know how 
to encode {0} yet", v.GetType ()));
+                               }
                        }
                        return value;
                }

Modified: trunk/olive/class/agclr/System.Windows.Shapes/ChangeLog
===================================================================
--- trunk/olive/class/agclr/System.Windows.Shapes/ChangeLog     2007-06-10 
05:37:50 UTC (rev 79107)
+++ trunk/olive/class/agclr/System.Windows.Shapes/ChangeLog     2007-06-10 
05:38:36 UTC (rev 79108)
@@ -1,3 +1,7 @@
+2007-06-10  Miguel de Icaza  <[EMAIL PROTECTED]>
+
+       * Line.cs: Register properties properly
+
 2007-06-08  Miguel de Icaza  <[EMAIL PROTECTED]>
 
        * Rectangle.cs: First binding.

Modified: trunk/olive/class/agclr/System.Windows.Shapes/Line.cs
===================================================================
--- trunk/olive/class/agclr/System.Windows.Shapes/Line.cs       2007-06-10 
05:37:50 UTC (rev 79107)
+++ trunk/olive/class/agclr/System.Windows.Shapes/Line.cs       2007-06-10 
05:38:36 UTC (rev 79108)
@@ -25,15 +25,19 @@
 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
-
+using Mono;
 namespace System.Windows.Shapes {
 
        public class Line : Shape {
 
-               public static readonly DependencyProperty X1Property = 
DependencyProperty.Register ("X1", typeof (double), typeof (Line));
-               public static readonly DependencyProperty Y1Property = 
DependencyProperty.Register ("Y1", typeof (double), typeof (Line));
-               public static readonly DependencyProperty X2Property = 
DependencyProperty.Register ("X2", typeof (double), typeof (Line));
-               public static readonly DependencyProperty Y2Property = 
DependencyProperty.Register ("Y2", typeof (double), typeof (Line));
+               public static readonly DependencyProperty X1Property =
+                       DependencyProperty.Lookup (Kind.LINE, "X1", typeof 
(double));
+               public static readonly DependencyProperty Y1Property =
+                       DependencyProperty.Lookup (Kind.LINE, "Y1", typeof 
(double));
+               public static readonly DependencyProperty X2Property =
+                       DependencyProperty.Lookup (Kind.LINE, "X2", typeof 
(double));
+               public static readonly DependencyProperty Y2Property =
+                       DependencyProperty.Lookup (Kind.LINE, "Y2", typeof 
(double));
 
                public Line ()
                {

Modified: trunk/olive/class/agclr/System.Windows.Shapes/Shape.cs
===================================================================
--- trunk/olive/class/agclr/System.Windows.Shapes/Shape.cs      2007-06-10 
05:37:50 UTC (rev 79107)
+++ trunk/olive/class/agclr/System.Windows.Shapes/Shape.cs      2007-06-10 
05:38:36 UTC (rev 79108)
@@ -75,7 +75,6 @@
                }
 
                public double[] StrokeDashArray {
-                       get { return (double[]) GetValue 
(StrokeDashArrayProperty); }
                        set { SetValue (StrokeDashArrayProperty, value); }
                }
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to