Author: rolf
Date: 2007-06-12 14:49:40 -0400 (Tue, 12 Jun 2007)
New Revision: 79327

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/runtime.cpp
   trunk/moon/src/runtime.h
Log:
2007-06-12  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>

        * runtime.cpp, runtime.h: Make DependencyObject::ParentProperty
        a normal field.



Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-06-12 18:46:41 UTC (rev 79326)
+++ trunk/moon/src/ChangeLog    2007-06-12 18:49:40 UTC (rev 79327)
@@ -1,3 +1,8 @@
+2007-06-12  Rolf Bjarne Kvinge  <[EMAIL PROTECTED]>
+
+       * runtime.cpp, runtime.h: Make DependencyObject::ParentProperty
+       a normal field.
+
 2007-06-12  Jackson Harper  <[EMAIL PROTECTED]>
 
        * xaml.cpp: Don't try to add properties to the panel.

Modified: trunk/moon/src/runtime.cpp
===================================================================
--- trunk/moon/src/runtime.cpp  2007-06-12 18:46:41 UTC (rev 79326)
+++ trunk/moon/src/runtime.cpp  2007-06-12 18:49:40 UTC (rev 79327)
@@ -1080,14 +1080,12 @@
 
        Value *current_value = (Value*)g_hash_table_lookup (current_values, 
property->name);
 
-       if (property != ParentProperty) {
-               if (current_value != NULL && current_value->k >= 
Value::DEPENDENCY_OBJECT) {
-                       current_value->AsDependencyObject ()->SetParent (NULL);
-               }
-               if (value != NULL && value->k >= Value::DEPENDENCY_OBJECT) {
-                       value->AsDependencyObject ()->SetParent (this);
-               }
+       if (current_value != NULL && current_value->k >= 
Value::DEPENDENCY_OBJECT) {
+               current_value->AsDependencyObject ()->SetParent (NULL);
        }
+       if (value != NULL && value->k >= Value::DEPENDENCY_OBJECT) {
+               value->AsDependencyObject ()->SetParent (this);
+       }
 
        if ((current_value == NULL && value != NULL) ||
            (current_value != NULL && value == NULL) ||
@@ -1199,6 +1197,7 @@
        current_values = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, 
free_value);
        events = new EventObject ();
        this->attached_list = NULL;
+       this->parent = NULL;
 }
 
 DependencyObject::~DependencyObject ()
@@ -1324,10 +1323,7 @@
 DependencyObject *
 DependencyObject::GetParent ()
 {
-       Value *parent = GetValue (ParentProperty);
-       if (parent == NULL)
-               return NULL;
-       return parent->AsDependencyObject ();
+       return parent;
 }
 
 void
@@ -1338,10 +1334,10 @@
        DependencyObject *current = parent;
        do while (current != NULL) {
                g_assert (current != this);
-               current = current ->GetParent ();
+               current = current->GetParent ();
        } 
 #endif
-       SetValue (ParentProperty, parent);
+       this->parent = parent;
 }
 
 void
@@ -1859,15 +1855,6 @@
        return types [type];
 }
 
-DependencyProperty *DependencyObject::ParentProperty;
-
-void
-dependencyobject_init ()
-{
-       DependencyObject::ParentProperty = DependencyObject::Register 
(Value::DEPENDENCY_OBJECT, "Parent", Value::DEPENDENCY_OBJECT);
-}
-
-
 static bool inited = FALSE;
 
 void
@@ -1878,7 +1865,6 @@
        inited = TRUE;
 
        types_init ();
-       dependencyobject_init ();
        namescope_init ();
        item_init ();
        framework_element_init ();

Modified: trunk/moon/src/runtime.h
===================================================================
--- trunk/moon/src/runtime.h    2007-06-12 18:46:41 UTC (rev 79326)
+++ trunk/moon/src/runtime.h    2007-06-12 18:49:40 UTC (rev 79327)
@@ -232,7 +232,6 @@
 
        EventObject *events;
        static GHashTable *properties;
-       static DependencyProperty *ParentProperty;
 
        virtual void OnPropertyChanged (DependencyProperty *property) {}
        virtual void OnSubPropertyChanged (DependencyProperty *prop, 
DependencyProperty *subprop) { }
@@ -258,6 +257,7 @@
  private:
        GHashTable        *current_values;
        GSList            *attached_list;
+       DependencyObject  *parent;
 };
 
 Value *dependency_object_get_value (DependencyObject *object, 
DependencyProperty *prop);

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

Reply via email to