Author: jackson
Date: 2006-06-09 13:41:55 -0400 (Fri, 09 Jun 2006)
New Revision: 61600

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs
Log:

        * TreeNode.cs:  Recalculate the visible order before doing the
        Expand/Collapse Below calls, because those calls generate an
        expose.
        - Reduce calls to the TreeView property, which is mildly
          expensive
        by using a local var.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-09 14:50:08 UTC (rev 61599)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-09 17:41:55 UTC (rev 61600)
@@ -1,3 +1,11 @@
+2006-06-09  Jackson Harper  <[EMAIL PROTECTED]>
+
+       * TreeNode.cs:  Recalculate the visible order before doing the
+       Expand/Collapse Below calls, because those calls generate an
+       expose.
+       - Reduce calls to the TreeView property, which is mildly expensive
+       by using a local var.
+
 2006-06-08 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 
        * FileDialog.cs: handle access errors when trying to create a folder

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs      
2006-06-09 14:50:08 UTC (rev 61599)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeNode.cs      
2006-06-09 17:41:55 UTC (rev 61600)
@@ -603,26 +603,31 @@
                {
                        if (is_expanded || nodes.Count < 1)
                                return;
+
                        bool cancel = false;
-                       if (TreeView != null) {
+                       TreeView tree_view = TreeView;
+                       if (tree_view != null) {
                                TreeViewCancelEventArgs e = new 
TreeViewCancelEventArgs (this, false, TreeViewAction.Expand);
-                               TreeView.OnBeforeExpand (e);
+                               tree_view.OnBeforeExpand (e);
                                cancel = e.Cancel;
                        }
 
                        if (!cancel) {
                                is_expanded = true;
                                int count_to_next = CountToNext ();
-                               if (TreeView != null)
-                                       TreeView.OnAfterExpand (new 
TreeViewEventArgs (this));
-                               if (IsVisible && TreeView != null)
-                                       TreeView.ExpandBelow (this, 
count_to_next);
+
+                               if (tree_view != null) {
+                                       tree_view.OnAfterExpand (new 
TreeViewEventArgs (this));
+
+                                       tree_view.RecalculateVisibleOrder 
(this);
+                                       tree_view.UpdateScrollBars ();
+
+                                       if (IsVisible)
+                                               tree_view.ExpandBelow (this, 
count_to_next);
+                               }
                        }
 
-                       if (TreeView != null) {
-                               TreeView.RecalculateVisibleOrder (this);
-                               TreeView.UpdateScrollBars ();
-                       }
+                       
                }
 
                private void Collapse (bool byInternal)
@@ -634,9 +639,10 @@
                                return;
 
                        bool cancel = false;
-                       if (TreeView != null) {
+                       TreeView tree_view = TreeView;
+                       if (tree_view != null) {
                                TreeViewCancelEventArgs e = new 
TreeViewCancelEventArgs (this, false, TreeViewAction.Collapse);
-                               TreeView.OnBeforeCollapse (e);
+                               tree_view.OnBeforeCollapse (e);
                                cancel = e.Cancel;
                        }
 
@@ -644,17 +650,18 @@
                                int count_to_next = CountToNext ();
 
                                is_expanded = false;
-                               if (TreeView != null)
-                                       TreeView.OnAfterCollapse (new 
TreeViewEventArgs (this));
-                               if (IsVisible && TreeView != null)
-                                       TreeView.CollapseBelow (this, 
count_to_next);
-                               if(!byInternal && TreeView != null && 
HasFocusInChildren ())
-                                       TreeView.SelectedNode = this;
-                       }
 
-                       if (TreeView != null) {
-                               TreeView.RecalculateVisibleOrder (this);
-                               TreeView.UpdateScrollBars ();
+                               if (tree_view != null) {
+                                       tree_view.OnAfterCollapse (new 
TreeViewEventArgs (this));
+
+                                       tree_view.RecalculateVisibleOrder 
(this);
+                                       tree_view.UpdateScrollBars ();
+
+                                       if (IsVisible)
+                                               tree_view.CollapseBelow (this, 
count_to_next);
+                                       if(!byInternal && HasFocusInChildren ())
+                                               tree_view.SelectedNode = this;
+                               }
                        }
                }
 

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

Reply via email to