Author: jackson
Date: 2006-06-09 16:13:23 -0400 (Fri, 09 Jun 2006)
New Revision: 61604

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

        * Form.cs: Layout the MDI child windows when creating the parent
        * form.
        * MdiClient.cs: use the parent form width/height (if available)
        when laying out the child windows, we do this because the
        mdiclient isn't docked yet when the initial layout is done.



Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-09 19:53:21 UTC (rev 61603)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog        
2006-06-09 20:13:23 UTC (rev 61604)
@@ -5,6 +5,10 @@
        expose.
        - Reduce calls to the TreeView property, which is mildly expensive
        by using a local var.
+       * Form.cs: Layout the MDI child windows when creating the parent form.
+       * MdiClient.cs: use the parent form width/height (if available)
+       when laying out the child windows, we do this because the
+       mdiclient isn't docked yet when the initial layout is done.
 
 2006-06-08 Gonzalo Paniagua Javier <[EMAIL PROTECTED]>
 

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2006-06-09 19:53:21 UTC (rev 61603)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs  
2006-06-09 20:13:23 UTC (rev 61604)
@@ -1405,6 +1405,10 @@
 
                        // Send initial location
                        OnLocationChanged(EventArgs.Empty);
+
+                       if (IsMdiContainer) {
+                               mdi_container.LayoutMdi (MdiLayout.Cascade);
+                       }
                }
 
                [EditorBrowsable(EditorBrowsableState.Advanced)]
@@ -1468,11 +1472,7 @@
                                                Top = CreateParams.Y;
                                                break;
                                }
-                       } else {
-                               MdiParent.MdiContainer.LayoutMdi 
(MdiLayout.Cascade);
-                               
                        }
-
                }
 
                [EditorBrowsable(EditorBrowsableState.Advanced)]

Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs     
2006-06-09 19:53:21 UTC (rev 61603)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/MdiClient.cs     
2006-06-09 20:13:23 UTC (rev 61604)
@@ -67,7 +67,6 @@
                                owner.ActiveMdiChild = form;
 
                                form.LocationChanged += new EventHandler 
(owner.FormLocationChanged);
-                               owner.LayoutMdi (MdiLayout.Cascade);
                        }
 
                        public override void Remove(Control value) {
@@ -89,9 +88,6 @@
                        BackColor = SystemColors.AppWorkspace;
                        Dock = DockStyle.Fill;
                        SetStyle (ControlStyles.Selectable, false);
-
-                       initial_layout_handler = new LayoutEventHandler 
(InitialLayoutHandler);
-                       Layout += initial_layout_handler;
                }
                #endregion      // Public Constructors
 
@@ -109,12 +105,6 @@
                        get { return (Form) Parent; }
                }
 
-               private void InitialLayoutHandler (object sender, 
LayoutEventArgs e)
-               {
-                       LayoutMdi (MdiLayout.Cascade);
-                       Layout -= initial_layout_handler;
-               }
-
                protected override Control.ControlCollection 
CreateControlsInstance ()
                {
                        return new MdiClient.ControlCollection (this);
@@ -184,6 +174,15 @@
 
                #region Public Instance Methods
                public void LayoutMdi (MdiLayout value) {
+
+                       int max_width = Int32.MaxValue;
+                       int max_height = Int32.MaxValue;
+
+                       if (Parent != null) {
+                               max_width = Parent.Width;
+                               max_height = Parent.Height;
+                       }
+
                        switch (value) {
                        case MdiLayout.Cascade:
                                int i = 0;
@@ -193,7 +192,7 @@
                                        int l = 22 * i;
                                        int t = 22 * i;
 
-                                       if (i != 0 && (l + form.Width > Width 
|| t + form.Height > Height)) {
+                                       if (i != 0 && (l + form.Width > 
max_width || t + form.Height > max_height)) {
                                                i = 0;
                                                l = 22 * i;
                                                t = 22 * i;

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

Reply via email to