2006-12-04 Rolf Bjarne Kvinge <RKvinge@novell.com>
authorRolf Bjarne Kvinge <RKvinge@novell.com>
Mon, 4 Dec 2006 17:10:17 +0000 (17:10 -0000)
committerRolf Bjarne Kvinge <RKvinge@novell.com>
Mon, 4 Dec 2006 17:10:17 +0000 (17:10 -0000)
* Form.cs: When a form's MdiParent is set add it directly
on top of the z-order in stead of relying on MdiClient's
ActivateChild to do it. Fixes #80135.

* MdiClient.cs:
- Remove original_order, mdi_child_list is already doing
the same thing.
- Create mdi_child_list on construction in
stead of first use (avoids a few null checks).

* MenuItem.cs: Use an already existing list of mdi children
to get the correct order of children and remove the other
redundant list.

svn path=/trunk/mcs/; revision=68974

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuItem.cs

index 864e610bfba99dccec099c26aa9490ed1766c838..535fc1391e536cc89e3f4341ab86923a8d01131a 100644 (file)
@@ -1,3 +1,19 @@
+2006-12-04  Rolf Bjarne Kvinge  <RKvinge@novell.com>
+
+       * Form.cs: When a form's MdiParent is set add it directly
+       on top of the z-order in stead of relying on MdiClient's
+       ActivateChild to do it. Fixes #80135.
+       
+       * MdiClient.cs: 
+       - Remove original_order, mdi_child_list is already doing
+       the same thing.
+       - Create mdi_child_list on construction in
+       stead of first use (avoids a few null checks).
+
+       * MenuItem.cs: Use an already existing list of mdi children
+       to get the correct order of children and remove the other
+       redundant list.
+
 2006-12-04  Chris Toshok  <toshok@ximian.com>
 
        * PropertyGridView.cs: cached_splitter_location is only used in
index 4aa8dabcf0682caca975afeebebe3e96b0a09507..1cfed4eba31d3784ac522151a4e79d47de6fdf97 100644 (file)
@@ -553,7 +553,6 @@ namespace System.Windows.Forms {
                                        throw new ArgumentException ();
 
                                if (mdi_parent != null) {
-                                       mdi_parent.MdiContainer.original_order.Remove (this);
                                        mdi_parent.MdiContainer.Controls.Remove (this);
                                }
 
@@ -561,8 +560,8 @@ namespace System.Windows.Forms {
                                        mdi_parent = value;
                                        window_manager = new MdiWindowManager (this,
                                                        mdi_parent.MdiContainer);
-                                       mdi_parent.MdiContainer.original_order.Add (this);
                                        mdi_parent.MdiContainer.Controls.Add (this);
+                                       mdi_parent.MdiContainer.Controls.SetChildIndex (this, 0);
 
                                        RecreateHandle ();
 
index 8198578465eff5aa0d5b6db8089db2c3419e3d2d..a5aab6c38f14fd1198ec204cd81a4e6fb997abb2 100644 (file)
@@ -50,7 +50,6 @@ namespace System.Windows.Forms {
                internal ArrayList mdi_child_list;
                private string form_text;
                private bool setting_form_text;
-               internal ArrayList original_order = new ArrayList (); // The order the child forms are added (used by the main menu to show the window menu)
                private Form active_child;
 
                #endregion      // Local Variables
@@ -62,7 +61,6 @@ namespace System.Windows.Forms {
                        
                        public ControlCollection(MdiClient owner) : base(owner) {
                                this.owner = owner;
-                               owner.mdi_child_list = new ArrayList ();
                        }
 
                        public override void Add(Control value) {
@@ -96,6 +94,7 @@ namespace System.Windows.Forms {
                #region Public Constructors
                public MdiClient()
                {
+                       mdi_child_list = new ArrayList ();
                        BackColor = SystemColors.AppWorkspace;
                        Dock = DockStyle.Fill;
                        SetStyle (ControlStyles.Selectable, false);
index 1346e2f8d67a23fd302fea1a8118c16804935236..9e47912166fe8d47784b208bc210f4749b84e583 100644 (file)
@@ -610,10 +610,13 @@ namespace System.Windows.Forms
                                        if (mdicontainer == null)
                                                break;
 
+                                       
                                        // Remove closed forms
-                                       foreach (MenuItem item in mdilist_items.Keys) {
+                                       MenuItem[] items = new MenuItem[mdilist_items.Count];
+                                       mdilist_items.Keys.CopyTo (items, 0);
+                                       foreach (MenuItem item in items) {
                                                Form mdichild = (Form) mdilist_items [item];
-                                               if (!mdicontainer.original_order.Contains (mdichild)) {
+                                               if (!mdicontainer.mdi_child_list.Contains(mdichild)) {
                                                        mdilist_items.Remove (item);
                                                        mdilist_forms.Remove (mdichild);
                                                        MenuItems.Remove (item);
@@ -621,8 +624,8 @@ namespace System.Windows.Forms
                                        }
                                        
                                        // Add new forms and update state for existing forms.
-                                       for ( int i = 0; i < mdicontainer.original_order.Count; i++) {
-                                               Form mdichild = (Form) mdicontainer.original_order [i];
+                                       for (int i = 0; i < mdicontainer.mdi_child_list.Count; i++) {
+                                               Form mdichild = (Form)mdicontainer.mdi_child_list[i];
                                                MenuItem item;
                                                if (mdilist_forms.Contains (mdichild)) {
                                                        item = (MenuItem) mdilist_forms [mdichild];