Author: jbevain
Date: 2007-11-20 12:18:55 -0500 (Tue, 20 Nov 2007)
New Revision: 89994

Modified:
   trunk/moon/src/ChangeLog
   trunk/moon/src/collection.cpp
   trunk/moon/src/dependencyobject.cpp
   trunk/moon/src/downloader.cpp
   trunk/moon/src/downloader.h
   trunk/moon/src/runtime.h
   trunk/moon/src/visual.cpp
Log:
2007-11-20  Jb Evain  <[EMAIL PROTECTED]>

        * downloader.h (Downloader): override SetSurface and GetSurface
        to work on a custom surface field.
        * downloader.cpp (Downloader::Downloader): initialize
        surface to NULL.
        * runtime.h (Surface::CreateDownloader): initialize the surface
        of the downloader.
        * collection.cpp: when removing an UIElement from an 
UIElementCollection,
        clear out its surface to NULL.
        * visual.cpp: remove null check preventing to set the surface to NULL.
        * dependencyobject.cpp: (DependencyObject::FindName): if the
        current DO has no parent, fallback to its surface to try
        FindName on its top level element (needed to call FindName
        on a downloader for instance). Fixes #335018.



Modified: trunk/moon/src/ChangeLog
===================================================================
--- trunk/moon/src/ChangeLog    2007-11-20 16:55:19 UTC (rev 89993)
+++ trunk/moon/src/ChangeLog    2007-11-20 17:18:55 UTC (rev 89994)
@@ -1,3 +1,19 @@
+2007-11-20  Jb Evain  <[EMAIL PROTECTED]>
+
+       * downloader.h (Downloader): override SetSurface and GetSurface
+       to work on a custom surface field.
+       * downloader.cpp (Downloader::Downloader): initialize
+       surface to NULL.
+       * runtime.h (Surface::CreateDownloader): initialize the surface
+       of the downloader.
+       * collection.cpp: when removing an UIElement from an 
UIElementCollection,
+       clear out its surface to NULL.
+       * visual.cpp: remove null check preventing to set the surface to NULL.
+       * dependencyobject.cpp: (DependencyObject::FindName): if the
+       current DO has no parent, fallback to its surface to try
+       FindName on its top level element (needed to call FindName
+       on a downloader for instance). Fixes #335018.
+
 2007-11-20  Jackson Harper  <[EMAIL PROTECTED]>
 
        * xaml.cpp: If we need to reparse the attributes for an element

Modified: trunk/moon/src/collection.cpp
===================================================================
--- trunk/moon/src/collection.cpp       2007-11-20 16:55:19 UTC (rev 89993)
+++ trunk/moon/src/collection.cpp       2007-11-20 17:18:55 UTC (rev 89994)
@@ -456,6 +456,8 @@
 {
        UIElement *item = (UIElement *) visual;
 
+       item->SetSurface (NULL);
+
        if (item->parent == NULL)
                return;
 

Modified: trunk/moon/src/dependencyobject.cpp
===================================================================
--- trunk/moon/src/dependencyobject.cpp 2007-11-20 16:55:19 UTC (rev 89993)
+++ trunk/moon/src/dependencyobject.cpp 2007-11-20 17:18:55 UTC (rev 89994)
@@ -19,6 +19,7 @@
 #include "dependencyobject.h"
 #include "clock.h"
 #include "runtime.h"
+#include "uielement.h"
 
 #if OBJECT_TRACKING
 // Define the ID of the object you want to track
@@ -603,8 +604,16 @@
                return rv;
        else if (parent)
                return parent->FindName (name);
-       else
+       else {
+               Surface *surface = GetSurface ();
+               if (surface) {
+                       UIElement *toplevel = surface->GetToplevel ();
+                       if (toplevel && toplevel != this)
+                               return toplevel->FindName (name);
+               }
+
                return NULL;
+       }
 }
 
 NameScope*

Modified: trunk/moon/src/downloader.cpp
===================================================================
--- trunk/moon/src/downloader.cpp       2007-11-20 16:55:19 UTC (rev 89993)
+++ trunk/moon/src/downloader.cpp       2007-11-20 17:18:55 UTC (rev 89994)
@@ -62,6 +62,7 @@
 
 Downloader::Downloader ()
 {
+       surface = NULL;
        downloader_state = Downloader::create_state (this);
        notify_size = NULL;
        filename = NULL;

Modified: trunk/moon/src/downloader.h
===================================================================
--- trunk/moon/src/downloader.h 2007-11-20 16:55:19 UTC (rev 89993)
+++ trunk/moon/src/downloader.h 2007-11-20 17:18:55 UTC (rev 89994)
@@ -89,7 +89,19 @@
        gpointer GetContext () { return context; }
        gpointer GetDownloaderState () { return downloader_state; }
 
+       virtual Surface *GetSurface ()
+       {
+               return surface;
+       }
+
+       virtual void SetSurface (Surface *surface)
+       {
+               this->surface = surface;
+       }
+
  private:
+       Surface *surface;
+
        GHashTable *part_hash;
 
        int64_t file_size;

Modified: trunk/moon/src/runtime.h
===================================================================
--- trunk/moon/src/runtime.h    2007-11-20 16:55:19 UTC (rev 89993)
+++ trunk/moon/src/runtime.h    2007-11-20 17:18:55 UTC (rev 89994)
@@ -106,6 +106,7 @@
        Downloader *CreateDownloader () 
        {
                Downloader *downloader = new Downloader ();
+               downloader->SetSurface (this);
                downloader->SetContext (downloader_context);
                return downloader;
        }

Modified: trunk/moon/src/visual.cpp
===================================================================
--- trunk/moon/src/visual.cpp   2007-11-20 16:55:19 UTC (rev 89993)
+++ trunk/moon/src/visual.cpp   2007-11-20 17:18:55 UTC (rev 89994)
@@ -27,9 +27,6 @@
 void
 Visual::SetSurface (Surface *surface)
 {
-       if (!surface)
-               return;
-               
        this->surface = surface;
 }
 

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

Reply via email to