From: Rolf Bjarne Kvinge Date: Mon, 4 Dec 2006 17:10:17 +0000 (-0000) Subject: 2006-12-04 Rolf Bjarne Kvinge X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=e2b12c45743e93520b1d4c038bcc71ebb0980519;p=mono.git 2006-12-04 Rolf Bjarne Kvinge * 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 --- diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog index 864e610bfba..535fc1391e5 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog @@ -1,3 +1,19 @@ +2006-12-04 Rolf Bjarne Kvinge + + * 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 * PropertyGridView.cs: cached_splitter_location is only used in diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs index 4aa8dabcf06..1cfed4eba31 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs @@ -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 (); diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs index 8198578465e..a5aab6c38f1 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs @@ -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); diff --git a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuItem.cs b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuItem.cs index 1346e2f8d67..9e47912166f 100644 --- a/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuItem.cs +++ b/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MenuItem.cs @@ -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];